Search in sources :

Example 1 with ConcurStandardAccountingExtractFile

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

the class ConcurStandardAccountingExtractServiceImpl method parseStandardAccoutingExtractFile.

@Override
public ConcurStandardAccountingExtractFile parseStandardAccoutingExtractFile(String standardAccountingExtractFileName) throws ValidationException {
    LOG.info("parseStandardAccoutingExtractFile, Attempting to parse the file " + standardAccountingExtractFileName);
    ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile = loadConcurStandardAccountingExtractFile(standardAccountingExtractFileName);
    logDetailedInfoForConcurStandardAccountingExtractFile(concurStandardAccountingExtractFile);
    return concurStandardAccountingExtractFile;
}
Also used : ConcurStandardAccountingExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile)

Example 2 with ConcurStandardAccountingExtractFile

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

the class ConcurStandardAccountingExtractCollectorBatchBuilderTest method assertCollectorBatchIsBuiltProperly.

protected void assertCollectorBatchIsBuiltProperly(ConcurCollectorBatchFixture expectedFixture, ConcurSAEFileFixture fixtureToBuildFrom) throws Exception {
    CollectorBatch expected = expectedFixture.toCollectorBatch();
    List<ConcurSAEDetailLineFixture> lineFixtures = ConcurFixtureUtils.getFixturesContainingParentFixture(ConcurSAEDetailLineFixture.class, fixtureToBuildFrom, ConcurSAEDetailLineFixture::getExtractFile);
    ConcurStandardAccountingExtractFile saeFileContents = fixtureToBuildFrom.toExtractFile();
    ConcurStandardAccountingExtractBatchReportData reportData = new ConcurStandardAccountingExtractBatchReportData();
    CollectorBatch actual = builder.buildCollectorBatchFromStandardAccountingExtract(1, saeFileContents, reportData);
    assertNotNull("The SAE file contents should have been converted to a CollectorBatch successfully", actual);
    assertCollectorBatchHasCorrectData(expected, actual);
    assertReportHasCorrectErrorLinesAndOrdering(lineFixtures, reportData);
    assertReportHasCorrectPendingClientLinesAndOrdering(lineFixtures, reportData);
    assertReportHasCorrectCashAdvanceStatistics(lineFixtures, reportData);
    assertReportHasCorrectCorporateCardStatistics(lineFixtures, reportData);
    assertReportHasCorrectPseudoPaymentCodeStatistics(lineFixtures, reportData);
}
Also used : CollectorBatch(org.kuali.kfs.gl.batch.CollectorBatch) ConcurSAEDetailLineFixture(edu.cornell.kfs.concur.batch.fixture.ConcurSAEDetailLineFixture) ConcurStandardAccountingExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile) ConcurStandardAccountingExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurStandardAccountingExtractBatchReportData)

Example 3 with ConcurStandardAccountingExtractFile

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

the class ConcurStandardAccountingExtractCreateCollectorFileServiceImplTest method assertCollectorFileIsGeneratedCorrectly.

protected void assertCollectorFileIsGeneratedCorrectly(String expectedResultsFileName, ConcurCollectorBatchFixture fixture) throws Exception {
    ConcurStandardAccountingExtractBatchReportData reportData = new ConcurStandardAccountingExtractBatchReportData();
    ConcurStandardAccountingExtractFile saeFileContents = new ConcurStandardAccountingExtractFile();
    saeFileContents.setOriginalFileName(fixture.name() + GeneralLedgerConstants.BatchFileSystem.TEXT_EXTENSION);
    String collectorFileName = collectorFileService.buildCollectorFile(saeFileContents, reportData);
    assertTrue("Collector file did not get created successfully", StringUtils.isNotBlank(collectorFileName));
    assertGeneratedCollectorFileHasCorrectName(saeFileContents.getOriginalFileName(), collectorFileName);
    String expectedResultsFilePath = EXPECTED_RESULTS_DIRECTORY_PATH + expectedResultsFileName;
    String actualResultsFilePath = COLLECTOR_OUTPUT_DIRECTORY_PATH + collectorFileName;
    assertFileContentsAreCorrect(expectedResultsFilePath, actualResultsFilePath);
}
Also used : ConcurStandardAccountingExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile) ConcurStandardAccountingExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurStandardAccountingExtractBatchReportData)

Example 4 with ConcurStandardAccountingExtractFile

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

the class ConcurStandardAccountingExtractFileFixture method buildConcurStandardAccountingExtractFile.

public static ConcurStandardAccountingExtractFile buildConcurStandardAccountingExtractFile(KualiDecimal[] debits, KualiDecimal[] credits, String employeeGroupId) {
    ConcurStandardAccountingExtractFile file = new ConcurStandardAccountingExtractFile();
    Date today = new Date(Calendar.getInstance().getTimeInMillis());
    file.setBatchDate(today);
    file.setRecordCount(new Integer(debits.length + credits.length));
    KualiDecimal journalTotal = KualiDecimal.ZERO;
    for (KualiDecimal debitAmount : debits) {
        journalTotal = journalTotal.add(debitAmount);
        file.getConcurStandardAccountingExtractDetailLines().add(buildConcurStandardAccountingExtractDetailLine(ConcurConstants.DEBIT, debitAmount, employeeGroupId));
    }
    for (KualiDecimal creditAmount : credits) {
        journalTotal = journalTotal.add(creditAmount);
        file.getConcurStandardAccountingExtractDetailLines().add(buildConcurStandardAccountingExtractDetailLine(ConcurConstants.CREDIT, creditAmount, employeeGroupId));
    }
    file.setJournalAmountTotal(journalTotal);
    return file;
}
Also used : ConcurStandardAccountingExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Date(java.sql.Date)

Example 5 with ConcurStandardAccountingExtractFile

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

the class ConcurStandardAccountingExtractToPdpAndCollectorStep method processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile.

protected boolean processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile(String saeFullyQualifiedFileName, ConcurStandardAccountingExtractBatchReportData reportData) {
    boolean success = true;
    LOG.info("processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile, current File: " + saeFullyQualifiedFileName);
    ConcurStandardAccountingExtractFile concurStandardAccoutingExtractFile = getConcurStandardAccountingExtractService().parseStandardAccoutingExtractFile(saeFullyQualifiedFileName);
    reportData.setConcurFileName(concurStandardAccoutingExtractFile.getOriginalFileName());
    if (getConcurStandardAccountingExtractValidationService().validateConcurStandardAccountExtractFile(concurStandardAccoutingExtractFile, reportData)) {
        String pdpOutputFileName = getConcurStandardAccountingExtractService().extractPdpFeedFromStandardAccountingExtract(concurStandardAccoutingExtractFile, reportData);
        String collectorOutputFileName = null;
        if (StringUtils.isEmpty(pdpOutputFileName)) {
            success = false;
            LOG.error("processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile, could not produce a PDP XML file for " + saeFullyQualifiedFileName);
        }
        if (success) {
            collectorOutputFileName = getConcurStandardAccountingExtractService().extractCollectorFeedFromStandardAccountingExtract(concurStandardAccoutingExtractFile, reportData);
            if (StringUtils.isEmpty(collectorOutputFileName)) {
                LOG.error("processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile, could not produce a Collector flat file for " + saeFullyQualifiedFileName);
                success = false;
            }
        }
        if (success) {
            boolean createdPdpDoneFile = false;
            try {
                getConcurStandardAccountingExtractService().createDoneFileForPdpFile(pdpOutputFileName);
                createdPdpDoneFile = true;
                getConcurStandardAccountingExtractService().createDoneFileForCollectorFile(collectorOutputFileName);
            } catch (IOException e) {
                LOG.error("processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile, unable to create .done file: ", e);
                success = false;
                if (createdPdpDoneFile) {
                    getConcurStandardAccountingExtractService().removeDoneFileForPdpFileQuietly(pdpOutputFileName);
                }
            }
        }
    } else {
        success = false;
        LOG.error("processCurrentFileAndExtractPdpFeedAndCollectorFromSAEFile, the SAE file failed high level validation.");
    }
    return success;
}
Also used : ConcurStandardAccountingExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile) IOException(java.io.IOException)

Aggregations

ConcurStandardAccountingExtractFile (edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile)7 ConcurStandardAccountingExtractBatchReportData (edu.cornell.kfs.concur.batch.report.ConcurStandardAccountingExtractBatchReportData)3 ConcurSAEDetailLineFixture (edu.cornell.kfs.concur.batch.fixture.ConcurSAEDetailLineFixture)1 File (java.io.File)1 IOException (java.io.IOException)1 Date (java.sql.Date)1 List (java.util.List)1 CollectorBatch (org.kuali.kfs.gl.batch.CollectorBatch)1 ValidationException (org.kuali.kfs.krad.exception.ValidationException)1 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1