Search in sources :

Example 1 with BatchInputFileType

use of org.kuali.kfs.sys.batch.BatchInputFileType in project cu-kfs by CU-CommunityApps.

the class PayeeACHAccountExtractServiceImpl method processACHBatchDetails.

// Portions of this method are based on code and logic from CustomerLoadServiceImpl.
@Transactional
@Override
public boolean processACHBatchDetails() {
    LOG.info("processACHBatchDetails: Beginning processing of ACH input files");
    int numSuccess = 0;
    int numPartial = 0;
    int numFail = 0;
    partialProcessingSummary = new HashMap<String, List<String>>();
    Map<String, BatchInputFileType> fileNamesToLoad = getListOfFilesToProcess();
    LOG.info("processACHBatchDetails: Found " + fileNamesToLoad.size() + " file(s) to process.");
    List<String> processedFiles = new ArrayList<String>();
    for (String inputFileName : fileNamesToLoad.keySet()) {
        LOG.info("processACHBatchDetails: Beginning processing of filename: " + inputFileName);
        processedFiles.add(inputFileName);
        try {
            List<String> errorList = new ArrayList();
            errorList = loadACHBatchDetailFile(inputFileName, fileNamesToLoad.get(inputFileName));
            if (errorList.isEmpty()) {
                LOG.info("processACHBatchDetails: Successfully loaded ACH input file");
                numSuccess++;
            } else {
                LOG.warn("processACHBatchDetails: ACH input file contained " + errorList.size() + " rows that could not be processed.");
                partialProcessingSummary.put(inputFileName, errorList);
                numPartial++;
            }
        } catch (Exception e) {
            LOG.error("processACHBatchDetails: Failed to load ACH input file due to this Exception:", e);
            numFail++;
        }
    }
    removeDoneFiles(processedFiles);
    LOG.info("processACHBatchDetails: ==============================================");
    LOG.info("processACHBatchDetails: ==== Summary of Payee ACH Account Extract ====");
    LOG.info("processACHBatchDetails: ==============================================");
    LOG.info("processACHBatchDetails: Files loaded successfully: " + numSuccess);
    LOG.info("processACHBatchDetails: Files loaded with one or more failed rows: " + numPartial);
    if (!partialProcessingSummary.isEmpty()) {
        for (String failingFileName : partialProcessingSummary.keySet()) {
            List<String> errorsEncountered = partialProcessingSummary.get(failingFileName);
            LOG.error("processACHBatchDetails: ACH input file contained " + errorsEncountered.size() + " rows that could not be processed.");
            for (Iterator iterator = errorsEncountered.iterator(); iterator.hasNext(); ) {
                String dataError = (String) iterator.next();
                LOG.error("processACHBatchDetails: " + dataError);
            }
        }
    }
    LOG.info("processACHBatchDetails: Files with errors: " + numFail);
    LOG.info("processACHBatchDetails: =====================");
    LOG.info("processACHBatchDetails: ==== End Summary ====");
    LOG.info("processACHBatchDetails: =====================");
    // For now, return true even if files or rows did not load successfully. Functionals will address the failed rows/files accordingly.
    return true;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) BatchInputFileType(org.kuali.kfs.sys.batch.BatchInputFileType) ValidationException(org.kuali.kfs.krad.exception.ValidationException) MessagingException(javax.mail.MessagingException) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) FileNotFoundException(java.io.FileNotFoundException) InvalidAddressException(org.kuali.kfs.krad.exception.InvalidAddressException) IOException(java.io.IOException) ParseException(org.kuali.kfs.sys.exception.ParseException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with BatchInputFileType

use of org.kuali.kfs.sys.batch.BatchInputFileType in project cu-kfs by CU-CommunityApps.

the class CuReceiptProcessingServiceImplNegativeTest method setupBatchInputFileTypes.

private List<BatchInputFileType> setupBatchInputFileTypes() {
    ReceiptProcessingCSVInputFileType batchInputFileType = new ReceiptProcessingCSVInputFileType();
    batchInputFileType.setDirectoryPath(BATCH_DIRECTORY);
    batchInputFileType.setFileExtension("csv");
    batchInputFileType.setCsvEnumClass(ReceiptProcessingCSV.class);
    List<BatchInputFileType> batchInputFileTypeList = new ArrayList<>();
    batchInputFileTypeList.add(batchInputFileType);
    return batchInputFileTypeList;
}
Also used : ReceiptProcessingCSVInputFileType(edu.cornell.kfs.module.receiptProcessing.batch.ReceiptProcessingCSVInputFileType) ArrayList(java.util.ArrayList) BatchInputFileType(org.kuali.kfs.sys.batch.BatchInputFileType)

Aggregations

ArrayList (java.util.ArrayList)2 BatchInputFileType (org.kuali.kfs.sys.batch.BatchInputFileType)2 ReceiptProcessingCSVInputFileType (edu.cornell.kfs.module.receiptProcessing.batch.ReceiptProcessingCSVInputFileType)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 List (java.util.List)1 MessagingException (javax.mail.MessagingException)1 InvalidAddressException (org.kuali.kfs.krad.exception.InvalidAddressException)1 ValidationException (org.kuali.kfs.krad.exception.ValidationException)1 ParseException (org.kuali.kfs.sys.exception.ParseException)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1 Transactional (org.springframework.transaction.annotation.Transactional)1