Search in sources :

Example 1 with LoadPaymentStatus

use of org.kuali.kfs.pdp.businessobject.LoadPaymentStatus in project cu-kfs by CU-CommunityApps.

the class PaymentFileServiceImpl method processPaymentFiles.

/**
 * @see org.kuali.kfs.pdp.service.PaymentFileService#processPaymentFiles(org.kuali.kfs.sys.batch.BatchInputFileType)
 */
@Override
public void processPaymentFiles(BatchInputFileType paymentInputFileType) {
    List<String> fileNamesToLoad = batchInputFileService.listInputFileNamesWithDoneFile(paymentInputFileType);
    for (String incomingFileName : fileNamesToLoad) {
        try {
            if (LOG.isDebugEnabled()) {
                LOG.debug("processPaymentFiles() Processing " + incomingFileName);
            }
            // collect various information for status of load
            LoadPaymentStatus status = new LoadPaymentStatus();
            status.setMessageMap(new MessageMap());
            // process payment file
            PaymentFileLoad paymentFile = processPaymentFile(paymentInputFileType, incomingFileName, status.getMessageMap());
            if (paymentFile != null && paymentFile.isPassedValidation()) {
                // load payment data
                loadPayments(paymentFile, status, incomingFileName);
                createOutputFile(status, incomingFileName);
            } else {
                // if we encounter an error for the payment file, we will remove the .done file so it will not be parse again
                LOG.error("Encounter a problem while processing payment file: " + incomingFileName + " .  Removing the done file to stop re-process.");
                removeDoneFile(incomingFileName);
            }
        } catch (RuntimeException e) {
            LOG.error("Caught exception trying to load payment file: " + incomingFileName, e);
        // swallow exception so we can continue processing files, the errors have been reported by email
        }
    }
}
Also used : LoadPaymentStatus(org.kuali.kfs.pdp.businessobject.LoadPaymentStatus) MessageMap(org.kuali.kfs.krad.util.MessageMap) PaymentFileLoad(org.kuali.kfs.pdp.businessobject.PaymentFileLoad)

Aggregations

MessageMap (org.kuali.kfs.krad.util.MessageMap)1 LoadPaymentStatus (org.kuali.kfs.pdp.businessobject.LoadPaymentStatus)1 PaymentFileLoad (org.kuali.kfs.pdp.businessobject.PaymentFileLoad)1