List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:io.cloudslang.lang.runtime.bindings.OutputsBinding.java
public Map<String, Serializable> bindOutputs(Map<String, Serializable> inputs, Map<String, Serializable> actionReturnValues, List<Output> possibleOutputs) { Map<String, Serializable> outputs = new LinkedHashMap<>(); if (possibleOutputs != null) { for (Output output : possibleOutputs) { String outputKey = output.getName(); String outputExpr = output.getExpression(); if (outputExpr != null) { //construct script context Map<String, Serializable> scriptContext = new HashMap<>(); //put action outputs scriptContext.putAll(actionReturnValues); //declare the new output if (!actionReturnValues.containsKey(outputKey)) { scriptContext.put(outputKey, null); }/* ww w.j av a2 s. c o m*/ //put operation inputs as a map if (MapUtils.isNotEmpty(inputs)) { scriptContext.put(ScoreLangConstants.BIND_OUTPUT_FROM_INPUTS_KEY, (Serializable) inputs); } Serializable scriptResult; try { scriptResult = scriptEvaluator.evalExpr(outputExpr, scriptContext); } catch (Throwable t) { throw new RuntimeException( "Error binding output: '" + output.getName() + "',\n\tError is: " + t.getMessage(), t); } //evaluate expression try { outputs.put(outputKey, scriptResult); } catch (ClassCastException ex) { throw new RuntimeException( "The output expression " + outputExpr + " does not return serializable value", ex); } } else { throw new RuntimeException("Output: " + outputKey + " has no expression"); } } } return outputs; }
From source file:org.mybatis.spring.batch.MyBatisPagingItemReader.java
@Override protected void doReadPage() { Map<String, Object> parameters = new HashMap<String, Object>(); if (parameterValues != null) { parameters.putAll(parameterValues); }/*from w w w . j av a 2 s . com*/ parameters.put("_page", getPage()); parameters.put("_pagesize", getPageSize()); parameters.put("_skiprows", getPage() * getPageSize()); if (results == null) { results = new CopyOnWriteArrayList<T>(); } else { results.clear(); } results.addAll(sqlSessionTemplate.<T>selectList(queryId, parameters)); }
From source file:org.saiku.plugin.PentahoSessionService.java
public Map<String, Object> getSession() { if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) { Object p = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (!sessionHolder.containsKey(p)) { populateSession(p);// w w w. j a va2 s.c om } Map<String, Object> r = new HashMap<String, Object>(); r.putAll(sessionHolder.get(p)); if (r.containsKey("password")) { r.remove("password"); } return r; } return new HashMap<String, Object>(); }
From source file:org.saiku.plugin.PentahoSessionService.java
public Map<String, Object> getAllSessionObjects() { if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) { Object p = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (!sessionHolder.containsKey(p)) { populateSession(p);/*from w w w . j a v a2 s . c o m*/ } Map<String, Object> r = new HashMap<String, Object>(); r.putAll(sessionHolder.get(p)); if (r.containsKey("password")) { r.remove("password"); } return r; } return new HashMap<String, Object>(); }
From source file:ch.cyberduck.core.azure.AzureMetadataFeature.java
@Override public Map<String, String> getMetadata(final Path file) throws BackgroundException { try {/*w ww .j av a 2 s . co m*/ if (containerService.isContainer(file)) { final CloudBlobContainer container = session.getClient() .getContainerReference(containerService.getContainer(file).getName()); container.downloadAttributes(); return container.getMetadata(); } else { final CloudBlob blob = session.getClient() .getContainerReference(containerService.getContainer(file).getName()) .getBlobReferenceFromServer(containerService.getKey(file)); // Populates the blob properties and metadata blob.downloadAttributes(null, null, context); final Map<String, String> metadata = new HashMap<String, String>(); metadata.putAll(blob.getMetadata()); final BlobProperties properties = blob.getProperties(); if (StringUtils.isNotBlank(properties.getCacheControl())) { metadata.put(HttpHeaders.CACHE_CONTROL, properties.getCacheControl()); } if (StringUtils.isNotBlank(properties.getContentType())) { metadata.put(HttpHeaders.CONTENT_TYPE, properties.getContentType()); } return metadata; } } catch (URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } catch (StorageException e) { throw new AzureExceptionMappingService().map("Failure to read attributes of {0}", e, file); } }
From source file:ws.salient.model.Settings.java
public Map<String, String> getAliases(Collection<String> profileIds) { Map<String, String> aliases = new LinkedHashMap(); getProfiles(profileIds).forEach(profile -> { aliases.putAll(profile.getAliases()); });/*from www . j a v a 2s . c om*/ return aliases; }
From source file:com.cognifide.qa.bb.config.YamlConfig.java
private Map<String, String> getSelectedContexts(Config rawConfig) { Map<String, String> contexts = new HashMap<>(); String contextsProperty = System.getProperty(SYS_PROP_CONFIG_CONTEXTS); List<String> selectedContexts = StringUtils.isNotBlank(contextsProperty) ? Arrays.asList(contextsProperty.split(",")) : rawConfig.getDefaultConfig().getContexts(); Map<String, Map<String, String>> allContexts = new HashMap<>(); allContexts.putAll(rawConfig.getContexts()); allContexts.putAll(readAdditionalContexts()); selectedContexts.stream()// ww w . j ava 2 s.co m .forEach(context -> contexts.putAll(allContexts.getOrDefault(context, Collections.emptyMap()))); return contexts; }
From source file:jp.eisbahn.oauth2.server.fetcher.accesstoken.impl.RequestParameter.java
/** * Fetch an access token from a request parameter and return it. This method * must be called when a result of the match() method is true only. * * @param request//www .j a v a 2 s . c o m * The request object. * @return the fetched access token. */ @Override public FetchResult fetch(Request request) { Map<String, String[]> params = new HashMap<String, String[]>(); Map<String, String[]> parameterMap = request.getParameterMap(); params.putAll(parameterMap); String[] atokens = params.get("access_token"); String[] otokens = params.get("oauth_token"); params.remove("access_token"); String token = null; if (atokens != null && atokens.length > 0) { token = atokens[0]; } if (otokens != null && otokens.length > 0) { if (StringUtils.isNotEmpty(otokens[0])) { token = otokens[0]; params.remove("oauth_token"); } } return new FetchResult(token, params); }
From source file:edu.unc.lib.dl.cdr.sword.server.deposit.AbstractDepositHandler.java
protected void registerDeposit(PID depositPid, PID destination, Deposit deposit, PackagingType type, String depositor, String owner, Map<String, String> extras) throws SwordError { Map<String, String> chkstatus = this.depositStatusFactory.get(depositPid.getUUID()); if (chkstatus != null && !chkstatus.isEmpty()) throw new SwordError(UriRegistry.ERROR_BAD_REQUEST, 400, "Duplicate request, repository already has deposit " + depositPid); Map<String, String> status = new HashMap<String, String>(); status.putAll(extras); // generic deposit fields status.put(DepositField.uuid.name(), depositPid.getUUID()); status.put(DepositField.submitTime.name(), String.valueOf(System.currentTimeMillis())); status.put(DepositField.fileName.name(), deposit.getFilename()); String email = SwordConfigurationImpl.getUserEmailAddress(); status.put(DepositField.depositorName.name(), email != null ? depositor : owner); status.put(DepositField.depositorEmail.name(), email != null ? email : owner + "@email.unc.edu"); status.put(DepositField.containerId.name(), destination.getPid()); status.put(DepositField.depositMethod.name(), DepositMethod.SWORD13.getLabel()); status.put(DepositField.packagingType.name(), type.getUri()); status.put(DepositField.depositMd5.name(), deposit.getMd5()); status.put(DepositField.depositSlug.name(), deposit.getSlug()); String permGroups = null;/*from ww w . j a va 2 s . c o m*/ if (this.getOverridePermissionGroups() != null) { permGroups = StringUtils.join(this.getOverridePermissionGroups(), ';'); } else { permGroups = StringUtils.join(GroupsThreadStore.getGroups(), ';'); } status.put(DepositField.permissionGroups.name(), permGroups); status.put(DepositField.state.name(), DepositState.unregistered.name()); status.put(DepositField.actionRequest.name(), DepositAction.register.name()); Set<String> nulls = new HashSet<String>(); for (String key : status.keySet()) { if (status.get(key) == null) nulls.add(key); } for (String key : nulls) status.remove(key); this.depositStatusFactory.save(depositPid.getUUID(), status); log.info(status.toString()); }
From source file:com.jaspersoft.jasperserver.war.cascade.CachedEngineService.java
public Map getSLParameters(ReportDataSource dataSource) { final SessionCache sessionCache = controlLogicCacheManager.getSessionCache(); // Cache SL parameters as Map class Map parameters = sessionCache.getCacheInfo(Map.class, dataSource.getURIString()); if (!doCache || parameters == null) { parameters = new HashMap(); ReportDataSourceService dataSourceService = engineService.createDataSourceService(dataSource); dataSourceService.setReportParameterValues(parameters); sessionCache.setCacheInfo(Map.class, dataSource.getURIString(), parameters); }/*from w ww. j a v a 2 s. c o m*/ //make own copy of list for each thread Map copy = new HashMap(parameters.size()); copy.putAll(parameters); return copy; }