List of usage examples for java.util LinkedHashMap LinkedHashMap
public LinkedHashMap()
From source file:com.gedaeusp.domain.TimeSeriesParser.java
public LinkedHashMap<Integer, UnitValue<T>> parse(String string, T unit) { LinkedHashMap<Integer, UnitValue<T>> result = new LinkedHashMap<Integer, UnitValue<T>>(); BufferedReader reader = new BufferedReader(new StringReader(string)); String line;//ww w. j av a 2 s .com try { while ((line = reader.readLine()) != null) { if (StringUtils.isBlank(line)) continue; String[] data = line.split(","); if (data.length != 2) continue; if (StringUtils.isBlank(data[0]) || "null".equals(data[0])) continue; if (StringUtils.isBlank(data[1]) || "null".equals(data[1])) continue; int time = Time.convertDateToSeconds(data[0]); result.put(time, new UnitValue<T>(Double.parseDouble(data[1]), unit)); } } catch (Exception e) { log.error("Error reading file: ", e); throw new DomainException("Failed to read data points.", e); } return result; }
From source file:com.yahoo.sql4d.insert.nodes.PartitionsSpec.java
public Map<String, Object> getDataMap() { Map<String, Object> map = new LinkedHashMap<>(); map.put("type", type); map.put("targetPartitionSize", targetPartitionSize); return map;// w w w . j ava2 s.co m }
From source file:PropertiesMap.java
public PropertiesMap() { props = new LinkedHashMap<String, Object>(); }
From source file:javaslang.jackson.datatype.serialize.MultimapSerializer.java
@Override Object toJavaObj(Multimap<?, ?> value) throws IOException { final LinkedHashMap<Object, List<Object>> result = new LinkedHashMap<>(); value.forEach(e -> {/* w ww.j a v a 2 s .c o m*/ List<Object> list = result.get(e._1); if (list == null) { list = new ArrayList<>(); result.put(e._1, list); } list.add(e._2); }); return result; }
From source file:com.opengamma.analytics.financial.curve.building.CurveBuildingBlockBundle.java
/** * Constructor from a map. A new map is created. * @param bundle A map of string to curve building units and Jacobian. *///from w w w .ja v a 2 s.co m public CurveBuildingBlockBundle(LinkedHashMap<String, Pair<CurveBuildingBlock, DoubleMatrix2D>> bundle) { _bundle = new LinkedHashMap<String, Pair<CurveBuildingBlock, DoubleMatrix2D>>(); _bundle.putAll(bundle); }
From source file:com.tom.deleteme.PrintAnnotations.java
public static JSONObject printAnnotations(CAS aCAS, PrintStream aOut) { // get iterator over annotations FSIterator iter = aCAS.getAnnotationIndex().iterator(); Map<String, String> map = new LinkedHashMap<String, String>(); JSONObject json = new JSONObject(); // iterate/* w w w . j av a 2s . c om*/ while (iter.isValid()) { FeatureStructure fs = iter.get(); printAnnotatedText(fs, aCAS, 0, aOut, json); iter.moveToNext(); } return json; }
From source file:com.janrain.backplane.server.BusConfig1.java
public BusConfig1(String busName, String owner, String retentionTimeSeconds, String retentionTimeStickySeconds) throws BackplaneServerException { Map<String, String> d = new LinkedHashMap<String, String>(); d.put(Field.BUS_NAME.getFieldName(), busName); d.put(Field.RETENTION_TIME_SECONDS.getFieldName(), retentionTimeSeconds); d.put(Field.RETENTION_STICKY_TIME_SECONDS.getFieldName(), retentionTimeStickySeconds); d.put(owner, BUS_PERMISSION.GETALL.name()); try {//from www .ja va2 s .c om init(busName, d); } catch (SimpleDBException e) { throw new BackplaneServerException(e.getMessage(), e); } }
From source file:act.reports.controller.AuctionListInvoicesControllerHelper.java
public List<Map<String, String>> convertAuctionListInvoicesToExcelFormat( AuctionListInvoicesDetailsList auctionListInvoicesDetailsList) { logger.info(/*w w w .j av a2 s . c o m*/ "In convertAuctionListInvoicesToExcelFormat(AuctionListInvoicesDetailsList auctionListInvoicesDetailsList)..."); List<Map<String, String>> excelDetails = new ArrayList<Map<String, String>>(); try { for (int i = 0; i < auctionListInvoicesDetailsList.getInvoiceId().size(); i++) { logger.info("i = " + i); Map<String, String> excelExpireData = new LinkedHashMap<String, String>(); //excelExpireData.put("invoiceId", (auctionListInvoicesDetailsList.getInvoiceId().get(i) != null) ? auctionListInvoicesDetailsList.getInvoiceId().get(i) : ""); excelExpireData.put("invoiceId", auctionListInvoicesDetailsList.getInvoiceId().get(i)); excelExpireData.put("vehicleYear", (auctionListInvoicesDetailsList.getVehicleYear().get(i) != null) ? auctionListInvoicesDetailsList.getVehicleYear().get(i) : ""); excelExpireData.put("vehicleMake", (auctionListInvoicesDetailsList.getVehicleMake().get(i) != null) ? auctionListInvoicesDetailsList.getVehicleMake().get(i) : ""); excelExpireData.put("vehicleModel", (auctionListInvoicesDetailsList.getVehicleModel().get(i) != null) ? auctionListInvoicesDetailsList.getVehicleModel().get(i) : ""); excelExpireData.put("vehicleVIN", (auctionListInvoicesDetailsList.getVehicleVIN().get(i) != null) ? auctionListInvoicesDetailsList.getVehicleVIN().get(i) : ""); excelExpireData.put("licensePlateCountry", (auctionListInvoicesDetailsList.getLicensePlateCountry().get(i) != null) ? auctionListInvoicesDetailsList.getLicensePlateCountry().get(i) : ""); excelExpireData.put("licensePlateState", (auctionListInvoicesDetailsList.getLicensePlateState().get(i) != null) ? auctionListInvoicesDetailsList.getLicensePlateState().get(i) : ""); excelExpireData.put("licensePlateNo", (auctionListInvoicesDetailsList.getLicensePlateNo().get(i) != null) ? auctionListInvoicesDetailsList.getLicensePlateNo().get(i) : ""); excelExpireData.put("markedAsSalvage", (auctionListInvoicesDetailsList.getMarkedAsSalvage().get(i) != null) ? auctionListInvoicesDetailsList.getMarkedAsSalvage().get(i) : ""); excelExpireData.put("lotLocation", (auctionListInvoicesDetailsList.getLotLocation().get(i) != null) ? auctionListInvoicesDetailsList.getLotLocation().get(i) : ""); excelExpireData.put("releasedTo", (auctionListInvoicesDetailsList.getReleasedTo().get(i) != null) ? auctionListInvoicesDetailsList.getReleasedTo().get(i) : ""); excelDetails.add(excelExpireData); } } catch (Exception e) { logger.error(e); e.printStackTrace(); } return excelDetails; }
From source file:com.sugaronrest.restapicalls.methodcalls.Authentication.java
/** * Login to SugarCRM via REST API call.//ww w . j av a2 s . c om * * @param loginRequest LoginRequest object. * @return LoginResponse object. */ public static LoginResponse login(LoginRequest loginRequest) throws Exception { LoginResponse loginResponse = new LoginResponse(); try { MessageDigest md5 = MessageDigest.getInstance("MD5"); String passwordHash = new BigInteger(1, md5.digest(loginRequest.password.getBytes())).toString(16); Map<String, String> userCredentials = new LinkedHashMap<String, String>(); userCredentials.put("user_name", loginRequest.username); userCredentials.put("password", passwordHash); Map<String, Object> auth = new LinkedHashMap<String, Object>(); auth.put("user_auth", userCredentials); auth.put("application_name", "RestClient"); ObjectMapper mapper = new ObjectMapper(); String jsonAuthData = mapper.writeValueAsString(auth); Map<String, Object> request = new LinkedHashMap<String, Object>(); request.put("method", "login"); request.put("input_type", "json"); request.put("response_type", "json"); request.put("rest_data", auth); String jsonRequest = mapper.writeValueAsString(request); request.put("rest_data", jsonAuthData); HttpResponse response = Unirest.post(loginRequest.url).fields(request).asString(); String jsonResponse = response.getBody().toString(); loginResponse.setJsonRawRequest(jsonRequest); loginResponse.setJsonRawResponse(jsonResponse); Map<String, Object> responseObject = mapper.readValue(jsonResponse, Map.class); if (responseObject.containsKey("id")) { loginResponse.sessionId = (responseObject.get("id").toString()); loginResponse.setStatusCode(response.getStatus()); loginResponse.setError(null); } else { ErrorResponse errorResponse = mapper.readValue(jsonResponse, ErrorResponse.class); errorResponse.setStatusCode(HttpStatus.SC_BAD_REQUEST); loginResponse.setStatusCode(HttpStatus.SC_BAD_REQUEST); loginResponse.setError(errorResponse); } } catch (Exception exception) { ErrorResponse errorResponse = ErrorResponse.format(exception, exception.getMessage()); loginResponse.setError(errorResponse); } return loginResponse; }
From source file:org.openmrs.module.chartsearch.web.controller.CommandsFormController.java
@RequestMapping(method = RequestMethod.GET) public void showForm(ModelMap map) { Map<IndexClearStrategies, String> clearStrategy = new LinkedHashMap<IndexClearStrategies, String>(); clearStrategy.put(IndexClearStrategies.IDS, "By patient ids"); clearStrategy.put(IndexClearStrategies.BASIC, "By max patients in index"); clearStrategy.put(IndexClearStrategies.NON_USAGE_TIME, "By max non usage time"); map.put("clearStrategies", clearStrategy); }