| 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.docsearch.service.SearchableAttributeProcessingService; |
| 24 | |
import org.kuali.rice.kew.exception.WorkflowRuntimeException; |
| 25 | |
import org.kuali.rice.kew.messaging.MessageServiceNames; |
| 26 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
| 27 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 28 | |
import org.kuali.rice.kim.api.entity.principal.Principal; |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | 0 | public class BlanketApproveProcessor implements BlanketApproveProcessorService { |
| 38 | |
|
| 39 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BlanketApproveProcessor.class); |
| 40 | |
|
| 41 | |
public void doBlanketApproveWork(String documentId, String principalId, Long actionTakenId, Set<String> nodeNames) { |
| 42 | 0 | doBlanketApproveWork(documentId, principalId, actionTakenId, nodeNames, false); |
| 43 | 0 | } |
| 44 | |
|
| 45 | |
public void doBlanketApproveWork(String documentId, String principalId, Long actionTakenId, Set<String> nodeNames, boolean shouldSearchIndex) { |
| 46 | 0 | KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true); |
| 47 | 0 | DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId); |
| 48 | 0 | ActionTakenValue actionTaken = KEWServiceLocator.getActionTakenService().findByActionTakenId(actionTakenId); |
| 49 | 0 | Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(principalId); |
| 50 | 0 | BlanketApproveAction blanketApprove = new BlanketApproveAction(document, principal, "", nodeNames); |
| 51 | 0 | LOG.debug("Doing blanket approve work document " + document.getDocumentId()); |
| 52 | |
try { |
| 53 | 0 | blanketApprove.performDeferredBlanketApproveWork(actionTaken); |
| 54 | 0 | } catch (Exception e) { |
| 55 | 0 | throw new WorkflowRuntimeException(e); |
| 56 | 0 | } |
| 57 | 0 | if (shouldSearchIndex) { |
| 58 | 0 | SearchableAttributeProcessingService searchableAttService = (SearchableAttributeProcessingService) MessageServiceNames.getSearchableAttributeService(KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId)); |
| 59 | 0 | searchableAttService.indexDocument(documentId); |
| 60 | |
} |
| 61 | 0 | LOG.debug("Work done and document requeued, document " + document.getDocumentId()); |
| 62 | 0 | } |
| 63 | |
} |