public void invokeSubmitPaymentRequestWS(Owner app, String userId) { SubmitPaymentResponse response = new SubmitPaymentResponse(); try { CentricService service = new CentricServiceLocator(); CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service); logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL); serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL); SubmitPaymentRequest request = getSubmitPaymentRequest(app); request.setUserId(userId); // Submit Web Service Call long startTime = (new Date()).getTime(); response = serviceStub.submitPayment(request); long elapsedTime = (new Date().getTime()) - startTime; logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******"); String resultCode = response.getStatus(); if (resultCode.equals("0")) { logger.info( "ICS inquiry response contained successful result code: " + response.getStatus()); } else { /* TODO implement non successful code */ } } catch (RemoteException re) { throw new DLSSystemException(re.getMessage(), re, logger); } }
public String retrieveVehiclePrice(String make, String model, String year, int miles) { RetrieveVehiclePriceResponse response = new RetrieveVehiclePriceResponse(); String price = null; try { CentricService service = new CentricServiceLocator(); CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service); logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL); serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL); RetrieveVehiclePriceRequest request = new RetrieveVehiclePriceRequest(); request.setMake(make); request.setModel(model); request.setYear(year); request.setMileage(String.valueOf(miles)); // request.setUserId(userId); // Submit Web Service Call long startTime = (new Date()).getTime(); response = serviceStub.retrieveVehiclePrice(request); long elapsedTime = (new Date().getTime()) - startTime; logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******"); price = response.getPrice(); } catch (RemoteException re) { throw new DLSSystemException(re.getMessage(), re, logger); } return price; }
public void loadArgs(String[] args) { DLRLogger.debug(CreateEntireFile.class, "loading args:"); String keyValues = ""; for (int i = 0; i < args.length; i += 2) { String key = args[i]; String value = args[i + 1]; keyValues += key; keyValues += " " + value + " "; ARGS_MAP.put(key, value); } DLRLogger.debug(CreateEntireFile.class, keyValues); System.out.println(keyValues); }
@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; }
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; } }
private Conviction getConvictionDetails(Long convictionId, HttpServletRequest request) { logger.debug( " .......Starting execution of ViewConvictionController.getConvictionDetails()....... "); try { return convictionBusiness.findConvictionById(convictionId); } catch (Exception e) { throw new RuntimeException("Exception while getting Conviction and associations", e); } }
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()); } }
@SuppressWarnings("unchecked") public HashMap invokeSubmitProductQueryWS(String[] productIdArray) { logger.info("Class ProcessIssuanceUtil...Method invokeSubmitProductQueryWS :line no :63"); SubmitProductQueryResponse response = new SubmitProductQueryResponse(); HashMap productFeeMap = new HashMap(); try { CentricService service = new CentricServiceLocator(); CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service); logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL); serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL); SubmitProductQueryRequest request = new SubmitProductQueryRequest(); request.setProductIds(productIdArray); long startTime = (new Date()).getTime(); /* * Commented the submit product query becuase we are not getting the * product list from drools cache loader */ logger.info("Class ProcessIssuanceUtil...Method invokeSubmitProductQueryWS :line no :79"); response = serviceStub.submitProductQuery(request); long elapsedTime = (new Date().getTime()) - startTime; logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******"); } catch (RemoteException re) { throw new DLSSystemException(re.getMessage(), re, logger); } float totalAmount = 0; if (response.getProducts() != null) { Product[] productArray = response.getProducts(); for (int i = 0; i < productArray.length; i++) { Product product = productArray[i]; productFeeMap.put(product.getProductId(), product); totalAmount = totalAmount + (new Float(product.getAmount()).floatValue()); } logger.info( "Class ProcessIssuanceUtil...Method invokeSubmitProductQueryWS :line no :94 with total amount " + totalAmount); } productFeeMap.put("TOTAL_AMOUNT", totalAmount + ""); return productFeeMap; }
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; } }
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"); } }
public String retrieveNextPlateNumber() { InventoryResponse response = new InventoryResponse(); String plateNumber = null; try { CentricService service = new CentricServiceLocator(); CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service); logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL); serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL); InventoryRequest request = new InventoryRequest(); request.setItemLocation("3"); request.setItemType("0101"); long startTime = (new Date()).getTime(); response = serviceStub.performInventoryOperation(request); long elapsedTime = (new Date().getTime()) - startTime; logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******"); System.out.println(response.getItemCode() + " " + response.getItemNumber()); if (org.apache.commons.lang.StringUtils.isNotBlank(response.getItemCode()) && !"ERROR".equalsIgnoreCase(response.getItemCode())) plateNumber = response.getItemCode().trim().toUpperCase(); } catch (RemoteException re) { throw new DLSSystemException(re.getMessage(), re, logger); } return plateNumber; }
private void writeTrailer() throws Exception { try { writer.write("T"); writer.write(HandlerUtil.padding(String.valueOf(count), 10, HandlerUtil.LEFT, "0")); writer.write("\r\n"); } catch (Exception io) { rc = false; String message = io.getMessage(); logger.debug(message, io); if (io.getCause() instanceof DataAccessResourceFailureException) throw new FatalUpdateException(message, io); throw new NonFatalException(message, io); } }
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) }
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; } }
/** * Expunge Conviction functionality. * * @param request * @param response * @return * @throws Exception */ public ModelAndView expungeOffense(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug(" .......in ViewConvictionController.expungeOffense()....... "); String applicantID = request.getParameter("id"); String convId = request.getParameter(LiConstants.CONVICTION_ID); String taskId = ControllerHelper.getTaskId(request); String path = getServletContext().getRealPath("/"); Boolean isReevaluate = new Boolean(request.getParameter("reevaluate")); offenseBusiness.expungeConviction(convId, taskId, path, isReevaluate.booleanValue()); request.setAttribute("msg", "message.expungeOffense"); request.setAttribute("audit", "Expunge Offense"); request .getSession() .setAttribute( "expungeSuccessMsg", "The Conviction " + convId + " is successfully expunged."); return new ModelAndView(new RedirectView("customerProfile.do?id=" + applicantID)); }
/** * 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); } } }
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()); } }
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()); } }