1 /**
2 * Copyright 2005-2015 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.hierarchyrouting;
17
18 import java.util.List;
19
20 import org.kuali.rice.kew.engine.RouteContext;
21 import org.kuali.rice.kew.engine.node.RouteNode;
22 import org.kuali.rice.kew.engine.node.RouteNodeInstance;
23
24
25 /**
26 * HierarchyProvider is responsible for exposing the hierarchy that the HierarchyRoutingNode
27 * climbs/descends.
28 * @author Kuali Rice Team (rice.collab@kuali.org)
29 */
30 public interface HierarchyProvider {
31 /**
32 * Marker interface for objects the represent a "stop" or "node" in a hierarchy.
33 * E.g. "unit"
34 */
35 public interface Stop { }
36
37 /**
38 * Initializer for the hierarchy provider.
39 * @param nodeInstance the HierarchyRouteNode instance
40 * @param context the RouteContext (nodeInstance may NOT be the HierarchyRouteNode instance; e.g. when transitioning into)
41 */
42 public void init(RouteNodeInstance nodeInstance, RouteContext context);
43
44 /**
45 * Find all leaf stops in the xml and convert them into a list of Stop objects
46 * @param context the RouteContext
47 * @return List Stop objects
48 */
49 public List<Stop> getLeafStops(RouteContext context);
50
51 /**
52 * @param nodeInstance the node instance
53 * @return whether stop state is associated with the specified node instance
54 */
55 public boolean hasStop(RouteNodeInstance nodeInstance);
56
57 /**
58 * Returns the Stop at the specified routeNodeInstance, or null if the node instance
59 * is not associated with a Stop
60 * @param nodeInstance the node instance to check
61 * @return the Stop at the route node instance
62 */
63 public Stop getStop(RouteNodeInstance nodeInstance);
64
65 /**
66 * Set any state necessary on the request node instance for a given stop. E.g. for chart/org routing
67 * set the org and chart in the node state
68 * @param requestNodeInstance the request node instance
69 * @param stop the stop for the request node
70 */
71 public void setStop(RouteNodeInstance requestNodeInstance, Stop stop);
72
73 /**
74 * @param stop the stop
75 * @return a a string that can be used to uniquely identify the stop. E.g. for chart/org routing,
76 * the chart and org
77 */
78 public String getStopIdentifier(Stop stop);
79
80 /**
81 * @param stopId the stop identifier
82 * @return the Stop by stop identifier
83 */
84 public Stop getStopByIdentifier(String stopId);
85
86
87 /**
88 * @param stop a stop
89 * @return the parent stop of the specified stop
90 */
91 public Stop getParent(Stop stop);
92
93 /**
94 * @param stop the stop
95 * @return whether the given stop is the root stop, i.e. has no parents
96 */
97 public boolean isRoot(Stop stop);
98
99 /**
100 * @param a one stop
101 * @param b another stop
102 * @return whether stops are equivalent
103 */
104 public boolean equals(Stop a, Stop b);
105
106 /**
107 * Configures the single request node definition/prototype used for all node instances
108 * @param hiearchyNodeInstance the hierarchy node instance
109 * @param node the request node definition/prototype
110 */
111 public void configureRequestNode(RouteNodeInstance hiearchyNodeInstance, RouteNode node);
112 }