001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kew.actionrequest.service; 017 018import org.kuali.rice.kew.actionrequest.ActionRequestValue; 019import org.kuali.rice.kew.actionrequest.Recipient; 020import org.kuali.rice.kew.actiontaken.ActionTakenValue; 021import org.kuali.rice.kew.engine.ActivationContext; 022import org.kuali.rice.kew.engine.node.RouteNodeInstance; 023import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; 024 025import java.util.Collection; 026import java.util.List; 027import java.util.Map; 028import java.util.Set; 029 030/** 031 * INTERNAL: Service to handle the building, sorting, saving, activating and deactivating of action request graphs. 032 * 033 * <p>These lists are what determine role and delegation behaviors in graphs of action requests. Fetching that is being 034 * done is also taking into account the 'weight' of action request codes.</p> 035 * 036 * @author Kuali Rice Team (rice.collab@kuali.org) 037 */ 038public interface ActionRequestService { 039 040 ActionRequestValue initializeActionRequestGraph(ActionRequestValue actionRequest, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance); 041 042 List<ActionRequestValue> findAllValidRequests(String principalId, String documentId, String requestCode); 043 044 List<ActionRequestValue> findAllValidRequests(String principalId, List<ActionRequestValue> actionRequests, String requestCode); 045 046 List<ActionRequestValue> findPendingByDoc(String documentId); 047 048 ActionRequestValue saveActionRequest(ActionRequestValue actionRequest); 049 050 ActionRequestValue activateRequest(ActionRequestValue actionRequest); 051 052 ActionRequestValue activateRequest(ActionRequestValue actionRequest, boolean simulate); 053 054 ActionRequestValue activateRequest(ActionRequestValue actionRequest, ActivationContext activationContext); 055 056 List<ActionRequestValue> activateRequests(List<ActionRequestValue> actionRequests); 057 058 List<ActionRequestValue> activateRequests(List<ActionRequestValue> actionRequests, boolean simulate); 059 060 List<ActionRequestValue> activateRequests(List<ActionRequestValue> actionRequests, ActivationContext activationContext); 061 062 ActionRequestValue activateRequestNoNotification(ActionRequestValue actionRequest, ActivationContext activationContext); 063 064 ActionRequestValue deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest); 065 066 List<ActionRequestValue> deactivateRequests(ActionTakenValue actionTaken, List<ActionRequestValue> actionRequests); 067 068 ActionRequestValue deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest, ActivationContext activationContext); 069 070 List<ActionRequestValue> deactivateRequests(ActionTakenValue actionTaken, List<ActionRequestValue> actionRequests, boolean simulate); 071 072 List<ActionRequestValue> deactivateRequests(ActionTakenValue actionTaken, List<ActionRequestValue> actionRequests, ActivationContext activationContext); 073 074 void deleteActionRequestGraph(ActionRequestValue actionRequest); 075 076 void deleteActionRequestGraphNoOutbox(ActionRequestValue actionRequest); 077 078 ActionRequestValue findByActionRequestId(String actionRequestId); 079 080 List<ActionRequestValue> findPendingRootRequestsByDocId(String documentId); 081 082 List<ActionRequestValue> findPendingRootRequestsByDocumentType(String documentTypeId); 083 084 List<ActionRequestValue> findAllActionRequestsByDocumentId(String documentId); 085 086 List<ActionRequestValue> findAllRootActionRequestsByDocumentId(String documentId); 087 088 List<ActionRequestValue> findPendingByActionRequestedAndDocId(String actionRequestedCdCd, String documentId); 089 090 /** 091 * This method gets a list of ids of all principals who have a pending action request for a document. 092 */ 093 List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(String actionRequestedCd, String documentId); 094 095 List<ActionRequestValue> findByStatusAndDocId(String statusCd, String documentId); 096 097 List<ActionRequestValue> findByDocumentIdIgnoreCurrentInd(String documentId); 098 099 List<ActionRequestValue> findActivatedByGroup(String groupId); 100 101 void updateActionRequestsForResponsibilityChange(Set<String> responsibilityIds); 102 103 ActionRequestValue getRoot(ActionRequestValue actionRequest); 104 105 List<ActionRequestValue> getRootRequests(Collection<ActionRequestValue> actionRequests); 106 107 List<ActionRequestValue> findPendingByDocRequestCdNodeName(String documentId, String requestCode, String nodeName); 108 109 /** 110 * Returns all pending requests for a given routing entity 111 * @param documentId the id of the document header being routed 112 * @return a List of all pending ActionRequestValues for the document 113 */ 114 List<ActionRequestValue> findAllPendingRequests(String documentId); 115 116 /** 117 * Filters action requests based on if they occur after the given requestCode, and if they relate to 118 * the given principal 119 * @param actionRequests the List of ActionRequestValues to filter 120 * @param principalId the id of the principal to find active requests for 121 * @param principalGroupIds List of group ids that the principal belongs to 122 * @param requestCode the request code for all ActionRequestValues to be after 123 * @return the filtered List of ActionRequestValues 124 */ 125 List<ActionRequestValue> filterActionRequestsByCode(List<ActionRequestValue> actionRequests, String principalId, List<String> principalGroupIds, String requestCode); 126 127 /** 128 * Returns the highest priority delegator in the list of action requests. 129 */ 130 Recipient findDelegator(List<ActionRequestValue> actionRequests); 131 132 ActionRequestValue findDelegatorRequest(ActionRequestValue actionRequest); 133 134 List<ActionRequestValue> findPendingRootRequestsByDocIdAtRouteNode(String documentId, String nodeInstanceId); 135 136 List<ActionRequestValue> findRootRequestsByDocIdAtRouteNode(String documentId, String nodeInstanceId); 137 138 List<ActionRequestValue> getDelegateRequests(ActionRequestValue actionRequest); 139 140 /** 141 * If this is a role request, then this method returns a List of the action request for each recipient within the 142 * role. Otherwise, it will return a List with just the original action request. 143 */ 144 List<ActionRequestValue> getTopLevelRequests(ActionRequestValue actionRequest); 145 146 /** 147 * Checks if the given user has any Action Requests on the given document. 148 */ 149 boolean doesPrincipalHaveRequest(String principalId, String documentId); 150 151 Map<String, String> getActionsRequested(DocumentRouteHeaderValue routeHeader, String principalId, boolean completeAndApproveTheSame); 152 153 ActionRequestValue getActionRequestForRole(String actionTakenId); 154}