List of usage examples for java.util Collections EMPTY_MAP
Map EMPTY_MAP
To view the source code for java.util Collections EMPTY_MAP.
Click Source Link
From source file:org.vinmonopolet.fulfilmentprocess.test.PaymentIntegrationTest.java
@Before public void setUpProductCatalogue() { try {//from w w w .j a v a 2 s . c o m new CoreBasicDataCreator().createEssentialData(Collections.EMPTY_MAP, null); importCsv("/vinmonopoletfulfilmentprocess/test/testBasics.csv", "windows-1252"); importCsv("/vinmonopoletfulfilmentprocess/test/testCatalog.csv", "windows-1252"); baseSiteService.setCurrentBaseSite(baseSiteService.getBaseSiteForUID("testSite"), false); LOG.warn("Catalogue has been imported"); } catch (final ImpExException e) { LOG.warn("Catalogue import has failed"); e.printStackTrace(); } catch (final Exception e) { LOG.warn("createEssentialData(...) has failed"); e.printStackTrace(); } }
From source file:com.jaredjstewart.SampleSecurityManager.java
private Map<String, Role> readRoles(final JsonNode jsonNode) { if (jsonNode.get("roles") == null) { return Collections.EMPTY_MAP; }/* w ww. j a va 2s. c o m*/ Map<String, Role> roleMap = new HashMap<>(); for (JsonNode rolesNode : jsonNode.get("roles")) { Role role = new Role(); role.name = rolesNode.get("name").asText(); String regionNames = null; String keys = null; JsonNode regionsNode = rolesNode.get("regions"); if (regionsNode != null) { if (regionsNode.isArray()) { regionNames = StreamSupport.stream(regionsNode.spliterator(), false).map(JsonNode::asText) .collect(Collectors.joining(",")); } else { regionNames = regionsNode.asText(); } } for (JsonNode operationsAllowedNode : rolesNode.get("operationsAllowed")) { String[] parts = operationsAllowedNode.asText().split(":"); String resourcePart = (parts.length > 0) ? parts[0] : null; String operationPart = (parts.length > 1) ? parts[1] : null; if (parts.length > 2) { regionNames = parts[2]; } if (parts.length > 3) { keys = parts[3]; } String regionPart = (regionNames != null) ? regionNames : "*"; String keyPart = (keys != null) ? keys : "*"; role.permissions.add(new ResourcePermission(resourcePart, operationPart, regionPart, keyPart)); } roleMap.put(role.name, role); if (rolesNode.has("serverGroup")) { role.serverGroup = rolesNode.get("serverGroup").asText(); } } return roleMap; }
From source file:com.exxonmobile.ace.hybris.fulfilmentprocess.test.PaymentIntegrationTest.java
@Before public void setUpProductCatalogue() { try {//from ww w .j a v a 2s . c o m new CoreBasicDataCreator().createEssentialData(Collections.EMPTY_MAP, null); importCsv("/exxonmobilfulfilmentprocess/test/testBasics.csv", "windows-1252"); importCsv("/exxonmobilfulfilmentprocess/test/testCatalog.csv", "windows-1252"); baseSiteService.setCurrentBaseSite(baseSiteService.getBaseSiteForUID("testSite"), false); LOG.warn("Catalogue has been imported"); } catch (final ImpExException e) { LOG.warn("Catalogue import has failed"); e.printStackTrace(); } catch (final Exception e) { LOG.warn("createEssentialData(...) has failed"); e.printStackTrace(); } }
From source file:de.betterform.xml.config.DefaultConfig.java
private HashMap loadExtensionFunctions(NodeInfo configContext, String sectionPath) throws XFormsException { HashMap map = new HashMap(); List nodeset = XPathCache.getInstance().evaluate(configContext, sectionPath, Collections.EMPTY_MAP, null); for (int i = 0; i < nodeset.size(); ++i) { Element element = (Element) XPathUtil.getAsNode(nodeset, i + 1); String namespace = element.getAttribute("namespace"); namespace = ("".equals(namespace)) ? null : namespace; //String prefix = element.getXFormsAttribute("prefix"); //prefix = ("".equals(prefix)) ? null : prefix; String function = element.getAttribute("name"); function = ("".equals(function)) ? null : function; String functionClass = element.getAttribute("class"); functionClass = ("".equals(functionClass)) ? null : functionClass; String key = (namespace == null) ? function : namespace + ((function == null) ? "" : " " + function); //String prefixKey = (prefix == null) ? function : prefix + // ((function == null) ? "" : " " + function); if ((function != null) && (functionClass != null)) { String javaFunction = element.getAttribute("java-name"); javaFunction = ((javaFunction == null) || "".equalsIgnoreCase(javaFunction)) ? function : javaFunction;/*w w w . j a v a2 s. c om*/ String[] classFunction = new String[] { functionClass, javaFunction }; if (key != null) { map.put(key, classFunction); } //if (prefixKey != null) { // map.put(prefixKey, classFunction); //} } } return map; }
From source file:org.chiba.xml.xforms.CustomElementFactory.java
/** * Loads the configuration for custom elements. * /* w ww .j ava 2 s . c o m*/ * @return A Map where the keys are in the format namespace-uri:element-name * and the value is the reference to the class that implements the * custom element, or an empty map if the configuration could not be * loaded for some reason. */ private static Map getCustomElementsConfig() { try { Map elementClassNames = Config.getInstance().getCustomElements(); Map elementClassRefs = new HashMap(elementClassNames.size()); Iterator itr = elementClassNames.entrySet().iterator(); //converts class names into the class references while (itr.hasNext()) { Map.Entry entry = (Entry) itr.next(); String key = (String) entry.getKey(); String className = (String) entry.getValue(); Class classRef = Class.forName(className); elementClassRefs.put(key, classRef); } //return the configuration return elementClassRefs; } catch (XFormsConfigException xfce) { LOGGER.error("could not load custom-elements config: " + xfce.getMessage()); } catch (ClassNotFoundException cnfe) { LOGGER.error("class configured for custom-element not found: " + cnfe.getMessage()); } //returns an empty map (no custom elements) return Collections.EMPTY_MAP; }
From source file:com.sun.faces.application.ApplicationAssociate.java
/** * Return a <code>Map</code> of navigation mappings loaded from * the configuration system. The key for the returned <code>Map</code> * is <code>from-view-id</code>, and the value is a <code>List</code> * of navigation cases.//from w ww . j ava 2 s . c o m * * @return Map the map of navigation mappings. */ public Map getNavigationCaseListMappings() { if (caseListMap == null) { return Collections.EMPTY_MAP; } return caseListMap; }
From source file:co.kademi.kdom.KParser.java
private KDocument.KDomElement createAndAddElement(String beginTagText, List<KDocument.KDomNode> currentChildren, final KDocument doc) { int firstSpace = beginTagText.indexOf(" "); String tag;// w w w . java 2s .c o m Map<String, String> atts; if (firstSpace > 0) { tag = beginTagText.substring(0, firstSpace); String sAtts = beginTagText.substring(firstSpace + 1); atts = parseAttributes(sAtts); } else { tag = beginTagText; atts = Collections.EMPTY_MAP; } KDocument.KDomElement el = doc.createElement(tag, atts, currentChildren); return el; }
From source file:org.cosmo.common.template.Page.java
public List<Map<String, String>> bindingAnnonations() { List<Map<String, String>> bindingAnnonations = new ArrayList(); for (Binding aBinding : _bindingArray) { if (aBinding instanceof Binding.ValueBinding) { bindingAnnonations.add(((Binding.ValueBinding) aBinding).getAnnonations()); } else {/* ww w. ja va 2 s. c o m*/ bindingAnnonations.add(Collections.EMPTY_MAP); } } return bindingAnnonations; }
From source file:org.geoserver.wps.kvp.ExecuteKvpRequestReader.java
/** * Parses a list of a I/O parameters/*from w ww . jav a2s. com*/ * @param inputString * @return */ List<IOParam> parseIOParameters(String inputString) { List<IOParam> result = new ArrayList<IOParam>(); if (inputString == null || "".equals(inputString.trim())) { return Collections.emptyList(); } // inputs are separated by ; String[] inputs = inputString.split(";"); for (String input : inputs) { // separate the id form the value/attribute int idx = input.indexOf("="); if (idx == -1) { result.add(new IOParam(input, null, Collections.EMPTY_MAP)); } else { String inputId = input.substring(0, idx); String[] valueAttributes = input.substring(idx + 1, input.length()).split("@"); String value = valueAttributes[0]; Map<String, String> attributes = parseAttributes(valueAttributes); result.add(new IOParam(inputId, value, attributes)); } } return result; }
From source file:edu.mayo.qdm.webapp.rest.controller.TranslatorController.java
/** * Creates the exceuction./* w w w. j av a 2s. c o m*/ * * @param request the request * @param startDate the start date * @param endDate the end date * @return the object * @throws Exception the exception */ @SuppressWarnings({ "rawtypes", "unchecked" }) @RequestMapping(value = "/executor/executions", method = RequestMethod.POST) public synchronized Object createExceuction(HttpServletRequest request, final @RequestParam(required = true) String startDate, final @RequestParam(required = true) String endDate, final @RequestParam(required = false) String valueSetDefinitions) throws Exception { //For now, don't validate the date. This requirement may //come back at some point. //this.dateValidator.validateDate(startDate, DateType.START); //this.dateValidator.validateDate(endDate, DateType.END); if (!(request instanceof MultipartHttpServletRequest)) { throw new IllegalStateException("ServletRequest expected to be of type MultipartHttpServletRequest"); } final Map<String, String> valueSetDefinitionsMap = valueSetDefinitions != null ? new ObjectMapper().readValue(valueSetDefinitions, HashMap.class) : Collections.EMPTY_MAP; final MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; final MultipartFile multipartFile = multipartRequest.getFile("file"); final String id = this.idGenerator.getId(); final FileSystemResult result = this.fileSystemResolver.getNewFiles(id); FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), result.getInputQdmXml()); String xmlFileName = multipartFile.getOriginalFilename(); final ExecutionInfo info = new ExecutionInfo(); info.setId(id); info.setStatus(Status.PROCESSING); info.setStart(new Date()); info.setParameters(new Parameters(startDate, endDate, xmlFileName)); this.fileSystemResolver.setExecutionInfo(id, info); this.executorService.submit(new Runnable() { @Override public void run() { ExecutionResult translatorResult = null; try { translatorResult = launcher.launchTranslator(IOUtils.toString(multipartFile.getInputStream()), dateValidator.parse(startDate), dateValidator.parse(endDate), valueSetDefinitionsMap); info.setStatus(Status.COMPLETE); info.setFinish(new Date()); fileSystemResolver.setExecutionInfo(id, info); FileUtils.writeStringToFile(result.getOuptutResultXml(), translatorResult.getXml()); } catch (Exception e) { info.setStatus(Status.FAILED); info.setFinish(new Date()); info.setError(ExceptionUtils.getFullStackTrace(e)); fileSystemResolver.setExecutionInfo(id, info); log.warn(e); throw new RuntimeException(e); } } }); if (this.isHtmlRequest(multipartRequest)) { return new ModelAndView("redirect:/executor/executions"); } else { String locationUrl = "executor/execution/" + id; final HttpHeaders headers = new HttpHeaders(); headers.setLocation(URI.create(locationUrl)); return new ResponseEntity(headers, HttpStatus.CREATED); } }