/** * @see org.kuali.ole.sys.batch.BatchInputFileTypeBase#process(java.lang.String, java.lang.Object) */ @Override public void process(String fileName, Object parsedFileContents) { PaymentFileLoad paymentFile = (PaymentFileLoad) parsedFileContents; if (paymentFile.isPassedValidation()) { // collect various information for status of load LoadPaymentStatus status = new LoadPaymentStatus(); status.setMessageMap(new MessageMap()); paymentFileService.loadPayments(paymentFile, status, fileName); paymentFileService.createOutputFile(status, fileName); } }
/** @see org.kuali.ole.sys.batch.BatchInputFileType#validate(java.lang.Object) */ public boolean validate(Object parsedFileContents) { PaymentFileLoad paymentFile = (PaymentFileLoad) parsedFileContents; // add validation for chartCode-accountNumber, as chartCode is not required in xsd due to // accounts-cant-cross-charts option AccountService acctserv = SpringContext.getBean(AccountService.class); boolean validAccounts = true; if (paymentFile.getPaymentGroups() != null) { for (PaymentGroup payGroup : paymentFile.getPaymentGroups()) { if (payGroup.getPaymentDetails() == null) continue; for (PaymentDetail payDetail : payGroup.getPaymentDetails()) { if (payDetail.getAccountDetail() == null) continue; for (PaymentAccountDetail acctDetail : payDetail.getAccountDetail()) { // if chart code is empty while accounts cannot cross charts, then derive chart code // from account number if (StringUtils.isEmpty(acctDetail.getFinChartCode())) { if (acctserv.accountsCanCrossCharts()) { GlobalVariables.getMessageMap() .putError( OLEConstants.GLOBAL_ERRORS, OLEKeyConstants.ERROR_BATCH_UPLOAD_FILE_EMPTY_CHART, acctDetail.getAccountNbr()); validAccounts = false; } else { // accountNumber shall not be empty, otherwise won't pass schema validation Account account = acctserv.getUniqueAccountForAccountNumber(acctDetail.getAccountNbr()); if (account != null) { acctDetail.setFinChartCode(account.getChartOfAccountsCode()); } else { GlobalVariables.getMessageMap() .putError( OLEConstants.GLOBAL_ERRORS, OLEKeyConstants.ERROR_BATCH_UPLOAD_FILE_INVALID_ACCOUNT, acctDetail.getAccountNbr()); validAccounts = false; } } } } } } } paymentFileService.doPaymentFileValidation(paymentFile, GlobalVariables.getMessageMap()); return validAccounts && paymentFile.isPassedValidation(); }