View Javadoc

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