Search in sources :

Example 1 with DisbursementVoucherDocumentExtension

use of com.rsmart.kuali.kfs.fp.businessobject.DisbursementVoucherDocumentExtension in project cu-kfs by CU-CommunityApps.

the class DisbursementVoucherDocumentBatchServiceImpl method populateDisbursementVoucherDocument.

/**
 * Creates a new DV document and populates from the batch instance
 *
 * @param disbursementVoucherBatch
 * @param batchDisbursementVoucherDocument batch dv document to pull values from
 * @param batchDefault contains default values to use if value in feed is empty
 * @param MessageMap MessageMap for adding encountered errors
 * @return DisbursementVoucherDocument created and populated DV document
 */
protected DisbursementVoucherDocument populateDisbursementVoucherDocument(DisbursementVoucherBatch disbursementVoucherBatch, BatchDisbursementVoucherDocument batchDisbursementVoucherDocument, DisbursementVoucherBatchDefault batchDefault, MessageMap MessageMap) {
    DisbursementVoucherDocument disbursementVoucherDocument = null;
    try {
        disbursementVoucherDocument = (DisbursementVoucherDocument) documentService.getNewDocument(DisbursementVoucherDocument.class);
    } catch (WorkflowException e) {
        LOG.error("Error creating new disbursement voucher document: " + e.getMessage());
        throw new RuntimeException("Error creating new disbursement voucher document: " + e.getMessage(), e);
    }
    // populate extension with batch id
    DisbursementVoucherDocumentExtension disbursementVoucherDocumentExtension = new DisbursementVoucherDocumentExtension();
    disbursementVoucherDocumentExtension.setDocumentNumber(disbursementVoucherDocument.getDocumentNumber());
    disbursementVoucherDocumentExtension.setBatchId(disbursementVoucherBatch.getBatchId());
    disbursementVoucherDocument.setExtension(disbursementVoucherDocumentExtension);
    populateDisbursementVoucherFields(disbursementVoucherDocument, batchDisbursementVoucherDocument, batchDefault, MessageMap);
    batchFeedHelperService.loadDocumentAttachments(disbursementVoucherDocument, batchDisbursementVoucherDocument.getAttachments(), attachmentsPath, "", MessageMap);
    return disbursementVoucherDocument;
}
Also used : DisbursementVoucherDocumentExtension(com.rsmart.kuali.kfs.fp.businessobject.DisbursementVoucherDocumentExtension) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) BatchDisbursementVoucherDocument(com.rsmart.kuali.kfs.fp.document.BatchDisbursementVoucherDocument) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Aggregations

DisbursementVoucherDocumentExtension (com.rsmart.kuali.kfs.fp.businessobject.DisbursementVoucherDocumentExtension)1 BatchDisbursementVoucherDocument (com.rsmart.kuali.kfs.fp.document.BatchDisbursementVoucherDocument)1 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1