Example usage for java.util HashMap putAll

List of usage examples for java.util HashMap putAll

Introduction

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

Prototype

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

Source Link

Document

Copies all of the mappings from the specified map to this map.

Usage

From source file:it.pcan.test.integration.amqp.ErrorHandler.java

@ServiceActivator
public Message handleException(Message msg) {
    System.out.println("Exception thrown: " + msg);
    MessageHandlingException payload = (MessageHandlingException) msg.getPayload();
    MessageHeaders headers = payload.getFailedMessage().getHeaders();
    HashMap<String, Object> newHeaders = new HashMap<>(headers);

    newHeaders.putAll(msg.getHeaders());
    Throwable cause = payload.getCause();
    RuntimeException ex = (cause instanceof RuntimeException) ? (RuntimeException) cause
            : new RuntimeException(cause);

    Message m = new GenericMessage(new RuntimeExceptionHolder(ex), newHeaders);
    return m;/*  www  .j av  a  2s. co  m*/
}

From source file:pt.ua.ieeta.dicom.DICOMTemplateRuleImp.java

@Override
public void setI18n(HashMap<String, String> i18ns) {
    HashMap<String, String> i18n = rule.get("i18n");
    i18n.clear();/*from w w  w .j  ava2 s .c  o  m*/
    i18n.putAll(i18ns);
}

From source file:com.pieframework.model.system.SubSystem.java

@Override
public HashMap<String, Component> getChildren() {
    HashMap<String, Component> children = new HashMap<String, Component>();
    children.putAll(this.getRoles());

    return children;
}

From source file:com.pieframework.model.system.Role.java

@Override
public HashMap<String, Component> getChildren() {
    HashMap<String, Component> children = new HashMap<String, Component>();
    children.putAll(this.getServices());

    return children;
}

From source file:be.neutrinet.ispng.mail.Renderer.java

public String renderInTemplate(String segmentName, Map<String, String> content, boolean plaintext) {
    fillInDefaults(content);//from w w w .j a v  a 2 s  .c o  m

    String rseg = render(segmentName, content, plaintext);
    HashMap<String, String> ct = new HashMap<>();
    content.remove("body");
    ct.putAll(content);
    ct.put("body", rseg);

    return render(BASE_TEMPLATE, ct, plaintext);
}

From source file:com.pieframework.model.system.System.java

@Override
public HashMap<String, Component> getChildren() {
    HashMap<String, Component> children = new HashMap<String, Component>();
    children.putAll(this.getSubSystems());

    return children;
}

From source file:com.hortonworks.amstore.view.proxy.Proxy.java

private HashMap<String, String> makeHeaders() {
    HashMap<String, String> headers = new HashMap<String, String>();
    headers.putAll(customHeaders);

    if (isUseAuthorization()) {
        String authString = username + ":" + password;
        byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
        String authStringEnc = new String(authEncBytes);

        headers.put("Authorization", "Basic " + authStringEnc);
    }/*from w w  w . j a v  a2s  . co  m*/
    return headers;
}

From source file:uk.ac.kcl.itemProcessors.DeIdDocumentItemProcessor.java

@Override
public Document process(final Document doc) {
    LOG.debug("starting " + this.getClass().getSimpleName() + " on doc " + doc.getDocName());
    HashMap<String, Object> newMap = new HashMap<>();
    newMap.putAll(doc.getAssociativeArray());
    doc.getAssociativeArray().forEach((k, v) -> {
        String newString = "";
        if (fieldsToDeId.contains(k.toLowerCase())) {
            try {
                if (useGateApp) {
                    newString = gateService.deIdentifyString(v.toString(), doc.getPrimaryKeyFieldValue());
                } else {
                    newString = elasticGazetteer.deIdentifyDates(v.toString(), doc.getPrimaryKeyFieldValue());
                    newString = elasticGazetteer.deIdentifyString(newString, doc.getPrimaryKeyFieldValue());
                }//from  w ww.j a v a  2s .  c om
                if (replaceFields) {
                    newMap.put(k, newString);
                } else {
                    newMap.put(("deidentified_" + k), newString);
                }
            } catch (DeIdentificationFailedException e) {
                LOG.warn("De-identification failed on document " + doc.getDocName(), e);
                if (replaceFields) {
                    newMap.put(k, e.getLocalizedMessage());
                } else {
                    newMap.put(("deidentified_" + k), e.getLocalizedMessage());
                }
            }
        }
    });

    doc.getAssociativeArray().clear();
    doc.getAssociativeArray().putAll(newMap);
    LOG.debug("finished " + this.getClass().getSimpleName() + " on doc " + doc.getDocName());
    return doc;
}

From source file:ch.sbb.releasetrain.action.JenkinsAction.java

@Override
public ActionResult doWork(ActionState state, HashMap properties) {
    Map<String, String> params = new HashMap<>(state.getConfig().getProperties());

    properties.putAll(params);

    JenkinsActionConfig conf = (JenkinsActionConfig) state.getConfig();

    http.setPassword(conf.getEncPassword());
    http.setUser(conf.getJenkinsUser());

    jenkinsThread = new JenkinsJobThread(conf.getJenkinsJobname(), "fromReleaseTrainJenkinsAction",
            conf.getJenkinsUrl(), conf.getJenkinsBuildToken(), http, properties);
    jenkinsThread.startBuildJobOnJenkins(true);
    state.setResultString(jenkinsThread.getBuildColor() + ": " + jenkinsThread.getJobUrl());
    if (jenkinsThread.getBuildColor().equalsIgnoreCase("green")) {
        return ActionResult.SUCCESS;
    }/*w w  w .  j  ava  2 s. c  o m*/
    return ActionResult.FAILED;
}

From source file:contrail.stages.GraphToFasta.java

/**
 * Get the parameters used by this stage.
 *//*from   ww w .  j a v  a  2s  .c o m*/
protected Map<String, ParameterDefinition> createParameterDefinitions() {
    HashMap<String, ParameterDefinition> defs = new HashMap<String, ParameterDefinition>();

    defs.putAll(super.createParameterDefinitions());

    for (ParameterDefinition def : ContrailParameters.getInputOutputPathOptions()) {
        defs.put(def.getName(), def);
    }
    return Collections.unmodifiableMap(defs);
}