use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.
the class ConcurCashAdvancePdpFeedFileServiceImpl method buildPdpFeedBaseEntry.
private PdpFeedFileBaseEntry buildPdpFeedBaseEntry(ConcurRequestExtractFile requestExtractFile, ConcurRequestExtractBatchReportData reportData) {
int totalPdpDetailRecordsCount = 0;
KualiDecimal totalPdpDetailRecordsAmount = KualiDecimal.ZERO;
PdpFeedFileBaseEntry pdpBaseEntry = new PdpFeedFileBaseEntry();
pdpBaseEntry.setHeader(buildPdpFeedHeaderEntry(requestExtractFile.getBatchDate()));
List<PdpFeedGroupEntry> groupEntries = new ArrayList<PdpFeedGroupEntry>();
for (ConcurRequestExtractRequestDetailFileLine detailFileLine : requestExtractFile.getRequestDetails()) {
if (isDetailFileLineValidCashAdvanceRequest(detailFileLine)) {
PdpFeedDetailEntry pdpDetailEntry = buildPdpFeedDetailEntry(detailFileLine, buildPdpFeedAccountingEntry(detailFileLine));
List<PdpFeedDetailEntry> pdpDetailEntries = new ArrayList<PdpFeedDetailEntry>();
pdpDetailEntries.add(pdpDetailEntry);
groupEntries.add(buildPdpFeedGroupEntry(detailFileLine, buildPdpFeedPayeeIdEntry(detailFileLine), pdpDetailEntries));
recordCashAdvanceGenerationInDuplicateTrackingTable(detailFileLine, pdpDetailEntry.getSourceDocNbr(), requestExtractFile.getFileName());
totalPdpDetailRecordsCount++;
totalPdpDetailRecordsAmount = totalPdpDetailRecordsAmount.add(detailFileLine.getRequestAmount());
}
updateReportDataForDetailFileLineBeingProcessed(reportData, detailFileLine, totalPdpDetailRecordsCount, totalPdpDetailRecordsAmount);
}
pdpBaseEntry.setGroup(groupEntries);
pdpBaseEntry.setTrailer(buildPdpFeedTrailerEntry(totalPdpDetailRecordsCount, totalPdpDetailRecordsAmount));
pdpBaseEntry.setVersion(ConcurConstants.FEED_FILE_ENTRY_HEADER_VERSION);
return pdpBaseEntry;
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.
the class ConcurCashAdvancePdpFeedFileServiceImpl method createPdpFeedFileForValidatedDetailFileLines.
@Transactional
public boolean createPdpFeedFileForValidatedDetailFileLines(ConcurRequestExtractFile requestExtractFile, ConcurRequestExtractBatchReportData reportData) {
boolean pdpFileSuccessfullyCreated = false;
PdpFeedFileBaseEntry pdpFeedFileDataObject = buildPdpFeedBaseEntry(requestExtractFile, reportData);
if (pdpFeedFileDataObject.getTrailer().getDetailCount().intValue() != 0) {
String fullyQualifiedPdpFileName = getConcurBatchUtilityService().buildFullyQualifiedPdpOutputFileName(getPaymentImportDirectory(), requestExtractFile.getFileName());
pdpFileSuccessfullyCreated = getConcurBatchUtilityService().createPdpFeedFile(pdpFeedFileDataObject, fullyQualifiedPdpFileName);
if (pdpFileSuccessfullyCreated) {
LOG.info("createPdpFeedFileForValidatedDetailFileLines: fullyQualifiedPdpFileName [" + fullyQualifiedPdpFileName + "] was created for requestExtractFile [" + requestExtractFile.getFileName() + "]");
requestExtractFile.setFullyQualifiedPdpFileName(fullyQualifiedPdpFileName);
} else {
LOG.error("createPdpFeedFileForValidatedDetailFileLines: FAILED TO CREATE: fullyQualifiedPdpFileName [" + fullyQualifiedPdpFileName + "] for requestExtractFile [" + requestExtractFile.getFileName() + "]");
}
}
return pdpFileSuccessfullyCreated;
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountingExtractServiceImpl method extractPdpFeedFromStandardAccountingExtract.
@Override
public String extractPdpFeedFromStandardAccountingExtract(ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile, ConcurStandardAccountingExtractBatchReportData reportData) {
boolean success = true;
String pdpFileName = StringUtils.EMPTY;
if (!concurStandardAccountingExtractFile.getConcurStandardAccountingExtractDetailLines().isEmpty()) {
PdpFeedFileBaseEntry pdpFeedFileBaseEntry = buildPdpFeedFileBaseEntry(concurStandardAccountingExtractFile, reportData);
pdpFeedFileBaseEntry = getConcurStandardAccountExtractPdpEntryService().createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(pdpFeedFileBaseEntry, reportData);
logPdpSummaryInformation(pdpFeedFileBaseEntry);
pdpFileName = buildPdpOutputFileName(concurStandardAccountingExtractFile.getOriginalFileName());
String pdpFullyQualifiedFilePath = getPaymentImportDirectory() + pdpFileName;
success = marshalPdpFeedFile(pdpFeedFileBaseEntry, pdpFullyQualifiedFilePath);
} else {
LOG.error("extractPdpFeedFromStandardAccountingExtract, there are no detail lines to process.");
}
return success ? pdpFileName : StringUtils.EMPTY;
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImplTest method createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_NoGroups.
@Test
public void createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_NoGroups() {
PdpFeedFileBaseEntry pdpFeedFileBaseEntry = PdpFeedFileBaseEntryFixture.FEED_ONE_TRANS_ZERO.toPdpFeedFileBaseEntry();
assertEquals("Should have 1 group", 1, pdpFeedFileBaseEntry.getGroup().size());
PdpFeedFileBaseEntry cleaned = pdpEntryService.createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(pdpFeedFileBaseEntry, reportData);
assertEquals("Should have no groups", 0, cleaned.getGroup().size());
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImplTest method createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_TransSumToZero.
@Test
public void createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_TransSumToZero() {
PdpFeedFileBaseEntry pdpFeedFileBaseEntry = PdpFeedFileBaseEntryFixture.FEED_TWO_TRANS_SUM_TO_ZERO.toPdpFeedFileBaseEntry();
assertEquals("Should have 1 group", 1, pdpFeedFileBaseEntry.getGroup().size());
PdpFeedFileBaseEntry cleaned = pdpEntryService.createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(pdpFeedFileBaseEntry, reportData);
assertEquals("Should have no groups", 0, cleaned.getGroup().size());
}
Aggregations