1 package org.kuali.ole.sys.context;
2
3
4 import org.kuali.ole.sys.OLEConstants;
5 import org.kuali.ole.sys.batch.AbstractStep;
6 import org.kuali.rice.coreservice.framework.parameter.ParameterService;
7 import org.kuali.rice.kew.api.KewApiServiceLocator;
8 import org.kuali.rice.kew.api.action.WorkflowDocumentActionsService;
9 import org.kuali.rice.kew.api.actionlist.ActionListService;
10 import org.kuali.rice.kew.api.doctype.DocumentTypeService;
11 import org.kuali.rice.kew.api.document.DocumentRefreshQueue;
12 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
13 import org.kuali.rice.krad.service.KRADServiceLocator;
14
15 import java.util.Date;
16 import java.util.HashMap;
17 import java.util.List;
18 import java.util.Map;
19
20
21
22
23 public class PaymentRequestBatchProcessor extends AbstractStep {
24 private WorkflowDocumentActionsService workflowDocumentActionsService;
25 private ActionListService actionListService;
26 private ParameterService parameterService;
27
28 @Override
29 public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
30
31 Map<String, String> payemntRequestMap = new HashMap<String, String>();
32 org.kuali.rice.kew.api.doctype.DocumentType documentType = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName("OLE_PREQ");
33 payemntRequestMap.put("docRouteStatus", OLEConstants.DocumentStatusCodes.ENROUTE);
34 payemntRequestMap.put("documentTypeId", documentType.getId());
35
36 List<DocumentRouteHeaderValue> olePaymentRequestDocumentList = (List<DocumentRouteHeaderValue>) KRADServiceLocator.getBusinessObjectService().findMatching(DocumentRouteHeaderValue.class, payemntRequestMap);
37
38 for (DocumentRouteHeaderValue olePaymentRequestDocument : olePaymentRequestDocumentList) {
39
40 DocumentRefreshQueue docRequeue = KewApiServiceLocator.getDocumentRequeuerService(
41 olePaymentRequestDocument.getDocumentType().getApplicationId(), olePaymentRequestDocument.getDocumentId(), 0);
42 docRequeue.refreshDocument(olePaymentRequestDocument.getDocumentId());
43
44 }
45 return true;
46 }
47 }