use of edu.cornell.kfs.fp.document.CorporateBilledCorporatePaidDocument in project cu-kfs by CU-CommunityApps.
the class CorporateBilledCorporatePaidCreateDocumentServiceImpl method routeProcurementCardDocuments.
@Override
public boolean routeProcurementCardDocuments() {
LOG.debug("routeProcurementCardDocuments() started");
Collection<CorporateBilledCorporatePaidDocument> cbcpDocumentList = retrieveCorporateBilledCorporatePaidDocuments(KewApiConstants.ROUTE_HEADER_SAVED_CD);
LOG.info("routeProcurementCardDocuments() Number of CBCP documents to Route: " + cbcpDocumentList.size());
Map<String, String> documentErrors = new HashMap<String, String>();
List<String> successfulDocuments = new ArrayList<String>();
for (CorporateBilledCorporatePaidDocument cbcpDocument : cbcpDocumentList) {
try {
LOG.info("routeProcurementCardDocuments() Routing CBCP document # " + cbcpDocument.getDocumentNumber() + ".");
documentService.prepareWorkflowDocument(cbcpDocument);
documentService.routeDocument(cbcpDocument, "CBCP document automatically routed", new ArrayList<AdHocRouteRecipient>());
successfulDocuments.add(cbcpDocument.getDocumentNumber());
} catch (WorkflowException we) {
documentErrors.put(cbcpDocument.getDocumentNumber(), "Workflow error: " + we.getMessage());
GlobalVariables.getMessageMap().clearErrorMessages();
LOG.error("routeProcurementCardDocuments, workflow error routing document # " + cbcpDocument.getDocumentNumber() + " " + we.getMessage(), we);
} catch (ValidationException ve) {
documentErrors.put(cbcpDocument.getDocumentNumber(), corporateBilledCorporatePaidRouteStepReportService.buildValidationErrorMessage(ve));
GlobalVariables.getMessageMap().clearErrorMessages();
LOG.error("routeProcurementCardDocuments, Error routing document # " + cbcpDocument.getDocumentNumber() + " " + ve.getMessage(), ve);
}
}
createAndEmailReport(cbcpDocumentList, documentErrors, successfulDocuments);
return true;
}
use of edu.cornell.kfs.fp.document.CorporateBilledCorporatePaidDocument in project cu-kfs by CU-CommunityApps.
the class CorporateBilledCorporatePaidCreateDocumentServiceImpl method createProcurementCardDocument.
@Override
public ProcurementCardDocument createProcurementCardDocument(List transactions) {
CorporateBilledCorporatePaidDocument cbcpDocument = (CorporateBilledCorporatePaidDocument) super.createProcurementCardDocument(transactions);
cbcpDocument.getDocumentHeader().setExplanation(getCorporateBilledCorporatePaidDocumentParameter(CuFPParameterConstants.CorporateBilledCorporatePaidDocument.DOCUMENT_EXPLANATION_PARAMETER_NAME));
setOrganizationDocumentNumberToPostingDate(cbcpDocument, cbcpDocument.getProcurementCardTransactionPostingDetailDate());
return cbcpDocument;
}
Aggregations