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:it.jnrpe.server.config.CJNRPEConfiguration.java
/** * Returns a Map containing the definition of all the commands * @return/*from www .j a va2s . c o m*/ */ public Map getCommandDefinitions() { CCommands cc = m_Configuration.getCommands(); if (cc != null) return cc.getCommandDefinitions(); else return Collections.EMPTY_MAP; //return m_Configuration.getCommands().getCommandDefinitions(); }
From source file:org.apache.tapestry5.upload.internal.services.MultipartDecoderImplTest.java
@Test public void process_file_items_creates_wrapped_request_and_sets_non_file_parameters() throws Exception { HttpServletRequest request = mockHttpServletRequest(); expect(request.getParameterMap()).andReturn(Collections.EMPTY_MAP); MultipartDecoderImpl decoder = new MultipartDecoderImpl(fileItemFactory, -1, -1, CHARSET); List<FileItem> fileItems = Arrays.asList(createValueItem("one", "first"), createValueItem("two", "second")); replay();/*from ww w. j a va2s .c o m*/ HttpServletRequest decodedRequest = decoder.processFileItems(request, fileItems); assertNotSame(decodedRequest, request); assertEquals(decodedRequest.getParameter("one"), "first"); assertEquals(decodedRequest.getParameter("two"), "second"); verify(); }
From source file:org.apache.sling.commons.messaging.mail.internal.SimpleMailBuilder.java
@Override public Email build(@Nonnull final String message, @Nonnull final String recipient, @Nonnull final Map data) throws EmailException { final Map configuration = (Map) data.getOrDefault("mail", Collections.EMPTY_MAP); final String subject = (String) configuration.getOrDefault(SUBJECT_KEY, this.configuration.subject()); final String from = (String) configuration.getOrDefault(FROM_KEY, this.configuration.from()); final String charset = (String) configuration.getOrDefault(CHARSET_KEY, this.configuration.charset()); final String smtpHostname = (String) configuration.getOrDefault(SMTP_HOSTNAME_KEY, this.configuration.smtpHostname()); final int smtpPort = (Integer) configuration.getOrDefault(SMTP_PORT_KEY, this.configuration.smtpPort()); final String smtpUsername = (String) configuration.getOrDefault(SMTP_USERNAME_KEY, this.configuration.smtpUsername()); final String smtpPassword = (String) configuration.getOrDefault(SMTP_PASSWORD_KEY, this.configuration.smtpPassword()); final Email email = new SimpleEmail(); email.setCharset(charset);// w ww.j av a2s . c o m email.setMsg(message); email.addTo(recipient); email.setSubject(subject); email.setFrom(from); email.setHostName(smtpHostname); email.setSmtpPort(smtpPort); email.setAuthentication(smtpUsername, smtpPassword); return email; }
From source file:gumga.framework.security.GumgaSoftwareValuesProxy.java
@Transactional @ApiOperation(value = "load", notes = "Carrega entidade pela chave informada.") @RequestMapping(value = "/{key}", method = RequestMethod.GET) public Map load(@PathVariable String key) { String software = GumgaThreadScope.softwareName.get(); String url = getBaseUrl() + "findbysoftwareandkey/" + software + "/" + key + "?gumgaToken=" + GumgaThreadScope.gumgaToken.get(); Map response = getRestTemplate().getForObject(url, Map.class); if (response == null) { response = Collections.EMPTY_MAP; }/*from w ww .jav a2 s. c o m*/ return response; }
From source file:com.redhat.rhn.frontend.taglibs.list.helper.ListHelper.java
/** * constructor/* ww w. j ava2 s. c om*/ * @param inp takes in a Listable Object. * @param request http servlet request */ public ListHelper(Listable inp, HttpServletRequest request) { this(inp, request, Collections.EMPTY_MAP); }
From source file:jp.primecloud.auto.zabbix.ZabbixAccessor.java
public synchronized Object execute(String method, JSON params) { // auth?????? if (!"user.login".equals(method) && StringUtils.isEmpty(auth)) { authenticate();//from www. j av a 2s .co m } Map<String, Object> request = new HashMap<String, Object>(); request.put("jsonrpc", "2.0"); request.put("method", method); request.put("params", params == null ? Collections.EMPTY_MAP : params); request.put("auth", auth == null ? "" : auth); request.put("id", ++id); String jsonRequest = JSONObject.fromObject(request).toString(); if (log.isDebugEnabled()) { // ? String str = jsonRequest; if (str.contains("password")) { str = str.replaceAll("\"password\":\".*?\"", "\"password\":\"--------\""); } if (str.contains("passwd")) { str = str.replaceAll("\"passwd\":\".*?\"", "\"passwd\":\"--------\""); } log.debug(str); } String jsonResponse = post(jsonRequest); if (log.isDebugEnabled()) { log.debug(jsonResponse); } JSONObject response = JSONObject.fromObject(jsonResponse); if (response.containsKey("error")) { ResponseError error = (ResponseError) JSONObject.toBean(response.getJSONObject("error"), ResponseError.class); // ????????????? if ("Not authorized".equals(error.getData())) { auth = ""; return execute(method, params); } // AutoException exception = new AutoException("EZABBIX-000001", method); exception.addDetailInfo("params=" + params); exception.addDetailInfo( "error=" + ReflectionToStringBuilder.toString(error, ToStringStyle.SHORT_PREFIX_STYLE)); throw exception; } return response.get("result"); }
From source file:net.sf.farrago.namespace.sfdc.SfdcNameDirectory.java
public FarragoMedColumnSet lookupColumnSet(FarragoTypeFactory typeFactory, String foreignName, String[] localName) throws SQLException { if (!scope.equals(FarragoMedMetadataQuery.OTN_TABLE)) { return null; }// ww w . j a va2 s. co m return server.newColumnSet(localName, server.getProperties(), typeFactory, null, Collections.EMPTY_MAP); }
From source file:de.hybris.platform.dfcheckoutservice.service.impl.DfDefaultCalculationService.java
@Override protected Map<TaxValue, Map<Set<TaxValue>, Double>> calculateSubtotal(final AbstractOrderModel order, final boolean recalculate) { System.out.println("hello ok"); if (recalculate || orderRequiresCalculationStrategy2.requiresCalculation(order)) { double subtotal = 0.0; // entry grouping via map { tax code -> Double } final List<AbstractOrderEntryModel> entries = order.getEntries(); final Map<TaxValue, Map<Set<TaxValue>, Double>> taxValueMap = new LinkedHashMap<TaxValue, Map<Set<TaxValue>, Double>>( entries.size() * 2);//from w ww . ja v a 2 s .c o m for (final AbstractOrderEntryModel entry : entries) { if (entry.isChecked()) { calculateTotals(entry, recalculate); final double entryTotal = entry.getTotalPrice().doubleValue(); subtotal += entryTotal; // use un-applied version of tax values!!! final Collection<TaxValue> allTaxValues = entry.getTaxValues(); final Set<TaxValue> relativeTaxGroupKey = getUnappliedRelativeTaxValues(allTaxValues); for (final TaxValue taxValue : allTaxValues) { if (taxValue.isAbsolute()) { addAbsoluteEntryTaxValue(entry.getQuantity().longValue(), taxValue.unapply(), taxValueMap); } else { addRelativeEntryTaxValue(entryTotal, taxValue.unapply(), relativeTaxGroupKey, taxValueMap); } } } } // store subtotal subtotal = commonI18NService2.roundCurrency(subtotal, order.getCurrency().getDigits().intValue()); order.setSubtotal(Double.valueOf(subtotal)); return taxValueMap; } return Collections.EMPTY_MAP; }
From source file:net.pms.dlna.protocolinfo.MimeType.java
/** * Creates a new {@link MimeType} instance using the given values. * * @param type the first part of the mime-type. * @param subtype the second part of the mime-type. * @param parameters a {@link Map} of additional parameters for this * mime-type.//w ww . j a v a2 s.c o m */ public MimeType(String type, String subtype, Map<String, String> parameters) { this.type = type == null ? ANY : type; this.subtype = subtype == null ? ANY : subtype; if (parameters == null) { this.parameters = Collections.EMPTY_MAP; } else { TreeMap<String, String> map = new TreeMap<String, String>(new Comparator<String>() { @Override public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); for (Entry<String, String> entry : parameters.entrySet()) { map.put(entry.getKey(), entry.getValue()); } this.parameters = Collections.unmodifiableSortedMap(map); } this.stringValue = generateStringValue(); }
From source file:com.adobe.ags.curly.test.ErrorBehaviorTest.java
@Test public void testHappyPath() throws IOException, ParseException { List<Action> actions = Arrays.asList(successAction(), successAction(), successAction(), successAction(), successAction());/*from w w w . j av a2 s . c o m*/ ActionGroupRunner runner = new ActionGroupRunner("Happy Test", ignore -> client, actions, Collections.EMPTY_MAP, Collections.EMPTY_SET); runner.run(); assertResults(runner.getResult(), true, true); }