1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.actions.asyncservices; |
18 | |
|
19 | |
import java.util.Set; |
20 | |
|
21 | |
import org.kuali.rice.kew.actions.BlanketApproveAction; |
22 | |
import org.kuali.rice.kew.actiontaken.ActionTakenValue; |
23 | |
import org.kuali.rice.kew.api.KewApiServiceLocator; |
24 | |
import org.kuali.rice.kew.api.WorkflowRuntimeException; |
25 | |
import org.kuali.rice.kew.api.document.attribute.DocumentAttributeIndexingQueue; |
26 | |
import org.kuali.rice.kew.messaging.MessageServiceNames; |
27 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
28 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
29 | |
import org.kuali.rice.kim.api.identity.principal.Principal; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 0 | public class BlanketApproveProcessor implements BlanketApproveProcessorService { |
39 | |
|
40 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BlanketApproveProcessor.class); |
41 | |
|
42 | |
public void doBlanketApproveWork(String documentId, String principalId, String actionTakenId, Set<String> nodeNames) { |
43 | 0 | doBlanketApproveWork(documentId, principalId, actionTakenId, nodeNames, false); |
44 | 0 | } |
45 | |
|
46 | |
public void doBlanketApproveWork(String documentId, String principalId, String actionTakenId, Set<String> nodeNames, boolean shouldSearchIndex) { |
47 | 0 | KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true); |
48 | 0 | DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId); |
49 | 0 | ActionTakenValue actionTaken = KEWServiceLocator.getActionTakenService().findByActionTakenId(actionTakenId); |
50 | 0 | Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(principalId); |
51 | 0 | BlanketApproveAction blanketApprove = new BlanketApproveAction(document, principal, "", nodeNames); |
52 | 0 | LOG.debug("Doing blanket approve work document " + document.getDocumentId()); |
53 | |
try { |
54 | 0 | blanketApprove.performDeferredBlanketApproveWork(actionTaken); |
55 | 0 | } catch (Exception e) { |
56 | 0 | throw new WorkflowRuntimeException(e); |
57 | 0 | } |
58 | 0 | if (shouldSearchIndex) { |
59 | 0 | DocumentAttributeIndexingQueue queue = KewApiServiceLocator.getDocumentAttributeIndexingQueue(document.getDocumentType().getApplicationId()); |
60 | 0 | queue.indexDocument(documentId); |
61 | |
} |
62 | 0 | LOG.debug("Work done and document requeued, document " + document.getDocumentId()); |
63 | 0 | } |
64 | |
} |