List of usage examples for java.util LinkedHashMap put
V put(K key, V value);
From source file:ca.sfu.federation.model.InputTable.java
/** * Get all dependancies for the Inputs in this InputTable. * @return SystolicArrayElements upon which this InputTable is dependant. * TODO: need to think about caching the dependancy list and how updates on the user input on Inputs can propagate dependancy updates to the SAE * TODO: need to think about whether order of dep list is significant, and therefore should be changed to a List output *//*from ww w.j av a2 s .co m*/ public Map getDependancies() { // init HashSet dep = new HashSet(); // add dependancies for each input to the set Iterator e = this.inputs.iterator(); while (e.hasNext()) { Input input = (Input) e.next(); dep.addAll((HashSet) input.getDependancies()); } // convert to map // should revisit this at some point .. doesn't make sense any more LinkedHashMap result = new LinkedHashMap(); Iterator iter = dep.iterator(); while (iter.hasNext()) { INamed named = (INamed) iter.next(); result.put(named.getName(), named); } // return result return (Map) result; }
From source file:org.zalando.stups.spring.boot.actuator.ExtInfoEndpointConfiguration.java
@Bean public InfoEndpoint infoEndpoint() throws Exception { LinkedHashMap<String, Object> info = new LinkedHashMap<String, Object>(); for (String filename : getAllPropertiesFiles()) { Resource resource = new ClassPathResource("/" + filename); Properties properties = new Properties(); if (resource.exists()) { properties = PropertiesLoaderUtils.loadProperties(resource); String name = resource.getFilename(); info.put(name.replace(PROPERTIES_SUFFIX, PROPERTIES_SUFFIX_REPLACEMENT), Maps.fromProperties(properties)); } else {/*from w ww. j a v a 2 s . c o m*/ if (failWhenResourceNotExists()) { throw new RuntimeException("Resource : " + filename + " does not exist"); } else { log.info("Resource {} does not exist", filename); } } } return new InfoEndpoint(info); }
From source file:com.bemis.portal.customer.service.impl.CustomerProfileLocalServiceImpl.java
@Override public int countCustomer(String criteria) { long companyId = _bemisPortalService.getDefaultCompanyId(); LinkedHashMap<String, Object> params = new LinkedHashMap<>(); params.put(_EXPANDO_ATTRIBUTES, criteria); return _organizationLocalService.search(companyId, OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, criteria, params, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null).getLength(); }
From source file:au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView.java
/** * From parameterized trigger plugin src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java * * @param base//from ww w .ja v a 2 s . c o m * One of the two parameters to merge. * @param overlay * The other parameters to merge * @return * Result of the merge. */ private static ParametersAction mergeParameters(final ParametersAction base, final ParametersAction overlay) { final LinkedHashMap<String, ParameterValue> params = new LinkedHashMap<String, ParameterValue>(); for (final ParameterValue param : base.getParameters()) { params.put(param.getName(), param); } for (final ParameterValue param : overlay.getParameters()) { params.put(param.getName(), param); } return new ParametersAction(params.values().toArray(new ParameterValue[params.size()])); }
From source file:org.devgateway.ocds.web.rest.controller.CostEffectivenessVisualsController.java
@ApiOperation(value = "Aggregated version of /api/costEffectivenessTenderAmount and " + "/api/costEffectivenessAwardAmount." + "This endpoint aggregates the responses from the specified endpoints, per year. " + "Responds to the same filters.") @RequestMapping(value = "/api/costEffectivenessTenderAwardAmount", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<DBObject> costEffectivenessTenderAwardAmount( @ModelAttribute @Valid final GroupingFilterPagingRequest filter) { Future<List<DBObject>> costEffectivenessAwardAmountFuture = controllerLookupService.asyncInvoke( new AsyncBeanParamControllerMethodCallable<List<DBObject>, GroupingFilterPagingRequest>() { @Override/*www . ja va 2 s. c om*/ public List<DBObject> invokeControllerMethod(GroupingFilterPagingRequest filter) { return costEffectivenessAwardAmount(filter); } }, filter); Future<List<DBObject>> costEffectivenessTenderAmountFuture = controllerLookupService.asyncInvoke( new AsyncBeanParamControllerMethodCallable<List<DBObject>, GroupingFilterPagingRequest>() { @Override public List<DBObject> invokeControllerMethod(GroupingFilterPagingRequest filter) { return costEffectivenessTenderAmount(filter); } }, filter); //this is completely unnecessary since the #get methods are blocking //controllerLookupService.waitTillDone(costEffectivenessAwardAmountFuture, costEffectivenessTenderAmountFuture); LinkedHashMap<Object, DBObject> response = new LinkedHashMap<>(); try { costEffectivenessAwardAmountFuture.get() .forEach(dbobj -> response.put(getYearMonthlyKey(filter, dbobj), dbobj)); costEffectivenessTenderAmountFuture.get().forEach(dbobj -> { if (response.containsKey(getYearMonthlyKey(filter, dbobj))) { Map<?, ?> map = dbobj.toMap(); map.remove(Keys.YEAR); if (filter.getMonthly()) { map.remove(Keys.MONTH); } response.get(getYearMonthlyKey(filter, dbobj)).putAll(map); } else { response.put(getYearMonthlyKey(filter, dbobj), dbobj); } }); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } Collection<DBObject> respCollection = response.values(); respCollection.forEach(dbobj -> { BigDecimal totalTenderAmount = BigDecimal.valueOf(dbobj.get(Keys.TOTAL_TENDER_AMOUNT) == null ? 0d : ((Number) dbobj.get(Keys.TOTAL_TENDER_AMOUNT)).doubleValue()); BigDecimal totalAwardAmount = BigDecimal.valueOf(dbobj.get(Keys.TOTAL_AWARD_AMOUNT) == null ? 0d : ((Number) dbobj.get(Keys.TOTAL_AWARD_AMOUNT)).doubleValue()); dbobj.put(Keys.DIFF_TENDER_AWARD_AMOUNT, totalTenderAmount.subtract(totalAwardAmount)); dbobj.put(Keys.PERCENTAGE_AWARD_AMOUNT, totalTenderAmount.compareTo(BigDecimal.ZERO) != 0 ? (totalAwardAmount.setScale(15).divide(totalTenderAmount, BigDecimal.ROUND_HALF_UP) .multiply(ONE_HUNDRED)) : BigDecimal.ZERO); dbobj.put(Keys.PERCENTAGE_DIFF_AMOUNT, totalTenderAmount.compareTo(BigDecimal.ZERO) != 0 ? (((BigDecimal) dbobj.get(Keys.DIFF_TENDER_AWARD_AMOUNT)).setScale(15) .divide(totalTenderAmount, BigDecimal.ROUND_HALF_UP).multiply(ONE_HUNDRED)) : BigDecimal.ZERO); }); return new ArrayList<>(respCollection); }
From source file:com.epam.ta.reportportal.database.dao.TestItemRepositoryCustomImpl.java
@Override public Map<String, String> findPathNames(Iterable<String> path) { Query q = query(where("_id").in(toObjId(path))); q.fields().include("name"); List<TestItem> testItems = mongoTemplate.find(q, TestItem.class); LinkedHashMap<String, String> pathNames = new LinkedHashMap<>(testItems.size()); for (TestItem testItem : testItems) { pathNames.put(testItem.getId(), testItem.getName()); }/*from w ww . j av a 2 s . co m*/ return pathNames; }
From source file:gtu._work.ui.SqlCreaterUI.java
private void firstRowMakeInsertSqlBtn(ActionEvent evt) { try {//w ww . ja v a 2s . c o m String tableName = Validate.notBlank(tableNameText.getText(), "??"); File srcFile = JCommonUtil.filePathCheck(excelFilePathText2.getText(), "?", "xlsx"); File saveFile = JCommonUtil._jFileChooser_selectFileOnly_saveFile(); if (saveFile == null) { JCommonUtil._jOptionPane_showMessageDialog_error("?"); return; } BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(saveFile), "utf8")); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile)); XSSFWorkbook xssfWorkbook = new XSSFWorkbook(bis); Sheet sheet = xssfWorkbook.getSheetAt(0); LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); for (int ii = 0; ii < sheet.getRow(0).getLastCellNum(); ii++) { valueMap.put(formatCellType(sheet.getRow(0).getCell(ii)), ""); } for (int j = 0; j < sheet.getPhysicalNumberOfRows(); j++) { Row row = sheet.getRow(j); LinkedHashMap<String, String> valueMap2 = (LinkedHashMap<String, String>) valueMap.clone(); int ii = 0; for (String key : valueMap2.keySet()) { valueMap2.put(key, formatCellType(row.getCell(ii))); ii++; } appendLog("" + valueMap2); String insertSql = this.fetchInsertSQL(tableName, valueMap2); appendLog("" + insertSql); writer.write(insertSql); writer.newLine(); } bis.close(); writer.flush(); writer.close(); JCommonUtil._jOptionPane_showMessageDialog_info("? : \n" + saveFile); } catch (Exception ex) { JCommonUtil.handleException(ex); } }
From source file:com.openerp.addons.note.NoteDBHelper.java
public LinkedHashMap<String, String> getAllNoteTags() { String oea_name = OEUser.current(mContext).getAndroidName(); LinkedHashMap<String, String> note_tag = new LinkedHashMap<String, String>(); List<HashMap<String, Object>> records = executeSQL( "SELECT id,name,oea_name FROM note_tag where oea_name = ?", new String[] { oea_name }); if (records.size() > 0) { for (HashMap<String, Object> row : records) { note_tag.put(row.get("name").toString(), row.get("id").toString()); }//w ww. j a va 2s . c om } return note_tag; }
From source file:com.bemis.portal.customer.service.impl.CustomerProfileLocalServiceImpl.java
@Override public List<CustomerProfile> searchCustomer(String criteria, int start, int end) throws PortalException { long companyId = _bemisPortalService.getDefaultCompanyId(); List<CustomerProfile> customerProfiles = new ArrayList<>(); LinkedHashMap<String, Object> params = new LinkedHashMap<>(); params.put(_EXPANDO_ATTRIBUTES, criteria); Hits hits = _organizationLocalService.search(companyId, OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, criteria, params, start, end, null); Document[] documents = hits.getDocs(); for (Document doc : documents) { long orgId = GetterUtil.getLong(doc.get(Field.ORGANIZATION_ID)); Organization org = _organizationLocalService.getOrganization(orgId); customerProfiles.add(asCustomerProfile(org)); }//from www . j av a 2 s . co m return customerProfiles; }
From source file:com.jaspersoft.studio.data.xml.XMLDataAdapterDescriptor.java
private void addMainNodeField(LinkedHashMap<String, JRDesignField> fieldsMap, Node item) { JRDesignField f = new JRDesignField(); f.setName(ModelUtils.getNameForField(new ArrayList<JRDesignField>(fieldsMap.values()), item.getNodeName())); f.setValueClass(String.class); f.setDescription("."); fieldsMap.put(".", f); }