List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:org.jasig.portlet.contacts.context.impl.ContactContextImpl.java
public Map getAll() { Map obj = new HashMap(); for (ContextProvider provider : contextProviders) { try {/*from w w w . j a v a 2 s . c o m*/ obj.putAll(provider.getContext()); } catch (Exception e) { log.debug(e); } } return obj; }
From source file:AbstractDokeosDocumentConverter.java
protected void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat) {/*www . j a va 2 s .c o m*/ Map/*<String,Object>*/ loadProperties = new HashMap(); loadProperties.putAll(getDefaultLoadProperties()); loadProperties.putAll(inputFormat.getImportOptions()); Map/*<String,Object>*/ storeProperties = outputFormat.getExportOptions(inputFormat.getFamily()); synchronized (openOfficeConnection) { XFileIdentifierConverter fileContentProvider = openOfficeConnection.getFileContentProvider(); String inputUrl = fileContentProvider.getFileURLFromSystemPath("", inputFile.getAbsolutePath()); String outputUrl = fileContentProvider.getFileURLFromSystemPath("", outputFile.getAbsolutePath()); try { loadAndExport(inputUrl, loadProperties, outputUrl, storeProperties); } catch (OpenOfficeException openOfficeException) { throw openOfficeException; } catch (Throwable throwable) { // difficult to provide finer grained error reporting here; // OOo seems to throw ErrorCodeIOException most of the time throw new OpenOfficeException("conversion failed", throwable); } } }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.StartDateBeforeEndDate.java
public Map<String, String> validate(EditConfiguration editConfig, EditSubmission editSub) { Map<String, Literal> existingLiterals = editConfig.getLiteralsInScope(); Literal existingStartDate = existingLiterals.get(startFieldName); Literal existingEndDate = existingLiterals.get(endFieldName); Map<String, Literal> literalsFromForm = editSub.getLiteralsFromForm(); Literal formStartDate = literalsFromForm.get(startFieldName); Literal formEndDate = literalsFromForm.get(endFieldName); Map<String, String> errors = new HashMap<String, String>(); if (formStartDate != null && formEndDate != null) { errors.putAll(checkDateLiterals(formStartDate, formEndDate)); } else if (formStartDate != null && existingEndDate != null) { errors.putAll(checkDateLiterals(formStartDate, existingEndDate)); } else if (existingStartDate != null && formEndDate != null) { errors.putAll(checkDateLiterals(existingStartDate, formEndDate)); } else if (existingStartDate != null && existingEndDate != null) { errors.putAll(checkDateLiterals(existingStartDate, existingEndDate)); }// w w w . j av a 2 s . c om if (errors.size() != 0) return errors; else return null; }
From source file:com.alignace.chargeio.net.ChargeIORequester.java
private String post(String url, String secretKey, Map<String, String> headers, String data) throws ChargeIOException, IOException { ServerResponse serverResponse = null; Map<String, String> header = getBasicHeader(secretKey); if (headers != null) header.putAll(headers); try {/* w w w.ja va 2 s. com*/ serverResponse = getRequestor().post(url, header, data); } catch (UnsupportedEncodingException e) { throw e; } String response = processResponse(serverResponse); return response; }
From source file:grails.plugin.searchable.internal.compass.DefaultSearchableMethodFactory.java
/** * Merges the user provided method default options with the defaults in {@link #DEFAULT_METHOD_OPTIONS} * @param defaultMethodOptions// ww w . jav a2s. c o m */ public void setDefaultMethodOptions(Map defaultMethodOptions) { Map tmp = new HashMap(); tmp.putAll(DEFAULT_METHOD_OPTIONS); tmp.putAll(defaultMethodOptions); this.defaultMethodOptions = tmp; }
From source file:org.jasig.springframework.web.portlet.upload.DefaultMultipartResourceRequest.java
@Override public Map<String, String[]> getParameterMap() { Map<String, String[]> paramMap = new HashMap<String, String[]>(); paramMap.putAll(super.getParameterMap()); paramMap.putAll(getMultipartParameters()); return paramMap; }
From source file:com.surveypanel.dao.JDBCFormDAO.java
@Override public boolean qualify(String formId, long surveyId, Map<String, Object> defaultValues) { FormDTO load = load(formId, surveyId); Map<String, Object> values = defaultValues; values.putAll(load.getValues()); String sql = "INSERT INTO survey_values_" + surveyId + " (question,name,value,formId,surveyId,created) VALUES (?,?,?,?,?,?);"; final Object[][] args = new Object[values.size()][5]; int count = 0; for (Entry<String, Object> value : values.entrySet()) { String fieldName = value.getKey(); String[] key = fieldName.split("_"); args[count] = new Object[] { key[0], fieldName, (String) value.getValue(), formId, surveyId }; count++;/*from w ww. j a v a 2 s. co m*/ } final int counter = values.size(); batchUpdate(sql, new BatchPreparedStatementSetter() { public void setValues(PreparedStatement ps, int i) throws SQLException { ps.setString(1, (String) args[i][0]); ps.setString(2, (String) args[i][1]); ps.setString(3, (String) args[i][2]); ps.setString(4, (String) args[i][3]); ps.setLong(5, (Long) args[i][4]); ps.setTimestamp(6, new Timestamp(Calendar.getInstance().getTimeInMillis())); } public int getBatchSize() { return counter; } }); update("UPDATE survey_" + surveyId + " SET qualified = true WHERE id = ?", new Object[] { formId }); return false; }
From source file:org.mybatis.spring.batch.MyBatisCursorItemReader.java
@Override protected void doOpen() throws Exception { Map<String, Object> parameters = new HashMap<String, Object>(); if (parameterValues != null) { parameters.putAll(parameterValues); }/* ww w . j a v a 2s. c o m*/ sqlSession = sqlSessionFactory.openSession(ExecutorType.SIMPLE); cursor = sqlSession.selectCursor(queryId, parameters); cursorIterator = cursor.iterator(); }
From source file:com.glaf.activiti.executionlistener.MyBatisExecutionListener.java
public void notify(DelegateExecution execution) throws Exception { logger.debug("----------------------------------------------------"); logger.debug("------------------MyBatis3ExecutionListener---------"); logger.debug("----------------------------------------------------"); CommandContext commandContext = Context.getCommandContext(); 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;/*w w w . j a va 2 s. c o m*/ String op = null; if (statementId != null) { statement = statementId.getExpressionText(); logger.debug("statementId:" + statement); } if (operation != null) { op = operation.getExpressionText(); logger.debug("operation:" + op); } if (status != null) { logger.debug("status:" + status.getValue(execution)); paramMap.put("status", status.getValue(execution)); } if (wfStatus != null) { logger.debug("wfStatus:" + wfStatus.getValue(execution)); paramMap.put("wfStatus", wfStatus.getValue(execution)); } if (message != null) { logger.debug("message:" + message); logger.debug("message:" + message.getValue(execution)); } if (StringUtils.isNotEmpty(statement) && StringUtils.isNotEmpty(op)) { MyBatisEntityDAO entityDAO = new MyBatisEntityDAO(commandContext.getDbSqlSession().getSqlSession()); SqlExecutor sqlExecutor = new SqlExecutor(); sqlExecutor.setOperation(op); sqlExecutor.setStatementId(statement); sqlExecutor.setParameter(paramMap); entityDAO.execute(sqlExecutor); } } }
From source file:com.migratebird.script.runner.impl.Application.java
protected ProcessBuilder createProcessBuilder(List<String> commandWithArguments) { ProcessBuilder processBuilder = new ProcessBuilder(commandWithArguments); Map<String, String> processEnvironment = processBuilder.environment(); processEnvironment.putAll(environmentVariables); processBuilder.redirectErrorStream(true); return processBuilder; }