예제 #1
0
  @Override
  protected Object formBackingObject(HttpServletRequest request) throws Exception {
    // navigation bar active tab
    request.setAttribute("customerActiveBoolean", true);

    Conviction conviction;
    Applicant applicant;

    String applicantID = request.getParameter("id");
    Long l_applicantID = Long.parseLong(applicantID);

    String convictionString = request.getParameter(LiConstants.CONVICTION_ID);
    Long convictionId = Long.parseLong(convictionString);
    if (convictionString != null && convictionString.trim().length() > 0) {
      convictionId = new Long(convictionString);
      conviction = getConvictionDetails(convictionId, request);
      applicant = convictionBusiness.getApplicant(l_applicantID);
      request.setAttribute("conviction", conviction);
    } else {
      logger.error("Could not find an Conviction ID in the request object.");
      throw new DLSSystemException(
          "Could not find Conviction Id registered with the name "
              + LiConstants.CONVICTION_ID
              + " in the request object.",
          logger);
    }

    if (request.getSession().getAttribute("addConvictionMsg") != null) {
      request.setAttribute("successMessage", "Conviction added successfully");
      request.getSession().removeAttribute("addConvictionMsg");
    }
    request.setAttribute("applicant", applicant);

    return conviction;
  }
예제 #2
0
  public void initialize() {
    try {
      if (appContext == null) {
        appContext = new ClassPathXmlApplicationContext(DLRConstants.appContextPath);
      }

      schema = getSchema();
      schema = schema + ".";

      jdbcTemplate = (JdbcTemplate) appContext.getBean("jdbcTemplate");

      // Use connection to run query because it is faster and use less
      // memory than JdbcTemplate.queryForList()
      con1 = jdbcTemplate.getDataSource().getConnection();

      ht.clear();
      ht.put("01", "JR.  ");
      ht.put("02", "SR.  ");
      ht.put("03", "II   ");
      ht.put("04", "III  ");
      ht.put("05", "IV   ");
      ht.put("06", "V    ");
      ht.put("07", "VI   ");
      ht.put("08", "VII  ");
      ht.put("09", "VIII ");
      ht.put("10", "IX   ");
    } catch (Exception e) {
      logger.error("Exception during initialize()", e);
      System.out.println(e);
      rc = false;
    }
  }
예제 #3
0
  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());
    }
  }
예제 #4
0
 private void process() {
   try {
     if (rc) {
       basicFlowDL();
       basicFlowID();
     } else {
       count = 0;
     }
   } // end of try
   catch (Exception e) {
     logger.error("Exception during process()", e);
     System.out.println("In process(), Get Exception " + e);
     rc = false;
   }
 }
예제 #5
0
  public void execute() {
    if (rc) {
      batchClass = getBatchProcessor();
      String statusCode = BatchConstants.SUCCESS;
      Long id = new Long(0);

      try {
        id =
            batchClass.auditProcess(
                "BEGIN", null, (String) ARGS_MAP.get(BatchConstants.BATCH_NAME), "");

        System.out.println("batchClass = " + batchClass);
        System.out.println("id = " + id);

        preProcess(getFileSequence(id));

        process();

        postProcess();

        if (false == rc) {
          statusCode = BatchConstants.FAILURE;
        }

        batchClass.auditProcess(
            "END," + statusCode + ",Total " + count,
            id,
            (String) ARGS_MAP.get(BatchConstants.BATCH_NAME),
            "");

        cleanUp();
      } // end of try
      catch (Exception e) {
        logger.error("Exception during execute()", e);
        System.out.println("In execute(), Get Exception " + e);

        batchClass.auditProcess(
            "END," + BatchConstants.FAILURE + ",Total " + count,
            id,
            (String) ARGS_MAP.get(BatchConstants.BATCH_NAME),
            "");
        System.exit(0);
      }
    } // end of if(rc)
  }
예제 #6
0
 private void initWriter(long sequence) {
   String outputFileName = (String) ARGS_MAP.get(BatchConstants.OUTPUT_FILE);
   if (StringUtils.isNotBlank(outputFileName))
     fileName = (String) ARGS_MAP.get(BatchConstants.OUTPUT_PATH) + outputFileName;
   else
     fileName =
         (String) ARGS_MAP.get(BatchConstants.OUTPUT_PATH)
             + baseFilePattern
             + "_"
             + dateFormatMMDDYYYY.format(new Date())
             + "_"
             + sequence;
   try {
     // writer = new FileWriter(fileName, true);
     writer = new BufferedWriter(new FileWriter(fileName), 6000000);
   } catch (Exception e) {
     logger.error("Exception during initWriter()", e);
     rc = false;
   }
 }
예제 #7
0
  /**
   * This method determines what XML element we are completing, and takes the appropriate action
   * based on the element type. This method is called by the SAX Parser.
   *
   * @param uri the Namespace URI
   * @param name the local name without prefix
   * @param qualifiedName the qualified name with prefix
   * @throws SAXException if a problem occurs during processing
   */
  public void endElement(String uri, String name, String qualifiedName) throws SAXException {
    StringBuffer errMsg = null;
    if (_inRefreshInterval) {
      long interval;
      try {
        interval = Long.parseLong(_buf.toString().trim());
      } catch (Exception e) {
        // The XML doesn't conform, this should never happen
        // So, we'll default the value to 0
        interval = 0;

        errMsg = new StringBuffer();
        errMsg.append("The refreshInterval in validValues.xml is not a number, ");
        errMsg.append("defaulting to 0 minutes");
        logger.error(errMsg.toString());
      }

      URLRolesParserMgr.setRefreshInterval(interval);
    } else if (_inRole) {
      roleString = _buf.toString().trim();
      _roleList.add(roleString);
    }

    // Zero out the buffer
    _buf.delete(0, _buf.length());

    if (name.equals(ROLE)) {
      _inRole = false;
    } else if (name.equals(URL)) {
      _inUrl = false;
    } else if (name.equals(REFRESH_INTERVAL)) {
      _inRefreshInterval = false;
    } else if (name.equals(URLS)) {
      URLRolesParserMgr.URL_ROLES = new String[_urlList.size()][2];
      for (int i = 0; i < _urlList.size(); i++) {
        URLRolesParserMgr.URL_ROLES[i][0] = (String) _urlList.get(i);
        URLRolesParserMgr.URL_ROLES[i][1] = (String) _roleList.get(i);
      }
    }
  }
예제 #8
0
  private String createRecord(ResultSet rs, String type) throws Exception {
    try {
      // String dlNumber = rs.getString("IREC_DOC_NBR");
      String dlNumber = rs.getString(1);
      dlNumber = dlNumber.trim();
      if (dlNumber.length() < 8) {
        dlNumber = StringUtils.leftPad(dlNumber, 8, ZERO);
      }
      dlNumber = StringUtils.leftPad(dlNumber, 10, ZERO);

      // String lastName = rs.getString("DPSP_LAST_NME");
      String lastName = rs.getString(2);
      lastName = lastName.trim();
      lastName = StringUtils.rightPad(lastName, 40, SPACE);

      // String firstName = rs.getString("DPSP_FIRST_NME");
      String firstName = rs.getString(3);
      if (firstName == null) {
        firstName = StringUtils.rightPad("", 40, SPACE);
      } else {
        firstName = firstName.trim();
        firstName = StringUtils.rightPad(firstName, 40, SPACE);
      }

      // String middleName = rs.getString("DPSP_MIDDLE_NME");
      String middleName = rs.getString(4);
      if (middleName == null) {
        middleName = StringUtils.rightPad("", 40, SPACE);
      } else {
        middleName = middleName.trim();
        middleName = StringUtils.rightPad(middleName, 40, SPACE);
      }

      // String suffix = rs.getString("DPSP_SUFFIX");
      String suffix = rs.getString(5);
      if (suffix == null) {
        suffix = "";
      } else {
        suffix = suffix.trim();
      }
      suffix = translateSuffixCode(suffix);

      String dob = "";
      // Object obj = rs.getObject("DPSP_DOB");
      Object obj = rs.getObject(6);
      if (obj == null) {
        dob = StringUtils.rightPad("", 8, SPACE);
      } else {
        dob = ((java.sql.Date) obj).toString();
        // dob = StringUtils.rightPad(dob, 10, SPACE);
        dob = parseDOB(dob);
      }

      // String address1 = rs.getString("DMDT_STRT_ADDR_1");
      String address1 = rs.getString(7);
      if (address1 == null) {
        address1 = StringUtils.rightPad("", 32, SPACE);
      } else {
        address1 = address1.trim();
        address1 = StringUtils.rightPad(address1, 32, SPACE);
      }

      // String address2 = rs.getString("DMDT_STRT_ADDR_2");
      String address2 = rs.getString(8);
      if (address2 == null) {
        address2 = StringUtils.rightPad("", 32, SPACE);
      } else {
        address2 = address2.trim();
        address2 = StringUtils.rightPad(address2, 32, SPACE);
      }

      // String city = rs.getString("DMDT_CITY");
      String city = rs.getString(9);
      if (city == null) {
        city = StringUtils.rightPad("", 33, SPACE);
      } else {
        city = city.trim();
        city = StringUtils.rightPad(city, 33, SPACE);
      }

      // String state = rs.getString("DMDT_STATE");
      String state = rs.getString(10);
      if (state == null) {
        state = StringUtils.rightPad("", 2, SPACE);
      } else {
        state = state.trim();
        state = StringUtils.rightPad(state, 2, SPACE);
      }

      // String zipcode = rs.getString("ZIPCODE");
      String zipcode = rs.getString(11);
      if (zipcode == null) {
        zipcode = StringUtils.rightPad("", 5, SPACE);
      } else {
        zipcode = zipcode.trim();
        zipcode = StringUtils.rightPad(zipcode, 5, SPACE);
      }

      // String zipcodeext = rs.getString("ZIPCODEEXT");
      String zipcodeext = rs.getString(12);
      if (zipcodeext == null) {
        zipcodeext = StringUtils.rightPad("", 4, SPACE);
      } else {
        zipcodeext = zipcodeext.trim();
        zipcodeext = StringUtils.rightPad(zipcodeext, 4, SPACE);
      }

      // String originalIssueDate = rs.getString("OIDTE");
      String originalIssueDate = rs.getString(13);
      if (originalIssueDate == null) {
        originalIssueDate = StringUtils.rightPad("", 10, SPACE);
      } else {
        originalIssueDate = originalIssueDate.trim();
        // originalIssueDate = StringUtils.rightPad(originalIssueDate,
        // 10, SPACE);
        originalIssueDate = parseDOB(originalIssueDate);
      }

      // String cardType = rs.getString("IREC_ISSUANCE_TYP");
      String cardType = rs.getString(14);
      if (cardType == null) {
        cardType = StringUtils.rightPad("", 2, SPACE);
      } else {
        cardType = type;
      }

      String recordStr =
          dlNumber
              + lastName
              + firstName
              + middleName
              + suffix
              + dob
              + address1
              + address2
              + city
              + state
              + zipcode
              + zipcodeext
              + originalIssueDate
              + cardType;

      return recordStr;
    } // end of try
    catch (Exception e) {
      System.out.println("createRecord()" + e);
      logger.error("Exception during createRecord()", e);
      rc = false;

      throw new RuntimeException(e.getMessage());
    }
  }
예제 #9
0
  public void basicFlowID() throws Exception {
    try {
      long n = 0;

      java.util.Date date = new java.util.Date();
      t1 = date.getTime();

      sqlStr =
          "SELECT IREC_DOC_NBR, DPSP_LAST_NME, DPSP_FIRST_NME, DPSP_MIDDLE_NME, DPSP_SUFFIX, DPSP_DOB, "
              + "DMDT_STRT_ADDR_1, DMDT_STRT_ADDR_2, DMDT_CITY, DMDT_STATE, SUBSTR(CHAR(DMDT_ZIP_CDE),1,5) AS ZIPCODE , "
              + "SUBSTR(CHAR(DMDT_ZIP_CDE),6,4) AS ZIPCODEEXT, SUBSTR(CHAR(IDDC_ORIG_ISS_DTE),1,10) AS OIDTE, "
              + "IREC_ISSUANCE_TYP FROM "
              + schema
              + "DPS_PERSON, "
              + schema
              + "ISSUANCE_RECORD, "
              + schema
              + "ID_DOCUMENT, "
              + schema
              + "DEMOGRAPHIC_DETAIL WHERE IREC_ISSUANCE_TYP = '2' AND DPSP_PERSON_ID = IREC_PERSON_ID "
              + "AND (DPSP_DV_FLG = '0' OR DPSP_DV_FLG IS NULL) AND (DPSP_DESIGNATION IS NULL OR (DPSP_DESIGNATION NOT IN ('S', 'A'))) "
              + "AND DPSP_PERSON_ID NOT IN (SELECT DISTINCT ADST_PERSON_ID FROM "
              + schema
              + "ADMIN_STATUS WHERE ADST_ADMIN_STATUS = '08' "
              + "AND ADST_REMOVE_DTE IS NULL) AND IREC_ID_NBR = IDDC_ID_NBR AND IDDC_ORIG_ISS_DTE IS NOT NULL "
              + "AND DPSP_PERSON_ID = DMDT_PERSON_ID AND DMDT_ADDR_TYP = 'P' FOR FETCH ONLY";

      stmt2 = con1.prepareStatement(sqlStr);
      rs2 = stmt2.executeQuery();

      date = new java.util.Date();
      t2 = date.getTime();

      logger.debug(sqlStr);
      logger.debug("Elapsed time for excuting SQL statement is " + (t2 - t1) + " ms");

      date = new java.util.Date();
      t1 = date.getTime();

      while (rs2.next()) {
        count++;
        n++;

        String recordStr = createRecord(rs2, "ID");
        writer.write(recordStr + "\r\n");
      } // end of while(rs2.next())

      date = new java.util.Date();
      t2 = date.getTime();

      logger.debug("Elapsed time for excuting while(rs2.next()) is " + (t2 - t1) + " ms");
      logger.debug("count = " + n);
      logger.debug(date.toString());

      if (rs2 != null) {
        rs2.close();
        rs2 = null;
      }

      if (stmt2 != null) {
        stmt2.close();
        stmt2 = null;
      }
    } // end of try
    catch (Exception e) {
      System.out.println("basicFlowID()" + e);
      logger.error("Exception during basicFlowID()", e);
      rc = false;

      throw new RuntimeException("Exception during basicFlowID()" + e.getMessage());
    }
  }