Search in sources :

Example 6 with PdpFeedFileBaseEntry

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;
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) ArrayList(java.util.ArrayList) ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine) PdpFeedDetailEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) PdpFeedGroupEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedGroupEntry)

Example 7 with PdpFeedFileBaseEntry

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;
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with PdpFeedFileBaseEntry

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;
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry)

Example 9 with PdpFeedFileBaseEntry

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());
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) Test(org.junit.Test)

Example 10 with PdpFeedFileBaseEntry

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());
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) Test(org.junit.Test)

Aggregations

PdpFeedFileBaseEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry)12 Test (org.junit.Test)7 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 ConcurRequestExtractRequestDetailFileLine (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine)1 ConcurStandardAccountingExtractDetailLine (edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)1 PdpFeedDetailEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry)1 PdpFeedGroupEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedGroupEntry)1 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1