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;
}
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;
}
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);
}
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;
}
Aggregations