Search in sources :

Example 6 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile in project cu-kfs by CU-CommunityApps.

the class ConcurRequestExtractFileServiceImpl method processFile.

public boolean processFile(String requestExtractFullyQualifiedFileName) {
    boolean processingSuccessful = false;
    ConcurRequestExtractFile requestExtractFile = loadFileIntoParsedDataObject(requestExtractFullyQualifiedFileName);
    ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
    reportData.setConcurFileName(parseRequestExtractFileNameFrom(requestExtractFullyQualifiedFileName));
    if (getConcurRequestExtractFileValidationService().requestExtractHeaderRowValidatesToFileContents(requestExtractFile, reportData)) {
        List<String> uniqueRequestIdsInFile = new ArrayList<String>();
        for (ConcurRequestExtractRequestDetailFileLine detailFileLine : requestExtractFile.getRequestDetails()) {
            getConcurRequestExtractFileValidationService().performRequestDetailLineValidation(detailFileLine, uniqueRequestIdsInFile);
        }
        requestExtractFile.setFileName(parseRequestExtractFileNameFrom(requestExtractFullyQualifiedFileName));
        processingSuccessful = getConcurCashAdvancePdpFeedFileService().createPdpFeedFileForValidatedDetailFileLines(requestExtractFile, reportData);
        if (processingSuccessful && StringUtils.isNotBlank(requestExtractFile.getFullyQualifiedPdpFileName())) {
            try {
                getConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile(requestExtractFile.getFullyQualifiedPdpFileName());
            } catch (IOException ioe) {
                LOG.error("processFile: ConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile generated IOException attempting to create .done file for generated PdpFeedFile: " + requestExtractFile.getFullyQualifiedPdpFileName());
                processingSuccessful = false;
            } catch (FileStorageException fse) {
                LOG.error("processFile: ConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile generated FileStorageException attempting to create .done file for generated PdpFeedFile: " + requestExtractFile.getFullyQualifiedPdpFileName());
                processingSuccessful = false;
            }
        }
    }
    File reportFile = getConcurRequestExtractReportService().generateReport(reportData);
    getConcurRequestExtractReportService().sendResultsEmail(reportData, reportFile);
    LOG.debug("method processFile:: requestExtractFile data after processing: " + KFSConstants.NEWLINE + requestExtractFile.toString());
    return processingSuccessful;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) ArrayList(java.util.ArrayList) ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine) IOException(java.io.IOException) FileStorageException(org.kuali.kfs.sys.exception.FileStorageException) ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) File(java.io.File)

Example 7 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile in project cu-kfs by CU-CommunityApps.

the class ConcurRequestExtractFileValidationServiceImplTest method testFileContainsBadEmployeeGroupId.

@Test
public void testFileContainsBadEmployeeGroupId() {
    LOG.info("testFileContainsBadEmployeeGroupId");
    ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.BAD_EMPLOYEE_GROUP_ID_FILE.createConcurRequestExtractFile();
    ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
    assertFalse("Expected Result: Request Detail row contains BAD Employee Group Id.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData));
    LOG.info(reportData.getHeaderValidationErrors());
    LOG.info(KFSConstants.NEWLINE);
    reportData = null;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) Test(org.junit.Test)

Example 8 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile in project cu-kfs by CU-CommunityApps.

the class ConcurRequestExtractFileValidationServiceImplTest method testHeaderAmountDoesNotMatch.

@Test
public void testHeaderAmountDoesNotMatch() {
    LOG.info("testHeaderAmountDoesNotMatch");
    ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.BAD_REQUEST_AMOUNT_FILE.createConcurRequestExtractFile();
    ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
    assertFalse("Expected Result: Header amount should NOT match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData));
    LOG.info(reportData.getHeaderValidationErrors());
    LOG.info(KFSConstants.NEWLINE);
    reportData = null;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) Test(org.junit.Test)

Aggregations

ConcurRequestExtractFile (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile)8 ConcurRequestExtractBatchReportData (edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)2 ConcurRequestExtractRequestDetailFileLine (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine)1 File (java.io.File)1 IOException (java.io.IOException)1 FileStorageException (org.kuali.kfs.sys.exception.FileStorageException)1