List of usage examples for java.util LinkedHashMap LinkedHashMap
public LinkedHashMap()
From source file:org.tdar.struts.result.FreemarkerHttpHeaderResult.java
public FreemarkerHttpHeaderResult() { headers = new LinkedHashMap<>(); status = HttpStatus.SC_OK; }
From source file:utils.WorkerManager.java
public static void useWorkerList(List<String> workerList) { workerMap = new LinkedHashMap<>(); write.lock();//w w w .jav a 2s . c o m for (String workerURL : workerList) { try { String result = HttpComm.heartbeat(workerURL); if (result.equals("result:success")) workerMap.put(workerURL, "OK"); else workerMap.put(workerURL, "DOWN"); // catch http exception } catch (HttpHostConnectException | NoHttpResponseException ex) { WorkerManager.getWorkerMap().put(workerURL, "DOWN"); Logger.getLogger(TaskSubmitThread.class.getName()).log(Level.SEVERE, null, ex); // catch general socket exception } catch (SocketException ex) { WorkerManager.getWorkerMap().put(workerURL, "DOWN"); Logger.getLogger(TaskSubmitThread.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(TaskSubmitThread.class.getName()).log(Level.SEVERE, null, ex); } } write.unlock(); }
From source file:gov.utah.dts.det.ccl.documents.reporting.reports.AbstractDimensionReport.java
@SuppressWarnings("unchecked") protected Input getLicenseTypeInput(boolean required) { Query query = reportRunner/*from ww w . j a va 2s. c o m*/ .getNativeQuery("select distinct license_type from rpt_dim_license_type order by license_type"); List<String> results = (List<String>) query.getResultList(); Map<String, String> types = new LinkedHashMap<String, String>(); if (!required) { types.put("All", "All"); } for (String res : results) { types.put(res, res); } return new Input(LICENSE_TYPE_KEY, "License Type", required ? results.get(0) : "All", String.class, required, types, InputDisplayType.SELECT); }
From source file:net.sf.logsupport.util.LogMessageUtil.java
/** * Converts the given list of log expression to an message map. * * @param expressionList The list of expression to convert. * @param mergeConstantExpressions Try to merge constant expression and create only one artifact where possible. * @return A map of log messages, where the unique log message is the key and multiple * occurrences of the same message is the value. *//* ww w . j a v a2 s . c om*/ public static Map<LogMessage, List<LogMessage>> toMessages(List<PsiMethodCallExpression> expressionList, boolean mergeConstantExpressions) { Map<LogMessage, List<LogMessage>> entries = new LinkedHashMap<LogMessage, List<LogMessage>>(); for (PsiMethodCallExpression expression : expressionList) { LogMessage message = new LogMessage(expression, mergeConstantExpressions); if (entries.containsKey(message)) entries.get(message).add(message); else entries.put(message, new ArrayList<LogMessage>(Arrays.asList(message))); } return entries; }
From source file:act.reports.controller.StorageLocationCurrentInventoryControllerHelper.java
public List<Map<String, String>> convertStorageLocationCurrentInventoryDetailsListAsExcelFormat( StorageLocationCurrentInventoryDetailsList storageLocationCurrentInventoryDetailsList) { logger.info("In convertStorageLocationCurrentInventoryDetailsListAsExcelFormat(...) ..."); List<Map<String, String>> excelDetails = new ArrayList<Map<String, String>>(); try {/*ww w. j a v a2s. co m*/ for (int i = 0; i < storageLocationCurrentInventoryDetailsList.getServiceCallDate().size(); i++) { Map<String, String> excelExpireData = new LinkedHashMap<String, String>(); excelExpireData.put("invoiceId", (storageLocationCurrentInventoryDetailsList.getInvoiceId().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getInvoiceId().get(i) : ""); excelExpireData.put("serviceCalldate", (storageLocationCurrentInventoryDetailsList.getServiceCallDate().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getServiceCallDate().get(i) : ""); excelExpireData.put("account", (storageLocationCurrentInventoryDetailsList.getAccount().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getAccount().get(i) : ""); excelExpireData.put("reason", (storageLocationCurrentInventoryDetailsList.getReason().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getReason().get(i) : ""); excelExpireData.put("year", (storageLocationCurrentInventoryDetailsList.getYear().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getYear().get(i) : ""); excelExpireData.put("make", (storageLocationCurrentInventoryDetailsList.getMake().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getMake().get(i) : ""); excelExpireData.put("model", (storageLocationCurrentInventoryDetailsList.getModel().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getModel().get(i) : ""); excelExpireData.put("vin", (storageLocationCurrentInventoryDetailsList.getVin().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getVin().get(i) : ""); excelExpireData.put("licensePlateCountry", (storageLocationCurrentInventoryDetailsList.getLicensePlateCountry().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getLicensePlateCountry().get(i) : ""); excelExpireData.put("licensePlateState", (storageLocationCurrentInventoryDetailsList.getLicensePlateState().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getLicensePlateState().get(i) : ""); excelExpireData.put("licensePlate", (storageLocationCurrentInventoryDetailsList.getLicensePlate().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getLicensePlate().get(i) : ""); excelExpireData.put("daysInStorage", (storageLocationCurrentInventoryDetailsList.getDaysInStorage().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getDaysInStorage().get(i) : ""); excelExpireData.put("markedForSalvage", (storageLocationCurrentInventoryDetailsList.getMarkedForSalvage().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getMarkedForSalvage().get(i) : ""); excelExpireData.put("lotLocation", (storageLocationCurrentInventoryDetailsList.getLotLocation().get(i) != null) ? storageLocationCurrentInventoryDetailsList.getLotLocation().get(i) : ""); excelDetails.add(excelExpireData); } } catch (Exception e) { logger.error(e); e.printStackTrace(); } return excelDetails; }
From source file:com.impetus.kundera.persistence.EntityResolver.java
/** * Resolve all reachable entities from entity. * /*from w ww . j a v a 2 s . co m*/ * @param entity * the entity * @param cascadeType * the cascade type * @param persistenceUnits * the persistence units * @return the all reachable entities */ public static List<EnhancedEntity> resolve(Object entity, CascadeType cascadeType) { Map<String, EnhancedEntity> map = new LinkedHashMap<String, EnhancedEntity>(); try { LOG.debug("Resolving reachable entities for cascade " + cascadeType); recursivelyResolveEntities(entity, cascadeType, map); } catch (PropertyAccessException e) { throw new ReaderResolverException(e); } if (LOG.isDebugEnabled()) { for (Map.Entry<String, EnhancedEntity> entry : map.entrySet()) { LOG.debug( "Entity => " + entry.getKey() + ", ForeignKeys => " + entry.getValue().getForeignKeysMap()); } } return new ArrayList<EnhancedEntity>(map.values()); }
From source file:amulet.resourceprofiler.JSONResourceReader.java
public JSONResourceReader() { deviceInformation = new DeviceInfo(); steadyStateInformation = new SteadyStateInfo(); apiInfo = new JSONArray(); energyParameters = new LinkedHashMap<String, EnergyParam>(); }
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); }//from www . j a va 2 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.apache.solr.common.util.Utils.java
public static Map getDeepCopy(Map map, int maxDepth, boolean mutable) { if (map == null) return null; if (maxDepth < 1) return map; Map copy = new LinkedHashMap(); for (Object o : map.entrySet()) { Map.Entry e = (Map.Entry) o; Object v = e.getValue();/*from w w w .ja v a2 s . c om*/ if (v instanceof Map) v = getDeepCopy((Map) v, maxDepth - 1, mutable); else if (v instanceof Collection) v = getDeepCopy((Collection) v, maxDepth - 1, mutable); copy.put(e.getKey(), v); } return mutable ? copy : Collections.unmodifiableMap(copy); }
From source file:at.molindo.dbcopy.handler.AbstractLinkedKeyedHandler.java
@Override protected final Map<K, V> createMap() { return new LinkedHashMap<K, V>(); }