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