org.kuali.rice.kew.actionrequest.service.impl
Class ActionRequestServiceImpl

java.lang.Object
  extended by org.kuali.rice.kew.actionrequest.service.impl.ActionRequestServiceImpl
All Implemented Interfaces:
ActionRequestService

public class ActionRequestServiceImpl
extends Object
implements ActionRequestService

Default implementation of the ActionRequestService.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
private  ActionRequestDAO actionRequestDAO
           
private static org.apache.log4j.Logger LOG
           
 
Constructor Summary
ActionRequestServiceImpl()
           
 
Method Summary
 void activateRequest(ActionRequestValue actionRequest)
           
 void activateRequest(ActionRequestValue actionRequest, ActivationContext activationContext)
           
 void activateRequest(ActionRequestValue actionRequest, boolean simulate)
           
private  void activateRequestInternal(ActionRequestValue actionRequest, ActivationContext activationContext)
          Internal helper method for activating a single action requests and it's children.
 List activateRequestNoNotification(ActionRequestValue actionRequest, ActivationContext activationContext)
           
 List activateRequestNoNotification(ActionRequestValue actionRequest, boolean simulate)
           
 void activateRequests(Collection actionRequests)
           
 void activateRequests(Collection actionRequests, ActivationContext activationContext)
           
 void activateRequests(Collection actionRequests, boolean simulate)
           
private  void activateRequestsInternal(Collection actionRequests, ActivationContext activationContext)
          Internal helper method for activating a Collection of action requests and their children.
 void alterActionRequested(List actionRequests, String actionRequestCd)
           
private  List<ActionItem> createActionItemsForPrincipals(ActionRequestValue actionRequest, List<String> principalIds)
           
protected  boolean deactivateOnActionAlreadyTaken(ActionRequestValue actionRequestToActivate, ActivationContext activationContext)
           
protected  boolean deactivateOnEmptyGroup(ActionRequestValue actionRequestToActivate, ActivationContext activationContext)
          Checks if the action request which is being activated has a group with no members.
 void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest)
           
private  void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest, ActionRequestValue deactivationRequester, ActivationContext activationContext)
           
 void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest, ActivationContext activationContext)
           
 void deactivateRequest(ActionTakenValue actionTaken, ActionRequestValue actionRequest, boolean simulate)
           
private  void deactivateRequests(ActionTakenValue actionTaken, Collection actionRequests, ActionRequestValue deactivationRequester, ActivationContext activationContext)
           
 void deactivateRequests(ActionTakenValue actionTaken, List actionRequests)
           
 void deactivateRequests(ActionTakenValue actionTaken, List actionRequests, ActivationContext activationContext)
           
 void deactivateRequests(ActionTakenValue actionTaken, List actionRequests, boolean simulate)
           
private  void deleteActionItems(ActionRequestValue actionRequest)
          Deletes the action items for the action request
 void deleteActionRequestGraph(ActionRequestValue actionRequest)
          Deletes an action request and all of its action items following the graph down through the action request's children.
 void deleteByActionRequestId(Long actionRequestId)
           
 void deleteByRouteHeaderId(Long routeHeaderId)
           
 boolean doesPrincipalHaveRequest(String principalId, Long documentId)
          Checks if the given user has any Action Requests on the given document.
 List<ActionRequestValue> filterActionRequestsByCode(List<ActionRequestValue> actionRequests, String principalId, List<String> principalGroupIds, String requestCode)
          Filters action requests based on if they occur after the given requestCode, and if they relate to the given principal
 List findActivatedByGroup(String groupId)
           
 List findAllActionRequestsByRouteHeaderId(Long routeHeaderId)
           
 List<ActionRequestValue> findAllPendingRequests(Long routeHeaderId)
          Returns all pending requests for a given routing entity
 List findAllRootActionRequestsByRouteHeaderId(Long routeHeaderId)
           
 List findAllValidRequests(String principalId, Collection actionRequests, String requestCode)
           
 List findAllValidRequests(String principalId, Long routeHeaderId, String requestCode)
           
 ActionRequestValue findByActionRequestId(Long actionRequestId)
           
 List findByRouteHeaderIdIgnoreCurrentInd(Long routeHeaderId)
           
 List<ActionRequestValue> findByStatusAndDocId(String statusCd, Long routeHeaderId)
           
 Recipient findDelegator(ActionRequestValue actionRequest)
          Returns the closest delegator for the given ActionRequest
 Recipient findDelegator(List actionRequests)
          Returns the highest priority delegator in the list of action requests.
 ActionRequestValue findDelegatorRequest(ActionRequestValue actionRequest)
           
 List findPendingByActionRequestedAndDocId(String actionRequestedCd, Long routeHeaderId)
           
 List findPendingByDoc(Long routeHeaderId)
           
 List findPendingByDocIdAtOrBelowRouteLevel(Long routeHeaderId, Integer routeLevel)
           
 List findPendingByDocRequestCdNodeName(Long routeHeaderId, String requestCode, String nodeName)
           
 List findPendingByDocRequestCdRouteLevel(Long routeHeaderId, String requestCode, Integer routeLevel)
           
 List findPendingRootRequestsByDocId(Long routeHeaderId)
           
 List findPendingRootRequestsByDocIdAtOrBelowRouteLevel(Long routeHeaderId, Integer routeLevel)
           
 List findPendingRootRequestsByDocIdAtRouteLevel(Long routeHeaderId, Integer routeLevel)
           
 List findPendingRootRequestsByDocIdAtRouteNode(Long routeHeaderId, Long nodeInstanceId)
           
 List findPendingRootRequestsByDocumentType(Long documentTypeId)
           
 List findRootRequestsByDocIdAtRouteNode(Long documentId, Long nodeInstanceId)
           
private  List<ActionItem> generateActionItems(ActionRequestValue actionRequest, ActivationContext activationContext)
          Generates ActionItems for the given ActionRequest and returns the List of generated Action Items.
private  ActionListService getActionListService()
           
 ActionRequestDAO getActionRequestDAO()
           
 AttributeSet getActionsRequested(DocumentRouteHeaderValue routeHeader, String principalId, boolean completeAndApproveTheSame)
           
protected  AttributeSet getActionsRequested(String principalId, List<ActionRequestValue> actionRequests, boolean completeAndApproveTheSame)
          Returns a Map of actions that are requested for the given principalId in the given list of action requests.
private  ActionTakenService getActionTakenService()
           
 List getDelegateRequests(ActionRequestValue actionRequest)
           
 List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(String actionRequestedCd, Long routeHeaderId)
          This method gets a list of ids of all principals who have a pending action request for a document.
 ActionRequestValue getRoot(ActionRequestValue actionRequest)
           
 List<ActionRequestValue> getRootRequests(Collection<ActionRequestValue> actionRequests)
           
private  RouteHeaderService getRouteHeaderService()
           
 List getTopLevelRequests(ActionRequestValue actionRequest)
          If this is a role request, then this method returns a List of the action request for each recipient within the role.
private  boolean haltForAllApprove(ActionRequestValue actionRequest, ActionRequestValue deactivationRequester)
          Returns true if we are dealing with an 'All Approve' request, the requester of the deactivation is a child of the 'All Approve' request, and all of the children have not been deactivated.
 ActionRequestValue initializeActionRequestGraph(ActionRequestValue actionRequest, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance)
           
 boolean isDuplicateRequest(ActionRequestValue actionRequest)
           
 boolean isValidActionRequestCode(String actionRequestCode)
           
private  void processResponsibilityId(ActionRequestValue actionRequest)
           
private  void propagatePropertiesToRequestGraph(ActionRequestValue actionRequest, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance)
           
 void saveActionRequest(ActionRequestValue actionRequest)
           
 void setActionRequestDAO(ActionRequestDAO actionRequestDAO)
           
private  void setPropertiesToRequest(ActionRequestValue actionRequest, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance)
           
 void updateActionRequestsForResponsibilityChange(Set<Long> responsibilityIds)
           
 void validateActionRequest(ActionRequestValue actionRequest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

actionRequestDAO

private ActionRequestDAO actionRequestDAO
Constructor Detail

ActionRequestServiceImpl

public ActionRequestServiceImpl()
Method Detail

findByActionRequestId

public ActionRequestValue findByActionRequestId(Long actionRequestId)
Specified by:
findByActionRequestId in interface ActionRequestService

getActionsRequested

public AttributeSet getActionsRequested(DocumentRouteHeaderValue routeHeader,
                                        String principalId,
                                        boolean completeAndApproveTheSame)
Specified by:
getActionsRequested in interface ActionRequestService

getActionsRequested

protected AttributeSet getActionsRequested(String principalId,
                                           List<ActionRequestValue> actionRequests,
                                           boolean completeAndApproveTheSame)
Returns a Map of actions that are requested for the given principalId in the given list of action requests.

Parameters:
principalId -
actionRequests -
completeAndApproveTheSame -
Returns:

initializeActionRequestGraph

public ActionRequestValue initializeActionRequestGraph(ActionRequestValue actionRequest,
                                                       DocumentRouteHeaderValue document,
                                                       RouteNodeInstance nodeInstance)
Specified by:
initializeActionRequestGraph in interface ActionRequestService

propagatePropertiesToRequestGraph

private void propagatePropertiesToRequestGraph(ActionRequestValue actionRequest,
                                               DocumentRouteHeaderValue document,
                                               RouteNodeInstance nodeInstance)

setPropertiesToRequest

private void setPropertiesToRequest(ActionRequestValue actionRequest,
                                    DocumentRouteHeaderValue document,
                                    RouteNodeInstance nodeInstance)

activateRequests

public void activateRequests(Collection actionRequests)
Specified by:
activateRequests in interface ActionRequestService

activateRequests

public void activateRequests(Collection actionRequests,
                             boolean simulate)
Specified by:
activateRequests in interface ActionRequestService

activateRequests

public void activateRequests(Collection actionRequests,
                             ActivationContext activationContext)
Specified by:
activateRequests in interface ActionRequestService

activateRequest

public void activateRequest(ActionRequestValue actionRequest)
Specified by:
activateRequest in interface ActionRequestService

activateRequest

public void activateRequest(ActionRequestValue actionRequest,
                            boolean simulate)
Specified by:
activateRequest in interface ActionRequestService

activateRequest

public void activateRequest(ActionRequestValue actionRequest,
                            ActivationContext activationContext)
Specified by:
activateRequest in interface ActionRequestService

activateRequestNoNotification

public List activateRequestNoNotification(ActionRequestValue actionRequest,
                                          boolean simulate)
Specified by:
activateRequestNoNotification in interface ActionRequestService

activateRequestNoNotification

public List activateRequestNoNotification(ActionRequestValue actionRequest,
                                          ActivationContext activationContext)
Specified by:
activateRequestNoNotification in interface ActionRequestService

activateRequestsInternal

private void activateRequestsInternal(Collection actionRequests,
                                      ActivationContext activationContext)
Internal helper method for activating a Collection of action requests and their children. Maintains an accumulator for generated action items.

Parameters:
actionRequests -
activationContext -

activateRequestInternal

private void activateRequestInternal(ActionRequestValue actionRequest,
                                     ActivationContext activationContext)
Internal helper method for activating a single action requests and it's children. Maintains an accumulator for generated action items.


generateActionItems

private List<ActionItem> generateActionItems(ActionRequestValue actionRequest,
                                             ActivationContext activationContext)
Generates ActionItems for the given ActionRequest and returns the List of generated Action Items.

Parameters:
actionRequest -
activationContext -
Returns:
the List of generated ActionItems

createActionItemsForPrincipals

private List<ActionItem> createActionItemsForPrincipals(ActionRequestValue actionRequest,
                                                        List<String> principalIds)

processResponsibilityId

private void processResponsibilityId(ActionRequestValue actionRequest)

deactivateOnActionAlreadyTaken

protected boolean deactivateOnActionAlreadyTaken(ActionRequestValue actionRequestToActivate,
                                                 ActivationContext activationContext)

deactivateOnEmptyGroup

protected boolean deactivateOnEmptyGroup(ActionRequestValue actionRequestToActivate,
                                         ActivationContext activationContext)
Checks if the action request which is being activated has a group with no members. If this is the case then it will immediately initiate de-activation on the request since a group with no members will result in no action items being generated so should be effectively skipped.


deactivateRequest

public void deactivateRequest(ActionTakenValue actionTaken,
                              ActionRequestValue actionRequest)
Specified by:
deactivateRequest in interface ActionRequestService

deactivateRequest

public void deactivateRequest(ActionTakenValue actionTaken,
                              ActionRequestValue actionRequest,
                              boolean simulate)
Specified by:
deactivateRequest in interface ActionRequestService

deactivateRequest

public void deactivateRequest(ActionTakenValue actionTaken,
                              ActionRequestValue actionRequest,
                              ActivationContext activationContext)
Specified by:
deactivateRequest in interface ActionRequestService

deactivateRequests

public void deactivateRequests(ActionTakenValue actionTaken,
                               List actionRequests)
Specified by:
deactivateRequests in interface ActionRequestService

deactivateRequests

public void deactivateRequests(ActionTakenValue actionTaken,
                               List actionRequests,
                               boolean simulate)
Specified by:
deactivateRequests in interface ActionRequestService

deactivateRequests

public void deactivateRequests(ActionTakenValue actionTaken,
                               List actionRequests,
                               ActivationContext activationContext)
Specified by:
deactivateRequests in interface ActionRequestService

deactivateRequests

private void deactivateRequests(ActionTakenValue actionTaken,
                                Collection actionRequests,
                                ActionRequestValue deactivationRequester,
                                ActivationContext activationContext)

deactivateRequest

private void deactivateRequest(ActionTakenValue actionTaken,
                               ActionRequestValue actionRequest,
                               ActionRequestValue deactivationRequester,
                               ActivationContext activationContext)

haltForAllApprove

private boolean haltForAllApprove(ActionRequestValue actionRequest,
                                  ActionRequestValue deactivationRequester)
Returns true if we are dealing with an 'All Approve' request, the requester of the deactivation is a child of the 'All Approve' request, and all of the children have not been deactivated. If all of the children are already deactivated or a non-child request initiated deactivation, then this method returns false. false otherwise.

Parameters:
actionRequest -
deactivationRequester -
Returns:

getRootRequests

public List<ActionRequestValue> getRootRequests(Collection<ActionRequestValue> actionRequests)
Specified by:
getRootRequests in interface ActionRequestService

getRoot

public ActionRequestValue getRoot(ActionRequestValue actionRequest)
Specified by:
getRoot in interface ActionRequestService

findAllPendingRequests

public List<ActionRequestValue> findAllPendingRequests(Long routeHeaderId)
Returns all pending requests for a given routing entity

Specified by:
findAllPendingRequests in interface ActionRequestService
Parameters:
routeHeaderId - the id of the document header being routed
Returns:
a List of all pending ActionRequestValues for the document

findAllValidRequests

public List findAllValidRequests(String principalId,
                                 Long routeHeaderId,
                                 String requestCode)
Specified by:
findAllValidRequests in interface ActionRequestService

findAllValidRequests

public List findAllValidRequests(String principalId,
                                 Collection actionRequests,
                                 String requestCode)
Specified by:
findAllValidRequests in interface ActionRequestService

filterActionRequestsByCode

public List<ActionRequestValue> filterActionRequestsByCode(List<ActionRequestValue> actionRequests,
                                                           String principalId,
                                                           List<String> principalGroupIds,
                                                           String requestCode)
Filters action requests based on if they occur after the given requestCode, and if they relate to the given principal

Specified by:
filterActionRequestsByCode in interface ActionRequestService
Parameters:
actionRequests - the List of ActionRequestValues to filter
principalId - the id of the principal to find active requests for
principalGroupIds - List of group ids that the principal belongs to
requestCode - the request code for all ActionRequestValues to be after
Returns:
the filtered List of ActionRequestValues

updateActionRequestsForResponsibilityChange

public void updateActionRequestsForResponsibilityChange(Set<Long> responsibilityIds)
Specified by:
updateActionRequestsForResponsibilityChange in interface ActionRequestService

deleteActionRequestGraph

public void deleteActionRequestGraph(ActionRequestValue actionRequest)
Deletes an action request and all of its action items following the graph down through the action request's children. This method should be invoked on a top-level action request.

Specified by:
deleteActionRequestGraph in interface ActionRequestService

deleteActionItems

private void deleteActionItems(ActionRequestValue actionRequest)
Deletes the action items for the action request

Parameters:
actionRequest - the action request whose action items to delete

findByRouteHeaderIdIgnoreCurrentInd

public List findByRouteHeaderIdIgnoreCurrentInd(Long routeHeaderId)
Specified by:
findByRouteHeaderIdIgnoreCurrentInd in interface ActionRequestService

findAllActionRequestsByRouteHeaderId

public List findAllActionRequestsByRouteHeaderId(Long routeHeaderId)
Specified by:
findAllActionRequestsByRouteHeaderId in interface ActionRequestService

findAllRootActionRequestsByRouteHeaderId

public List findAllRootActionRequestsByRouteHeaderId(Long routeHeaderId)

findPendingByActionRequestedAndDocId

public List findPendingByActionRequestedAndDocId(String actionRequestedCd,
                                                 Long routeHeaderId)
Specified by:
findPendingByActionRequestedAndDocId in interface ActionRequestService

getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId

public List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(String actionRequestedCd,
                                                                                     Long routeHeaderId)
Description copied from interface: ActionRequestService
This method gets a list of ids of all principals who have a pending action request for a document.

Specified by:
getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId in interface ActionRequestService
Returns:
See Also:
ActionRequestService.getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(java.lang.String, java.lang.Long)

findPendingByDocIdAtOrBelowRouteLevel

public List findPendingByDocIdAtOrBelowRouteLevel(Long routeHeaderId,
                                                  Integer routeLevel)
Specified by:
findPendingByDocIdAtOrBelowRouteLevel in interface ActionRequestService

findPendingRootRequestsByDocId

public List findPendingRootRequestsByDocId(Long routeHeaderId)
Specified by:
findPendingRootRequestsByDocId in interface ActionRequestService

findPendingRootRequestsByDocIdAtRouteNode

public List findPendingRootRequestsByDocIdAtRouteNode(Long routeHeaderId,
                                                      Long nodeInstanceId)
Specified by:
findPendingRootRequestsByDocIdAtRouteNode in interface ActionRequestService

findRootRequestsByDocIdAtRouteNode

public List findRootRequestsByDocIdAtRouteNode(Long documentId,
                                               Long nodeInstanceId)
Specified by:
findRootRequestsByDocIdAtRouteNode in interface ActionRequestService

findPendingRootRequestsByDocIdAtOrBelowRouteLevel

public List findPendingRootRequestsByDocIdAtOrBelowRouteLevel(Long routeHeaderId,
                                                              Integer routeLevel)
Specified by:
findPendingRootRequestsByDocIdAtOrBelowRouteLevel in interface ActionRequestService

findPendingRootRequestsByDocIdAtRouteLevel

public List findPendingRootRequestsByDocIdAtRouteLevel(Long routeHeaderId,
                                                       Integer routeLevel)
Specified by:
findPendingRootRequestsByDocIdAtRouteLevel in interface ActionRequestService

findPendingRootRequestsByDocumentType

public List findPendingRootRequestsByDocumentType(Long documentTypeId)
Specified by:
findPendingRootRequestsByDocumentType in interface ActionRequestService

saveActionRequest

public void saveActionRequest(ActionRequestValue actionRequest)
Specified by:
saveActionRequest in interface ActionRequestService

findPendingByDoc

public List findPendingByDoc(Long routeHeaderId)
Specified by:
findPendingByDoc in interface ActionRequestService

findPendingByDocRequestCdRouteLevel

public List findPendingByDocRequestCdRouteLevel(Long routeHeaderId,
                                                String requestCode,
                                                Integer routeLevel)
Specified by:
findPendingByDocRequestCdRouteLevel in interface ActionRequestService

findPendingByDocRequestCdNodeName

public List findPendingByDocRequestCdNodeName(Long routeHeaderId,
                                              String requestCode,
                                              String nodeName)
Specified by:
findPendingByDocRequestCdNodeName in interface ActionRequestService

findActivatedByGroup

public List findActivatedByGroup(String groupId)
Specified by:
findActivatedByGroup in interface ActionRequestService

getActionListService

private ActionListService getActionListService()

getActionTakenService

private ActionTakenService getActionTakenService()

getActionRequestDAO

public ActionRequestDAO getActionRequestDAO()

setActionRequestDAO

public void setActionRequestDAO(ActionRequestDAO actionRequestDAO)

getRouteHeaderService

private RouteHeaderService getRouteHeaderService()

findByStatusAndDocId

public List<ActionRequestValue> findByStatusAndDocId(String statusCd,
                                                     Long routeHeaderId)
Specified by:
findByStatusAndDocId in interface ActionRequestService

alterActionRequested

public void alterActionRequested(List actionRequests,
                                 String actionRequestCd)
Specified by:
alterActionRequested in interface ActionRequestService

isDuplicateRequest

public boolean isDuplicateRequest(ActionRequestValue actionRequest)
Specified by:
isDuplicateRequest in interface ActionRequestService

findDelegator

public Recipient findDelegator(List actionRequests)
Description copied from interface: ActionRequestService
Returns the highest priority delegator in the list of action requests.

Specified by:
findDelegator in interface ActionRequestService

findDelegator

public Recipient findDelegator(ActionRequestValue actionRequest)
Description copied from interface: ActionRequestService
Returns the closest delegator for the given ActionRequest

Specified by:
findDelegator in interface ActionRequestService

findDelegatorRequest

public ActionRequestValue findDelegatorRequest(ActionRequestValue actionRequest)
Specified by:
findDelegatorRequest in interface ActionRequestService

deleteByRouteHeaderId

public void deleteByRouteHeaderId(Long routeHeaderId)
Specified by:
deleteByRouteHeaderId in interface ActionRequestService

deleteByActionRequestId

public void deleteByActionRequestId(Long actionRequestId)
Specified by:
deleteByActionRequestId in interface ActionRequestService

validateActionRequest

public void validateActionRequest(ActionRequestValue actionRequest)
Specified by:
validateActionRequest in interface ActionRequestService

getDelegateRequests

public List getDelegateRequests(ActionRequestValue actionRequest)
Specified by:
getDelegateRequests in interface ActionRequestService

getTopLevelRequests

public List getTopLevelRequests(ActionRequestValue actionRequest)
Description copied from interface: ActionRequestService
If this is a role request, then this method returns a List of the action request for each recipient within the role. Otherwise, it will return a List with just the original action request.

Specified by:
getTopLevelRequests in interface ActionRequestService

isValidActionRequestCode

public boolean isValidActionRequestCode(String actionRequestCode)
Specified by:
isValidActionRequestCode in interface ActionRequestService

doesPrincipalHaveRequest

public boolean doesPrincipalHaveRequest(String principalId,
                                        Long documentId)
Description copied from interface: ActionRequestService
Checks if the given user has any Action Requests on the given document.

Specified by:
doesPrincipalHaveRequest in interface ActionRequestService


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.