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.netflix.spinnaker.orca.pipeline.util.ContextParameterProcessor.java

public Map<String, Object> buildExecutionContext(Stage stage, boolean includeStageContext) {
    Map<String, Object> augmentedContext = new HashMap<>();
    if (includeStageContext) {
        augmentedContext.putAll(stage.getContext());
    }// w w  w.  ja  v  a  2 s .c  om
    if (stage.getExecution().getType() == PIPELINE) {
        augmentedContext.put("trigger", mapper.convertValue(stage.getExecution().getTrigger(),
                new TypeReference<Map<String, Object>>() {
                }));
        augmentedContext.put("execution", stage.getExecution());
    }

    return augmentedContext;
}

From source file:com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.java

protected void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile,
        DocumentFormat outputFormat) {// ww  w  . j  a  v  a  2  s.c om
    Map/*<String,Object>*/ loadProperties = new HashMap();
    loadProperties.putAll(getDefaultLoadProperties());
    loadProperties.putAll(inputFormat.getImportOptions());

    Map/*<String,Object>*/ storeProperties = outputFormat.getExportOptions(inputFormat.getFamily());

    synchronized (openOfficeConnection) {
        XFileIdentifierConverter fileContentProvider = openOfficeConnection.getFileContentProvider();
        String inputUrl = fileContentProvider.getFileURLFromSystemPath("", inputFile.getAbsolutePath());
        String outputUrl = fileContentProvider.getFileURLFromSystemPath("", outputFile.getAbsolutePath());

        loadAndExport(inputUrl, loadProperties, outputUrl, storeProperties);
    }
}

From source file:com.jnj.b2b.cockpits.cmscockpit.session.impl.DefaultCmsCockpitPerspective.java

@Override
public void createNewItem(final ObjectTemplate template, final Map<String, Object> initValues,
        final boolean loadDefaultValues) {
    final Map<String, Object> initialValues = new HashMap<String, Object>();
    initialValues.putAll(initValues);
    if (!initialValues.containsKey("CMSItem" + CATALOGVERSION)) {
        final TypedObject catalogVersion = getTypeService()
                .wrapItem(getCmsAdminSiteService().getActiveCatalogVersion());
        initialValues.put("CMSItem" + CATALOGVERSION, catalogVersion);
    }//ww w.  j  a va2s.  c  om

    getEditorArea().reset();
    setActiveItem(null);
    getEditorArea().setCurrentObject(getActiveItem());

    for (final BrowserModel b : getBrowserArea().getVisibleBrowsers()) {
        getBrowserArea().updateActivation(b);
    }

    final EditorAreaController eac = getEditorArea().getEditorAreaController();
    eac.setCreateFromTemplate(template, initialValues, loadDefaultValues);
    eac.resetSectionPanelModel();
}

From source file:org.kew.rmf.reconciliation.configurations.MatchConfigurationTestingStepdefs.java

private Map<String, String> doSingleTestQuery(Map<String, String> origQuery)
        throws TooManyMatchesException, MatchExecutionException {
    // Copy the map, as Cucumber supplies an UnmodifiableMap
    Map<String, String> query = new HashMap<>();
    query.putAll(origQuery);

    query.put("id", query.get("queryId")); // Means the id can show up in the debug output.
    List<Map<String, String>> matches = currentMatcher.getMatches(query);

    logger.debug("Found some matches: {}", matches.size());
    if (matches.size() < 4) {
        logger.debug("Matches for {} are {}", query, matches);
    }/*from w  w w  . j  av a2s  .com*/

    // Construct result string (list of ids)
    ArrayList<String> matchedIds = new ArrayList<>();
    for (Map<String, String> match : matches) {
        matchedIds.add(match.get("id"));
    }
    Collections.sort(matchedIds);

    query.put("results", StringUtils.join(matchedIds, " "));

    return query;
}

From source file:com.discovery.darchrow.net.ParamUtil.java

/**
 * ? <br>//ww w. j av a2s. c  o m
 * ?????a=1&a=2,a,[3,4] a=3&a=4.
 * 
 * @param uri
 *            URI ? (URI),<br>
 *            ? ?,?,??,<br>
 *            ??, ?
 * @param nameAndValueMap
 *            nameAndValueMap  request.getParameterMap
 * @param charsetType
 *            ?
 * @return ? ???
 */
public static String addParameterArrayMap(URI uri, Map<String, String[]> nameAndValueMap, String charsetType) {
    if (null == uri) {
        throw new IllegalArgumentException("uri can not be null!");
    }
    if (Validator.isNullOrEmpty(nameAndValueMap)) {
        throw new IllegalArgumentException("nameAndValueMap can not be null!");
    }
    // ***********************************************************************
    String url = uri.toString();
    String before = URIUtil.getBeforePath(url);
    // ***********************************************************************
    // getQuery()  URI ??
    // getRawQuery()  URI ? URI ???? URI 
    String query = uri.getRawQuery();
    // ***********************************************************************
    Map<String, String[]> map = new LinkedHashMap<String, String[]>();
    // url??
    if (Validator.isNullOrEmpty(query)) {
        // nothing to do
    } else {
        Map<String, String[]> originalMap = URIUtil.parseQueryToArrayMap(query, null);
        map.putAll(originalMap);
    }
    map.putAll(nameAndValueMap);
    // **************************************************************
    return URIUtil.getEncodedUrlByArrayMap(before, map, charsetType);
}

From source file:backtype.storm.utils.Utils.java

private static Map loadProperty(String prop) {
    Map ret = new HashMap<Object, Object>();
    Properties properties = new Properties();

    try {/*from  w w  w  . j  av  a2  s  . c om*/
        InputStream stream = new FileInputStream(prop);
        properties.load(stream);
        if (properties.size() == 0) {
            System.out.println("WARN: Config file is empty");
            return null;
        } else {
            ret.putAll(properties);
        }
    } catch (FileNotFoundException e) {
        System.out.println("No such file " + prop);
        throw new RuntimeException(e.getMessage());
    } catch (Exception e1) {
        e1.printStackTrace();
        throw new RuntimeException(e1.getMessage());
    }

    return ret;
}

From source file:com.rsmart.certification.impl.control.RedirectView.java

/**
 * Prepares the view given the specified model, merging it with static
 * attributes and a RequestContext attribute, if necessary.
 * Delegates to renderMergedOutputModel for the actual rendering.
 *
 * @param model/*from w  w w. j  a  va2  s. c  o m*/
 * @param request
 * @param response
 * @throws java.lang.Exception
 * @see #renderMergedOutputModel
 */
public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (model == null) {
        model = new HashMap();
    }
    model.putAll(getPortalParamManager().getParams(request));
    super.render(model, request, response);
}

From source file:org.hdiv.web.multipart.HDIVMultipartResolver.java

/**
 * Return the multipart parameters as Map of field name to form field String value.
 *//*from  w  w  w  . ja v a  2  s.c o  m*/
public Map<String, String[]> getMultipartTextElements(Hashtable textElements) {

    Map<String, String[]> multipartParameters = new HashMap<String, String[]>();
    multipartParameters.putAll(textElements);
    return multipartParameters;
}

From source file:com.adaptris.core.management.jetty.FromXmlConfig.java

private Map<String, String> mergeWithSystemProperties() {
    Map<String, String> result = PropertyHelper
            .asMap(PropertyHelper.getPropertySubset(System.getProperties(), JETTY_PREFIX));
    result.putAll(PropertyHelper.asMap(PropertyHelper.getPropertySubset(initialProperties, JETTY_PREFIX)));
    log.trace("Additional properties for XML Config {}", result);
    return result;
}

From source file:be.vlaanderen.sesam.proxy.internal.BundleActivator.java

@Override
public synchronized void onConfigurationChanged(List<Rule> rules) {
    // must update channels we are listening to
    Map<Integer, Channel> oldChannels = new HashMap<Integer, Channel>();
    oldChannels.putAll(channels);

    if (rules != null && rules.size() > 0) {
        for (Rule rule : rules) {
            Integer port = rule.getLocalRequestPort();
            if (port != null && port > 0) {
                if (channels.containsKey(port)) { // port can be used multiple times so test on channels.
                    oldChannels.remove(port);
                } else {
                    Channel c = serverBootstrap.bind(new InetSocketAddress(port));
                    channels.put(port, c);
                    log.info(" - Started listening on port: " + port);
                }/*from   w w  w .j  a  v  a 2s.  co m*/
            }
        }
    }

    for (Entry<Integer, Channel> entry : oldChannels.entrySet()) {
        channels.remove(entry.getKey());
        entry.getValue().unbind().addListener(new ChannelFutureListener() {

            public void operationComplete(ChannelFuture future) throws Exception {
                InetSocketAddress addr = (InetSocketAddress) future.getChannel().getLocalAddress();
                log.info("Stopped listening on port: " + addr.getPort() + " -- "
                        + (future.isSuccess() ? "Success" : "Fail"));
            }
        });
    }
}