List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:org.cloudfoundry.identity.uaa.oauth.DefaultTokenConverter.java
@Override public Map<String, ?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) { Map<String, Object> response = new HashMap<String, Object>(); AuthorizationRequest clientToken = authentication.getAuthorizationRequest(); if (!authentication.isClientOnly()) { response.putAll(userTokenConverter.convertUserAuthentication(authentication.getUserAuthentication())); }// ww w .j a v a 2 s . c o m response.put(OAuth2AccessToken.SCOPE, token.getScope()); if (token.getAdditionalInformation().containsKey(JwtTokenEnhancer.TOKEN_ID)) { response.put(JwtTokenEnhancer.TOKEN_ID, token.getAdditionalInformation().get(JwtTokenEnhancer.TOKEN_ID)); } if (token.getExpiration() != null) { response.put("exp", token.getExpiration().getTime() / 1000); } response.putAll(token.getAdditionalInformation()); response.put("client_id", clientToken.getClientId()); if (clientToken.getResourceIds() != null && !clientToken.getResourceIds().isEmpty()) { response.put("aud", clientToken.getResourceIds()); } return response; }
From source file:com.comcast.video.dawg.service.house.MongoHouseService.java
private synchronized PersistableDevice persistKeys(PersistableDevice source, DawgDevice target, boolean replace) { // copy all existing data into the new document Map<String, Object> data = replace ? new HashMap<String, Object>() : source.getData(); data.putAll(target.getData()); // this is a dirty way to regenerate the keys PersistableDevice update = new PersistableDevice(data); update.reserve(source.getReserver()); update.setExpiration(source.getExpiration()); return update; }
From source file:com.github.peterjanes.node.NpmTestMojo.java
/** * * @throws MojoExecutionException if anything unexpected happens. */// w w w .j a va2s .co m public void execute() throws MojoExecutionException { if (!workingDirectory.exists()) { workingDirectory.mkdirs(); } CommandLine commandLine = new CommandLine(executable); Executor exec = new DefaultExecutor(); exec.setWorkingDirectory(workingDirectory); Map env = new HashMap(); try { Map systemEnvVars = EnvironmentUtils.getProcEnvironment(); env.putAll(systemEnvVars); } catch (IOException e) { getLog().error("Could not assign default system enviroment variables.", e); } env.put("NODE_PATH", new File(workingDirectory, "node_modules").getAbsolutePath()); env.put("XUNIT_FILE", outputFile.getAbsolutePath()); List commandArguments = new ArrayList(); commandArguments.add("test"); String[] args = new String[commandArguments.size()]; for (int i = 0; i < commandArguments.size(); i++) { args[i] = (String) commandArguments.get(i); } commandLine.addArguments(args, false); OutputStream stdout = System.out; OutputStream stderr = System.err; try { outputFile.getParentFile().mkdirs(); getLog().debug("Executing command line " + commandLine + " in directory " + workingDirectory.getAbsolutePath()); exec.setStreamHandler(new PumpStreamHandler(stdout, stderr, System.in)); int resultCode = exec.execute(commandLine, env); if (0 != resultCode) { throw new MojoExecutionException( "Result of " + commandLine + " execution is: '" + resultCode + "'."); } } catch (ExecuteException e) { throw new MojoExecutionException(EXECUTION_FAILED, e); } catch (IOException e) { throw new MojoExecutionException(EXECUTION_FAILED, e); } }
From source file:com.jedi.oracle.OracleCall.java
@Override public void execute(Connection connection) throws Exception { if (connection == null) { DataSource dataSource = DataSourceManager.getInstance().getDataSource(); if (dataSource == null) { throw new RuntimeException("Datasource is null"); }//w w w.ja v a 2 s .c om connection = dataSource.getConnection(); } fillParametersFromFields(); String sql = this.createSQL(this.getName()); Map customTypes = this.getTypeMap(); if (customTypes != null && !customTypes.isEmpty()) { Map map = connection.getTypeMap(); map.putAll(customTypes); connection.setTypeMap(map); } OracleCallableStatement statement = (OracleCallableStatement) connection.prepareCall(sql); OracleParameterUtils.register(statement, this.parameters); try { statement.execute(); } catch (SQLException e) { if (reExecutionRequired(e)) { statement.execute(); } else { throw e; } } OracleParameterUtils.bind(this.parameters, statement); fillFieldValuesFromParameters(); }
From source file:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SearchIndividualsDataGetter.java
@Override public Map<String, Object> getData(Map<String, Object> pageData) { // Merge the pageData with the request parameters. PageData overrides Map<String, String[]> merged = new HashMap<String, String[]>(); merged.putAll(vreq.getParameterMap()); for (String key : pageData.keySet()) { merged.put(key, new String[] { String.valueOf(pageData.get(key)) }); }//from ww w . j a v a 2 s. c o m return doSearchQuery(merged); }
From source file:org.drools.container.spring.beans.StatefulKnowledgeSessionBeanFactory.java
@Override protected void internalAfterPropertiesSet() { if (getConf() != null && getWorkItems() != null && !getWorkItems().isEmpty()) { Map<String, WorkItemHandler> map = ((SessionConfiguration) getConf()).getWorkItemHandlers(); map.putAll(getWorkItems()); }/* w w w .j a va2 s .co m*/ if (jpaConfiguration != null) { Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, jpaConfiguration.getEntityManagerFactory()); env.set(EnvironmentName.TRANSACTION_MANAGER, jpaConfiguration.getPlatformTransactionManager()); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] { new SerializablePlaceholderResolverStrategy(ClassObjectMarshallingStrategyAcceptor.DEFAULT) }); if (jpaConfiguration.getId() >= 0) { ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(jpaConfiguration.getId(), getKbase(), getConf(), env); } else { ksession = JPAKnowledgeService.newStatefulKnowledgeSession(getKbase(), getConf(), env); } } else { ksession = getKbase().newStatefulKnowledgeSession(getConf(), null); } if (getBatch() != null && !getBatch().isEmpty()) { for (Command<?> cmd : getBatch()) { ksession.execute(cmd); } } if (getNode() != null) { getNode().set(getName(), this.ksession); } // Additions for JIRA JBRULES-3076 for (AgendaEventListener agendaEventListener : getAgendaEventListeners()) { ksession.addEventListener(agendaEventListener); } for (ProcessEventListener processEventListener : getProcessEventListeners()) { ksession.addEventListener(processEventListener); } for (WorkingMemoryEventListener workingMemoryEventListener : getWorkingMemoryEventListeners()) { ksession.addEventListener(workingMemoryEventListener); } // End of Additions for JIRA JBRULES-3076 }
From source file:azkaban.jobExecutor.AbstractProcessJob.java
public Map<String, String> getEnvironmentVariables() { Props props = getJobProps();/*from w w w . ja va 2 s .c o m*/ Map<String, String> envMap = props.getMapByPrefix(ENV_PREFIX); envMap.putAll(props.getMapByPrefix(ENV_PREFIX_UCASE)); return envMap; }
From source file:org.jasig.portlet.proxy.service.web.HttpContentRequestImpl.java
/** * duplicate() creates a duplicate of the HttpContentRequest without * using clone(). All objects are unique, but the data contained within * the objects is the same/* w ww . ja v a 2 s . c o m*/ * @return a unique HttpContentRequestImpl object with the same data */ public HttpContentRequestImpl duplicate() { HttpContentRequestImpl copy = new HttpContentRequestImpl(); copy.setMethod(this.getMethod()); copy.setForm(this.isForm()); copy.setProxiedLocation(this.getProxiedLocation()); copy.setHttpContext(this.getHttpContext()); Map<String, String> copyHeaders = new LinkedHashMap<String, String>(); copyHeaders.putAll(this.headers); copy.setHeaders(copyHeaders); // String[] needs to be copied manually, otherwise, you end up with the // same object in the new HttpContentRequestImpl Map<String, IFormField> copyParameters = new LinkedHashMap<String, IFormField>(); for (Entry<String, IFormField> requestEntry : this.getParameters().entrySet()) { String key = requestEntry.getKey(); IFormField values = requestEntry.getValue(); copyParameters.put(key, values.duplicate()); } copy.setParameters(copyParameters); return copy; }
From source file:com.bisone.saiku.security.replace.SessionService.java
public Map<String, Object> getSession() throws Exception { if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Object p = auth.getPrincipal(); if (sessionHolder.containsKey(p)) { Map<String, Object> r = new HashMap<String, Object>(); r.putAll(sessionHolder.get(p)); r.remove("password"); return r; }/* w w w. j a v a2 s . co m*/ } return new HashMap<String, Object>(); }