protected void writeRecord(IBaseRecord record) throws Exception { CreateSelectiveServiceRecordImpl ssRecord = (CreateSelectiveServiceRecordImpl) record; Applicant applicant = ssRecord.getApplicant(); IssuanceDoc dl = applicant.getLicense(); IssuanceDoc unl = applicant.getUNL(); IssuanceDoc id = applicant.getStateID(); IssuanceDoc issuanceDoc = null; if (dl != null) { issuanceDoc = dl; } else if (unl != null) { issuanceDoc = unl; } else { issuanceDoc = id; } if (issuanceDoc == null) throw new RuntimeException("unable to find an issuance doc for the current applicant"); String dlIdUnl = HandlerUtil.padding(issuanceDoc.getDlIdUnlNumber(), 10); String lastName = HandlerUtil.padding(applicant.getLastName(), 40); String firstName = HandlerUtil.padding(applicant.getFirstName(), 40); String middleName = HandlerUtil.padding(applicant.getMiddleName(), 40); String suffix = HandlerUtil.padding(convertSuffix(applicant.getSuffix()), 5); String physicalStreet1 = HandlerUtil.padding(applicant.getPhysicalAddress().getStreet1(), 32); String physicalStreet2 = HandlerUtil.padding(applicant.getPhysicalAddress().getStreet2(), 32); String physicalCity = HandlerUtil.padding(applicant.getPhysicalAddress().getCity(), 33); String physicalState = HandlerUtil.padding(applicant.getPhysicalAddress().getState(), 2); String physicalZipCode = HandlerUtil.padding(applicant.getPhysicalAddress().getZip(), 5); String physicalZipCodeExt = HandlerUtil.padding(applicant.getPhysicalAddress().getZipExt(), 4); if (physicalZipCode == null || (physicalZipCodeExt != null && physicalZipCodeExt.trim().length() == 0)) { physicalZipCodeExt = "0000"; } String formatedDob = DateUtil.formatDate("MMddyyyy", applicant.getPlaceOfBirthInfo().getBrthDob()); String dateOfBirth = HandlerUtil.padding(formatedDob, 8); String ssn = HandlerUtil.padding(applicant.getSsn(), 9); String formatedAppDate = DateUtil.formatDate("MMddyyyy", new Date()); String applicationDate = HandlerUtil.padding(formatedAppDate, 8); String errorFlag = convertErrDelFlag(applicant.getErrDelFlag()); String output = new StringBuffer() .append(dlIdUnl) .append(lastName) .append(firstName) .append(middleName) .append(suffix) .append(physicalStreet1) .append(physicalStreet2) .append(physicalCity) .append(physicalState) .append(physicalZipCode) .append(physicalZipCodeExt) .append(dateOfBirth) .append(ssn) .append(applicationDate) .append(errorFlag) .toString(); writer.write(output + "\r\n"); }
public void validate(Object command, Errors errors) { Enforcement ea = (Enforcement) command; if (!DataDictionaryValidator.validateLiftDate(DateUtil.formatDate(ea.getLiftDate()), true)) { errors.reject("error.LiftDate"); } }
private void validateBirthInfo(Errors errors, ApplicantBean appBean) { if (!DataDictionaryValidator.validateCity(appBean.getPlaceOfBirthInfo().getCity(), false)) { errors.rejectValue( "placeOfBirthInfo.city", "error.li.person.cityofbirth", null, "Invalid city of birth."); } if ("TX".equalsIgnoreCase(appBean.getPlaceOfBirthInfo().getState()) && !DataDictionaryValidator.validateCounty( appBean.getPlaceOfBirthInfo().getCounty(), false)) { errors.rejectValue( "placeOfBirthInfo.county", "error.li.person.county", null, "Invalid county of birth."); } if (!DataDictionaryValidator.validateState(appBean.getPlaceOfBirthInfo().getState(), false)) { errors.rejectValue( "placeOfBirthInfo.state", "error.li.person.state", null, "Invalid state of birth."); } if (!DataDictionaryValidator.validateCountry( appBean.getPlaceOfBirthInfo().getCountry(), false)) { errors.rejectValue( "placeOfBirthInfo.country", "error.li.person.country", null, "Invalid Country of birth."); } if (!DataDictionaryValidator.validateDateOfBirthDOB( DateUtil.formatDate(appBean.getPlaceOfBirthInfo().getBrthDob()), true)) { errors.rejectValue( "placeOfBirthInfo.dateOfBirth", "error.li.person.dob", null, "Invalid Date of birth(Format:mm/dd/yyyy). - " + appBean.getPlaceOfBirthInfo().getBrthDob()); } }
private void setDates(Enforcement ea, String suspensionPeriod) { ea.setEnfActionBegDate(new Date()); if (suspensionPeriod != null) { int suspensionDays = Integer.parseInt(suspensionPeriod); ea.setEnfActionEndDate( DateUtil.getFutureDateAsDate(ea.getEnfActionBegDate(), suspensionDays)); } else { ea.setEnfActionEndDate(Utility.INDEFINITE); } }
private void validateBirthDate(Errors errors, ApplicantBean appBean) { if (!DataDictionaryValidator.validateDateOfBirthDOB( DateUtil.formatDate(appBean.getPlaceOfBirthInfo().getBrthDob()), true)) { errors.rejectValue( "placeOfBirthInfo.brthDob", "error.li.person.dob", null, "Invalid Date of birth(Format:mm/dd/yyyy). - " + appBean.getPlaceOfBirthInfo().getBrthDob()); } }
private void writeHeader() throws Exception { try { writer.write("H"); writer.write(DateUtil.formatDate("MMddyyyy", new Date())); writer.write("\r\n"); } catch (Exception e) { logger.error("Exception during writeHeader()", e); rc = false; throw new RuntimeException("Exception during writeHeader(), " + e.getMessage()); } }
protected void writeHeader() throws Exception { writer.write("H"); writer.write(DateUtil.formatDate("MMddyyyy", new Date())); writer.write("\r\n"); }