List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:com.company.eleave.leave.rest.ITAnnualBalanceLeaveController.java
@Test public void testAddLeaveForEmployeeSuccessfully() throws Exception { final long overtimeLeaveTypeId = 8; final int leaveDaysAllowed = 6; final int leaveDaysRemaining = 6; final String leaveTypeName = "Overtime"; final Date validityDate = Date.valueOf("2016-12-12"); final AnnualBalanceLeaveDTO newAnnualBalanceLeaveDTO = new AnnualBalanceLeaveDTO(); newAnnualBalanceLeaveDTO.setLeaveDaysAllowed(leaveDaysAllowed); newAnnualBalanceLeaveDTO.setLeaveDaysRemaining(leaveDaysRemaining); newAnnualBalanceLeaveDTO.setLeaveTypeId(overtimeLeaveTypeId); newAnnualBalanceLeaveDTO.setLeaveTypeName(leaveTypeName); newAnnualBalanceLeaveDTO.setValidityDate(validityDate); mockMvc.perform(post(request(RestURI.ANNUAL_BALANCE_LEAVES_BY_EMPLOYEE, EMPLOYEE_ID)) .contentType(TestObjectConverter.APPLICATION_JSON_UTF8) .content(TestObjectConverter.convertObjectToJsonBytes(newAnnualBalanceLeaveDTO))) .andExpect(status().isCreated()).andExpect(header().string("location", "/annualBalanceLeaves/6")); //check if size of annual balance leaves has increased final String contentAsString = mockMvc .perform(get(request(RestURI.ANNUAL_BALANCE_LEAVES_BY_EMPLOYEE, EMPLOYEE_ID))) .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); List<LinkedHashMap> result = new ObjectMapper().readValue(contentAsString, List.class); Assert.assertEquals(4, result.size()); final LinkedHashMap firstAnnualBalanceLeave = result.stream().filter(map -> ((int) map.get("id") == 6)) .findAny().get();/*from w w w.j a va2 s . c om*/ Assert.assertEquals(leaveDaysAllowed, (int) firstAnnualBalanceLeave.get("leaveDaysAllowed")); Assert.assertEquals(leaveDaysRemaining, (int) firstAnnualBalanceLeave.get("leaveDaysRemaining")); Assert.assertEquals(overtimeLeaveTypeId, (int) firstAnnualBalanceLeave.get("leaveTypeId")); Assert.assertEquals(leaveTypeName, firstAnnualBalanceLeave.get("leaveTypeName")); Assert.assertEquals("2016-12-12", firstAnnualBalanceLeave.get("validityDate")); }
From source file:com.miserablemind.api.consumer.tradeking.api.impl.response_entities.TKUserResponse.java
/** * For User Profile TradeKing returns an array instead of some sensible normal object * The getter methods get it from the List that is turned into hash map for faster access. * * @param userData data fed in my deserializer * @throws Exception if cannot deserialize data *///from w ww . jav a2 s . c om @SuppressWarnings("unchecked") @JsonSetter("userdata") public void deserializeUserData(LinkedHashMap<String, Object> userData) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new TradeKingModule()); boolean isDisabled = userData.get("disabled").equals("true"); boolean resetPassword = userData.get("resetpassword").equals("true"); boolean resetTradingPassword = userData.get("resettradingpassword").equals("true"); UserAccount[] accounts = (UserAccount[]) this.extractArray(UserAccount[].class, userData, "account"); //User Profile Object UserProfile userProfile = new UserProfile(); LinkedHashMap<String, ArrayList> data = (LinkedHashMap<String, ArrayList>) userData.get("userprofile"); ArrayList<LinkedHashMap<String, String>> entry = (ArrayList<LinkedHashMap<String, String>>) data .get("entry"); for (LinkedHashMap<String, String> entryLine : entry) { UserProfileKeys key = UserProfileKeys.fromString(entryLine.get("name")); //catch all if (null == key) { userProfile.add(entryLine.get("name"), entryLine.get("value")); continue; } switch (key) { case AGREEMENT_FDIC: userProfile.setFDICAgreement(entryLine.get("value")); break; case DASHBOARD_COLLAPSED: userProfile.setAccountSummaryDashboardCollapsed(entryLine.get("value")); break; case EMAIL_ADDRESS: userProfile.setEmailAddress(entryLine.get("value")); break; case UUID: userProfile.setUUID(entryLine.get("value")); break; case FDIC_PAPER: userProfile.setFDICPaper(entryLine.get("value")); break; case FIRST_NAME: userProfile.setFirstName(entryLine.get("value")); break; case GAINS_KEEPER: userProfile.setGainsKeeper(entryLine.get("value").equals("Y")); break; case LAST_NAME: userProfile.setLasName(entryLine.get("value")); break; case NEW_MESSAGE: userProfile.setHasMewMessage(entryLine.get("value").equals("Y")); break; case REAL_TIME_STOCK_QUOTE: userProfile.setRealTimeStockQuote(entryLine.get("value").equals("Y")); break; case USE_TRADING_PASSWORD: userProfile.setTradingPasswordUsed(entryLine.get("value").equals("Y")); break; default: userProfile.add(entryLine.get("name"), entryLine.get("value")); } } this.user = new TradeKingUser(isDisabled, resetPassword, resetTradingPassword, accounts, userProfile); }
From source file:com.company.eleave.leave.rest.ITTakenLeaveController.java
@Test public void testGetAllLeavesForApproverSuccessfully() throws Exception { final String contentAsString = mockMvc.perform(get(request(RestURI.TAKEN_LEAVES_BY_APPROVER, APPROVER_ID))) .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); List<LinkedHashMap> result = new ObjectMapper().readValue(contentAsString, List.class); Assert.assertEquals(3, result.size()); final LinkedHashMap approvedStandardAnnualBalanceLeave = result.stream() .filter(map -> ((int) map.get("id") == 1)).findAny().get(); Assert.assertEquals(5, (int) approvedStandardAnnualBalanceLeave.get("approverId")); Assert.assertEquals("john doe5Approver", approvedStandardAnnualBalanceLeave.get("approverName")); Assert.assertEquals(1, (int) approvedStandardAnnualBalanceLeave.get("leaveDaysTaken")); Assert.assertEquals("2016-01-01", approvedStandardAnnualBalanceLeave.get("leaveFrom")); Assert.assertEquals("2016-01-01", approvedStandardAnnualBalanceLeave.get("leaveTo")); Assert.assertEquals("Standard holiday", approvedStandardAnnualBalanceLeave.get("leaveType")); final LinkedHashMap approvedStandard2AnnualBalanceLeave = result.stream() .filter(map -> ((int) map.get("id") == 2)).findAny().get(); Assert.assertEquals(5, (int) approvedStandard2AnnualBalanceLeave.get("approverId")); Assert.assertEquals("john doe5Approver", approvedStandard2AnnualBalanceLeave.get("approverName")); Assert.assertEquals(4, (int) approvedStandard2AnnualBalanceLeave.get("leaveDaysTaken")); Assert.assertEquals("2016-02-02", approvedStandard2AnnualBalanceLeave.get("leaveFrom")); Assert.assertEquals("2016-02-05", approvedStandard2AnnualBalanceLeave.get("leaveTo")); Assert.assertEquals("Standard holiday", approvedStandard2AnnualBalanceLeave.get("leaveType")); }
From source file:com.redhat.topicindex.security.FedoraAccountSystem.java
private boolean checkCLAAgreement(LinkedHashMap groups) { for (Object key : groups.keySet()) { LinkedHashMap group = (LinkedHashMap) groups.get(key); if (group.containsKey("name")) { if (group.get("name").equals("cla_done")) { return true; }/* w ww. j a v a 2 s .co m*/ } } return false; }
From source file:com.google.api.codegen.config.GapicProductConfig.java
private static void createSingleResourceNameConfig(DiagCollector diagCollector, CollectionConfigProto collectionConfigProto, LinkedHashMap<String, SingleResourceNameConfig> singleResourceNameConfigsMap, @Nullable ProtoFile file, TargetLanguage language) {/*w w w .ja v a2s . co m*/ SingleResourceNameConfig singleResourceNameConfig = SingleResourceNameConfig .createSingleResourceName(diagCollector, collectionConfigProto, file, language); if (singleResourceNameConfig == null) { return; } if (singleResourceNameConfigsMap.containsKey(singleResourceNameConfig.getEntityId())) { SingleResourceNameConfig otherConfig = singleResourceNameConfigsMap .get(singleResourceNameConfig.getEntityId()); if (!singleResourceNameConfig.getNamePattern().equals(otherConfig.getNamePattern())) { diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL, "Inconsistent collection configs across interfaces. Entity name: " + singleResourceNameConfig.getEntityId())); } } else { singleResourceNameConfigsMap.put(singleResourceNameConfig.getEntityId(), singleResourceNameConfig); } }
From source file:org.raxa.module.raxacore.web.v1_0.controller.PatientListControllerTest.java
/** * @see PatientListController#getPatientListsByName(String,HttpServletRequest) * @verifies find matching patient list//from w w w . j a va 2 s. c o m */ @Test public void getPatientListsByName_shouldFindMatchingPatientList() throws Exception { String results = controller.getPatientListsByName("TestList2", request); LinkedHashMap patientList = (LinkedHashMap) ((ArrayList) SimpleObject.parseJson(results).get("results")) .get(0); Assert.assertEquals("68547121-1b70-465e-99ee-c9dfd95e7d30", patientList.get("uuid")); Assert.assertEquals("TestList2", patientList.get("name")); Assert.assertNull(patientList.get("searchQuery")); Assert.assertNull(patientList.get("auditInfo")); }
From source file:org.envirocar.wps.DataTransformProcess.java
private Set<String> gatherPropertiesForFeatureTypeBuilder(ArrayList<?> features) { Set<String> distinctPhenomenonNames = new HashSet<String>(); for (Object object : features) { if (object instanceof LinkedHashMap<?, ?>) { LinkedHashMap<?, ?> featureMap = (LinkedHashMap<?, ?>) object; Object propertiesObject = featureMap.get("properties"); if (propertiesObject instanceof LinkedHashMap<?, ?>) { LinkedHashMap<?, ?> propertiesMap = (LinkedHashMap<?, ?>) propertiesObject; Object phenomenonsObject = propertiesMap.get("phenomenons"); if (phenomenonsObject instanceof LinkedHashMap<?, ?>) { LinkedHashMap<?, ?> phenomenonsMap = (LinkedHashMap<?, ?>) phenomenonsObject; for (Object phenomenonKey : phenomenonsMap.keySet()) { Object phenomenonValue = phenomenonsMap.get(phenomenonKey); if (phenomenonValue instanceof LinkedHashMap<?, ?>) { LinkedHashMap<?, ?> phenomenonValueMap = (LinkedHashMap<?, ?>) phenomenonValue; String unit = phenomenonValueMap.get("unit").toString(); distinctPhenomenonNames.add(phenomenonKey.toString() + " (" + unit + ")"); }//from w w w .ja v a2 s .c om } } } } } return distinctPhenomenonNames; }
From source file:ca.sfu.federation.model.InputTable.java
/** * Get dep for a particular named input. * @param InputName The input name./*from w w w . ja va 2s . c o m*/ */ public List getDependancies(String InputName) { ArrayList deps = new ArrayList(); LinkedHashMap index = this.getInputIndex(); Input input = (Input) index.get(InputName); if (input != null) { deps.addAll(input.getDependancies()); } return (List) deps; }
From source file:ca.sfu.federation.model.InputTable.java
/** * Set the Input user value./*from w w w. j a va 2 s . c om*/ * @param InputName The Input name. * @param UserInputValue The user specified input value. */ public void setInput(String InputName, String UserInputValue) { LinkedHashMap index = this.getInputIndex(); Input myInput = (Input) index.get(InputName); try { myInput.setUserInput(UserInputValue); } catch (Exception ex) { String stack = ExceptionUtils.getFullStackTrace(ex); logger.log(Level.WARNING, "{0}", stack); } // notify parent object of change this.setChanged(); this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_INPUT_CHANGE)); }
From source file:org.raxa.module.raxacore.web.v1_0.controller.DrugGroupControllerTest.java
/** * @see DrugGroupController#getDrugGroupsByName(String,HttpServletRequest) * @verifies find matching patient list/*from ww w . jav a 2 s. c om*/ */ @Test public void getDrugGroupsByName_shouldFindMatchingDrugGroups() throws Exception { String results = controller.getDrugGroupsByName("TestDrugGroup2", request); LinkedHashMap drugGroup = (LinkedHashMap) ((ArrayList) SimpleObject.parseJson(results).get("results")) .get(0); Util.log("Found DrugGroup(s)", drugGroup); Assert.assertEquals("68547121-1b70-465e-99ee-c9dfd95e7d30", drugGroup.get("uuid")); Assert.assertEquals("TestDrugGroup2", drugGroup.get("name")); Assert.assertNull(drugGroup.get("auditInfo")); }