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:in.sc.main.CategoryController.java

private String productList(String unique_id, Model model, HashMap inputMap) {

    inputMap.put(featureTable, "product_feature_map");
    inputMap.put("src_id", 4);
    inputMap.put(ProductHelper.getFilterVals, 4);
    HashMap gFeatureMap = pHelper.getFeatureMap(inputMap);
    inputMap.put("gFeatureMap", gFeatureMap);

    try {/*from  ww w  .j  av  a2  s  . c o  m*/
        if (inputMap.get("filterQ") != null) {
            HashMap reqMap = generateRequestMap((String) inputMap.get("filterQ"), gFeatureMap);
            inputMap.putAll(reqMap);
            model.addAttribute("filterQ", inputMap.get("filterQ"));
        }
        ArrayList data = (ArrayList) pHelper.getProductLists1(inputMap);
        //            if (inputMap.containsKey(pHelper.brandname)) {
        //                model.addAttribute("brandName", ((ArrayList) inputMap.get("brandName")).get(0));
        //            }
        ArrayList catList = (ArrayList) lHelper.getListsDetails(0, (int) inputMap.get(ProductHelper.category));
        if (data.size() > 0) {
            model.addAttribute("pBean", data.get(0));
        }
        model.addAttribute("dataList", data);
        model.addAttribute("cat_id", inputMap.get(ProductHelper.category));
        model.addAttribute("bMap", pHelper.selectBrand((int) inputMap.get(ProductHelper.category)));
        model.addAttribute("gFeatureMap", gFeatureMap);
        model.addAttribute("catList", catList);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return "category_1";
}

From source file:it.unibas.spicy.persistence.csv.DAOCsv.java

@SuppressWarnings("unchecked")
public void addInstances(IDataSourceProxy dataSource, HashMap<String, ArrayList<Object>> newFilesMap)
        throws DAOException {
    //merge previous map with the new one
    HashMap<String, ArrayList<Object>> mergeMap = new HashMap<String, ArrayList<Object>>();
    HashMap<String, ArrayList<Object>> previousMap = (HashMap) dataSource
            .getAnnotation(SpicyEngineConstants.INSTANCE_PATH_LIST);
    mergeMap.putAll(previousMap);
    mergeMap.putAll(newFilesMap);/* ww w .java2s . co m*/
    //replace annotation
    dataSource.addAnnotation(SpicyEngineConstants.INSTANCE_PATH_LIST, mergeMap);
    //change flag so that new instances will be loaded to the temporary DB
    dataSource.addAnnotation(SpicyEngineConstants.LOADED_INSTANCES_FLAG, false);
    String catalog = (String) dataSource.getAnnotation(SpicyEngineConstants.CSV_DB_NAME);
    //load instance sample of the new files
    loadInstanceSample(dataSource, newFilesMap, catalog);
}

From source file:org.kuali.kfs.module.tem.document.web.struts.TravelEntertainmentForm.java

protected Map<String, ExtraButton> createButtonsMap() {
    final HashMap<String, ExtraButton> result = new HashMap<String, ExtraButton>();

    // New Entertainment button
    ExtraButton newEntertainmentButton = new ExtraButton();
    newEntertainmentButton.setExtraButtonProperty("methodToCall.newEntertainment");
    newEntertainmentButton.setExtraButtonSource(
            "${" + KFSConstants.EXTERNALIZABLE_IMAGES_URL_KEY + "}buttonsmall_newentertainment.png");
    newEntertainmentButton.setExtraButtonAltText("New Entertainment");

    result.put(newEntertainmentButton.getExtraButtonProperty(), newEntertainmentButton);

    result.putAll(createPaymentExtraButtonMap());

    return result;
}

From source file:org.nuxeo.ecm.platform.routing.web.RoutingTaskActionsBean.java

public TaskInfo getTaskInfo(final Task task, final boolean getFormVariables) {
    if (tasksInfoCache.containsKey(task.getId())) {
        return tasksInfoCache.get(task.getId());
    }/*  ww  w . ja  v a  2 s .co  m*/
    final String routeDocId = task.getVariable(DocumentRoutingConstants.TASK_ROUTE_INSTANCE_DOCUMENT_ID_KEY);
    final String nodeId = task.getVariable(DocumentRoutingConstants.TASK_NODE_ID_KEY);
    if (routeDocId == null) {
        throw new NuxeoException("Can not get the source graph for this task");
    }
    if (nodeId == null) {
        throw new NuxeoException("Can not get the source node for this task");
    }
    final TaskInfo[] res = new TaskInfo[1];
    new UnrestrictedSessionRunner(documentManager) {
        @Override
        public void run() {
            DocumentModel doc = session.getDocument(new IdRef(routeDocId));
            GraphRoute route = doc.getAdapter(GraphRoute.class);
            GraphNode node = route.getNode(nodeId);
            HashMap<String, Serializable> map = new HashMap<String, Serializable>();
            if (getFormVariables) {
                map.putAll(node.getVariables());
                map.putAll(route.getVariables());
            }
            res[0] = new TaskInfo(task.getId(), map, node.getTaskLayout(), node.getTaskButtons(),
                    node.allowTaskReassignment(), task.getName());
        }
    }.runUnrestricted();
    // don't add tasks in cache when are fetched without the form variables
    // for
    // bulk processing
    if (getFormVariables) {
        tasksInfoCache.put(task.getId(), res[0]);
    }
    return res[0];
}

From source file:org.apache.nifi.processors.attributes.UpdateAttribute.java

@OnScheduled
public void onScheduled(final ProcessContext context) throws IOException {
    criteriaCache.set(CriteriaSerDe.deserialize(context.getAnnotationData()));

    propertyValues.clear();//from  w w w  . ja va  2 s  .c  om

    if (stateful) {
        StateManager stateManager = context.getStateManager();
        StateMap state = stateManager.getState(Scope.LOCAL);
        HashMap<String, String> tempMap = new HashMap<>();
        tempMap.putAll(state.toMap());
        String initValue = context.getProperty(STATEFUL_VARIABLES_INIT_VALUE).getValue();

        // Initialize the stateful default actions
        for (PropertyDescriptor entry : context.getProperties().keySet()) {
            if (entry.isDynamic()) {
                if (!tempMap.containsKey(entry.getName())) {
                    tempMap.put(entry.getName(), initValue);
                }
            }
        }

        // Initialize the stateful actions if the criteria exists
        final Criteria criteria = criteriaCache.get();
        if (criteria != null) {
            for (Rule rule : criteria.getRules()) {
                for (Action action : rule.getActions()) {
                    if (!tempMap.containsKey(action.getAttribute())) {
                        tempMap.put(action.getAttribute(), initValue);
                    }
                }
            }
        }

        context.getStateManager().setState(tempMap, Scope.LOCAL);
    }

    defaultActions = getDefaultActions(context.getProperties());
    debugEnabled = getLogger().isDebugEnabled();
}

From source file:it.cnr.icar.eric.server.query.CompressContentQueryFilterPlugin.java

@SuppressWarnings({ "rawtypes", "unchecked" })
protected List executeQuery(ServerRequestContext context, String queryId, Map queryParams) throws Exception {
    List<?> res = null;//from   w  ww .j a va  2 s  .  c  o  m
    AdhocQueryRequest req = BindingUtility.getInstance().createAdhocQueryRequest("SELECT * FROM DummyTable");
    int startIndex = 0;
    int maxResults = -1;
    req.setStartIndex(BigInteger.valueOf(startIndex));
    req.setMaxResults(BigInteger.valueOf(maxResults));

    HashMap<String, String> slotsMap = new HashMap<String, String>();
    slotsMap.put(BindingUtility.CANONICAL_SLOT_QUERY_ID, queryId);
    if ((queryParams != null) && (queryParams.size() > 0)) {
        slotsMap.putAll(queryParams);
    }
    BindingUtility.getInstance().addSlotsToRequest(req, slotsMap);

    //Now execute the query
    HashMap<String, Object> idToRepositoryItemMap = new HashMap<String, Object>();
    context.setRepositoryItemsMap(idToRepositoryItemMap);

    boolean requestOk = false;
    try {
        context.pushRegistryRequest(req);
        AdhocQueryResponse ebAdhocQueryResponse = QueryManagerFactory.getInstance().getQueryManager()
                .submitAdhocQuery(context);
        bu.checkRegistryResponse(ebAdhocQueryResponse);
        res = ebAdhocQueryResponse.getRegistryObjectList().getIdentifiable();
        requestOk = true;
    } finally {
        context.popRegistryRequest();
        closeContext(context, requestOk);
    }
    return res;
}

From source file:com.jci.po.service.PoServiceImpl.java

@Override
public PoItemDetailRes getPoItemDetail(PoItemDetailReq request)
        throws InvalidKeyException, URISyntaxException, StorageException {
    PaginationParam paginationParam = request.getPaginationParam();
    ScrollingParam param = new ScrollingParam();

    if (paginationParam != null) {
        param.setPartition(paginationParam.getNextPartition());
        param.setRow(paginationParam.getNextRow());
    }/*from   w  ww .  j a  v  a  2  s .c  om*/

    // For where condition
    param.setSize(request.getSize());

    DataHelper azureRequest = new DataHelper();
    azureRequest.setErpName(request.getErpName());
    azureRequest.setPoNum(request.getPoNum());
    azureRequest.setPartitionValue(AzureUtils.getPoItemPartitionKey(request.getErpName()));
    azureRequest.setTableName(poItemTableName);
    ResultSet resultSet = repo.getPoItemDetail(param, azureRequest);
    List<HashMap<String, Object>> series = resultSet.getSeries();
    HashMap<String, Object> oldMap = series.get(0);
    LOG.info("oldMap--->" + oldMap);

    azureRequest.setTableName(poTableName);
    azureRequest.setPartitionValue(AzureUtils.getPoPartitionKey(request.getErpName()));
    resultSet = repo.getPoItemDetail(param, azureRequest);
    List<HashMap<String, Object>> series2 = resultSet.getSeries();

    LOG.info("series2--->" + series2.get(0));

    oldMap.putAll(series2.get(0));
    series.clear();
    series.add(oldMap);
    //series.addAll(resultSet.getSeries());
    resultSet.setSeries(series);

    PoItemDetailRes response = new PoItemDetailRes();
    response.setResultSet(resultSet);
    response.setMessage("OK");
    return response;
}

From source file:org.zaproxy.zap.extension.soap.WSDLCustomParser.java

private void parseWSDL(Definitions wsdl, boolean sendMessages) {
    StringBuilder sb = new StringBuilder();
    List<Service> services = wsdl.getServices();
    keyIndex++;//from   ww w . ja va  2 s.co  m

    /* Endpoint identification. */
    for (Service service : services) {
        for (Port port : service.getPorts()) {
            Binding binding = port.getBinding();
            AbstractBinding innerBinding = binding.getBinding();
            String soapPrefix = innerBinding.getPrefix();
            int soapVersion = detectSoapVersion(wsdl, soapPrefix); // SOAP 1.X, where X is represented by this
            // variable.
            /* If the binding is not a SOAP binding, it is ignored. */
            String style = detectStyle(innerBinding);
            if (style != null && (style.equals("document") || style.equals("rpc"))) {

                List<BindingOperation> operations = binding.getOperations();
                String endpointLocation = port.getAddress().getLocation().toString();
                sb.append("\n|-- Port detected: " + port.getName() + " (" + endpointLocation + ")\n");

                /* Identifies operations for each endpoint.. */
                for (BindingOperation bindOp : operations) {
                    String opDisplayName = "/" + bindOp.getName() + " (v1." + soapVersion + ")";
                    sb.append("|\t|-- SOAP 1." + soapVersion + " Operation: " + bindOp.getName());
                    /* Adds this operation to the global operations chart. */
                    recordOperation(keyIndex, bindOp);
                    /* Identifies operation's parameters. */
                    List<Part> requestParts = detectParameters(wsdl, bindOp);
                    /* Set values to parameters. */
                    HashMap<String, String> formParams = new HashMap<String, String>();
                    for (Part part : requestParts) {
                        Element element = part.getElement();
                        if (element != null) {
                            formParams.putAll(fillParameters(element, null));
                        }
                    }
                    /* Connection test for each operation. */
                    /* Basic message creation. */
                    SOAPMsgConfig soapConfig = new SOAPMsgConfig(wsdl, soapVersion, formParams, port, bindOp);
                    lastConfig = soapConfig;
                    HttpMessage requestMessage = createSoapRequest(soapConfig);
                    if (sendMessages)
                        sendSoapRequest(keyIndex, requestMessage, opDisplayName, sb);
                } // bindingOperations loop
            } // Binding check if
        } // Ports loop
    }
    printOutput(sb);
}

From source file:it.cnr.icar.eric.server.interfaces.soap.BSTRequest.java

/**
 * Processes the Request by dispatching it to a service in the registry.
 *//*from w  ww  .ja  v a2  s.  c  o  m*/
@SuppressWarnings("static-access")
public Response process() throws RegistryException {

    Response response = null;
    RegistryResponseType ebRegistryResponseType = null;

    HashMap<String, Object> responseRepositoryItemMap = new HashMap<String, Object>();

    RegistryRequestType message = context.getCurrentRegistryRequest();

    if (message instanceof AdhocQueryRequest) {

        AdhocQueryRequest ebAdhocQueryRequest = (AdhocQueryRequest) message;

        ebRegistryResponseType = qm.submitAdhocQuery(context);

        ResponseOptionType responseOption = ebAdhocQueryRequest.getResponseOption();
        ReturnType returnType = responseOption.getReturnType();

        if (returnType == returnType.LEAF_CLASS_WITH_REPOSITORY_ITEM) {
            responseRepositoryItemMap.putAll(context.getRepositoryItemsMap());
        }
    } else if (message instanceof ApproveObjectsRequest) {
        ebRegistryResponseType = lcm.approveObjects(context);
    } else if (message instanceof SetStatusOnObjectsRequest) {
        ebRegistryResponseType = lcm.setStatusOnObjects(context);
    } else if (message instanceof DeprecateObjectsRequest) {
        ebRegistryResponseType = lcm.deprecateObjects(context);
    } else if (message instanceof UndeprecateObjectsRequest) {
        ebRegistryResponseType = lcm.unDeprecateObjects(context);
    } else if (message instanceof RemoveObjectsRequest) {
        ebRegistryResponseType = lcm.removeObjects(context);
    } else if (message instanceof SubmitObjectsRequest) {
        ebRegistryResponseType = lcm.submitObjects(context);
    } else if (message instanceof UpdateObjectsRequest) {
        ebRegistryResponseType = lcm.updateObjects(context);
    } else if (message instanceof RelocateObjectsRequest) {
        ebRegistryResponseType = lcm.relocateObjects(context);
    } else {
        RegistryResponseHolder respHolder = lcm.extensionRequest(context);

        // Due to bad design few lines down we are idToRepositoryItemMap for
        // response attachment map
        // Following line is a workaround for that
        responseRepositoryItemMap = respHolder.getAttachmentsMap();
        ebRegistryResponseType = respHolder.getRegistryResponseType();
    }

    response = new Response(ebRegistryResponseType, responseRepositoryItemMap);

    return response;
}

From source file:org.wso2.carbon.mediator.datamapper.DataMapperMediator.java

/**
 * Retrieve property values and insert into a map
 *
 * @param propertiesNamesList Required properties
 * @param synCtx              Message context
 * @return Map filed with property name and the value
 *//* w ww. j a  v a  2s.c  om*/
private Map<String, Map<String, Object>> getPropertiesMap(List<String> propertiesNamesList,
        MessageContext synCtx) {
    Map<String, Map<String, Object>> propertiesMap = new HashMap<>();
    String[] contextAndName;
    Object value;
    org.apache.axis2.context.MessageContext axis2MsgCtx = ((Axis2MessageContext) synCtx)
            .getAxis2MessageContext();
    HashMap functionProperties = new HashMap();
    Stack<TemplateContext> templeteContextStack = ((Stack) synCtx
            .getProperty(SynapseConstants.SYNAPSE__FUNCTION__STACK));
    if (templeteContextStack != null && !templeteContextStack.isEmpty()) {
        TemplateContext templateContext = templeteContextStack.peek();
        functionProperties.putAll(templateContext.getMappedValues());
    }
    for (String propertyName : propertiesNamesList) {
        contextAndName = propertyName.split("\\['|'\\]");
        switch (contextAndName[0].toUpperCase()) {
        case DEFAULT_CONTEXT:
        case SYNAPSE_CONTEXT:
            value = synCtx.getProperty(contextAndName[1]);
            break;
        case TRANSPORT_CONTEXT:
            value = ((Map) axis2MsgCtx.getProperty(TRANSPORT_HEADERS)).get(contextAndName[1]);
            break;
        case AXIS2_CONTEXT:
            value = axis2MsgCtx.getProperty(contextAndName[1]);
            break;
        case AXIS2_CLIENT_CONTEXT:
            value = axis2MsgCtx.getOptions().getProperty(contextAndName[1]);
            break;
        case OPERATIONS_CONTEXT:
            value = axis2MsgCtx.getOperationContext().getProperty(contextAndName[1]);
            break;
        case FUNCTION_CONTEXT:
            value = functionProperties.get(contextAndName[1]);
            break;
        default:
            log.warn(contextAndName[0] + " scope is not found. Setting it to an empty value.");
            value = EMPTY_STRING;
        }
        if (value == null) {
            log.warn(propertyName + "not found. Setting it to an empty value.");
            value = EMPTY_STRING;
        }
        insertToMap(propertiesMap, contextAndName, value);
    }

    return propertiesMap;
}