01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.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 edu.iu.uis.eden.engine;
18:
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import edu.iu.uis.eden.engine.node.Branch;
23: import edu.iu.uis.eden.engine.node.BranchState;
24: import edu.iu.uis.eden.engine.node.DynamicNode;
25: import edu.iu.uis.eden.engine.node.DynamicResult;
26: import edu.iu.uis.eden.engine.node.RouteNode;
27: import edu.iu.uis.eden.engine.node.RouteNodeInstance;
28: import edu.iu.uis.eden.exception.WorkflowException;
29:
30: public class DynamicSplitTestNode implements DynamicNode {
31:
32: private static final String NEXT_NODE_NAME = "SubRequests";
33: private static final String[] ROLES = new String[] { "Sub1",
34: "Sub2", "Sub3" };
35:
36: public DynamicResult transitioningInto(RouteContext context,
37: RouteNodeInstance process, RouteHelper helper)
38: throws Exception {
39: List nextNodeInstances = new ArrayList();
40: for (int index = 0; index < ROLES.length; index++) {
41: String roleName = ROLES[index];
42: RouteNode node = helper.getNodeFactory().getRouteNode(
43: context, NEXT_NODE_NAME);
44: if (node == null) {
45: throw new WorkflowException(
46: "Couldn't locate node for name: "
47: + NEXT_NODE_NAME);
48: }
49: RouteNodeInstance nextNodeInstance = helper
50: .getNodeFactory().createRouteNodeInstance(
51: context.getDocument().getRouteHeaderId(),
52: node);
53: Branch branch = helper.getNodeFactory().createBranch(
54: roleName, context.getNodeInstance().getBranch(),
55: nextNodeInstance);
56: branch.addBranchState(new BranchState("role", roleName));
57: branch.setSplitNode(context.getNodeInstance());
58: nextNodeInstances.add(nextNodeInstance);
59: }
60: //return new DynamicResult(true, nextNodeInstances);
61: throw new UnsupportedOperationException("No!!!!");
62: }
63:
64: public DynamicResult transitioningOutOf(RouteContext context,
65: RouteHelper helper) throws Exception {
66: throw new UnsupportedOperationException("never written");
67: }
68: }
|