List of usage examples for org.apache.commons.lang BooleanUtils toBooleanObject
public static Boolean toBooleanObject(String str)
Converts a String to a Boolean.
'true'
, 'on'
or 'yes'
(case insensitive) will return true
.
From source file:org.objectstyle.cayenne.dataview.DataTypeSpec.java
public Object toDataType(DataTypeEnum dataType, Object untypedValue) { Class dataTypeClass = getJavaClass(dataType); if (dataTypeClass == null || untypedValue == null || ClassUtils.isAssignable(untypedValue.getClass(), dataTypeClass)) { if (DataTypeEnum.DATE_TYPE.equals(dataType) && Date.class.equals(dataTypeClass)) { return DateUtils.truncate(untypedValue, Calendar.DATE); }// w w w. jav a2s .c o m return untypedValue; } Object v = null; String strUntypedValue = null; boolean isStringUntypedValue; Number numUntypedValue = null; boolean isNumberUntypedValue; if (isStringUntypedValue = untypedValue instanceof String) strUntypedValue = (String) untypedValue; if (isNumberUntypedValue = untypedValue instanceof Number) numUntypedValue = (Number) untypedValue; switch (dataType.getValue()) { case DataTypeEnum.BOOLEAN_TYPE_VALUE: if (isNumberUntypedValue) v = BooleanUtils.toBooleanObject(numUntypedValue.intValue()); else if (isStringUntypedValue) v = BooleanUtils.toBooleanObject(strUntypedValue); break; case DataTypeEnum.INTEGER_TYPE_VALUE: if (isNumberUntypedValue) v = new Integer(numUntypedValue.intValue()); else if (isStringUntypedValue) v = NumberUtils.createInteger(strUntypedValue); break; case DataTypeEnum.DOUBLE_TYPE_VALUE: if (isNumberUntypedValue) v = new Double(numUntypedValue.doubleValue()); else if (isStringUntypedValue) v = NumberUtils.createDouble(strUntypedValue); break; case DataTypeEnum.STRING_TYPE_VALUE: v = ObjectUtils.toString(untypedValue); break; case DataTypeEnum.DATE_TYPE_VALUE: if (isNumberUntypedValue) v = DateUtils.truncate(new Date(numUntypedValue.longValue()), Calendar.DATE); break; case DataTypeEnum.DATETIME_TYPE_VALUE: if (isNumberUntypedValue) v = new Date(numUntypedValue.longValue()); break; case DataTypeEnum.MONEY_TYPE_VALUE: if (isNumberUntypedValue) v = new Double(numUntypedValue.doubleValue()); else if (isStringUntypedValue) v = NumberUtils.createDouble(strUntypedValue); break; case DataTypeEnum.PERCENT_TYPE_VALUE: if (isNumberUntypedValue) v = new Double(numUntypedValue.doubleValue()); else if (isStringUntypedValue) v = NumberUtils.createDouble(strUntypedValue); break; } return v; }
From source file:org.objectstyle.cayenne.dataview.DataTypeSpec.java
public Object fromDataType(Class untypedValueClass, DataTypeEnum dataType, Object typedValue) { if (typedValue == null) return null; Class dataTypeClass = getJavaClass(dataType); // Validate.isTrue(typedValue.getClass().equals(dataTypeClass)); if (untypedValueClass == null) return typedValue; if (ClassUtils.isAssignable(dataTypeClass, untypedValueClass)) return typedValue; String strTypedValue = null;//from w w w . j a va 2 s.c o m boolean isStringTypedValue; Number numTypedValue = null; boolean isNumberTypedValue; Boolean boolTypedValue = null; boolean isBooleanTypedValue; Date dateTypedValue = null; boolean isDateTypedValue; if (isStringTypedValue = typedValue instanceof String) strTypedValue = (String) typedValue; if (isNumberTypedValue = typedValue instanceof Number) numTypedValue = (Number) typedValue; if (isBooleanTypedValue = typedValue instanceof Boolean) boolTypedValue = (Boolean) typedValue; if (isDateTypedValue = typedValue instanceof Date) dateTypedValue = (Date) typedValue; Object v = null; if (String.class.equals(untypedValueClass)) { v = ObjectUtils.toString(typedValue); } else if (BigDecimal.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createBigDecimal(strTypedValue); else if (isNumberTypedValue) v = new BigDecimal(numTypedValue.doubleValue()); else if (isBooleanTypedValue) v = new BigDecimal(BooleanUtils.toInteger(boolTypedValue.booleanValue())); else if (isDateTypedValue) v = new BigDecimal(dateTypedValue.getTime()); } else if (Boolean.class.equals(untypedValueClass)) { if (isStringTypedValue) v = BooleanUtils.toBooleanObject(strTypedValue); else if (isNumberTypedValue) v = BooleanUtils.toBooleanObject(numTypedValue.intValue()); else if (isDateTypedValue) v = BooleanUtils.toBooleanObject((int) dateTypedValue.getTime()); } else if (Byte.class.equals(untypedValueClass)) { if (isStringTypedValue) v = Byte.valueOf(strTypedValue); else if (isNumberTypedValue) v = new Byte(numTypedValue.byteValue()); else if (isBooleanTypedValue) v = new Byte((byte) BooleanUtils.toInteger(boolTypedValue.booleanValue())); else if (isDateTypedValue) v = new Byte((byte) dateTypedValue.getTime()); } else if (byte[].class.equals(untypedValueClass)) { if (isStringTypedValue) v = strTypedValue.getBytes(); } else if (Double.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createDouble(strTypedValue); else if (isNumberTypedValue) v = new Double(numTypedValue.doubleValue()); else if (isBooleanTypedValue) v = new Double(BooleanUtils.toInteger(boolTypedValue.booleanValue())); else if (isDateTypedValue) v = new Double(dateTypedValue.getTime()); } else if (Float.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createFloat(strTypedValue); else if (isNumberTypedValue) v = new Float(numTypedValue.floatValue()); else if (isBooleanTypedValue) v = new Float(BooleanUtils.toInteger(boolTypedValue.booleanValue())); else if (isDateTypedValue) v = new Float(dateTypedValue.getTime()); } else if (Integer.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createInteger(strTypedValue); else if (isNumberTypedValue) v = new Integer(numTypedValue.intValue()); else if (isBooleanTypedValue) v = BooleanUtils.toIntegerObject(boolTypedValue.booleanValue()); else if (isDateTypedValue) v = new Integer((int) dateTypedValue.getTime()); } else if (Long.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createLong(strTypedValue); else if (isNumberTypedValue) v = new Long(numTypedValue.longValue()); else if (isBooleanTypedValue) v = new Long(BooleanUtils.toInteger(boolTypedValue.booleanValue())); else if (isDateTypedValue) v = new Long(dateTypedValue.getTime()); } else if (java.sql.Date.class.equals(untypedValueClass)) { if (isNumberTypedValue) v = new java.sql.Date(numTypedValue.longValue()); else if (isDateTypedValue) v = new java.sql.Date(dateTypedValue.getTime()); } else if (java.sql.Time.class.equals(untypedValueClass)) { if (isNumberTypedValue) v = new java.sql.Time(numTypedValue.longValue()); else if (isDateTypedValue) v = new java.sql.Time(dateTypedValue.getTime()); } else if (java.sql.Timestamp.class.equals(untypedValueClass)) { if (isNumberTypedValue) v = new java.sql.Timestamp(numTypedValue.longValue()); else if (isDateTypedValue) v = new java.sql.Timestamp(dateTypedValue.getTime()); } else if (Date.class.equals(untypedValueClass)) { if (isNumberTypedValue) v = new Date(numTypedValue.longValue()); } return v; }
From source file:org.ojbc.adapters.analyticsstaging.custody.processor.AbstractReportRepositoryProcessor.java
protected Integer savePerson(Node personNode, String personUniqueIdentifier, String extPrefix) throws Exception { Person person = new Person(); person.setPersonUniqueIdentifier(personUniqueIdentifier); person.setPersonUniqueIdentifier2(XmlUtils.xPathStringSearch(personNode, "preceding-sibling::jxdm51:Booking/jxdm51:BookingSubject/jxdm51:SubjectIdentification/nc30:IdentificationID")); ;//www. j a v a2s . com String personRaceCode = XmlUtils.xPathStringSearch(personNode, "jxdm51:PersonRaceCode"); if (StringUtils.isBlank(personRaceCode)) { personRaceCode = XmlUtils.xPathStringSearch(personNode, "pc-bkg-codes:PersonRaceCode"); } person.setPersonRaceCode(personRaceCode); person.setPersonRaceId(descriptionCodeLookupService.retrieveCode(CodeTable.PersonRaceType, personRaceCode)); String personSex = XmlUtils.xPathStringSearch(personNode, "jxdm51:PersonSexCode"); person.setPersonSexCode(StringUtils.trimToNull(personSex)); person.setPersonSexId(descriptionCodeLookupService.retrieveCode(CodeTable.PersonSexType, personSex)); String personEthnicityType = XmlUtils.xPathStringSearch(personNode, "jxdm51:PersonEthnicityCode"); person.setPersonEthnicityTypeDescription(StringUtils.trimToNull(personEthnicityType)); person.setPersonEthnicityTypeId(descriptionCodeLookupService.retrieveCode(CodeTable.PersonEthnicityType, StringUtils.trimToNull(personEthnicityType))); String personBirthDate = XmlUtils.xPathStringSearch(personNode, "nc30:PersonBirthDate/nc30:Date"); person.setPersonBirthDate(LocalDate.parse(personBirthDate)); String language = XmlUtils.xPathStringSearch(personNode, "nc30:PersonPrimaryLanguage/nc30:LanguageName"); person.setLanguage(language); person.setLanguageId(descriptionCodeLookupService.retrieveCode(CodeTable.LanguageType, language)); String personCriminalHistorySummaryRef = XmlUtils.xPathStringSearch(personNode, "parent::br-doc:BookingReport/nc30:ActivityPersonAssociation" + "[nc30:Person/@s30:ref=/br-doc:BookingReport/jxdm51:Booking/jxdm51:BookingSubject/nc30:RoleOfPerson/@s30:ref]/nc30:Activity/@s30:ref"); String registeredSexOffender = XmlUtils.xPathStringSearch(personNode, "/br-doc:BookingReport/jxdm51:PersonCriminalHistorySummary[@s30:id='" + personCriminalHistorySummaryRef + "']/jxdm51:RegisteredSexualOffenderIndicator"); Boolean registeredSexOffenderBoolean = BooleanUtils.toBooleanObject(registeredSexOffender); String sexOffenderStatus = BooleanUtils.toString(registeredSexOffenderBoolean, "registered", "not registered", null); person.setSexOffenderStatusTypeId( descriptionCodeLookupService.retrieveCode(CodeTable.SexOffenderStatusType, sexOffenderStatus)); String educationLevel = XmlUtils.xPathStringSearch(personNode, "nc30:PersonEducationLevelText"); person.setEducationLevel(educationLevel); String occupation = XmlUtils.xPathStringSearch(personNode, "jxdm51:PersonAugmentation/nc30:EmployeeOccupationCategoryText"); person.setOccupation(occupation); Boolean homelessIndicator = BooleanUtils .toBooleanObject(XmlUtils.xPathStringSearch(personNode, extPrefix + ":PersonHomelessIndicator")); String domicileStatusType = BooleanUtils.toString(homelessIndicator, "homeless", "not homeless", null); person.setDomicileStatusTypeId( descriptionCodeLookupService.retrieveCode(CodeTable.DomicileStatusType, domicileStatusType)); Boolean personVeteranBenefitsEligibilityIndicator = BooleanUtils.toBooleanObject( XmlUtils.xPathStringSearch(personNode, extPrefix + ":PersonVeteranBenefitsEligibilityIndicator")); String programEligibilityType = BooleanUtils.toString(personVeteranBenefitsEligibilityIndicator, "Veteran Services", "none", null); person.setProgramEligibilityTypeId(descriptionCodeLookupService .retrieveCode(CodeTable.ProgramEligibilityType, programEligibilityType)); Boolean inmateWorkReleaseIndicator = BooleanUtils.toBooleanObject(XmlUtils.xPathStringSearch(personNode, "preceding-sibling::jxdm51:Detention/" + extPrefix + ":InmateWorkReleaseIndicator")); String workReleaseStatusType = BooleanUtils.toString(inmateWorkReleaseIndicator, "assigned", "not assigned", null); person.setWorkReleaseStatusTypeId( descriptionCodeLookupService.retrieveCode(CodeTable.WorkReleaseStatusType, workReleaseStatusType)); ; String militaryServiceStatusCode = XmlUtils.xPathStringSearch(personNode, "nc30:PersonMilitarySummary/ac-bkg-codes:MilitaryServiceStatusCode"); Integer militaryServiceStatusTypeId = descriptionCodeLookupService .retrieveCode(CodeTable.MilitaryServiceStatusType, militaryServiceStatusCode); person.setMilitaryServiceStatusType(new KeyValue(militaryServiceStatusTypeId, militaryServiceStatusCode)); Integer personId = analyticalDatastoreDAO.savePerson(person); return personId; }
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)); }/* w w w.java2 s .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); } } }
From source file:org.ojbc.adapters.analyticsstaging.custody.processor.AbstractReportRepositoryProcessor.java
private void processTreatmentNodes(BehavioralHealthAssessment assessment, Node behavioralHealthInfoNode, String extPrefix) throws Exception { NodeList treatmentNodes = XmlUtils.xPathNodeListSearch(behavioralHealthInfoNode, "nc30:Treatment"); if (treatmentNodes.getLength() > 0) { List<Treatment> treatments = new ArrayList<Treatment>(); for (int i = 0; i < treatmentNodes.getLength(); i++) { Node treatmentNode = treatmentNodes.item(i); Treatment treatment = new Treatment(); treatment.setBehavioralHealthAssessmentID(assessment.getBehavioralHealthAssessmentId()); String startDateString = XmlUtils.xPathStringSearch(treatmentNode, "nc30:ActivityDateRange/nc30:StartDate/nc30:Date"); if (StringUtils.isNotBlank(startDateString)) { treatment.setTreatmentStartDate(LocalDate.parse(startDateString)); }//from ww w. j a v a 2s . co m String treatmentProvider = XmlUtils.xPathStringSearch(treatmentNode, "nc30:TreatmentProvider/nc30:EntityOrganization/nc30:OrganizationName"); treatment.setTreatmentProviderName(treatmentProvider); Boolean treatmentCourtOrdered = BooleanUtils.toBooleanObject( XmlUtils.xPathStringSearch(treatmentNode, extPrefix + ":TreatmentCourtOrderedIndicator")); String treatmentAdmissionReason = BooleanUtils.toString(treatmentCourtOrdered, "court ordered", "voluntary", null); treatment.setTreatmentAdmissionReasonTypeId(descriptionCodeLookupService .retrieveCode(CodeTable.TreatmentAdmissionReasonType, treatmentAdmissionReason)); Boolean treatmentActive = BooleanUtils.toBooleanObject( XmlUtils.xPathStringSearch(treatmentNode, extPrefix + ":TreatmentActiveIndicator")); String treamentStatusType = BooleanUtils.toString(treatmentActive, "active", "inactive", null); treatment.setTreatmentStatusTypeId(descriptionCodeLookupService .retrieveCode(CodeTable.TreatmentStatusType, treamentStatusType)); treatments.add(treatment); } analyticalDatastoreDAO.saveTreatments(treatments); assessment.setTreatments(treatments); } }
From source file:org.ojbc.adapters.analyticsstaging.custody.processor.BookingReportProcessor.java
@Transactional private Booking processBookingReport(Document report) throws Exception { Node bookingReportNode = XmlUtils.xPathNodeSearch(report, "/br-doc:BookingReport"); String bookingNumber = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Booking/jxdm51:BookingAgencyRecordIdentification/nc30:IdentificationID"); checkBookingNumber(bookingNumber);//from www . j a va 2 s. c o m Booking booking = new Booking(); booking.setBookingNumber(bookingNumber); Integer personId = processPersonAndBehavioralHealthInfo(report); booking.setPersonId(personId); String bookingDateTimeString = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Booking/nc30:ActivityDate/nc30:DateTime"); LocalDateTime bookingDateTime = parseLocalDateTime(bookingDateTimeString); if (bookingDateTime != null) { booking.setBookingDate(bookingDateTime.toLocalDate()); booking.setBookingTime(bookingDateTime.toLocalTime()); } else { String bookingDateString = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Booking/nc30:ActivityDate/nc30:Date"); booking.setBookingDate(parseLocalDate(bookingDateString)); } String facility = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Booking/jxdm51:BookingDetentionFacility/nc30:FacilityIdentification/nc30:IdentificationID"); Integer facilityId = descriptionCodeLookupService.retrieveCode(CodeTable.Facility, facility); booking.setFacilityId(facilityId); String supervisionUnitType = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Detention/jxdm51:SupervisionAugmentation/jxdm51:SupervisionAreaIdentification/nc30:IdentificationID"); Integer supervisionUnitTypeId = descriptionCodeLookupService.retrieveCode(CodeTable.SupervisionUnitType, supervisionUnitType); booking.setSupervisionUnitTypeId(supervisionUnitTypeId); String supervisionReleaseEligibilityDate = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Detention/jxdm51:SupervisionAugmentation/jxdm51:SupervisionReleaseEligibilityDate/nc30:Date"); booking.setScheduledReleaseDate(parseLocalDate(supervisionReleaseEligibilityDate)); String inmateJailResidentIndicator = XmlUtils.xPathStringSearch(bookingReportNode, "jxdm51:Detention/br-ext:InmateJailResidentIndicator"); booking.setInmateJailResidentIndicator(BooleanUtils.toBooleanObject(inmateJailResidentIndicator)); Integer bookingId = analyticalDatastoreDAO.saveBooking(booking); booking.setBookingId(bookingId); processCustodyReleaseInfo(bookingReportNode, bookingId, bookingNumber); return booking; }
From source file:org.ojbc.adapters.analyticsstaging.custody.processor.CustodyStatusChangeReportProcessor.java
@Transactional private Integer processCustodyStatusChangeReport(Document report) throws Exception { CustodyStatusChange custodyStatusChange = new CustodyStatusChange(); Node personNode = XmlUtils.xPathNodeSearch(report, "/cscr-doc:CustodyStatusChangeReport/cscr-ext:Custody/nc30:Person"); Node custodyNode = XmlUtils.xPathNodeSearch(report, "/cscr-doc:CustodyStatusChangeReport/cscr-ext:Custody"); String bookingNumber = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Booking/jxdm51:BookingAgencyRecordIdentification/nc30:IdentificationID"); custodyStatusChange.setBookingNumber(bookingNumber); Integer bookingId = getBookingIdByBookingNumber(bookingNumber); custodyStatusChange.setBookingId(bookingId); Integer personId = processPersonAndBehavioralHealthInfo(personNode, bookingNumber); custodyStatusChange.setPersonId(personId); String bookingDateTimeString = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Booking/nc30:ActivityDate/nc30:DateTime"); LocalDateTime bookingDateTime = parseLocalDateTime(bookingDateTimeString); if (bookingDateTime != null) { custodyStatusChange.setBookingDate(bookingDateTime.toLocalDate()); custodyStatusChange.setBookingTime(bookingDateTime.toLocalTime()); } else {/*from ww w.j a v a 2s . co m*/ String bookingDateString = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Booking/nc30:ActivityDate/nc30:Date"); custodyStatusChange.setBookingDate(parseLocalDate(bookingDateString)); } String facility = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Booking/jxdm51:BookingDetentionFacility/nc30:FacilityIdentification/nc30:IdentificationID"); Integer facilityId = descriptionCodeLookupService.retrieveCode(CodeTable.Facility, facility); custodyStatusChange.setFacilityId(facilityId); String supervisionUnitType = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Detention/jxdm51:SupervisionAugmentation/jxdm51:SupervisionAreaIdentification/nc30:IdentificationID"); Integer supervisionUnitTypeId = descriptionCodeLookupService.retrieveCode(CodeTable.SupervisionUnitType, supervisionUnitType); custodyStatusChange.setSupervisionUnitTypeId(supervisionUnitTypeId); String supervisionReleaseEligibilityDate = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Detention/jxdm51:SupervisionAugmentation/jxdm51:SupervisionReleaseEligibilityDate/nc30:Date"); custodyStatusChange.setScheduledReleaseDate(parseLocalDate(supervisionReleaseEligibilityDate)); String inmateJailResidentIndicator = XmlUtils.xPathStringSearch(custodyNode, "jxdm51:Detention/cscr-ext:InmateJailResidentIndicator"); custodyStatusChange .setInmateJailResidentIndicator(BooleanUtils.toBooleanObject(inmateJailResidentIndicator)); processCustodyReleaseInfo(custodyNode, bookingId, bookingNumber); Integer custodyStatusChangeId = analyticalDatastoreDAO.saveCustodyStatusChange(custodyStatusChange); return custodyStatusChangeId; }
From source file:org.ojbc.adapters.rapbackdatastore.processor.SubscriptionReportingProcessor.java
private FbiRapbackSubscription buildFbiSubscriptionFromUpdate(Document report) throws Exception { Node rootNode = XmlUtils.xPathNodeSearch(report, "/fed_subcr_upd-doc:FederalSubscriptionUpdateReport"); Node rapbackSubscriptionData = XmlUtils.xPathNodeSearch(rootNode, "fed_subcr_upd-ext:RapBackSubscriptionData"); FbiRapbackSubscription fbiRapbackSubscription = new FbiRapbackSubscription(); String rapBackActivityNotificationFormatCode = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackActivityNotificationFormatCode"); fbiRapbackSubscription.setRapbackActivityNotificationFormat(rapBackActivityNotificationFormatCode); String rapBackExpirationDate = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackExpirationDate/nc30:Date"); fbiRapbackSubscription.setRapbackExpirationDate(XmlUtils.parseXmlDate(rapBackExpirationDate)); String rapBackInStateOptOutIndicator = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackInStateOptOutIndicator"); fbiRapbackSubscription.setRapbackOptOutInState(BooleanUtils.toBooleanObject(rapBackInStateOptOutIndicator)); String rapBackSubscriptionDate = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackSubscriptionDate/nc30:Date"); fbiRapbackSubscription.setRapbackStartDate(XmlUtils.parseXmlDate(rapBackSubscriptionDate)); String rapBackSubscriptionIdentification = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackSubscriptionIdentification/nc30:IdentificationID"); fbiRapbackSubscription.setFbiSubscriptionId(rapBackSubscriptionIdentification); String rapBackSubscriptionTermCode = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackSubscriptionTermCode"); fbiRapbackSubscription.setSubscriptionTerm(rapBackSubscriptionTermCode); String rapBackTermDate = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr_upd-ext:RapBackTermDate/nc30:Date"); fbiRapbackSubscription.setRapbackTermDate(XmlUtils.parseXmlDate(rapBackTermDate)); String ucn = XmlUtils.xPathStringSearch(rootNode, "nc30:Person[@s30:id=../jxdm50:Subject/nc30:RoleOfPerson/@s30:ref]/jxdm50:PersonAugmentation/jxdm50:PersonFBIIdentification/nc30:IdentificationID"); fbiRapbackSubscription.setUcn(ucn);// w ww . ja v a 2 s . com return fbiRapbackSubscription; }
From source file:org.ojbc.adapters.rapbackdatastore.processor.SubscriptionReportingProcessor.java
private FbiRapbackSubscription buildNewFbiSubscription(Document report) throws Exception { Node rootNode = XmlUtils.xPathNodeSearch(report, "/fed_subcr-doc:FederalSubscriptionCreationReport"); Node rapbackSubscriptionData = XmlUtils.xPathNodeSearch(rootNode, "fed_subcr-ext:RapBackSubscriptionData"); FbiRapbackSubscription fbiRapbackSubscription = new FbiRapbackSubscription(); String rapBackActivityNotificationFormatCode = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackActivityNotificationFormatCode"); fbiRapbackSubscription.setRapbackActivityNotificationFormat(rapBackActivityNotificationFormatCode); String rapBackCategoryCode = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackCategoryCode"); fbiRapbackSubscription.setRapbackCategory(rapBackCategoryCode); String rapBackExpirationDate = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackExpirationDate/nc30:Date"); fbiRapbackSubscription.setRapbackExpirationDate(XmlUtils.parseXmlDate(rapBackExpirationDate)); String rapBackInStateOptOutIndicator = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackInStateOptOutIndicator"); fbiRapbackSubscription.setRapbackOptOutInState(BooleanUtils.toBooleanObject(rapBackInStateOptOutIndicator)); String rapBackSubscriptionDate = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackSubscriptionDate/nc30:Date"); fbiRapbackSubscription.setRapbackStartDate(XmlUtils.parseXmlDate(rapBackSubscriptionDate)); String rapBackSubscriptionIdentification = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackSubscriptionIdentification/nc30:IdentificationID"); fbiRapbackSubscription.setFbiSubscriptionId(rapBackSubscriptionIdentification); String rapBackSubscriptionTermCode = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackSubscriptionTermCode"); fbiRapbackSubscription.setSubscriptionTerm(rapBackSubscriptionTermCode); String rapBackTermDate = XmlUtils.xPathStringSearch(rapbackSubscriptionData, "fed_subcr-ext:RapBackTermDate/nc30:Date"); fbiRapbackSubscription.setRapbackTermDate(XmlUtils.parseXmlDate(rapBackTermDate)); String ucn = XmlUtils.xPathStringSearch(rootNode, "nc30:Person[@s30:id=../jxdm50:Subject/nc30:RoleOfPerson/@s30:ref]/jxdm50:PersonAugmentation/jxdm50:PersonFBIIdentification/nc30:IdentificationID"); fbiRapbackSubscription.setUcn(ucn);/*from w w w. j a va2s.c o m*/ return fbiRapbackSubscription; }
From source file:org.ojbc.web.WebUtils.java
public static Boolean getFederatedQueryUserIndicator(Element samlAssertion) { String federatedQueryUserIndicatorString = null; try {/*from w ww . j a v a 2 s . c o m*/ federatedQueryUserIndicatorString = XmlUtils.xPathStringSearch(samlAssertion, "/saml2:Assertion/saml2:AttributeStatement[1]/" + "saml2:Attribute[@Name='gfipm:ext:user:FederatedQueryUserIndicator']/saml2:AttributeValue"); } catch (Exception e) { log.warn("Failed to retrieve FederatedQueryUserIndicator"); e.printStackTrace(); } if (federatedQueryUserIndicatorString != null && federatedQueryUserIndicatorString.equals("1")) { federatedQueryUserIndicatorString = "true"; } Boolean federatedQueryUserIndicator = BooleanUtils .toBooleanObject(StringUtils.trimToNull(federatedQueryUserIndicatorString)); return federatedQueryUserIndicator; }