use of org.kuali.kfs.krad.workflow.service.WorkflowDocumentService in project cu-kfs by CU-CommunityApps.
the class CuElectronicInvoiceHelperServiceImpl method routeEIRTDocuments.
protected boolean routeEIRTDocuments() {
Collection<String> documentIdList = null;
try {
documentIdList = retrieveDocumentsToRoute(KewApiConstants.ROUTE_HEADER_SAVED_CD, ElectronicInvoiceRejectDocument.class);
} catch (WorkflowException e1) {
LOG.error("Error retrieving eirt documents for routing: " + e1.getMessage(), e1);
throw new RuntimeException(e1.getMessage(), e1);
} catch (RemoteException re) {
LOG.error("Error retrieving eirt documents for routing: " + re.getMessage(), re);
throw new RuntimeException(re.getMessage(), re);
}
// Collections.reverse(documentIdList);
LOG.info("EIRTs to Route: " + documentIdList);
DocumentService documentService = SpringContext.getBean(DocumentService.class);
WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class);
for (String eirtDocumentId : documentIdList) {
try {
LOG.info("Retrieving EIRT document # " + eirtDocumentId + ".");
ElectronicInvoiceRejectDocument eirtDocument = (ElectronicInvoiceRejectDocument) documentService.getByDocumentHeaderId(eirtDocumentId);
LOG.info("Routing EIRT document # " + eirtDocumentId + ".");
documentService.prepareWorkflowDocument(eirtDocument);
LOG.info("EIRT document # " + eirtDocumentId + " prepared for workflow.");
// calling workflow service to bypass business rule checks
workflowDocumentService.route(eirtDocument.getDocumentHeader().getWorkflowDocument(), "Routed by electronic invoice batch job", null);
LOG.info("EIRT document # " + eirtDocumentId + " routed.");
} catch (WorkflowException e) {
LOG.error("Error routing document # " + eirtDocumentId + " " + e.getMessage());
throw new RuntimeException(e.getMessage(), e);
}
}
return true;
}
use of org.kuali.kfs.krad.workflow.service.WorkflowDocumentService in project cu-kfs by CU-CommunityApps.
the class CuElectronicInvoiceHelperServiceImpl method routePREQDocuments.
/**
* @return
*/
protected boolean routePREQDocuments() {
Collection<String> documentIdList = null;
try {
documentIdList = retrieveDocumentsToRoute(KewApiConstants.ROUTE_HEADER_SAVED_CD, PaymentRequestDocument.class);
} catch (WorkflowException e1) {
LOG.error("Error retrieving preq documents for routing: " + e1.getMessage(), e1);
throw new RuntimeException(e1.getMessage(), e1);
} catch (RemoteException re) {
LOG.error("Error retrieving preq documents for routing: " + re.getMessage(), re);
throw new RuntimeException(re.getMessage(), re);
}
// Collections.reverse(documentIdList);
LOG.info("PREQs to Route: " + documentIdList);
DocumentService documentService = SpringContext.getBean(DocumentService.class);
WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class);
for (String preqDocumentId : documentIdList) {
try {
LOG.info("Retrieving PREQ document # " + preqDocumentId + ".");
PaymentRequestDocument preqDocument = (PaymentRequestDocument) documentService.getByDocumentHeaderId(preqDocumentId);
LOG.info("Routing PREQ document # " + preqDocumentId + ".");
if (preqDocument.getPaymentRequestElectronicInvoiceIndicator()) {
documentService.prepareWorkflowDocument(preqDocument);
LOG.info("PREQ document # " + preqDocumentId + " prepared for workflow.");
// calling workflow service to bypass business rule checks
workflowDocumentService.route(preqDocument.getDocumentHeader().getWorkflowDocument(), "Routed by electronic invoice batch job", null);
LOG.info("PREQ document # " + preqDocumentId + " routed.");
}
} catch (WorkflowException e) {
LOG.error("Error routing document # " + preqDocumentId + " " + e.getMessage());
throw new RuntimeException(e.getMessage(), e);
}
}
return true;
}
Aggregations