List of usage examples for java.time LocalDate parse
public static LocalDate parse(CharSequence text)
From source file:edu.lternet.pasta.portal.search.TemporalList.java
private static int calculateMonths(String beginDate, String endDate) { int durationInMonths; LocalDate localBeginDate = LocalDate.parse(beginDate); LocalDate localEndDate = LocalDate.parse(endDate); Period duration = Period.between(localBeginDate, localEndDate); int years = duration.getYears(); int months = duration.getMonths(); int days = duration.getDays(); durationInMonths = ((years * 12) + months); if (days > 15) { durationInMonths++;//from www. jav a 2s . com } System.out.printf("Begin Date: %s, End Date: %s\n", beginDate, endDate); System.out.printf("The duration is %d years, %d months and %d days\n", duration.getYears(), duration.getMonths(), duration.getDays()); System.out.printf("The total duration in months is %d\n\n", durationInMonths); return durationInMonths; }
From source file:io.github.mikesaelim.arxivoaiharvester.xml.XMLParser.java
/** * Parse the datestamp of a record.//www . ja v a 2 s. c o m * @throws ParseException if there is a parsing error */ @VisibleForTesting LocalDate parseDatestamp(String value) { LocalDate datestamp; try { datestamp = LocalDate.parse(value); } catch (DateTimeParseException e) { throw new ParseException("Could not parse datestamp '" + value + "' in ISO_LOCAL_DATE format"); } return datestamp; }
From source file:com.swcguild.dvdlibraryv3.DVDLibraryController.java
private void editReleaseDate(Dvd toEdit) { String dateStr = con.readString("Enter the new release date in format YYYY-mm-dd"); LocalDate date = LocalDate.parse(dateStr); toEdit.setReleaseDate(date);/*from w ww . j a v a2 s .c o m*/ con.print("The new release date is " + dateStr); }
From source file:org.ojbc.adapters.analyticsstaging.custody.CamelContextAdamsWrongOrderTest.java
public void testCustodyStatusChangeReportService() throws Exception { Exchange senderExchange = createSenderExchange( "src/test/resources/xmlInstances/custodyStatusChangeReport/CustodyStatusChangeReport-Adams.xml"); Person person = analyticalDatastoreDAO.getPerson(1); Assert.assertNull(person);//from w ww .j a v a 2 s . c o m List<CustodyStatusChange> custodyStatusChanges = analyticalDatastoreDAO .getCustodyStatusChangesByBookingId(1); assertTrue(custodyStatusChanges.isEmpty()); List<CustodyStatusChangeCharge> custodyStatusChangeCharges = analyticalDatastoreDAO .getCustodyStatusChangeCharges(1); assertTrue(custodyStatusChangeCharges.isEmpty()); //Send the one-way exchange. Using template.send will send an one way message Exchange returnExchange = template.send("direct:custodyStatusChangeReportingService", senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } person = analyticalDatastoreDAO.getPerson(1); Assert.assertNotNull(person); assertThat(person.getPersonId(), is(1)); assertThat(person.getDomicileStatusTypeId(), nullValue()); assertThat(person.getPersonUniqueIdentifier2(), is("Booking Subject Number")); assertThat(person.getEducationLevel(), is("High School Graduate")); assertThat(person.getOccupation(), is("Truck Driver")); assertThat(person.getMilitaryServiceStatusType().getValue(), is("Active")); List<BehavioralHealthAssessment> behavioralHealthAssessments = analyticalDatastoreDAO .getBehavioralHealthAssessments(1); assertThat(behavioralHealthAssessments.size(), is(1)); BehavioralHealthAssessment behavioralHealthAssessment = behavioralHealthAssessments.get(0); assertTrue(behavioralHealthAssessment.getBehavioralHealthDiagnoses().size() == 1); assertThat(behavioralHealthAssessment.getBehavioralHealthDiagnoses().get(0), is("Schizophrenia 295.10")); assertThat(behavioralHealthAssessment.getPersonId(), is(1)); assertThat(behavioralHealthAssessment.getBehavioralHealthAssessmentId(), is(1)); assertThat(behavioralHealthAssessment.getSeriousMentalIllness(), is(true)); assertThat(behavioralHealthAssessment.getCareEpisodeStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(behavioralHealthAssessment.getCareEpisodeEndDate(), is(LocalDate.parse("2016-04-01"))); assertThat(behavioralHealthAssessment.getEnrolledProviderName(), is("79")); assertThat(behavioralHealthAssessment.getMedicaidStatusTypeId(), nullValue()); List<Treatment> treatments = analyticalDatastoreDAO.getTreatments(1); assertThat(treatments.size(), is(1)); Treatment treatment = treatments.get(0); assertThat(treatment.getBehavioralHealthAssessmentID(), is(1)); assertThat(treatment.getTreatmentStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(treatment.getTreatmentAdmissionReasonTypeId(), nullValue()); assertThat(treatment.getTreatmentStatusTypeId(), nullValue()); assertThat(treatment.getTreatmentProviderName(), is("Treatment Providing Organization Name")); List<PrescribedMedication> prescribedMedications = analyticalDatastoreDAO.getPrescribedMedication(1); assertThat(prescribedMedications.size(), is(1)); PrescribedMedication prescribedMedication = prescribedMedications.get(0); assertThat(prescribedMedication.getBehavioralHealthAssessmentID(), is(1)); assertThat(prescribedMedication.getMedicationDescription(), is("Zyprexa")); assertThat(prescribedMedication.getMedicationDispensingDate(), is(LocalDate.parse("2016-01-01"))); assertThat(prescribedMedication.getMedicationDoseMeasure(), is("3mg")); custodyStatusChanges = analyticalDatastoreDAO.getCustodyStatusChangesByBookingNumber("Booking Number"); assertThat(custodyStatusChanges.size(), is(1)); CustodyStatusChange custodyStatusChange = custodyStatusChanges.get(0); assertEquals(LocalDate.parse("2013-12-17"), custodyStatusChange.getBookingDate()); assertEquals(LocalTime.parse("09:30"), custodyStatusChange.getBookingTime()); assertThat(custodyStatusChange.getFacilityId(), is(2)); assertThat(custodyStatusChange.getSupervisionUnitTypeId(), is(10)); assertThat(custodyStatusChange.getBookingId(), nullValue()); assertThat(custodyStatusChange.getBookingNumber(), is("Booking Number")); assertThat(custodyStatusChange.getScheduledReleaseDate(), is(LocalDate.parse("2014-12-17"))); assertThat(custodyStatusChange.getInmateJailResidentIndicator(), is(false)); List<CustodyStatusChangeArrest> custodyStatusChangeArrests = analyticalDatastoreDAO .getCustodyStatusChangeArrests(1); assertThat(custodyStatusChangeArrests.size(), is(1)); CustodyStatusChangeArrest custodyStatusChangeArrest = custodyStatusChangeArrests.get(0); assertThat(custodyStatusChangeArrest.getCustodyStatusChangeId(), is(1)); assertThat(custodyStatusChangeArrest.getCustodyStatusChangeArrestId(), is(1)); assertEquals("30", custodyStatusChangeArrest.getAddress().getStreetNumber()); assertEquals("Main Street", custodyStatusChangeArrest.getAddress().getStreetName()); assertEquals("Denton", custodyStatusChangeArrest.getAddress().getCity()); assertEquals("CO", custodyStatusChangeArrest.getAddress().getState()); assertEquals("99999", custodyStatusChangeArrest.getAddress().getPostalcode()); assertTrue(custodyStatusChangeArrest.getAddress().getLocationLatitude().doubleValue() == 56.1111); assertTrue(custodyStatusChangeArrest.getAddress().getLocationLongitude().doubleValue() == 32.1111); assertThat(custodyStatusChangeArrest.getArrestAgencyId(), is(22)); custodyStatusChangeCharges = analyticalDatastoreDAO.getCustodyStatusChangeCharges(1); assertThat(custodyStatusChangeCharges.size(), is(1)); CustodyStatusChangeCharge custodyStatusChangeCharge = custodyStatusChangeCharges.get(0); assertThat(custodyStatusChangeCharge.getChargeCode(), is("Charge Code ID")); assertTrue(custodyStatusChangeCharge.getCustodyStatusChangeArrestId() == 1); assertTrue(custodyStatusChangeCharge.getBondAmount().doubleValue() == 500.00); assertThat(custodyStatusChangeCharge.getBondType().getValue(), is("PR BOND")); assertThat(custodyStatusChangeCharge.getAgencyId(), is(21)); assertThat(custodyStatusChangeCharge.getChargeClassTypeId(), is(2)); assertThat(custodyStatusChangeCharge.getBondStatusTypeId(), is(11)); assertThat(custodyStatusChangeCharge.getChargeJurisdictionTypeId(), is(2)); assertThat(custodyStatusChangeCharge.getChargeDisposition(), is("Disposition")); }
From source file:org.ojbc.adapters.analyticsstaging.custody.CamelContextAdamsTest.java
public void testCustodyStatusChangeReportService() throws Exception { Exchange senderExchange = createSenderExchange( "src/test/resources/xmlInstances/custodyStatusChangeReport/CustodyStatusChangeReport-Adams.xml"); Person person = analyticalDatastoreDAO.getPerson(1); Assert.assertNotNull(person);/* w ww. ja v a2 s .c o m*/ List<CustodyStatusChange> custodyStatusChanges = analyticalDatastoreDAO .getCustodyStatusChangesByBookingId(1); assertTrue(custodyStatusChanges.isEmpty()); List<CustodyStatusChangeCharge> custodyStatusChangeCharges = analyticalDatastoreDAO .getCustodyStatusChangeCharges(1); assertTrue(custodyStatusChangeCharges.isEmpty()); //Send the one-way exchange. Using template.send will send an one way message Exchange returnExchange = template.send("direct:custodyStatusChangeReportingService", senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } person = analyticalDatastoreDAO.getPerson(1); Assert.assertNotNull(person); Person person2 = analyticalDatastoreDAO.getPerson(2); Assert.assertNotNull(person2); Assert.assertEquals(Integer.valueOf(2), person2.getPersonId()); assertThat(person2.getDomicileStatusTypeId(), nullValue()); assertThat(person2.getPersonUniqueIdentifier2(), is("Booking Subject Number")); assertThat(person2.getEducationLevel(), is("High School Graduate")); assertThat(person2.getOccupation(), is("Truck Driver")); assertThat(person2.getMilitaryServiceStatusType().getValue(), is("Active")); List<BehavioralHealthAssessment> behavioralHealthAssessments = analyticalDatastoreDAO .getBehavioralHealthAssessments(2); assertThat(behavioralHealthAssessments.size(), is(1)); BehavioralHealthAssessment behavioralHealthAssessment = behavioralHealthAssessments.get(0); assertTrue(behavioralHealthAssessment.getBehavioralHealthDiagnoses().size() == 1); assertThat(behavioralHealthAssessment.getBehavioralHealthDiagnoses().get(0), is("Schizophrenia 295.10")); assertThat(behavioralHealthAssessment.getPersonId(), is(2)); assertThat(behavioralHealthAssessment.getBehavioralHealthAssessmentId(), is(2)); assertThat(behavioralHealthAssessment.getSeriousMentalIllness(), is(true)); assertThat(behavioralHealthAssessment.getCareEpisodeStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(behavioralHealthAssessment.getCareEpisodeEndDate(), is(LocalDate.parse("2016-04-01"))); assertThat(behavioralHealthAssessment.getEnrolledProviderName(), is("79")); assertThat(behavioralHealthAssessment.getMedicaidStatusTypeId(), nullValue()); List<Treatment> treatments = analyticalDatastoreDAO.getTreatments(2); assertThat(treatments.size(), is(1)); Treatment treatment = treatments.get(0); assertThat(treatment.getBehavioralHealthAssessmentID(), is(2)); assertThat(treatment.getTreatmentStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(treatment.getTreatmentAdmissionReasonTypeId(), nullValue()); assertThat(treatment.getTreatmentStatusTypeId(), nullValue()); assertThat(treatment.getTreatmentProviderName(), is("Treatment Providing Organization Name")); List<PrescribedMedication> prescribedMedications = analyticalDatastoreDAO.getPrescribedMedication(2); assertThat(prescribedMedications.size(), is(1)); PrescribedMedication prescribedMedication = prescribedMedications.get(0); assertThat(prescribedMedication.getBehavioralHealthAssessmentID(), is(2)); assertThat(prescribedMedication.getMedicationDescription(), is("Zyprexa")); assertThat(prescribedMedication.getMedicationDispensingDate(), is(LocalDate.parse("2016-01-01"))); assertThat(prescribedMedication.getMedicationDoseMeasure(), is("3mg")); custodyStatusChanges = analyticalDatastoreDAO.getCustodyStatusChangesByBookingId(1); assertThat(custodyStatusChanges.size(), is(1)); CustodyStatusChange custodyStatusChange = custodyStatusChanges.get(0); assertEquals(LocalDate.parse("2013-12-17"), custodyStatusChange.getBookingDate()); assertEquals(LocalTime.parse("09:30"), custodyStatusChange.getBookingTime()); assertThat(custodyStatusChange.getFacilityId(), is(2)); assertThat(custodyStatusChange.getSupervisionUnitTypeId(), is(10)); assertThat(custodyStatusChange.getBookingId(), is(1)); assertThat(custodyStatusChange.getBookingNumber(), is("Booking Number")); assertThat(custodyStatusChange.getScheduledReleaseDate(), is(LocalDate.parse("2014-12-17"))); assertThat(custodyStatusChange.getInmateJailResidentIndicator(), is(false)); List<CustodyStatusChangeArrest> custodyStatusChangeArrests = analyticalDatastoreDAO .getCustodyStatusChangeArrests(1); assertThat(custodyStatusChangeArrests.size(), is(1)); CustodyStatusChangeArrest custodyStatusChangeArrest = custodyStatusChangeArrests.get(0); assertThat(custodyStatusChangeArrest.getCustodyStatusChangeId(), is(1)); assertThat(custodyStatusChangeArrest.getCustodyStatusChangeArrestId(), is(1)); assertEquals("30", custodyStatusChangeArrest.getAddress().getStreetNumber()); assertEquals("Main Street", custodyStatusChangeArrest.getAddress().getStreetName()); assertEquals("Denton", custodyStatusChangeArrest.getAddress().getCity()); assertEquals("CO", custodyStatusChangeArrest.getAddress().getState()); assertEquals("99999", custodyStatusChangeArrest.getAddress().getPostalcode()); assertTrue(custodyStatusChangeArrest.getAddress().getLocationLatitude().doubleValue() == 56.1111); assertTrue(custodyStatusChangeArrest.getAddress().getLocationLongitude().doubleValue() == 32.1111); assertThat(custodyStatusChangeArrest.getArrestAgencyId(), is(22)); custodyStatusChangeCharges = analyticalDatastoreDAO.getCustodyStatusChangeCharges(1); assertThat(custodyStatusChangeCharges.size(), is(1)); CustodyStatusChangeCharge custodyStatusChangeCharge = custodyStatusChangeCharges.get(0); assertThat(custodyStatusChangeCharge.getChargeCode(), is("Charge Code ID")); assertTrue(custodyStatusChangeCharge.getCustodyStatusChangeArrestId() == 1); assertTrue(custodyStatusChangeCharge.getBondAmount().doubleValue() == 500.00); assertThat(custodyStatusChangeCharge.getBondType().getValue(), is("PR BOND")); assertThat(custodyStatusChangeCharge.getAgencyId(), is(21)); assertThat(custodyStatusChangeCharge.getChargeClassTypeId(), is(2)); assertThat(custodyStatusChangeCharge.getBondStatusTypeId(), is(11)); assertThat(custodyStatusChangeCharge.getChargeJurisdictionTypeId(), is(2)); assertThat(custodyStatusChangeCharge.getChargeDisposition(), is("Disposition")); }
From source file:org.nuxeo.apidoc.browse.Distribution.java
protected Map<String, Serializable> readFormData(FormData formData) { Map<String, Serializable> properties = new HashMap<>(); // Release date String released = formData.getString("released"); if (StringUtils.isNotBlank(released)) { LocalDate date = LocalDate.parse(released); Instant instant = date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant(); properties.put(PROP_RELEASED, Date.from(instant)); }/*from w w w . j a v a 2s . co m*/ return properties; }
From source file:org.openmhealth.shim.Application.java
/** * Endpoint for retrieving data from shims. * * @param username User ID record for which to retrieve data, if not approved this will throw ShimException. * todo: finish javadoc!/*w ww . ja v a 2 s. c om*/ * @return The shim data response wrapper with data from the shim. */ @RequestMapping(value = "/data/{shim}/{dataType}", produces = APPLICATION_JSON_VALUE) public ShimDataResponse data(@RequestParam(value = "username") String username, @PathVariable("shim") String shim, @PathVariable("dataType") String dataTypeKey, @RequestParam(value = "normalize", defaultValue = "") String normalize, @RequestParam(value = "dateStart", defaultValue = "") String dateStart, @RequestParam(value = "dateEnd", defaultValue = "") String dateEnd, @RequestParam(value = "numToReturn", defaultValue = "50") Long numToReturn) throws ShimException { setPassThroughAuthentication(username, shim); ShimDataRequest shimDataRequest = new ShimDataRequest(); shimDataRequest.setDataTypeKey(dataTypeKey); if (!normalize.equals("")) { shimDataRequest.setNormalize(Boolean.parseBoolean(normalize)); } if (!"".equals(dateStart)) { shimDataRequest.setStartDateTime(LocalDate.parse(dateStart).atStartOfDay().atOffset(UTC)); } if (!"".equals(dateEnd)) { shimDataRequest.setEndDateTime(LocalDate.parse(dateEnd).atStartOfDay().atOffset(UTC)); } shimDataRequest.setNumToReturn(numToReturn); AccessParameters accessParameters = accessParametersRepo.findByUsernameAndShimKey(username, shim, new Sort(Sort.Direction.DESC, "dateCreated")); if (accessParameters == null) { throw new ShimException("User '" + username + "' has not authorized shim: '" + shim + "'"); } shimDataRequest.setAccessParameters(accessParameters); return shimRegistry.getShim(shim).getData(shimDataRequest); }
From source file:com.ifpb.agendaeletronica.visao.TelaCadastro.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed Usuario usuario = new Usuario(); try {// www. ja va 2 s . co m usuario.setNome(campoNome.getText()); LocalDate nascimento = LocalDate .parse(new SimpleDateFormat("yyyy-MM-dd").format(campoNascimento.getDate())); usuario.setNascimento(nascimento); if (jRadioButton1.isSelected()) { usuario.setSexo('M'); } else if (jRadioButton2.isSelected()) { usuario.setSexo('F'); } usuario.setEmail(campoEmail.getText()); usuario.setSenha(new String(campoSenha.getPassword())); try { if (sendEmail(usuario.getEmail(), usuario.getSenha(), usuario.getNome())) { dao.createUsuario(usuario); JOptionPane.showMessageDialog(null, "Cadastrado Com Sucesso"); this.dispose(); } else { JOptionPane.showMessageDialog(null, "J Existe Um Usurio Com Esse E-mail", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } } catch (EmailException ex) { JOptionPane.showMessageDialog(null, "Falha ao Enviar E-mail", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } } catch (DateTimeParseException ex) { JOptionPane.showMessageDialog(null, "Data Invlida", "Mensagem de erro", JOptionPane.ERROR_MESSAGE); } catch (IOException | ClassNotFoundException ex) { JOptionPane.showMessageDialog(null, "Falha na conexo", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } catch (EmailInvalidoException ex) { JOptionPane.showMessageDialog(null, "E-mail No Pode Ser Vazio", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } catch (SenhaInvalidaException ex) { JOptionPane.showMessageDialog(null, "Senha No Pode Ser Vazia", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "J Existe um Usurio Com Esse E-mail", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } catch (NullPointerException ex) { JOptionPane.showMessageDialog(null, "Data Invlida", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, "Verifique a Data Informada", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } catch (NomeInvalidoException ex) { JOptionPane.showMessageDialog(null, "Nome No Pode Ser Vazio", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } catch (DateTimeException ex) { JOptionPane.showMessageDialog(null, "Data de Nascimento Invlida", "Mensagem de Erro", JOptionPane.ERROR_MESSAGE); } }
From source file:com.mycompany.trafficimportfileconverter2.Main2Controller.java
private void loadInInfo(File file) { BufferedReader TSVFile = null; //get rid of any dates and data already there. dates.clear();/* w w w . j ava2 s .c o m*/ data.clear(); try { TSVFile = new BufferedReader(new FileReader(file.getAbsoluteFile())); String dataRow = TSVFile.readLine(); while (dataRow != null) { String[] row = dataRow.split("\t"); System.out.println(row[1] + "Will be:\n" + row[2]); dates.add(LocalDate.parse("20" + row[0])); data.add(getData(row)); dataRow = TSVFile.readLine(); } TSVFile.close(); log("Days in file: " + dates.size()); if (dates.size() > datePickers.length) { log("WARNING: More days found in file than can be displayed!\n" + "Only the first " + datePickers.length + " " + "can be displayed and configurable.\nThe last " + (dates.size() - datePickers.length) + " " + "dates in your file will be\nimported with" + " the dates untouched!\n\n"); log("Unconfigurable days that will be imported:"); for (int i = datePickers.length; i < dates.size(); i++) { log(dates.get(i).format(DateTimeFormatter.ISO_DATE)); } } System.out.println(); } catch (FileNotFoundException ex) { Logger.getLogger(Main2Controller.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Main2Controller.class.getName()).log(Level.SEVERE, null, ex); } catch (ArrayIndexOutOfBoundsException e) { Logger.getLogger(Main2Controller.class.getName()).log(Level.SEVERE, null, e); String str = "It appears like the file contents were invalid.\n" + "Please try again or a different file."; System.out.println(str); log(str); } finally { try { TSVFile.close(); } catch (IOException ex) { Logger.getLogger(Main2Controller.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:org.ojbc.adapters.analyticsstaging.custody.processor.AbstractReportRepositoryProcessor.java
protected void processBehavioralHealthInfo(Node personNode, Integer personId, String extPrefix) throws Exception { String behavioralHealthInfoRef = XmlUtils.xPathStringSearch(personNode, extPrefix + ":PersonBehavioralHealthInformation/@s30:ref"); String personCareEpisodeRef = XmlUtils.xPathStringSearch(personNode, extPrefix + ":PersonCareEpisode/@s30:ref"); if (StringUtils.isNotBlank(behavioralHealthInfoRef) || StringUtils.isNotBlank(personCareEpisodeRef)) { BehavioralHealthAssessment assessment = new BehavioralHealthAssessment(); assessment.setPersonId(personId); Node behavioralHealthInfoNode = XmlUtils.xPathNodeSearch(personNode, "following-sibling::" + extPrefix + ":BehavioralHealthInformation['" + behavioralHealthInfoRef + "']"); if (behavioralHealthInfoNode != null) { String seriousMentalIllnessIndicator = XmlUtils.xPathStringSearch(behavioralHealthInfoNode, extPrefix + ":SeriousMentalIllnessIndicator"); assessment.setSeriousMentalIllness(BooleanUtils.toBooleanObject(seriousMentalIllnessIndicator)); String medicaidIndicator = XmlUtils.xPathStringSearch(behavioralHealthInfoNode, "hs:MedicaidIndicator"); Boolean medicaidIndicatorBoolean = BooleanUtils.toBooleanObject(medicaidIndicator); String medicaidStatusType = BooleanUtils.toString(medicaidIndicatorBoolean, "eligible", "not eligible", null); assessment.setMedicaidStatusTypeId(descriptionCodeLookupService .retrieveCode(CodeTable.MedicaidStatusType, medicaidStatusType)); String regionalAuthorityAssignmentText = XmlUtils.xPathStringSearch(behavioralHealthInfoNode, extPrefix + ":RegionalBehavioralHealthAuthorityAssignmentText"); assessment.setEnrolledProviderName(regionalAuthorityAssignmentText); Boolean substanceAbuseIndicator = BooleanUtils.toBooleanObject(XmlUtils .xPathStringSearch(behavioralHealthInfoNode, extPrefix + ":SubstanceAbuseIndicator")); if (BooleanUtils.isTrue(substanceAbuseIndicator)) { Integer assessmentCategoryTypeId = descriptionCodeLookupService .retrieveCode(CodeTable.AssessmentCategoryType, ASSESSMENT_CATEGORY_SUBSTANCE_ABUSE); assessment.getAssessmentCategory() .add(new KeyValue(assessmentCategoryTypeId, ASSESSMENT_CATEGORY_SUBSTANCE_ABUSE)); }//from ww w . ja v a 2s . co m Boolean generalMentalHealthConditionIndicator = BooleanUtils .toBooleanObject(XmlUtils.xPathStringSearch(behavioralHealthInfoNode, extPrefix + ":GeneralMentalHealthConditionIndicator")); if (BooleanUtils.isTrue(generalMentalHealthConditionIndicator)) { Integer assessmentCategoryTypeId = descriptionCodeLookupService.retrieveCode( CodeTable.AssessmentCategoryType, ASSESSMENT_CATEGORY_GENERAL_MENTAL_HEALTH); assessment.getAssessmentCategory() .add(new KeyValue(assessmentCategoryTypeId, ASSESSMENT_CATEGORY_GENERAL_MENTAL_HEALTH)); } String careEpisodeStartDateString = XmlUtils.xPathStringSearch(personNode, "following-sibling::" + extPrefix + ":CareEpisode[@s30:id='" + personCareEpisodeRef + "']/nc30:ActivityDateRange/nc30:StartDate/nc30:Date"); LocalDate careEpisodeStartDate = StringUtils.isNotBlank(careEpisodeStartDateString) ? LocalDate.parse(careEpisodeStartDateString) : null; assessment.setCareEpisodeStartDate(careEpisodeStartDate); String careEpisodeEndDateString = XmlUtils.xPathStringSearch(personNode, "following-sibling::" + extPrefix + ":CareEpisode[@s30:id='" + personCareEpisodeRef + "']/nc30:ActivityDateRange/nc30:EndDate/nc30:Date"); LocalDate careEpisodeEndDate = StringUtils.isNotBlank(careEpisodeEndDateString) ? LocalDate.parse(careEpisodeEndDateString) : null; assessment.setCareEpisodeEndDate(careEpisodeEndDate); Integer assessmentId = analyticalDatastoreDAO.saveBehavioralHealthAssessment(assessment); assessment.setBehavioralHealthAssessmentId(assessmentId); processEvaluationNodes(assessment, behavioralHealthInfoNode, extPrefix); processTreatmentNodes(assessment, behavioralHealthInfoNode, extPrefix); processPrescribedMedications(assessment, behavioralHealthInfoNode, extPrefix); } } }