Example usage for java.util Map putAll

List of usage examples for java.util Map putAll

Introduction

In this page you can find the example usage for java.util Map putAll.

Prototype

void putAll(Map<? extends K, ? extends V> m);

Source Link

Document

Copies all of the mappings from the specified map to this map (optional operation).

Usage

From source file:edu.cornell.mannlib.vitro.webapp.web.widgets.BrowseWidget.java

protected WidgetTemplateValues doAllClassGroupsDisplay(Environment env, Map params, HttpServletRequest request,
        ServletContext context) {// w  ww  .j  a  v a2  s.co m
    Map<String, Object> body = new HashMap<String, Object>();
    body.putAll(getCommonValues(env, context));
    body.putAll(getAllClassGroupData(request, params, context));

    String macroName = Mode.ALL_CLASS_GROUPS.macroName;
    return new WidgetTemplateValues(macroName, body);
}

From source file:edu.cornell.mannlib.vitro.webapp.web.widgets.BrowseWidget.java

protected WidgetTemplateValues doClassDisplay(Environment env, Map params, HttpServletRequest request,
        ServletContext context) {/*from w  ww.  j a  va2 s  .  c  om*/
    Map<String, Object> body = new HashMap<String, Object>();
    body.putAll(getCommonValues(env, context));
    body.putAll(getClassData(request, params, context));

    String macroName = Mode.VCLASS.macroName;
    return new WidgetTemplateValues(macroName, body);
}

From source file:edu.cornell.mannlib.vitro.webapp.web.widgets.BrowseWidget.java

protected WidgetTemplateValues doClassGroupDisplay(Environment env, Map params, HttpServletRequest request,
        ServletContext context) {/*from   www  . j a  v  a  2  s  .com*/
    Map<String, Object> body = new HashMap<String, Object>();
    body.putAll(getCommonValues(env, context));
    body.putAll(getClassGroupData(request, params, context));

    String macroName = Mode.CLASS_GROUP.macroName;
    return new WidgetTemplateValues(macroName, body);
}

From source file:net.shopxx.plugin.paypalPayment.PaypalPaymentPlugin.java

@Override
public boolean verifyNotify(PaymentPlugin.NotifyMethod notifyMethod, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    PaymentLog paymentLog = getPaymentLog(request.getParameter("invoice"));
    if (paymentLog != null
            && pluginConfig.getAttribute("partner").equals(request.getParameter("receiver_email"))
            && pluginConfig.getAttribute("currency").equals(request.getParameter("mc_currency"))
            && "Completed".equals(request.getParameter("payment_status"))
            && paymentLog.getAmount().compareTo(new BigDecimal(request.getParameter("mc_gross"))) == 0) {
        Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
        parameterMap.put("cmd", "_notify-validate");
        parameterMap.putAll(request.getParameterMap());
        if ("VERIFIED".equals(WebUtils.post("https://www.paypal.com/cgi-bin/webscr", parameterMap))) {
            return true;
        }/*  w w  w . j  av  a 2 s .  c  o  m*/
    }
    return false;
}

From source file:fr.acxio.tools.agia.transform.ListFieldSetToMapProcessor.java

@Override
public Map<String, Object> process(List<FieldSet> sItem) throws Exception {
    Map<String, Object> aResult = null;
    if ((sItem != null) && !sItem.isEmpty()) {
        aResult = new HashMap<String, Object>();
        for (int aRecIdx = 0; aRecIdx < sItem.size(); aRecIdx++) {
            aResult.putAll(mapFieldSet(sItem.get(aRecIdx), aRecIdx));
        }/*  w w  w. j a v  a2  s  . co  m*/
    }
    return aResult;
}

From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaSearchQueryOptions.java

@Override
public Map<String, String> getOptions(EditConfigurationVTwo editConfig, String fieldName,
        WebappDaoFactory wDaoFact) throws Exception {

    Map<String, Individual> individualMap = new HashMap<String, Individual>();

    for (String vclassURI : vclassURIs) {
        individualMap.putAll(getIndividualsForClass(vclassURI, wDaoFact));
    }//from  w ww .j  a  va 2  s.co m

    //sort the individuals 
    List<Individual> individuals = new ArrayList<Individual>();
    individuals.addAll(individualMap.values());

    //Here we will remove individuals already in the range
    Individual subject = wDaoFact.getIndividualDao().getIndividualByURI(subjectUri);
    List<ObjectPropertyStatement> stmts = subject.getObjectPropertyStatements();

    individuals = FieldUtils.removeIndividualsAlreadyInRange(individuals, stmts, predicateUri, objectUri);
    //Also remove subjectUri if it 
    individuals = removeSubjectUri(individuals, subjectUri);
    //sort the list
    Collections.sort(individuals);
    //set up the options map
    Map<String, String> optionsMap = new HashMap<String, String>();

    if (defaultOptionLabel != null) {
        optionsMap.put(LEFT_BLANK, defaultOptionLabel);
    }

    if (individuals.size() == 0) {
        //return empty map, unlike individualsViaVclass
        return optionsMap;
    } else {
        for (Individual ind : individuals) {
            if (ind.getURI() != null) {
                optionsMap.put(ind.getURI(), ind.getName().trim());
            }
        }
    }
    return optionsMap;

}

From source file:com.seajas.search.profiler.authentication.strategy.codex.CodexAuthenticationStrategy.java

/**
 * {@inheritDoc}//from ww  w .j  av a2 s. c  o  m
 */
@Override
public AuthenticationResult authenticate(final String url, final Map<String, String> parameters) {
    String resultUrl = url, username = parameters.get(resultMappingUsernameParameter), providerId;

    // The resulting parameter-map can be optionally augmented with additional parameters - hence we create a new one

    Map<String, String> resultParameters = new HashMap<String, String>();

    resultParameters.putAll(parameters);

    // Determine which provider this URL belongs to (if any)

    try {
        providerId = urlToProviderId(new URL(resultUrl));
    } catch (MalformedURLException e) {
        logger.error("The given URL '" + url + "' was not valid - not performing authentication", e);

        return createEmptyResult(resultUrl, resultParameters);
    }

    // Now determine the token and secret from the codex' identity service

    String identityResult;

    if (providerId == null && username == null) {
        logger.error(
                "Neither a provider could be detected from the URL, nor was a username given - unable to determine if we should apply for a poolable token (provider required) or a generic username (username required) - not performing authentication");

        return createEmptyResult(resultUrl, resultParameters);
    } else if (username != null) {
        identityResult = identityService.getLastToken(username, providerId);

        if (identityResult == null) {
            logger.error("Could not retrieve token for username '" + username + "'"
                    + (providerId != null ? " and provider '" + providerId + "'" : ""));

            return createEmptyResult(resultUrl, resultParameters);
        }
    } else {
        identityResult = identityService.getNextPoolableToken(providerId);

        if (identityResult == null) {
            logger.error("Could not retrieve poolable token for provider '" + providerId + "'");

            return createEmptyResult(resultUrl, resultParameters);
        }
    }

    // And split it up, should it also contain a secret (in the case of OAuth1)

    String[] accessTokenAndSecret = identityResult.split("/");

    String accessToken = accessTokenAndSecret[0].trim(),
            secret = accessTokenAndSecret.length > 1 ? accessTokenAndSecret[1].trim() : "";

    return new AuthenticationResult(
            resultUrl.replace(REPLACEMENT_ACCESS_TOKEN, accessToken).replace(REPLACEMENT_SECRET, secret),
            resultParameters);
}

From source file:gov.nih.nci.cabig.caaers.web.admin.AbstractAgentTab.java

@Override
public Map<String, Object> referenceData(HttpServletRequest request, AgentCommand command) {
    Map<String, Object> refdata = super.referenceData(request, command);
    Map tMap = new LinkedHashMap();
    tMap.put("", "Please select");
    tMap.putAll(WebUtils.collectOptions(Arrays.asList(Term.values()), null, "displayName"));
    refdata.put("terminology", tMap);
    refdata.put("ctcVersion", collectOptions(ctcDao.getAll(), "id", "name"));
    refdata.put("meddraVersion", collectOptions(meddraVersionDao.getAll(), "id", "name"));
    return refdata;
}

From source file:com.github.mjeanroy.springmvc.view.mustache.core.DefaultMustacheTemplateLoader.java

private Map<String, String> getPartialAliases() {
    final Map<String, String> aliases = new HashMap<String, String>();
    aliases.putAll(partialAliases);
    aliases.putAll(temporaryPartialAliases.get());
    return aliases;
}