Search in sources :

Example 1 with CollectorBatch

use of org.kuali.kfs.gl.batch.CollectorBatch in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCollectorBatchBuilder method resetBuilderForNextRun.

protected void resetBuilderForNextRun() {
    this.collectorBatch = new CollectorBatch();
    this.lineGroups = new LinkedHashMap<>();
    this.collectorHelper = null;
    this.batchSequenceNumber = 0;
    this.reportData = null;
}
Also used : CollectorBatch(org.kuali.kfs.gl.batch.CollectorBatch)

Example 2 with CollectorBatch

use of org.kuali.kfs.gl.batch.CollectorBatch in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCollectorBatchBuilder method buildCollectorBatchFromStandardAccountingExtract.

/**
 * @throws IllegalArgumentException if any arguments are null.
 */
public CollectorBatch buildCollectorBatchFromStandardAccountingExtract(int nextBatchSequenceNumber, ConcurStandardAccountingExtractFile saeFileContents, ConcurStandardAccountingExtractBatchReportData newReportData) {
    if (saeFileContents == null) {
        throw new IllegalArgumentException("saeFileContents cannot be null");
    } else if (newReportData == null) {
        throw new IllegalArgumentException("newReportData cannot be null");
    }
    this.batchSequenceNumber = nextBatchSequenceNumber;
    this.reportData = newReportData;
    CollectorBatch result;
    try {
        LOG.info("buildCollectorBatchFromStandardAccountingExtract(): Generating Collector data from SAE file: " + saeFileContents.getOriginalFileName());
        if (batchSequenceNumber < MIN_BATCH_SEQUENCE_NUMBER || batchSequenceNumber > MAX_BATCH_SEQUENCE_NUMBER) {
            throw new IllegalArgumentException("Batch Sequence Number should have been an integer between " + MIN_BATCH_SEQUENCE_NUMBER + " and " + MAX_BATCH_SEQUENCE_NUMBER);
        }
        updateCollectorBatchHeaderFields(saeFileContents);
        initializeCollectorHelperFromCollectorBatch();
        groupLines(saeFileContents.getConcurStandardAccountingExtractDetailLines());
        updateCollectorBatchWithOriginEntries();
        LOG.info("buildCollectorBatchFromStandardAccountingExtract(): Finished generating Collector data from SAE file: " + saeFileContents.getOriginalFileName());
        LOG.info("buildCollectorBatchFromStandardAccountingExtract(): Total GL Entry Count: " + collectorBatch.getTotalRecords());
        LOG.info("buildCollectorBatchFromStandardAccountingExtract(): Total Debit Amount: " + collectorBatch.getTotalAmount());
        result = collectorBatch;
    } catch (Exception e) {
        LOG.error("buildCollectorBatchFromStandardAccountingExtract(): Error encountered while generating Collector data from SAE file", e);
        reportData.addHeaderValidationError("Error processing SAE-to-Collector feed: " + e.getMessage());
        result = null;
    } finally {
        resetBuilderForNextRun();
    }
    return result;
}
Also used : CollectorBatch(org.kuali.kfs.gl.batch.CollectorBatch)

Example 3 with CollectorBatch

use of org.kuali.kfs.gl.batch.CollectorBatch 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 4 with CollectorBatch

use of org.kuali.kfs.gl.batch.CollectorBatch in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCreateCollectorFileServiceImplTest method buildFixtureBasedCollectorBatch.

protected CollectorBatch buildFixtureBasedCollectorBatch(Integer sequenceNumber, ConcurStandardAccountingExtractFile saeFileContents) {
    String fixtureConstantName = StringUtils.substringBeforeLast(saeFileContents.getOriginalFileName(), KFSConstants.DELIMITER);
    ConcurCollectorBatchFixture fixture;
    try {
        fixture = ConcurCollectorBatchFixture.valueOf(fixtureConstantName);
    } catch (IllegalArgumentException | NullPointerException e) {
        return null;
    }
    CollectorBatch collectorBatch = fixture.toCollectorBatch();
    collectorBatch.setBatchSequenceNumber(sequenceNumber);
    return collectorBatch;
}
Also used : CollectorBatch(org.kuali.kfs.gl.batch.CollectorBatch) ConcurCollectorBatchFixture(edu.cornell.kfs.concur.batch.fixture.ConcurCollectorBatchFixture)

Aggregations

CollectorBatch (org.kuali.kfs.gl.batch.CollectorBatch)4 ConcurStandardAccountingExtractFile (edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile)1 ConcurCollectorBatchFixture (edu.cornell.kfs.concur.batch.fixture.ConcurCollectorBatchFixture)1 ConcurSAEDetailLineFixture (edu.cornell.kfs.concur.batch.fixture.ConcurSAEDetailLineFixture)1 ConcurStandardAccountingExtractBatchReportData (edu.cornell.kfs.concur.batch.report.ConcurStandardAccountingExtractBatchReportData)1