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