List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:xolpoc.plugins.StreamPlugin.java
private void track(final Module module, MessageChannel channel, final Map<String, Object> historyProps) { final MessageBuilderFactory messageBuilderFactory = module.getComponent( IntegrationUtils.INTEGRATION_MESSAGE_BUILDER_FACTORY_BEAN_NAME, MessageBuilderFactory.class) == null ? new DefaultMessageBuilderFactory() : module.getComponent(IntegrationUtils.INTEGRATION_MESSAGE_BUILDER_FACTORY_BEAN_NAME, MessageBuilderFactory.class); if (channel instanceof ChannelInterceptorAware) { ((ChannelInterceptorAware) channel).addInterceptor(new ChannelInterceptorAdapter() { @Override// w w w . j a v a2s . c o m public Message<?> preSend(Message<?> message, MessageChannel channel) { @SuppressWarnings("unchecked") Collection<Map<String, Object>> history = (Collection<Map<String, Object>>) message.getHeaders() .get(XdHeaders.XD_HISTORY); if (history == null) { history = new ArrayList<Map<String, Object>>(1); } else { history = new ArrayList<Map<String, Object>>(history); } Map<String, Object> map = new LinkedHashMap<String, Object>(); map.putAll(historyProps); map.put("thread", Thread.currentThread().getName()); history.add(map); Message<?> out = messageBuilderFactory.fromMessage(message) .setHeader(XdHeaders.XD_HISTORY, history).build(); return out; } }); } }
From source file:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter.java
private Map<String, Object> doClassAlphaDisplay(Map params, VitroRequest request, ServletContext context) throws Exception { Map<String, Object> body = new HashMap<String, Object>(); body.putAll(getCommonValues(context, request)); body.putAll(getClassAlphaValues(params, request, context)); return body;/*w ww . j ava2 s . c o m*/ }
From source file:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter.java
protected Map<String, Object> doClassGroupDisplay(Map params, VitroRequest request, ServletContext context) { Map<String, Object> body = new HashMap<String, Object>(); body.putAll(getCommonValues(context, request)); body.putAll(getClassGroupData(request, params, context)); return body;/* w ww .j av a 2s. c o m*/ }
From source file:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter.java
protected Map<String, Object> doAllClassGroupsDisplay(Map params, VitroRequest request, ServletContext context) {//from www . jav a2 s. c o m Map<String, Object> body = new HashMap<String, Object>(); body.putAll(getCommonValues(context, request)); body.putAll(getAllClassGroupData(request, params, context)); return body; }
From source file:Main.java
/** * Merge the list of data to main list by list of key * * @param lstMain Main list//ww w . j a v a 2 s . c o m * @param lstData List of data. Every item is also a list. * @param lstKey List of key */ public static void mergeData(List lstMain, List lstData, List lstKey) { if (lstMain == null || lstData == null || lstData.size() == 0 || lstKey == null || lstKey.size() == 0) { return; } for (int index1 = 0, n = lstMain.size(); index1 < n; index1++) { Map mapMain = (Map) lstMain.get(index1); Map keyValue = new HashMap(); for (int index2 = 0, m = lstKey.size(); index2 < m; index2++) { Object key = lstKey.get(index2); keyValue.put(key, mapMain.get(key)); } for (int index2 = 0, m = lstData.size(); index2 < m; index2++) { List lstChild = (List) lstData.get(index2); for (int index3 = 0, s = lstChild.size(); index3 < s; index3++) { Map mapChild = (Map) lstChild.get(index3); boolean flag = true; for (int index4 = 0, t = lstKey.size(); index4 < t; index4++) { Object key = lstKey.get(index4); Object valueFromMain = keyValue.get(key); Object valueFromChild = mapChild.get(key); if ((valueFromMain != null && !valueFromMain.equals(valueFromChild)) || (valueFromMain == null && valueFromChild != null)) { flag = false; break; } } if (flag) { mapMain.putAll(mapChild); break; } } } } }
From source file:ar.com.fdvs.dj.core.DynamicJasperHelper.java
/** * Compiles the report and applies the layout. <b>generatedParams</b> MUST NOT BE NULL * All the key objects from the generatedParams map that are String, will be registered as parameters of the report. * @param dr/*from ww w .j av a 2s .com*/ * @param layoutManager * @param generatedParams * @return * @throws JRException */ public final static JasperReport generateJasperReport(DynamicReport dr, LayoutManager layoutManager, Map generatedParams) throws JRException { log.info("generating JasperReport"); JasperReport jr = null; if (generatedParams == null) generatedParams = new HashMap(); visitSubreports(dr, generatedParams); compileOrLoadSubreports(dr, generatedParams); DynamicJasperDesign jd = generateJasperDesign(dr); registerEntities(jd, dr, layoutManager); registerParams(jd, generatedParams); //if we have parameters from the outside, we register them layoutManager.applyLayout(jd, dr); JRProperties.setProperty(JRCompiler.COMPILER_PREFIX, "ar.com.fdvs.dj.util.DJJRJdtCompiler"); jr = JasperCompileManager.compileReport(jd); generatedParams.putAll(jd.getParametersWithValues()); return jr; }
From source file:com.haulmont.yarg.loaders.impl.JsonDataLoader.java
@Override public List<Map<String, Object>> loadData(ReportQuery reportQuery, BandData parentBand, Map<String, Object> reportParams) { Map<String, Object> currentParams = new HashMap<String, Object>(); if (reportParams != null) { currentParams.putAll(reportParams); }/*from www .j av a 2 s. c o m*/ List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); Matcher matcher = parameterPattern.matcher(reportQuery.getScript()); String parameterName = getParameterName(matcher); //adds parameters from parent bands hierarchy BandData curentParentBand = parentBand; while (curentParentBand != null) { addParentBandDataToParameters(curentParentBand, currentParams); curentParentBand = curentParentBand.getParentBand(); } if (parameterName != null) { Object parameterValue = currentParams.get(parameterName); if (parameterValue != null && StringUtils.isNotBlank(parameterValue.toString())) { String json = parameterValue.toString(); String script = matcher.replaceAll(""); if (StringUtils.isBlank(script)) { throw new DataLoadingException( String.format("The script doesn't contain json path expression. " + "Script [%s]", reportQuery.getScript())); } matcher = AbstractDbDataLoader.COMMON_PARAM_PATTERN.matcher(script); while (matcher.find()) { String parameter = matcher.group(1); script = matcher.replaceAll(String.valueOf(currentParams.get(parameter))); } try { Object scriptResult = JsonPath.read(json, script); parseScriptResult(result, script, scriptResult); } catch (com.jayway.jsonpath.PathNotFoundException e) { return Collections.emptyList(); } catch (Throwable e) { throw new DataLoadingException(String.format( "An error occurred while loading data with script [%s]", reportQuery.getScript()), e); } } else { return Collections.emptyList(); } } else { throw new DataLoadingException(String.format( "Query string doesn't contain link to parameter. " + "Script [%s]", reportQuery.getScript())); } return result; }
From source file:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter.java
protected Map<String, Object> doClassDisplay(Map params, VitroRequest request, ServletContext context) { Map<String, Object> body = new HashMap<String, Object>(); body.putAll(getCommonValues(context, request)); body.putAll(getClassData(request, params, context)); return body;//from ww w . j av a2s. com }
From source file:edu.cornell.mannlib.vitro.webapp.web.widgets.BrowseWidget.java
private Map<String, Object> getClassData(HttpServletRequest request, Map params, ServletContext context) { Map<String, Object> map = new HashMap<String, Object>(); map.putAll(getClassGroupData(request, params, context)); String classUri = getParam(Mode.VCLASS, request, params); VitroRequest vreq = new VitroRequest(request); VClass vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(classUri); map.put("class", new VClassTemplateModel(vclass)); List<Individual> inds = vreq.getWebappDaoFactory().getIndividualDao().getIndividualsByVClass(vclass); List<ListedIndividual> tInds = new ArrayList<ListedIndividual>(inds.size()); for (Individual ind : inds) { tInds.add(new ListedIndividual(ind, vreq)); }/* w ww .ja v a2 s . c om*/ map.put("individualsInClass", tInds); return map; }