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:com.screenslicer.common.CommonUtil.java

public static String combinedJson(Object obj1, Object obj2) {
    Map<String, Object> map1 = CommonUtil.gson.fromJson(CommonUtil.gson.toJson(obj1, obj1.getClass()),
            CommonUtil.objectType);//  w w  w  . j  a v  a  2  s .  c o  m
    Map<String, Object> map2 = CommonUtil.gson.fromJson(CommonUtil.gson.toJson(obj2, obj2.getClass()),
            CommonUtil.objectType);
    map1.putAll(map2);
    return CommonUtil.gson.toJson(map1, CommonUtil.objectType);
}

From source file:org.ofbiz.common.CommonServices.java

/**
 * Echo service; returns exactly what was sent.
 * This service does not have required parameters and does not validate
 *//*from   w ww.  j  a  v  a  2  s.c  om*/
public static Map<String, Object> echoService(DispatchContext dctx, Map<String, ?> context) {
    Map<String, Object> result = FastMap.newInstance();
    result.putAll(context);
    result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
    return result;
}

From source file:com.helpinput.core.Utils.java

public static Map<String, Object> map(Map<String, Object> source, Map<String, Object> dest) {
    if (dest == null)
        dest = createValues();/*from   ww w . j  a v a2  s . com*/
    if (hasLength(source))
        dest.putAll(source);
    return dest;
}

From source file:de.micromata.genome.logging.BaseLogging.java

protected static <V> Map<String, V> createNewMap(Map<String, V> oldValues, Map<String, V> newValues) {
    Map<String, V> ret = new HashMap<>(oldValues);
    ret.putAll(newValues);
    return ret;/*from   w  w w. j ava2s.co  m*/

}

From source file:de.micromata.genome.logging.BaseLogging.java

protected static <V> Map<String, V> createNewDisposableMap(Map<String, V> oldValues, Map<String, V> newValues) {
    Map<String, V> ret = createNewCacheMap(oldValues);
    ret.putAll(newValues);
    return ret;//from w  ww.ja  v  a 2 s  . c  o m

}

From source file:edu.cmu.cs.lti.util.uima.UimaConvenience.java

public static <K extends Annotation, T extends Annotation> Map<K, Collection<T>> indexCoveredAndCovering(
        JCas aJCas, Class<K> keyType, Class<T> valueType) {
    Map<K, Collection<T>> index = new HashMap<K, Collection<T>>();

    Map<K, Collection<T>> covered = JCasUtil.indexCovered(aJCas, keyType, valueType);

    Map<K, Collection<T>> covering = JCasUtil.indexCovering(aJCas, keyType, valueType);

    index.putAll(covered);
    index.putAll(covering);/*from  w  ww .j  av  a  2 s  .c  om*/

    return covered;
}

From source file:com.dtolabs.rundeck.core.dispatcher.DataContextUtils.java

/**
 * Generate a set of key value pairs to use for environment variables, from the context data set
 *//*from   w w  w .  j ava2s  . co  m*/
public static Map<String, String> generateEnvVarsFromContext(
        final Map<String, Map<String, String>> dataContext) {
    final Map<String, String> context = new HashMap<String, String>();
    if (null != dataContext) {
        for (final Map.Entry<String, Map<String, String>> entry : dataContext.entrySet()) {
            final Map<String, String> envs = generateEnvVarsFromData(entry.getValue(), entry.getKey());
            if (null != envs) {
                context.putAll(envs);
            }
        }
    }
    return context;
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.DataGetterUtils.java

public static Map<String, Object> getDataForPage(String pageUri, VitroRequest vreq, ServletContext context) {
    //Based on page type get the appropriate data getter
    Map<String, Object> page = getMapForPage(vreq, pageUri);
    //Get data getters map
    Map<String, PageDataGetter> dataGetterMap = getPageDataGetterMap(context);
    //Get types associated with page
    Map<String, Object> data = new HashMap<String, Object>();
    List<String> dataGetters = (List<String>) page.get("dataGetters");
    log.debug("Retrieved data getters for Page " + pageUri + " = " + dataGetters.toString());
    if (dataGetters != null) {
        for (String dataGetter : dataGetters) {
            Map<String, Object> moreData = null;
            PageDataGetter getter = dataGetterMap.get(dataGetter);
            log.debug("Retrieved data getter for " + dataGetter);
            try {
                moreData = getAdditionalData(pageUri, dataGetter, page, vreq, getter, context);
                if (moreData != null)
                    data.putAll(moreData);
            } catch (Throwable th) {
                log.error(th, th);//  w  w w  .j av  a2s  . c o m
            }
        }
    }
    return data;
}

From source file:org.toobsframework.pres.util.ParameterUtil.java

public static Map buildParameterMap(HttpServletRequest request, boolean compCall) {
    Map params = new HashMap();
    HttpSession session = request.getSession();
    Enumeration attributes = session.getAttributeNames();
    // Session has lowest priority
    while (attributes.hasMoreElements()) {
        String thisAttribute = (String) attributes.nextElement();
        //if (session.getAttribute(thisAttribute) instanceof String) {
        params.put(thisAttribute, session.getAttribute(thisAttribute));
        //}// w ww .j a  va  2 s.  com
    }
    // Parameters next highest
    params.putAll(request.getParameterMap());

    // Attributes rule all
    attributes = request.getAttributeNames();
    while (attributes.hasMoreElements()) {
        String thisAttribute = (String) attributes.nextElement();
        if (!excludedParameters.contains(thisAttribute)) {
            if (log.isDebugEnabled()) {
                log.debug("Putting " + thisAttribute + " As " + request.getAttribute(thisAttribute));
            }
            params.put(thisAttribute, request.getAttribute(thisAttribute));
        }
    }
    params.put("httpQueryString", request.getQueryString());
    if (compCall && request.getMethod().equals("POST")) {
        StringBuffer qs = new StringBuffer();
        Iterator iter = request.getParameterMap().entrySet().iterator();
        int i = 0;
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            String key = (String) entry.getKey();
            String[] value = (String[]) entry.getValue();
            for (int j = 0; j < value.length; j++) {
                if (i > 0)
                    qs.append("&");
                qs.append(key).append("=").append(value[j]);
                i++;
            }
        }
        params.put("httpQueryString", qs.toString());
    }
    return params;
}

From source file:com.feilong.core.net.ParamUtil.java

/**
 *  parameter array value map./*  ww w . j  a  v a  2s.co m*/
 * 
 * <p>
 *  <code>queryString</code> ??,??map,?? <code>arrayValueMap</code>;<br>
 *  {@link LinkedHashMap},??map?
 * </p>
 * 
 * @param uriString
 *            the uri string
 * @param queryString
 *            the query
 * @param arrayValueMap
 *            the name and array value map
 * @param charsetType
 *            ??, {@link CharsetType}<br>
 *            <span style="color:green">null empty,?,?</span><br>
 *            ??,??,ie?chrome? url ,?
 * @return the string
 * @since 1.4.0
 */
static String addParameterArrayValueMap(String uriString, String queryString,
        Map<String, String[]> arrayValueMap, String charsetType) {
    Map<String, String[]> safeArrayValueMap = ObjectUtils.defaultIfNull(arrayValueMap,
            Collections.<String, String[]>emptyMap());

    Map<String, String[]> arrayParamValuesMap = newLinkedHashMap(safeArrayValueMap.size());
    //???queryString map
    if (isNotNullOrEmpty(queryString)) {
        arrayParamValuesMap.putAll(toSafeArrayValueMap(queryString, null));
    }
    arrayParamValuesMap.putAll(safeArrayValueMap);
    return combineUrl(URIUtil.getFullPathWithoutQueryString(uriString), arrayParamValuesMap, charsetType);
}