private void validateContactInfo(Errors errors, ApplicantBean appBean) {
   if (!DataDictionaryValidator.validatePhoneNumber(
       appBean.getHomePhoneInfo().getCtinContactInfo(), true)) {
     errors.rejectValue(
         "homePhoneInfo.ctinContactInfo",
         "error.li.person.phoneNumber1",
         null,
         "Invalid Phone Number 1.");
   }
   if (!DataDictionaryValidator.validatePhoneNumber(
       appBean.getOtherPhoneInfo().getCtinContactInfo(), false)) {
     errors.rejectValue(
         "otherPhoneInfo.ctinContactInfo",
         "error.li.person.phoneNumber2",
         null,
         "Invalid Phone Number 2.");
   }
   if (!DataDictionaryValidator.validateEmailAddress(
       appBean.getEmailInfo().getCtinContactInfo(), true)) {
     errors.rejectValue(
         "emailInfo.ctinContactInfo",
         "error.li.person.emailaddress",
         null,
         "Invalid email address.");
   }
 }
 private void validateCustomerType(ApplicantBean appBean, Errors errors) {
   // if(!DataDictionaryValidator.validateCustomerType(appBean.getOwnerType(),
   // true))
   if (appBean.getOwnerType() == null || appBean.getOwnerType() == "") {
     errors.rejectValue("ownerType", "error.li.customer.ownerType", null, "Invalid Customer Type");
   }
 }
 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 validateSsn(ApplicantBean appBean, Errors errors) {

    if (!DataDictionaryValidator.validateSocialSecurityNumberSSN(appBean.getSsn(), false)) {
      errors.rejectValue(
          "ssn", "error.li.person.socialsecuritynumber", null, "Invalid Social Security Number");
    }

    if (StringUtils.trimToNull(appBean.getSsn()) == null && !appBean.isSsnAffidavitBooleanValue()) {
      errors.reject(
          "error.li.cdl.ssn", "Either a Social Security Number or an Affadavit is required.");
    }
  }
 /*
  * private boolean isMailingAddressInfoPresent(Applicant appBean ,
  * HttpServletRequest request){ boolean retVal = false;
  *
  * String isMailingAddressPresent = (String)
  * request.getParameter("mailAddrTrig");
  *
  * if(isMailingAddressPresent== null) { retVal |=
  * StringUtils.isNotEmpty(xn.getMailingCity()); retVal |=
  * StringUtils.isNotEmpty(xn.getMailingCountry()); retVal |=
  * StringUtils.isNotEmpty(xn.getMailingState()); retVal |=
  * StringUtils.isNotEmpty(xn.getMailingStreetAddress1()); retVal |=
  * StringUtils.isNotEmpty(xn.getMailingStreetAddress2()); retVal |=
  * StringUtils.isNotEmpty(xn.getMailingZipCode()); retVal |=
  * StringUtils.isNotEmpty(xn.getMailingZipCodeExtension()); } else {
  * xn.setMailingCity(xn.getPhysicalCity());
  * xn.setMailingCountry(xn.getPhysicalCountry());
  * xn.setMailingState(xn.getPhysicalState());
  * xn.setMailingStreetAddress1(xn.getPhysicalStreetAddress1());
  * xn.setMailingStreetAddress2(xn.getPhysicalStreetAddress2());
  * xn.setMailingZipCode(xn.getPhysicalZipCode());
  * xn.setMailingZipCodeExtension(xn.getPhysicalZipCodeExtension());
  * appBean.getTransactionInProgress().setTransactionDetail(xn); retVal =
  * false; } return retVal; }
  */
 private void validateTemporaryVisitor(ApplicantBean appBean, Errors errors) {
   if (appBean != null && appBean.getOtherInfo() != null) {
     if (isUSCitizen(appBean.getOtherInfo()) && appBean.getOtherInfo().isTemporaryVisitor()) {
       errors.reject(
           "Invalid US Citizen1", "Applicant cannot be a US Citizen and a Temporary Visitor");
       return;
     }
     if (appBean.getOtherInfo().isTemporaryVisitor()
         && (appBean.getOtherInfo().getVisaExpirationDate() == null)) {
       errors.reject(
           "Invalid Temporary Visitor1",
           "Applicant requires a Temporary Visitor Expiration Date "
               + "when Temporary Visitor is true");
       return;
     }
     if (appBean.getOtherInfo().isTemporaryVisitor()
         && (appBean.getOtherInfo().getVisaExpirationDate() != null)) {
       if (!DataDictionaryValidator.validateDate(
           appBean.getOtherInfo().getVisaExpirationDate(), true)) {
         errors.reject(
             "Invalid Temporary Visitor Expiration Date1",
             "Invalid Temporary Visitor Expiration Date ");
         return;
       }
     }
   } else {
     return;
   }
 }
  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 validateBaseApplicantInfo(Errors errors, ApplicantBean appBean) {
    if (appBean.isNoFirstName() && StringUtils.isNotEmpty(appBean.getFirstName())) {
      errors.rejectValue(
          "firstName",
          "error.li.person.firstname",
          null,
          "First Name entered and No First Name Checked.");
    } else if (appBean.isNoFirstName() == false && StringUtils.isEmpty(appBean.getFirstName())) {
      errors.rejectValue(
          "noFirstName",
          "error.li.person.firstname",
          null,
          "No First Name entered and No First Name Checked.");
    }
    if (!DataDictionaryValidator.validateFirstName(appBean.getFirstName(), false)) {
      errors.rejectValue("firstName", "error.li.person.firstname", null, "Invalid First Name.");
    }
    if (!DataDictionaryValidator.validateLastName(appBean.getLastName(), true)) {
      errors.rejectValue("lastName", "error.li.person.lastname", null, "Invalid Last Name.");
    }
    if (!DataDictionaryValidator.validateMiddleName(appBean.getMiddleName(), false)) {
      errors.rejectValue("middleName", "error.li.person.middlename", null, "Invalid Middle Name.");
    }
    /*
     * if(!DataDictionaryValidator.validateSuffix(appBean.getSuffix(),false))
     * { errors.rejectValue("suffix", "error.li.person.suffix", null,
     * "Invalid Suffix."); }
     */

  }
 private void validateCitizenForUnknownValue(ApplicantBean appBean, Errors errors) {
   if (appBean != null
       && appBean.getOtherInfo() != null
       && appBean.getOtherInfo().getUsCitizen() == null) {
     errors.reject(
         "Invalid US Citizen Value",
         "US Citizen must be Yes or No. It cannot be Unknown for Issuance Transaction.");
   }
 }
 private void validatePhysicalDescription(Errors errors, ApplicantBean appBean) {
   if (!DataDictionaryValidator.validateSex(appBean.getPhysicalDescription().getSex(), true)) {
     errors.rejectValue("physicalDescription.sex", "error.li.person.sex", null, "Invalid sex.");
   }
   if (!DataDictionaryValidator.validateEyeColor(
       appBean.getPhysicalDescription().getEyecolor(), true)) {
     errors.rejectValue(
         "physicalDescription.eyecolor", "error.li.person.eyecolor", null, "Invalid Eye Color.");
   }
   if (!DataDictionaryValidator.validateHairColor(
       appBean.getPhysicalDescription().getHaircolor(), true)) {
     errors.rejectValue(
         "physicalDescription.haircolor",
         "error.li.person.haircolor",
         null,
         "Invalid Hair Color.");
   }
   if (!DataDictionaryValidator.validateRace(appBean.getPhysicalDescription().getRace(), true)) {
     errors.rejectValue("physicalDescription.race", "error.li.person.race", null, "Invalid Race.");
   }
   if (!DataDictionaryValidator.validateHeight(
       appBean.getPhysicalDescription().getHeight(), true)) {
     errors.rejectValue(
         "physicalDescription.height", "error.li.person.height", null, "Invalid height.");
   }
   if (!DataDictionaryValidator.validateWeight(
       appBean.getPhysicalDescription().getWeight(), true)) {
     errors.rejectValue(
         "physicalDescription.weight", "error.li.person.weight", null, "Invalid weight.");
   }
 }
  /**
   * Added the method only for Place of Birth Validation. AddDLPlaceOfBirth.jsp
   *
   * @param errors
   * @param appBean
   */
  private void validatePlaceOfBirthInfo(Errors errors, ApplicantBean appBean) {
    if (!DataDictionaryValidator.validateCity(appBean.getPlaceOfBirthInfo().getCity(), true)) {
      errors.rejectValue(
          "placeOfBirthInfo.city", "error.li.person.cityofbirth", null, "Invalid city of birth.");
    }

    if ("US".equalsIgnoreCase(appBean.getPlaceOfBirthInfo().getCountry())
        && !DataDictionaryValidator.validateCounty(
            appBean.getPlaceOfBirthInfo().getCounty(), true)) {
      errors.rejectValue(
          "placeOfBirthInfo.county", "error.li.person.county", null, "Invalid county of birth.");
    }

    if (!DataDictionaryValidator.validateState(appBean.getPlaceOfBirthInfo().getState(), true)) {
      errors.rejectValue(
          "placeOfBirthInfo.state", "error.li.person.state", null, "Invalid state of birth.");
    }
    if (!DataDictionaryValidator.validateCountry(
        appBean.getPlaceOfBirthInfo().getCountry(), true)) {
      errors.rejectValue(
          "placeOfBirthInfo.country", "error.li.person.country", null, "Invalid Country of birth.");
    }
  }
  private void validateMailingAddress(Errors errors, ApplicantBean appBean) {

    if (!DataDictionaryValidator.validateStreetAddress1(
        appBean.getMailingAddress().getStreet1(), true)) {
      errors.reject("error.li.mailingAddress.street1", null, "Invalid Mailing Street Address 1.");
      logger.info("did not like street address : " + appBean.getMailingAddress().getStreet1());
    }
    if (!DataDictionaryValidator.validateStreetAddress2(
        appBean.getMailingAddress().getStreet2(), false)) {
      errors.reject("error.li.mailinAddress.street2", null, "Invalid Mailing Street Address 2.");
    }
    if (!DataDictionaryValidator.validateCity(appBean.getMailingAddress().getCity(), true)) {
      errors.reject("error.li.mailingAddress.city", null, "Invalid Mailing City.");
      logger.info("did not like city : " + appBean.getMailingAddress().getCity());
    }
    if (!DataDictionaryValidator.validateZipCode(appBean.getMailingAddress().getZip(), true)) {
      errors.reject("error.li.mailingAddress.zip", null, "Invalid Mailing Zip Code.");
    }
    /*
     * if(!DataDictionaryValidator.validateZipCodeExtension(appBean.
     * getMailingAddress().getMailingZipCodeExtension(),false)){
     * errors.reject("error.li.mailingAddress.zipExt", null,
     * "Invalid Mailing zip Extension."); }
     */
    if (!DataDictionaryValidator.validateState(appBean.getMailingAddress().getState(), true)) {
      errors.reject("error.li.mailingAddress.state", "Invalid Mailing State.");
    }

    // Change Order 16 Field Validation Rule 24
    if (appBean.getMailingAddress().getCountry() != null
        && !"US".equalsIgnoreCase(appBean.getMailingAddress().getCountry())) {
      // Change Order 16 1.1.12 Assumptions
      appBean.getMailingAddress().setZip("00000");
      // xn.setMailingZipCodeExtension("0000");
    }
  }
  private void validatePhysicalAddress(Errors errors, ApplicantBean appBean) {

    if (!DataDictionaryValidator.validateStreetAddress1(
        appBean.getPhysicalAddress().getStreet1(), true)) {
      errors.reject("error.li.PhysicalAddress.street1", null, "Invalid Physical Street Address 1.");
    }
    if (!DataDictionaryValidator.validateStreetAddress2(
        appBean.getPhysicalAddress().getStreet1(), false)) {
      errors.reject("error.li.mailinAddress.street2", null, "Invalid Physical Street Address 2.");
    }
    if (!DataDictionaryValidator.validateCity(appBean.getPhysicalAddress().getCity(), true)) {
      errors.reject("error.li.PhysicalAddress.city", null, "Invalid Physical City.");
    }
    if (!DataDictionaryValidator.validateZipCode(appBean.getPhysicalAddress().getZip(), true)) {
      errors.reject("error.li.PhysicalAddress.zip", null, "Invalid Physical Zip Code.");
    }
    /*
     * if(!DataDictionaryValidator.validateZipCodeExtension(xn.
     * getPhysicalZipCodeExtension(),false)){
     * errors.reject("error.li.PhysicalAddress.zipExt", null,
     * "Invalid Physical zip Extension."); }
     */
    if (!DataDictionaryValidator.validateState(appBean.getPhysicalAddress().getState(), true)) {
      errors.reject("error.li.PhysicalAddress.state", "Invalid Physical State.");
    }

    if ("TX".equalsIgnoreCase(appBean.getPhysicalAddress().getState())
        && !DataDictionaryValidator.validateCounty(
            appBean.getPhysicalAddress().getCounty(), true)) {
      errors.reject(
          "rror.li.PhysicalAddress.county",
          "If Physical State = 'TX', then Physical County is required.");
    }

    // Change Order 16 Field Validation Rule 23
    if (appBean.getPhysicalAddress().getCountry() != null
        && !"US".equalsIgnoreCase(appBean.getPhysicalAddress().getCountry())) {
      if (appBean.getPhysicalAddress().getCounty() != null
          && appBean.getPhysicalAddress().getCounty().trim().length() > 0) {
        errors.reject(
            "error.li.PhysicalAddress.county2",
            "If Physical Country is not equal to 'United States' , then Physical County must be null.");
      }
      if (appBean.getPhysicalAddress().getState() != null
          && !"ZZ".equalsIgnoreCase(appBean.getPhysicalAddress().getState())) {
        errors.reject(
            "error.li.PhysicalAddress.state",
            "If Physical Country is not equal to 'United States' , then Physical State must be Others.");
      }

      // Change Order 16 1.1.12 Assumptions
      appBean.getPhysicalAddress().setZip("00000");
      // appBean.getPhysicalAddress().setZipCodeExtension("0000");

    }

    // // Change Order 16 Field Validation Rule 6 Amendment.
    // if(xn.getPhysicalState()!=null &&
    // !xn.getPhysicalState().equalsIgnoreCase("TX")) {
    // if(xn.getPhysicalCounty()!=null &&
    // xn.getPhysicalCounty().trim().length() > 0) {
    // errors.reject("error.li.PhysicalAddress.county1",
    // "If Physical State is not TX , then Physical County should be null");
    // }
    // }

  }