예제 #1
0
  public void validate(Object command, Errors errors) {

    Enforcement ea = (Enforcement) command;
    if (!DataDictionaryValidator.validateLiftDate(DateUtil.formatDate(ea.getLiftDate()), true)) {
      errors.reject("error.LiftDate");
    }
  }
예제 #2
0
 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);
   }
 }
예제 #3
0
  private Enforcement createEa(
      String eaCode,
      String eaStatus,
      HashMap<String, Object> processorHashmap,
      Conviction[] allOffenses)
      throws Exception {
    Applicant app = (Applicant) processorHashmap.get("applicant");
    Conviction conv = (Conviction) processorHashmap.get("conviction");
    String suspensionPeriod = (String) processorHashmap.get("suspensionPeriod");

    Enforcement tempNewEA = new Enforcement();
    tempNewEA.setApplicant(app);
    tempNewEA.setEnfActionCode(eaCode);
    setDates(tempNewEA, suspensionPeriod);
    tempNewEA.setStatus(eaStatus);
    if (conv != null) {
      if (tempNewEA.getConvictions() == null) {
        tempNewEA.setConvictions(new HashSet<Object>());
      }
      tempNewEA.getConvictions().add(conv);
      tempNewEA.getConvictions().addAll(Arrays.asList(allOffenses));
    }

    // Save the new enforcement
    try {
      eaDao.save(tempNewEA);
    } catch (DataAccessException e) {
      throw getBaseExceptionType(
          "DB Error: Failure to save new enforcement "
              + " for applicant (SSN : "
              + app.getSsn()
              + " )",
          e,
          logger,
          LOG_DEBUG);
    }
    return tempNewEA;
  }
예제 #4
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);
    }
  }