Esempio n. 1
0
  /*
   * Build a HashMap for tokens in templates
   */
  protected Map<Object, Object> buildTemplateParams(
      String template, Object config, TemporaryRequestData tempRequestData) {
    Map<Object, Object> templateParams = new HashMap<Object, Object>();
    HashMap<String, Object> processorHashmap = (HashMap) config;
    Applicant hashApp = (Applicant) processorHashmap.get("applicant");
    Applicant applicant = vaDao.findPDFApplicant(hashApp.getId());
    if (processorHashmap.get("eaId") != null) {
      tempRequestData.setTransactionId((Long) processorHashmap.get("eaId"));
    }

    // applicantDao.getApplicantById(record.getApplicant().getId());
    templateParams.put(PDFHeaderGenerator.DPS_HEADER, getDpsHeader());
    String dlNumber =
        applicant.getLicense() != null ? applicant.getLicense().getDlIdUnlNumber() : "";
    templateParams.put("DL_ID_UNL_NUMBER", dlNumber);
    tempRequestData.setDocumentNumber(dlNumber);

    // templateParams.put("DL_ID_UNL_NUMBER", "123");
    // tempRequestData.setDocumentNumber("123");
    String idNumber =
        applicant.getStateID() != null ? applicant.getStateID().getDlIdUnlNumber() : "";
    templateParams.put("ID_NUMBER", idNumber);
    if (StringUtils.isBlank(tempRequestData.getDocumentNumber()))
      tempRequestData.setDocumentNumber(idNumber);
    // templateParams.put("ID_NUMBER", "223");
    // if (StringUtils.isBlank(tempRequestData.getDocumentNumber()))
    // tempRequestData.setDocumentNumber("223");
    String unlNumber = applicant.getUNL() != null ? applicant.getUNL().getDlIdUnlNumber() : "";
    templateParams.put("UNL_NUMBER", unlNumber);
    if (StringUtils.isBlank(tempRequestData.getDocumentNumber()))
      tempRequestData.setDocumentNumber(unlNumber);

    // templateParams.put("UNL_NUMBER", "333");
    // if (StringUtils.isBlank(tempRequestData.getDocumentNumber()))
    // tempRequestData.setDocumentNumber("333");

    String firstName =
        StringUtils.isBlank(applicant.getFirstName()) ? "" : applicant.getFirstName();
    templateParams.put("FIRST_NAME", firstName);
    tempRequestData.setFirstName(firstName);

    // templateParams.put("FIRST_NAME", "JOHN");
    // tempRequestData.setFirstName("JOHN");
    String middleName =
        StringUtils.isBlank(applicant.getMiddleName()) ? "" : applicant.getMiddleName();
    templateParams.put("MIDDLE_NAME", middleName);
    tempRequestData.setMiddleName(middleName);
    // templateParams.put("MIDDLE_NAME", "");
    // tempRequestData.setMiddleName("");
    String lastName = StringUtils.isBlank(applicant.getLastName()) ? "" : applicant.getLastName();
    templateParams.put("LAST_NAME", lastName);
    tempRequestData.setLastName(lastName);
    // templateParams.put("LAST_NAME", "DOE");
    // tempRequestData.setLastName("DOE");
    templateParams.put("SUFFIX", "");

    String mailStreetAdd1 = applicant.getMailingAddress().getStreet1();
    String mailStreetAdd2 = applicant.getMailingAddress().getStreet2();
    String mailCity = applicant.getMailingAddress().getCity();
    String mailState = applicant.getMailingAddress().getState();
    String mailZip = applicant.getMailingAddress().getZip();
    String mailZipExt = applicant.getMailingAddress().getZipExt();

    String physicalStreetAdd1 = applicant.getPhysicalAddress().getStreet1();
    String physicalStreetAdd2 = applicant.getPhysicalAddress().getStreet2();
    String physicalCity = applicant.getPhysicalAddress().getCity();
    String physicalState = applicant.getPhysicalAddress().getState();
    String physicalZip = applicant.getPhysicalAddress().getZip();
    String physicalZipExt = applicant.getPhysicalAddress().getZipExt();

    templateParams.put(
        "MAILING_STREET_ADDRESS_1",
        StringUtils.isNotBlank(mailStreetAdd1) ? mailStreetAdd1 : physicalStreetAdd1);
    templateParams.put(
        "MAILING_STREET_ADDRESS_2",
        StringUtils.isNotBlank(mailStreetAdd2) ? mailStreetAdd2 : physicalStreetAdd2);
    templateParams.put("MAILING_CITY", StringUtils.isNotBlank(mailCity) ? mailCity : physicalCity);
    templateParams.put(
        "MAILING_STATE", StringUtils.isNotBlank(mailState) ? mailState : physicalState);
    templateParams.put("MAILING_ZIP_CODE", StringUtils.isNotBlank(mailZip) ? mailZip : physicalZip);
    templateParams.put(
        "MAILING_ZIP_CODE_EXTENSION",
        StringUtils.isNotBlank(mailZipExt) ? mailZipExt : physicalZipExt);

    // templateParams.put("MAILING_STREET_ADDRESS_1", "1 Test st");
    // templateParams.put("MAILING_STREET_ADDRESS_2", "");
    // templateParams.put("MAILING_CITY", "Austin");
    // templateParams.put("MAILING_STATE", "VA");
    // templateParams.put("MAILING_ZIP_CODE", "23233");
    // templateParams.put("MAILING_ZIP_CODE_EXTENSION", "");
    templateParams.put(
        PDFFooterGenerator.DPS_FOOTER, PDFFooterGenerator.getDpsFooter(getTemplatePath()));
    return templateParams;
  }
Esempio n. 2
0
  protected void processSuspension(
      HashMap<String, Object> processorHashmap, String suspensionPeriod, Conviction[] allOffenses)
      throws ParseException, Exception {
    if (suspensionPeriod != null) {
      System.out.println("suspensionPeriod: " + suspensionPeriod);

      // Create the EA
      Enforcement newEA =
          createEa("9000", DLRConstants.ENF_STATUS_PROBATED, processorHashmap, allOffenses);
      vaDao.saveEventAudit(
          newEA.getApplicant().getId(),
          "Enforcement",
          (String) ListDataLoader.ALLENFORCEMENTACTIONCODES.get(newEA.getEnfActionCode())
              + " Submitted");
      if (logger.isDebug()) {
        logger.debug(
            "added new enforcement: id = "
                + newEA.getId()
                + " : app.id = "
                + newEA.getApplicant().getId());
      }
      processorHashmap.put("eaId", newEA.getId()); // for uniqueness of
      // letter generated.
      // generate suspension letter
      generatePDFLetter(processorHashmap);
      Applicant app = (Applicant) processorHashmap.get("applicant");

      vaDao.updateApplicantStatus(app.getId(), LiConstants.RecordStatus.NOT_ELIGIBLE);
      vaDao.updateIssuanceStatus(
          newEA.getApplicant().getId(),
          LiConstants.IssuanceStatus.SUSPENDED,
          DLRConstants.CARDTYPE_DRIVER_LICENSE);
      // vaDao.saveEventAudit(newEA.getApplicant().getId(),
      // "Enforcement Action", "Insert EA(6940) ");
    } else {

      // Create the EA
      Enforcement newEA =
          createEa(
              "9001", DLRConstants.ENF_STATUS_EVAL_FURTHER_ACTION, processorHashmap, allOffenses);
      vaDao.saveEventAudit(
          newEA.getApplicant().getId(),
          "Enforcement",
          (String) ListDataLoader.ALLENFORCEMENTACTIONCODES.get(newEA.getEnfActionCode())
              + " Submitted");
      System.out.println(newEA.getId());
      Applicant app = (Applicant) processorHashmap.get("applicant");

      if (logger.isDebug()) {
        logger.debug("added new enforcement: id = " + newEA.getId() + " : app.id = " + app.getId());
      }

      AdminStatus as = new AdminStatus();
      as.setAppliedDate(new Timestamp(new Date().getTime()));
      as.setStatus(DLRConstants.ADMIN_STATUS_FEE_OWED);
      as.setApplicant(app);
      as.setEnfActionId(newEA.getId());
      AdminStatusFee adminStatusFee = new AdminStatusFee();
      adminStatusFee.setStatus(as.getStatus());
      adminStatusFee.setAsfsAdminFee(new BigDecimal("500.00"));
      adminStatusFee.setAdminStatus(as);
      Set adminStatusFees = new HashSet();
      adminStatusFees.add(adminStatusFee);
      as.setAdminStatusFees(adminStatusFees);
      try {
        appDao.saveOrUpdateObject(as);
      } catch (DataAccessException e) {
        throw getBaseExceptionType(
            "Failure to update applicant (SSN : " + app.getSsn() + " ) - " + e.getMessage(),
            e,
            logger,
            LOG_DEBUG);
      }
      vaDao.saveEventAudit(app.getId(), "Admin Status", " Fee Owed Submitted");

      vaDao.updateIssuanceStatus(
          app.getId(), LiConstants.IssuanceStatus.SUSPENDED, app.getOccupationalDL().getCardType());

      processorHashmap.put("eaId", newEA.getId()); // for uniqueness of
      // letter generated.
      // processing for applicant
      // generate suspension letter, add admin status and update issuance
      // status
      generatePDFLetter(processorHashmap);
    }
  }