List of usage examples for java.util LinkedHashMap values
public Collection<V> values()
From source file:com.perceptive.epm.perkolcentral.action.ajax.EmployeeDetailsAction.java
public String executeGetAllEmployeesAtOnce() throws ExceptionWrapper { try {//from w w w . j a va 2s.c om LinkedHashMap<Long, EmployeeBO> employeeLinkedHashMap = new LinkedHashMap<Long, EmployeeBO>(); employeeLinkedHashMap = employeeBL.getAllEmployees(); gridModel = new ArrayList<EmployeeBO>(employeeLinkedHashMap.values()); CollectionUtils.filter(gridModel, new Predicate() { @Override public boolean evaluate(Object o) { return StringUtils.contains(((EmployeeBO) o).getEmployeeName().toLowerCase(), term.toLowerCase()); } }); } catch (Exception ex) { throw new ExceptionWrapper(ex); } return SUCCESS; }
From source file:org.icgc.dcc.portal.repository.DonorRepository.java
@Override public MultiSearchResponse counts(LinkedHashMap<String, Query> queries) { MultiSearchRequestBuilder search = client.prepareMultiSearch(); for (val query : queries.values()) { log.info("Converting {}", query.getFilters()); val pql = CONVERTER.convertCount(query, DONOR_CENTRIC); val request = queryEngine.execute(pql, DONOR_CENTRIC); search.add(request.getRequestBuilder()); }//from ww w. j a v a 2 s . co m return search.execute().actionGet(); }
From source file:org.peerfact.impl.network.gnp.topology.GnpSpace.java
/** * Calculates good positions for all Hosts in Map * //from w w w . j av a 2 s.co m * @param monitorResheduling * number of rescheduling the downhill simplex */ private void insertCoordinates(int monitorResheduling) { GnpSpace.calculationStepStatus = 2; coordinateIndex.clear(); LinkedHashMap<Integer, Host> peers = this.getMapRef().getHostIndex(); int c = 0; for (Host host : peers.values()) { GnpSpace.calculationProgressStatus = c; if (host.getHostType() == Host.HOST) { GnpPosition coord = this.insertCoordinateDownhillSimplex(host, monitorResheduling); coordinateIndex.put(host.getIpAddress(), coord); c++; if (c % 1000 == 0) { log.debug(c + " of " + peers.size() + " are positioned in gnp"); } } if (!calculationInProgress) { return; } } GnpSpace.calculationStepStatus = 0; GnpSpace.calculationInProgress = false; }
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// w ww. j a va 2 s . c om * 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.icgc.dcc.portal.repository.DonorRepository.java
@Override public MultiSearchResponse nestedCounts(LinkedHashMap<String, LinkedHashMap<String, Query>> queries) { val search = client.prepareMultiSearch(); for (val nestedQuery : queries.values()) { for (val innerQuery : nestedQuery.values()) { log.info("Nested converting {}", innerQuery); val pql = CONVERTER.convertCount(innerQuery, DONOR_CENTRIC); val request = queryEngine.execute(pql, DONOR_CENTRIC); search.add(request.getRequestBuilder()); }/*from ww w. ja v a 2s . c om*/ } log.debug("{}", search); return search.execute().actionGet(); }
From source file:com.alibaba.wasp.meta.FMetaStore.java
@Override public void dropTable(String tableName) throws MetaException { LinkedHashMap<String, Index> indexs = fMetaServices.getAllIndex(tableName); if (indexs != null) { for (Index index : indexs.values()) { String htable = StorageTableNameBuilder.buildIndexTableName(index); deleteTable(htable);// w w w. ja v a2s . co m } } String htablename = StorageTableNameBuilder.buildEntityTableName(tableName); deleteTable(htablename); fMetaServices.dropTable(tableName); }
From source file:org.kuali.rice.kew.rule.web.DocumentConfigurationViewAction.java
@SuppressWarnings("unchecked") public void populateRoutingResponsibilities(DocumentConfigurationViewForm form) { // pull all the responsibilities // merge the data and attach to route levels // pull the route levels and store on form //List<RouteNode> routeNodes = getRouteNodeService().getFlattenedNodes(form.getDocumentType(), true); Map<String, List<Role>> respToRoleMap = new HashMap<String, List<Role>>(); List<ProcessDefinitionBo> processes = (List<ProcessDefinitionBo>) form.getDocumentType().getProcesses(); if (!(processes.isEmpty())) { RouteNode rootNode = processes.get(0).getInitialRouteNode(); LinkedHashMap<String, RouteNode> routeNodeMap = new LinkedHashMap<String, RouteNode>(); flattenRouteNodes(rootNode, routeNodeMap); form.setRouteNodes(new ArrayList<RouteNode>(routeNodeMap.values())); // pull all the responsibilities and store into a map for use by the JSP // FILTER TO THE "Review" template only // pull responsibility roles DocumentType docType = form.getDocumentType(); Set<Responsibility> responsibilities = new HashSet<Responsibility>(); Map<String, List<ResponsibilityForDisplay>> nodeToRespMap = new LinkedHashMap<String, List<ResponsibilityForDisplay>>(); while (docType != null) { QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); Predicate p = and(equal("template.namespaceCode", KRADConstants.KUALI_RICE_WORKFLOW_NAMESPACE), equal("template.name", KewApiConstants.DEFAULT_RESPONSIBILITY_TEMPLATE_NAME), equal("active", Boolean.TRUE), equal("attributes[documentTypeName]", docType.getName())); builder.setPredicates(p);//from w w w . java 2 s . c om List<Responsibility> resps = getResponsibilityService().findResponsibilities(builder.build()) .getResults(); for (Responsibility r : resps) { String routeNodeName = r.getAttributes().get(KimConstants.AttributeConstants.ROUTE_NODE_NAME); if (StringUtils.isNotBlank(routeNodeName)) { if (!nodeToRespMap.containsKey(routeNodeName)) { nodeToRespMap.put(routeNodeName, new ArrayList<ResponsibilityForDisplay>()); nodeToRespMap.get(routeNodeName).add(new ResponsibilityForDisplay(r, false)); } else { // check if the responsibility in the existing list is for the current document // if so, OK to add. Otherwise, a lower level document has overridden this // responsibility (since we are walking up the hierarchy if (nodeToRespMap.get(routeNodeName).get(0).getDetails() .get(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME) .equals(docType.getName())) { nodeToRespMap.get(routeNodeName).add(new ResponsibilityForDisplay(r, false)); } else { // doc type name did not match, mark as overridden nodeToRespMap.get(routeNodeName).add(new ResponsibilityForDisplay(r, true)); } } responsibilities.add(r); } } docType = docType.getParentDocType(); } form.setResponsibilityMap(nodeToRespMap); for (Responsibility responsibility : responsibilities) { List<String> roleIds = getResponsibilityService() .getRoleIdsForResponsibility(responsibility.getId()); if (!roleIds.isEmpty()) { respToRoleMap.put(responsibility.getId(), getRoleService().getRoles(roleIds)); } } } form.setResponsibilityRoles(respToRoleMap); }
From source file:com.predic8.membrane.core.interceptor.apimanagement.ApiManagementConfiguration.java
private Map<String, Policy> parsePolicies(Map<String, Object> yaml) { Map<String, Policy> result = new HashMap<String, Policy>(); Object policies = yaml.get("policies"); if (policies == null) { log.warn("\"policies\" keyword not found"); return result; }//from www .jav a2 s . co m List<Object> yamlPolicies = (List<Object>) policies; for (Object yamlPolicyObj : yamlPolicies) { if (yamlPolicyObj == null) { continue; } LinkedHashMap<String, Object> yamlPolicy = (LinkedHashMap<String, Object>) yamlPolicyObj; for (Object polObj : yamlPolicy.values()) { if (polObj == null) { continue; } LinkedHashMap<String, Object> yamlPolicyDef = (LinkedHashMap<String, Object>) polObj; Policy policy = new Policy(); Object name = yamlPolicyDef.get("id"); if (name == null) { log.warn("Policy object found, but no \"id\" field"); continue; } String policyName = (String) name; policy.setName(policyName); Object serviceProxiesObj = yamlPolicyDef.get("serviceProxy"); if (serviceProxiesObj == null) { log.warn("Policy object found, but no service proxies specified "); continue; } List<String> serviceProxyNames = (List<String>) serviceProxiesObj; for (String sp : serviceProxyNames) { policy.getServiceProxies().add(sp); } //Optionals like rateLimit/quota etc. follow Object rateLimitObj = yamlPolicyDef.get("rateLimit"); if (rateLimitObj != null) { LinkedHashMap<String, Object> rateLimitData = (LinkedHashMap<String, Object>) rateLimitObj; RateLimit rateLimit = new RateLimit(); int requests = -1; Object requestsObj = rateLimitData.get("requests"); if (requestsObj == null) { log.warn("RateLimit object found, but request field is empty"); requests = RateLimit.REQUESTS_DEFAULT; } else { try { requests = Integer.parseInt((String) requestsObj); } catch (NumberFormatException ignored) { // there is an entry, but its not a number ( maybe empty quotes ) requests = RateLimit.REQUESTS_DEFAULT; } } int interval = -1; Object intervalObj = rateLimitData.get("interval"); if (intervalObj == null) { log.warn( "RateLimit object found, but interval field is empty. Setting default: \" + RateLimit.INTERVAL_DEFAULT"); interval = RateLimit.INTERVAL_DEFAULT; } else { try { interval = Integer.parseInt((String) intervalObj); } catch (NumberFormatException ignored) { interval = RateLimit.INTERVAL_DEFAULT; } } rateLimit.setRequests(requests); rateLimit.setInterval(interval); policy.setRateLimit(rateLimit); } Object quotaObj = yamlPolicyDef.get("quota"); if (quotaObj != null) { LinkedHashMap<String, Object> quota = (LinkedHashMap<String, Object>) quotaObj; Object quotaSizeObj = quota.get("size"); long quotaNumber = 0; String quotaSymbolString = ""; if (quotaSizeObj == null) { log.warn("Quota object found, but size field is empty"); quotaNumber = Quota.SIZE_DEFAULT; } else { try { String quotaString = (String) quotaSizeObj; quotaNumber = ((Number) NumberFormat.getInstance().parse(quotaString)).intValue(); quotaSymbolString = quotaString.replaceFirst(Long.toString(quotaNumber), "") .toLowerCase(); } catch (ParseException ignored) { quotaNumber = Quota.SIZE_DEFAULT; } } if (quotaSymbolString.length() > 0) { char quotaSymbol = quotaSymbolString.charAt(0); switch (quotaSymbol) { case 'g': quotaNumber *= 1024; case 'm': quotaNumber *= 1024; case 'k': quotaNumber *= 1024; case 'b': default: } } Object quotaIntervalObj = quota.get("interval"); int quotaInterval = 0; if (quotaIntervalObj == null) { log.warn("Quota object found, but interval field is empty"); quotaInterval = Quota.INTERVAL_DEFAULT; } else { try { quotaInterval = Integer.parseInt((String) quotaIntervalObj); } catch (NumberFormatException ignored) { quotaInterval = Quota.INTERVAL_DEFAULT; } } Quota q = new Quota(); q.setSize(quotaNumber); q.setInterval(quotaInterval); policy.setQuota(q); } result.put(policyName, policy); } } return result; }
From source file:com.perceptive.epm.perkolcentral.action.ajax.EmployeeDetailsAction.java
public String executeEmployeesByLicenseAjax() throws ExceptionWrapper { try {// w ww . j a v a2 s . c om LoggingHelpUtil.printDebug("Page " + getPage() + " Rows " + getRows() + " Sorting Order " + getSord() + " Index Row :" + getSidx()); LoggingHelpUtil.printDebug("Search :" + searchField + " " + searchOper + " " + searchString); // Calcalate until rows ware selected int to = (rows * page); // Calculate the first row to read int from = to - rows; LinkedHashMap<Long, EmployeeBO> employeeLinkedHashMap = new LinkedHashMap<Long, EmployeeBO>(); employeeLinkedHashMap = employeeBL.getAllEmployees(); ArrayList<EmployeeBO> allEmployees = new ArrayList<EmployeeBO>(employeeLinkedHashMap.values()); CollectionUtils.filter(allEmployees, new Predicate() { @Override public boolean evaluate(Object o) { EmployeeBO emp = (EmployeeBO) o; if (CollectionUtils.exists(emp.getLicenses(), new Predicate() { @Override public boolean evaluate(Object o) { return ((LicenseBO) o).getLicenseTypeName().equalsIgnoreCase(selectedLicenseTypeName); //To change body of implemented methods use File | Settings | File Templates. } })) return true; else return false; } }); //// Handle Order By if (sidx != null && !sidx.equals("")) { Collections.sort(allEmployees, new Comparator<EmployeeBO>() { public int compare(EmployeeBO e1, EmployeeBO e2) { if (sidx.equalsIgnoreCase("employeeName")) return sord.equalsIgnoreCase("asc") ? e1.getEmployeeName().compareTo(e2.getEmployeeName()) : e2.getEmployeeName().compareTo(e1.getEmployeeName()); else if (sidx.equalsIgnoreCase("jobTitle")) return sord.equalsIgnoreCase("asc") ? e1.getJobTitle().compareTo(e2.getJobTitle()) : e2.getJobTitle().compareTo(e1.getJobTitle()); else return sord.equalsIgnoreCase("asc") ? e1.getEmployeeName().compareTo(e2.getEmployeeName()) : e2.getEmployeeName().compareTo(e1.getEmployeeName()); } }); } // records = allEmployees.size(); total = (int) Math.ceil((double) records / (double) rows); gridModel = new ArrayList<EmployeeBO>(); to = to > records ? records : to; for (int iCounter = from; iCounter < to; iCounter++) { EmployeeBO employeeBO = allEmployees.get(iCounter); //new EmployeeBO((Employee) employeeLinkedHashMap.values().toArray()[iCounter]); gridModel.add(employeeBO); } } catch (Exception ex) { throw new ExceptionWrapper(ex); } return SUCCESS; }
From source file:com.perceptive.epm.perkolcentral.action.ajax.EmployeeDetailsAction.java
public String executeEmployeesByTeamAjax() throws ExceptionWrapper { try {/* ww w . j ava2 s .c om*/ LoggingHelpUtil.printDebug("Page " + getPage() + " Rows " + getRows() + " Sorting Order " + getSord() + " Index Row :" + getSidx()); LoggingHelpUtil.printDebug("Search :" + searchField + " " + searchOper + " " + searchString); // Calcalate until rows ware selected int to = (rows * page); // Calculate the first row to read int from = to - rows; LinkedHashMap<Long, EmployeeBO> employeeLinkedHashMap = new LinkedHashMap<Long, EmployeeBO>(); employeeLinkedHashMap = employeeBL.getAllEmployees(); ArrayList<EmployeeBO> allEmployees = new ArrayList<EmployeeBO>(employeeLinkedHashMap.values()); CollectionUtils.filter(allEmployees, new Predicate() { @Override public boolean evaluate(Object o) { EmployeeBO emp = (EmployeeBO) o; if (CollectionUtils.exists(emp.getGroups(), new Predicate() { @Override public boolean evaluate(Object o) { return ((GroupBO) o).getGroupId().equalsIgnoreCase(selectedGroupId); //To change body of implemented methods use File | Settings | File Templates. } })) return true; else return false; } }); //// Handle Order By if (sidx != null && !sidx.equals("")) { Collections.sort(allEmployees, new Comparator<EmployeeBO>() { public int compare(EmployeeBO e1, EmployeeBO e2) { if (sidx.equalsIgnoreCase("employeeName")) return sord.equalsIgnoreCase("asc") ? e1.getEmployeeName().compareTo(e2.getEmployeeName()) : e2.getEmployeeName().compareTo(e1.getEmployeeName()); else if (sidx.equalsIgnoreCase("jobTitle")) return sord.equalsIgnoreCase("asc") ? e1.getJobTitle().compareTo(e2.getJobTitle()) : e2.getJobTitle().compareTo(e1.getJobTitle()); else if (sidx.equalsIgnoreCase("manager")) return sord.equalsIgnoreCase("asc") ? e1.getManager().compareTo(e2.getManager()) : e2.getManager().compareTo(e1.getManager()); else return sord.equalsIgnoreCase("asc") ? e1.getEmployeeName().compareTo(e2.getEmployeeName()) : e2.getEmployeeName().compareTo(e1.getEmployeeName()); } }); } // records = allEmployees.size(); total = (int) Math.ceil((double) records / (double) rows); gridModel = new ArrayList<EmployeeBO>(); to = to > records ? records : to; for (int iCounter = from; iCounter < to; iCounter++) { EmployeeBO employeeBO = allEmployees.get(iCounter); //new EmployeeBO((Employee) employeeLinkedHashMap.values().toArray()[iCounter]); gridModel.add(employeeBO); } } catch (Exception ex) { throw new ExceptionWrapper(ex); } return SUCCESS; }