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.adobe.acs.commons.forms.Form.java

/**
 * Get data as ValueMap/*from  w  ww  . j  ava 2 s  . c  o  m*/
 *
 * @return
 */
public ValueMap getValueMap() {
    final Map<String, Object> map = new HashMap<String, Object>();
    map.putAll(this.data);
    return new ValueMapDecorator(map);
}

From source file:com.adobe.acs.commons.forms.Form.java

/**
 * Get Errors as ValueMap/*from   w w  w . j ava 2 s.c o  m*/
 *
 * @return
 */
public ValueMap getErrorsValueMap() {
    final Map<String, Object> map = new HashMap<String, Object>();
    map.putAll(this.errors);
    return new ValueMapDecorator(map);
}

From source file:com.rodiontsev.maven.plugins.buildinfo.BuildInfoMojo.java

public void execute() throws MojoExecutionException, MojoFailureException {
    Map<String, String> map = new LinkedHashMap<String, String>();

    for (InfoProvider provider : ServiceLoader.load(InfoProvider.class)) {
        map.putAll(provider.getInfo(project, this));
    }//from  w w  w  . j  a v a 2  s  .  com

    File buildDir = new File(project.getBuild().getDirectory());
    File file = new File(buildDir, filename);

    Writer out = null;
    try {
        // we may not have target/ yet
        buildDir.mkdir();
        boolean created = file.createNewFile();
        out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
        for (Map.Entry<String, String> entry : map.entrySet()) {
            out.write(entry.getKey());
            out.write(" = ");
            out.write(entry.getValue());
            out.write("\n");
        }
        out.flush();
        getLog().info(created ? "Created " : "Overwrote " + file.getAbsolutePath());
    } catch (IOException e) {
        getLog().warn(e.getMessage());
    } finally {
        IOUtils.closeQuietly(out);
    }
}

From source file:net.mindengine.oculus.frontend.web.controllers.SecureSimpleFormController.java

@SuppressWarnings("unchecked")
@Override/*from  w w  w  . j a  v  a 2s . c  o  m*/
protected Map referenceData(HttpServletRequest request) throws Exception {
    Map map = new HashMap<String, Object>();

    map.put("title", title);

    Map refMap = super.referenceData(request);
    if (refMap != null) {
        map.putAll(refMap);
    }
    return map;
}

From source file:io.wcm.caravan.io.http.request.CaravanHttpRequestBuilder.java

private String getExpandedUrl(Map<String, Object> parameters) {

    Map<String, Object> mergedParams = Maps.newHashMap(parameters);
    mergedParams.putAll(values);
    List<String> sortedQueryNames = Lists.newArrayList(queryNames);
    Collections.sort(sortedQueryNames);
    String operator = path.indexOf("?") == -1 ? "?" : "&";
    String query = queryNames.isEmpty() ? "" : ('{' + operator + StringUtils.join(queryNames, ',') + '}');
    return UriTemplate.fromTemplate(path + query).expand(mergedParams);

}

From source file:fitnesse.testsystems.CommandRunner.java

private Map<String, String> determineEnvironment() {
    if (environmentVariables == null) {
        return Collections.emptyMap();
    }//from   w  ww.  jav  a2 s. co  m
    Map<String, String> systemVariables = new HashMap<>(System.getenv());
    systemVariables.putAll(environmentVariables);
    return systemVariables;
}

From source file:com.baidu.rigel.biplatform.parser.node.CalculateNode.java

@Override
public Map<Condition, Set<String>> collect() {
    Map<Condition, Set<String>> leftCondition = left.collectVariableCondition();
    Map<Condition, Set<String>> rightCondition = right.collectVariableCondition();
    Map<Condition, Set<String>> result = new HashMap<Condition, Set<String>>();

    result.putAll(leftCondition);
    if (MapUtils.isEmpty(leftCondition)) {
        result.putAll(rightCondition);//from  w  w  w .j av  a 2 s.c o  m
    } else if (MapUtils.isNotEmpty(rightCondition)) {
        rightCondition = new HashMap<Condition, Set<String>>(rightCondition);
        for (Entry<Condition, Set<String>> entry : result.entrySet()) {
            if (rightCondition.containsKey(entry.getKey())) {
                entry.getValue().addAll(rightCondition.get(entry.getKey()));
                rightCondition.remove(entry.getKey());
            }
        }
        if (MapUtils.isNotEmpty(rightCondition)) {
            result.putAll(rightCondition);
        }
    }
    return result;

}

From source file:azkaban.flowtrigger.plugin.FlowTriggerDependencyPluginManager.java

private DependencyPluginConfig mergePluginConfig(final Map<String, String> publicProps,
        final Map<String, String> privateProps) throws FlowTriggerDependencyPluginException {
    final Map<String, String> combined = new HashMap<>();
    combined.putAll(publicProps);
    combined.putAll(privateProps);/*from   ww w.  j  av  a2 s .  c o m*/
    if (combined.size() != publicProps.size() + privateProps.size()) {
        throw new FlowTriggerDependencyPluginException(
                "duplicate property found in both public and" + " private properties");
    }
    return new DependencyPluginConfigImpl(combined);
}

From source file:com.glaf.activiti.tasklistener.PrepareTaskAssigneeListener.java

@Override
public void notify(DelegateTask delegateTask) {
    logger.debug("----------------------------------------------------");
    logger.debug("---------------PrepareTaskAssigneeListener----------");
    logger.debug("----------------------------------------------------");

    CommandContext commandContext = Context.getCommandContext();
    DelegateExecution execution = delegateTask.getExecution();
    logger.debug("dbSqlsession:" + commandContext.getDbSqlSession());
    logger.debug("sqlsession:" + commandContext.getDbSqlSession().getSqlSession());

    if (execution != null) {
        Map<String, Object> paramMap = new java.util.HashMap<String, Object>();
        paramMap.putAll(execution.getVariables());
        String statement = null;//ww  w.  j av  a2s  . com
        if (statementId != null) {
            statement = statementId.getExpressionText();
            logger.debug("statementId:" + statement);
        }
        if (roleId != null) {
            logger.debug("roleId:" + roleId.getExpressionText());
            paramMap.put("roleId", roleId.getExpressionText());
        }

        if (StringUtils.isNotEmpty(statement)) {
            MyBatisEntityDAO entityDAO = new MyBatisEntityDAO(commandContext.getDbSqlSession().getSqlSession());
            List<?> list = entityDAO.getList(statement, paramMap);
            if (list != null && !list.isEmpty()) {
                Collection<String> users = new java.util.HashSet<String>();
                Collection<String> groups = new java.util.HashSet<String>();
                for (Object object : list) {
                    if (object instanceof org.activiti.engine.identity.User) {
                        String actorId = ((org.activiti.engine.identity.User) object).getId();
                        if (!users.contains(actorId)) {
                            users.add(actorId);
                        }
                    } else if (object instanceof org.activiti.engine.identity.Group) {
                        String groupId = ((org.activiti.engine.identity.Group) object).getId();
                        if (!groups.contains(groupId)) {
                            groups.add(groupId);
                        }
                    } else if (object instanceof com.glaf.core.identity.User) {
                        String actorId = ((com.glaf.core.identity.User) object).getActorId();
                        if (!users.contains(actorId)) {
                            users.add(actorId);
                        }
                    } else if (object instanceof com.glaf.core.identity.Role) {
                        String groupId = String.valueOf(((com.glaf.core.identity.Role) object).getRoleId());
                        if (!groups.contains(groupId)) {
                            groups.add(groupId);
                        }
                    }
                }

                logger.debug("users:" + users);
                logger.debug("groups:" + groups);

                if (users.size() > 0) {
                    if (outputAssigneeVar != null) {
                        Object name = outputAssigneeVar.getValue(delegateTask.getExecution());
                        if (name != null) {
                            execution.setVariable(name.toString(), users.iterator().next());
                        }
                    }

                    if (outputUsersVar != null) {
                        Object name = outputUsersVar.getValue(delegateTask.getExecution());
                        if (name != null) {
                            execution.setVariable(name.toString(), users);
                        }
                    }
                }

                if (groups.size() > 0) {
                    if (outputGroupsVar != null) {
                        Object name = outputGroupsVar.getValue(delegateTask.getExecution());
                        if (name != null) {
                            execution.setVariable(name.toString(), groups);
                        }
                    }
                }
            }
        }
    }
}