| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| RouteNodeService | 
  | 
  | 1.0;1 | 
| 1 |  /* | |
| 2 |   * Copyright 2005-2008 The Kuali Foundation | |
| 3 |   *  | |
| 4 |   *  | |
| 5 |   * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 6 |   * you may not use this file except in compliance with the License. | |
| 7 |   * You may obtain a copy of the License at | |
| 8 |   *  | |
| 9 |   * http://www.opensource.org/licenses/ecl2.php | |
| 10 |   *  | |
| 11 |   * Unless required by applicable law or agreed to in writing, software | |
| 12 |   * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 |   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 |   * See the License for the specific language governing permissions and | |
| 15 |   * limitations under the License. | |
| 16 |   */ | |
| 17 |  package org.kuali.rice.kew.engine.node.service; | |
| 18 | ||
| 19 |  import org.kuali.rice.kew.doctype.bo.DocumentType; | |
| 20 |  import org.kuali.rice.kew.engine.node.*; | |
| 21 |  import org.kuali.rice.kew.engine.node.Process; | |
| 22 |  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; | |
| 23 | ||
| 24 |  import java.util.List; | |
| 25 |  import java.util.Set; | |
| 26 | ||
| 27 | ||
| 28 |  /** | |
| 29 |   * A service which provides data access for {@link RouteNode}, {@link RouteNodeInstance},  | |
| 30 |   * {@link NodeState}, and {@link Branch} objects. | |
| 31 |   *  | |
| 32 |   * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 33 |   */ | |
| 34 | public interface RouteNodeService {  | |
| 35 | ||
| 36 | public void save(RouteNode node);  | |
| 37 | public void save(RouteNodeInstance nodeInstance);  | |
| 38 | public void save(NodeState nodeState);  | |
| 39 | public void save(Branch branch);  | |
| 40 |      public RouteNode findRouteNodeById(Long nodeId); | |
| 41 |      public RouteNodeInstance findRouteNodeInstanceById(Long nodeInstanceId); | |
| 42 | ||
| 43 |      /** | |
| 44 |       *  | |
| 45 |       * This method looks though the passed in DocumentRouteHeaderValue and retrieves a nodeInstance that | |
| 46 |       * matches the ID passed in.  | |
| 47 |       *  | |
| 48 |       * @param nodeInstanceId | |
| 49 |       * @param document | |
| 50 |       * @return | |
| 51 |       */ | |
| 52 |      public RouteNodeInstance findRouteNodeInstanceById(Long nodeInstanceId, DocumentRouteHeaderValue document); | |
| 53 | ||
| 54 |      /** | |
| 55 |       * Retrieves the initial node instances of the given document.  The initial node instances are  | |
| 56 |       * those node instances which are at the very beginning of the route.  Usually, this will | |
| 57 |       * just be a single node instance. | |
| 58 |       */ | |
| 59 |      public List getInitialNodeInstances(Long documentId); | |
| 60 | ||
| 61 |      /** | |
| 62 |       * Retrieves the active node instances of the given Document.  The active node instances | |
| 63 |       * represent where in the route path the document is currently located. | |
| 64 |       * @param documentId of the document | |
| 65 |       * @return list of route node instances | |
| 66 |       */ | |
| 67 |      public List<RouteNodeInstance> getActiveNodeInstances(Long documentId); | |
| 68 | ||
| 69 |      public List<RouteNodeInstance> getActiveNodeInstances(DocumentRouteHeaderValue document); | |
| 70 | ||
| 71 |      /** | |
| 72 |       * Retrieves the terminal node instances of the given Document.  The terminal node instances | |
| 73 |       * are nodes in the route path which are both inactive and complete and have no next nodes | |
| 74 |       * in their path.  Terminal node instances will typically only exist on documents which are no | |
| 75 |       * longer Enroute. | |
| 76 |       * @param documentId for the given Document | |
| 77 |       * @return list of terminal node instances | |
| 78 |       */ | |
| 79 |      public List<RouteNodeInstance> getTerminalNodeInstances(Long documentId); | |
| 80 | ||
| 81 |      /** | |
| 82 |       * Returns the node instances representing the most recent node instances in the document. | |
| 83 |       * The algorithm for locating the current nodes is as follows: If the document has | |
| 84 |       * active node instances, return those, otherwise return it's terminal node instances. | |
| 85 |       */ | |
| 86 |      public List getCurrentNodeInstances(Long documentId); | |
| 87 | ||
| 88 |      public NodeState findNodeState(Long nodeInstanceId, String key); | |
| 89 |      public RouteNode findRouteNodeByName(Long documentTypeId, String name); | |
| 90 |      public List findFinalApprovalRouteNodes(Long documentTypeId); | |
| 91 |      public List findNextRouteNodesInPath(RouteNodeInstance nodeInstance, String nodeName); | |
| 92 | public boolean isNodeInPath(DocumentRouteHeaderValue document, String nodeName);  | |
| 93 |      public List findRouteNodeInstances(Long documentId); | |
| 94 |      public List findProcessNodeInstances(RouteNodeInstance process); | |
| 95 |      public Set findPreviousNodeNames(Long documentId); | |
| 96 | ||
| 97 |      /** | |
| 98 |       * Returns a List of the distinct node names through which this document might pass in it's future  | |
| 99 |       * routing.  In certain cases this will be an approximation based on what the system knows at the | |
| 100 |       * time of execution.  | |
| 101 |       */ | |
| 102 |      public List<String> findFutureNodeNames(Long documentId); | |
| 103 | ||
| 104 |      /** | |
| 105 |       * Flatten all the document types route nodes into a single List.  This includes all processes  | |
| 106 |       * on the DocumentType. | |
| 107 |       *  | |
| 108 |       * @param documentType DocumentType who's nodes will be flattened. | |
| 109 |       * @param climbHierarchy whether to include the parents nodes if the passed in DocumentType contains no nodes | |
| 110 |       * @return List or empty List | |
| 111 |       */ | |
| 112 | public List<RouteNode> getFlattenedNodes(DocumentType documentType, boolean climbHierarchy);  | |
| 113 |      public List<RouteNode> getFlattenedNodes(Process process); | |
| 114 | ||
| 115 |      /** | |
| 116 |       * Returns a flattened list of RouteNodeInstances on the given document.  If the includeProcesses flag is | |
| 117 |       * true than this method includes process RouteNodeInstances, otherwise they are excluded. | |
| 118 |       * which are processes. | |
| 119 |       * @param document route header value | |
| 120 |       * @param includeProcesses flag | |
| 121 |       * @return list of routeNodeInstances | |
| 122 |       */ | |
| 123 | public List<RouteNodeInstance> getFlattenedNodeInstances(DocumentRouteHeaderValue document, boolean includeProcesses);  | |
| 124 | ||
| 125 |      public NodeGraphSearchResult searchNodeGraph(NodeGraphSearchCriteria criteria); | |
| 126 | ||
| 127 |      /** | |
| 128 |       * Returns a list of active node instances associated with the document that are active | |
| 129 |       * @param document | |
| 130 |       * @param nodeName | |
| 131 |       * @return | |
| 132 |       */ | |
| 133 |      public List<RouteNodeInstance> getActiveNodeInstances(DocumentRouteHeaderValue document, String nodeName); | |
| 134 | public void deleteByRouteNodeInstance(RouteNodeInstance routeNodeInstance);  | |
| 135 | public void deleteNodeStateById(Long nodeStateId);  | |
| 136 | public void deleteNodeStates(List statesToBeDeleted);  | |
| 137 | ||
| 138 |      /** | |
| 139 |           * Record that the given RouteNodeInstance on the Document was revoked.  This will happen when an  | |
| 140 |           * action such as Return to Previous or Move Document bypasses the given RouteNodeInstance on it's | |
| 141 |           * path back to a previous point in the history of the document's route path.  | |
| 142 |           */ | |
| 143 | public void revokeNodeInstance(DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance);  | |
| 144 | ||
| 145 |      /** | |
| 146 |       * Returns a List of the revoked RouteNodeInstances on the given Document. | |
| 147 |       *  | |
| 148 |       * @see revokeNodeInstance | |
| 149 |       */ | |
| 150 |      public List getRevokedNodeInstances(DocumentRouteHeaderValue document); | |
| 151 | ||
| 152 | }  |