List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:gov.nih.nci.cabig.caaers.web.admin.CreateINDController.java
/** * Validate the form,if no errors found, save the InvestigationalNewDrug object. Then return to * the success view.//from w w w.j a va 2 s . c o m */ @SuppressWarnings("unchecked") @Override protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd, BindException errors) throws Exception { INDCommand command = (INDCommand) cmd; validate(command, errors); if (!errors.hasErrors()) { InvestigationalNewDrug iNewDrug = command.createInvestigationalNewDrug(); investigationalNewDrugDao.save(iNewDrug); request.setAttribute("flashMessage", "Successfully saved the Investigational New Drug details"); command.reset(); } Map map = this.referenceData(request, command, errors); map.putAll(errors.getModel()); ModelAndView modelAndView = new ModelAndView(getSuccessView(), map); // needed for saving session state request.getSession().setAttribute(getFormSessionAttributeName(), command); return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.admin.MandatoryFieldsController.java
@SuppressWarnings("unchecked") @Override//from w ww . ja va 2s .c o m protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd, BindException errors) throws Exception { // If there are no binding errors then save the updated values of CaaersFieldDefinition MandatoryFieldsCommand command = (MandatoryFieldsCommand) cmd; // If there are no erros then save the CaaersFieldsDefinitions list if (!errors.hasErrors()) { for (CaaersFieldDefinition cfd : command.getMandatoryFields()) { // System.out.println("Saving..." + cfd.getFieldPath() + "=" + cfd.getMandatory()); caaersFieldDefinitionDao.save(cfd); } // reinitialize caaersFieldConfigurationManager caaersFieldConfigurationManager.initializeConfigurationManager(); } Map map = this.referenceData(request, command, errors); map.putAll(errors.getModel()); ModelAndView modelAndView = new ModelAndView(getFormView(), map); return modelAndView.addObject("updated", true); }
From source file:com.ufukuzun.myth.dialect.handler.AjaxRequestResponseBodyReturnValueHandler.java
@Override public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception { mavContainer.setRequestHandled(true); if (returnValue != null && AjaxResponse.class.isInstance(returnValue)) { AjaxResponse ajaxResponse = (AjaxResponse) returnValue; HttpServletResponse response = (HttpServletResponse) webRequest.getNativeResponse(); HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); ModelAndView modelAndView = ajaxResponse.getModelAndView(); Map<String, Object> mavContainerAttributes = new LinkedHashMap<String, Object>(); mavContainerAttributes.putAll(mavContainer.getModel()); modelAndView.getModelMap().mergeAttributes(mavContainerAttributes); returnValue = myth.response(ajaxResponse.getAjaxRequest(), modelAndView, response, request); writeWithMessageConverters(returnValue, returnType, webRequest); }/*from www . ja va 2 s. c o m*/ }
From source file:com.celements.photo.metadata.MetaInfoExtractor.java
/** * To get all meta tags possibly contained in an image. * // w w w . j a va 2 s . c om * @param imageFile File to extract the Metadata from. * @return Hashtable containing the directorys data. * @throws MetadataException */ public Map<String, String> getAllTags(InputStream imageFile) throws MetadataException { Metadata data = getMetadata(imageFile); Map<String, String> tags = new HashMap<String, String>(); for (Directory dir : data.getDirectories()) { tags.putAll(getDirsTags(dir)); } return tags; }
From source file:com.npower.dm.setup.task.digester.ModelFamilyItemObjectCreationFactory.java
public Object createObject(Attributes attributes) throws Exception { ModelFamilyItem result = new ModelFamilyItem(); String parentID = attributes.getValue("parent"); if (StringUtils.isNotEmpty(parentID)) { parentID = parentID.trim();/* w ww. j a v a 2 s. com*/ ModelFamilyManager manager = ModelFamilyManager.getInstance(); ModelFamilyItem family = manager.findModelFamily(parentID); if (family != null) { PropertyUtils.copyProperties(result, family); List<String> cpTemplatesFiles = new ArrayList<String>(); cpTemplatesFiles.addAll(family.getCpTemplatesFiles()); result.setCpTemplatesFiles(cpTemplatesFiles); List<String> ddfFiles = new ArrayList<String>(); ddfFiles.addAll(family.getDdfFiles()); result.setDdfFiles(ddfFiles); List<FirmwareItem> firmwares = new ArrayList<FirmwareItem>(); firmwares.addAll(family.getFirmwares()); result.setFirmwares(firmwares); List<String> profileMappingFiles = new ArrayList<String>(); profileMappingFiles.addAll(family.getProfileMappingFiles()); result.setProfileMappingFiles(profileMappingFiles); Map<String, String> specifications = new LinkedHashMap<String, String>(); specifications.putAll(family.getSpecifications()); result.setSpecifications(specifications); List<String> tacs = new ArrayList<String>(); tacs.addAll(family.getTacs()); result.setTacs(tacs); } result.setParentID(parentID); } return result; }
From source file:com.gerrydevstory.myxie.page.PageService.java
/** * Builds page with given path. Page is an association of site template, layout and * several components (widgets). First the template is fetched then components are * substituted into it.// w w w. j a v a2s.c om * * @param path * path of the requested page. For example if the URL is * http://mycoolblog.com/contact-us then the path is /contact-us. If / * prefix not given it will be appended. * @param out * output writer where the resulting page is written */ public void buildPage(String path, Writer out, Model model) { Template siteTemplate = templateRepo.findByName("master"); Page page = pageRepo.findByPath(path); Layout layout = layoutRepo.findByName(page.getLayoutName()); Map<String, Object> context = new HashMap<String, Object>(); context.put("layout", layout); context.put("page", page); context.putAll(model.asMap()); siteTemplate.render(context, out); }
From source file:com.npower.dm.setup.task.digester.ModelItemObjectCreationFactory.java
public Object createObject(Attributes attributes) throws Exception { ModelItem result = new ModelItem(); String familyID = attributes.getValue("family"); if (StringUtils.isNotEmpty(familyID)) { familyID = familyID.trim();/*w ww . j av a 2 s . c om*/ ModelFamilyManager manager = ModelFamilyManager.getInstance(); ModelFamilyItem family = manager.findModelFamily(familyID); if (family != null) { PropertyUtils.copyProperties(result, family); List<String> cpTemplatesFiles = new ArrayList<String>(); cpTemplatesFiles.addAll(family.getCpTemplatesFiles()); result.setCpTemplatesFiles(cpTemplatesFiles); List<String> ddfFiles = new ArrayList<String>(); ddfFiles.addAll(family.getDdfFiles()); result.setDdfFiles(ddfFiles); List<FirmwareItem> firmwares = new ArrayList<FirmwareItem>(); firmwares.addAll(family.getFirmwares()); result.setFirmwares(firmwares); List<String> profileMappingFiles = new ArrayList<String>(); profileMappingFiles.addAll(family.getProfileMappingFiles()); result.setProfileMappingFiles(profileMappingFiles); Map<String, String> specifications = new LinkedHashMap<String, String>(); specifications.putAll(family.getSpecifications()); result.setSpecifications(specifications); List<String> tacs = new ArrayList<String>(); tacs.addAll(family.getTacs()); result.setTacs(tacs); } result.setFamilyID(familyID); } return result; }
From source file:apiserver.services.images.services.exiftool.ImageMetadataService.java
public Object metadataClear(Message<?> message) { FileMetadataJob props = (FileMetadataJob) message.getPayload(); try {// ww w . j a v a 2s . c o m File file = props.getDocument().getFile(); Map metadataDirectories = new HashMap(); ETOperation op = new ETOperation(); //op.getTags("Filename","ImageWidth","ImageHeight","FNumber","ExposureTime","iso"); //op.addRawArgs( "-a", "-u", "-g" ); op.addRawArgs("-all= dst.jpg"); op.addImage(); // setup command and execute it (capture output) ArrayListOutputConsumer output = new ArrayListOutputConsumer(); ExiftoolCmd et = new ExiftoolCmd(); et.setOutputConsumer(output); et.run(op, file.getAbsolutePath()); ArrayList<String> cmdOutput = output.getOutput(); for (String tag : cmdOutput) { String[] _tag = tag.trim().split("\t"); //todo , not going to work. need to count spaces String _group = _tag[0].trim(); String _key = _tag[1].trim(); String _value = _tag[2].trim(); if (!metadataDirectories.containsKey(_group)) { metadataDirectories.put(_group, new HashMap()); } Map subMap = (Map) metadataDirectories.get(_group); subMap.put(_key, _value); } // send back // Could be a HashMap or a MultiValueMap Map payload = (Map) message.getPayload(); payload.putAll(metadataDirectories); Map cfData = new HashMap(); payload.put("ExifTool", cfData); return payload; } catch (Throwable e) { //URL location = coldfusion.runtime.NeoPageContext.class.getProtectionDomain().getCodeSource().getLocation(); //System.out.print(location); e.printStackTrace(); //todo use logging library throw new RuntimeException(e); } }
From source file:org.mitre.jwt.signer.service.impl.DefaultJwtSigningAndValidationService.java
/** * /* w ww .ja va2 s. co m*/ * Returns a copy of the collection of signers. * * @see * org.mitre.jwt.signer.service.JwtSigningAndValidationService#getAllPublicKeys * () */ @Override public Map<String, JwtSigner> getAllSigners() { Map<String, JwtSigner> map = new HashMap<String, JwtSigner>(); map.putAll(signers); return map; }
From source file:com.theisleoffavalon.mcmanager.mobile.MinecraftCommand.java
/** * @return the arguments//from w w w. j a va 2 s . com */ public Map<String, ArgType> getArguments() { Map<String, ArgType> map = new HashMap<String, ArgType>(); map.putAll(this.arguments); return map; }