1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.actions;
17
18 import org.kuali.rice.kew.actionrequest.ActionRequestFactory;
19 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
20 import org.kuali.rice.kew.actiontaken.ActionTakenValue;
21 import org.kuali.rice.kew.api.doctype.DocumentTypePolicy;
22 import org.kuali.rice.kew.api.exception.InvalidActionTakenException;
23 import org.kuali.rice.kew.api.exception.WorkflowException;
24 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
25 import org.kuali.rice.kew.service.KEWServiceLocator;
26 import org.kuali.rice.kew.api.KewApiConstants;
27 import org.kuali.rice.kim.api.identity.principal.PrincipalContract;
28
29 import java.util.Collection;
30 import java.util.List;
31
32
33
34
35
36
37 public class SuperUserDisapproveEvent extends SuperUserActionTakenEvent {
38
39 private final boolean sendAcknowledgements;
40
41 public SuperUserDisapproveEvent(DocumentRouteHeaderValue routeHeader, PrincipalContract principal) {
42 this(routeHeader, principal, DEFAULT_ANNOTATION, DEFAULT_RUN_POSTPROCESSOR_LOGIC);
43 }
44
45 public SuperUserDisapproveEvent(DocumentRouteHeaderValue routeHeader, PrincipalContract principal, String annotation, boolean runPostProcessor) {
46 super(KewApiConstants.ACTION_TAKEN_SU_DISAPPROVED_CD, KewApiConstants.SUPER_USER_DISAPPROVE, routeHeader, principal, annotation, runPostProcessor);
47 this.sendAcknowledgements = isPolicySet(routeHeader.getDocumentType(), DocumentTypePolicy.SEND_NOTIFICATION_ON_SU_DISAPPROVE);
48 }
49
50 @Override
51 protected void processActionTaken(ActionTakenValue actionTaken) {
52 if (sendAcknowledgements) {
53 Collection<ActionRequestValue> actionRequests = actionTaken.getActionRequests();
54 if (!actionRequests.isEmpty()) {
55 generateAcknowledgementsToPreviousActionTakers(actionRequests.iterator().next().getNodeInstance());
56 }
57 }
58 }
59
60 protected void markDocument() throws WorkflowException {
61
62 getRouteHeader().markDocumentDisapproved();
63 KEWServiceLocator.getRouteHeaderService().saveRouteHeader(getRouteHeader());
64 }
65 }