View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.actionrequest.service;
17  
18  import org.kuali.rice.kew.actionrequest.ActionRequestValue;
19  import org.kuali.rice.kew.actionrequest.Recipient;
20  import org.kuali.rice.kew.actiontaken.ActionTakenValue;
21  import org.kuali.rice.kew.engine.ActivationContext;
22  import org.kuali.rice.kew.engine.node.RouteNodeInstance;
23  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
24  
25  import java.util.Collection;
26  import java.util.List;
27  import java.util.Map;
28  import java.util.Set;
29  
30  /**
31   * Service to handle the building, sorting, saving, activating and deactivating of action request graphs.  These lists are
32   * what determine role and delegation behaviors in graphs of action requests.
33   *
34   * Fetching that is being done is also taking into account the 'weight' of action request codes.
35   *
36   * @author Kuali Rice Team (rice.collab@kuali.org)
37   */
38  public interface ActionRequestService {
39  	public ActionRequestValue initializeActionRequestGraph(ActionRequestValue actionRequest, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance);
40  
41      public void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest);
42  
43      public void deactivateRequests(ActionTakenValue actionTaken, List actionRequests);
44  
45      public void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest, boolean simulate);
46  
47      public void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest, ActivationContext activationContext);
48  
49      public void deactivateRequests(ActionTakenValue actionTaken, List actionRequests, boolean simulate);
50  
51      public void deactivateRequests(ActionTakenValue actionTaken, List actionRequests, ActivationContext activationContext);
52  
53      public void deleteActionRequestGraph(ActionRequestValue actionRequest);
54  
55      public List findAllValidRequests(String principalId, String documentId, String requestCode);
56  
57      public List findAllValidRequests(String principalId, Collection actionRequests, String requestCode);
58  
59      public List<ActionRequestValue> findPendingByDoc(String documentId);
60  
61      public void saveActionRequest(ActionRequestValue actionRequest);
62  
63      public void activateRequest(ActionRequestValue actionRequest);
64  
65      public void activateRequest(ActionRequestValue actionRequest, boolean simulate);
66  
67      public void activateRequest(ActionRequestValue actionRequest, ActivationContext activationContext);
68  
69      public void activateRequests(Collection actionRequests);
70  
71      public void activateRequests(Collection actionRequests, boolean simulate);
72  
73  	public void activateRequests(Collection actionRequests, ActivationContext activationContext);
74  
75      public List activateRequestNoNotification(ActionRequestValue actionRequest, boolean simulate);
76  
77      public List activateRequestNoNotification(ActionRequestValue actionRequest, ActivationContext activationContext);
78  
79      public ActionRequestValue findByActionRequestId(String actionRequestId);
80  
81      public List<ActionRequestValue> findPendingRootRequestsByDocId(String documentId);
82  
83      public List<ActionRequestValue> findPendingRootRequestsByDocIdAtRouteLevel(String documentId, Integer routeLevel);
84  
85      public List<ActionRequestValue> findPendingByDocIdAtOrBelowRouteLevel(String documentId, Integer routeLevel);
86  
87      public List<ActionRequestValue> findPendingRootRequestsByDocIdAtOrBelowRouteLevel(String documentId, Integer routeLevel);
88  
89      public List<ActionRequestValue> findPendingRootRequestsByDocumentType(String documentTypeId);
90  
91      public List<ActionRequestValue> findAllActionRequestsByDocumentId(String documentId);
92      
93      public List<ActionRequestValue> findAllRootActionRequestsByDocumentId(String documentId);
94  
95      public List<ActionRequestValue> findPendingByActionRequestedAndDocId(String actionRequestedCdCd, String documentId);
96  
97      /**
98       *
99       * This method gets a list of ids of all principals who have a pending action request for a document.
100      *
101      * @param actionRequestedCd
102      * @param documentId
103      * @return
104      */
105     public List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(String actionRequestedCd, String documentId);
106 
107     public List<ActionRequestValue> findByStatusAndDocId(String statusCd, String documentId);
108 
109     public void alterActionRequested(List actionRequests, String actionRequestCd);
110 
111     public List<ActionRequestValue> findByDocumentIdIgnoreCurrentInd(String documentId);
112 
113     public List findActivatedByGroup(String groupId);
114 
115     public void updateActionRequestsForResponsibilityChange(Set<String> responsibilityIds);
116 
117     public ActionRequestValue getRoot(ActionRequestValue actionRequest);
118 
119     public List<ActionRequestValue> getRootRequests(Collection<ActionRequestValue> actionRequests);
120 
121     public boolean isDuplicateRequest(ActionRequestValue actionRequest);
122 
123     public List<ActionRequestValue> findPendingByDocRequestCdRouteLevel(String documentId, String requestCode, Integer routeLevel);
124 
125     public List<ActionRequestValue> findPendingByDocRequestCdNodeName(String documentId, String requestCode, String nodeName);
126     
127     /**
128      * Returns all pending requests for a given routing entity
129      * @param documentId the id of the document header being routed
130      * @return a List of all pending ActionRequestValues for the document
131      */
132     public abstract List<ActionRequestValue> findAllPendingRequests(String documentId);
133     
134 	/**
135 	 * Filters action requests based on if they occur after the given requestCode, and if they relate to 
136 	 * the given principal
137 	 * @param actionRequests the List of ActionRequestValues to filter
138 	 * @param principalId the id of the principal to find active requests for
139 	 * @param principalGroupIds List of group ids that the principal belongs to
140 	 * @param requestCode the request code for all ActionRequestValues to be after
141 	 * @return the filtered List of ActionRequestValues
142 	 */
143 	public abstract List<ActionRequestValue> filterActionRequestsByCode(List<ActionRequestValue> actionRequests, String principalId, List<String> principalGroupIds, String requestCode);
144 
145     /**
146      * Returns the highest priority delegator in the list of action requests.
147      */
148     public Recipient findDelegator(List actionRequests);
149 
150     /**
151      * Returns the closest delegator for the given ActionRequest
152      */
153     public Recipient findDelegator(ActionRequestValue actionRequest);
154 
155     public ActionRequestValue findDelegatorRequest(ActionRequestValue actionRequest);
156 
157     public void deleteByDocumentId(String documentId);
158 
159     public void deleteByActionRequestId(String actionRequestId);
160 
161     public void validateActionRequest(ActionRequestValue actionRequest);
162 
163     public List<ActionRequestValue> findPendingRootRequestsByDocIdAtRouteNode(String documentId, String nodeInstanceId);
164 
165     public List<ActionRequestValue> findRootRequestsByDocIdAtRouteNode(String documentId, String nodeInstanceId);
166 
167     public List getDelegateRequests(ActionRequestValue actionRequest);
168 
169     /**
170      * If this is a role request, then this method returns a List of the action request for each recipient within the
171      * role.  Otherwise, it will return a List with just the original action request.
172      */
173     public List getTopLevelRequests(ActionRequestValue actionRequest);
174 
175     public boolean isValidActionRequestCode(String actionRequestCode);
176 
177     /**
178      * Checks if the given user has any Action Requests on the given document.
179      */
180     public boolean doesPrincipalHaveRequest(String principalId, String documentId);
181 
182     public Map<String, String> getActionsRequested(DocumentRouteHeaderValue routeHeader, String principalId, boolean completeAndApproveTheSame);
183 
184     public ActionRequestValue getActionRequestForRole(String actionTakenId);
185 }