1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.engine;
17
18 import org.kuali.rice.kew.engine.node.Branch;
19 import org.kuali.rice.kew.engine.node.RouteNode;
20 import org.kuali.rice.kew.engine.node.RouteNodeInstance;
21 import org.kuali.rice.kew.service.KEWServiceLocator;
22
23
24
25
26
27
28
29 public class RoutingNodeFactory {
30
31 public Branch createBranch(String name, Branch parentBranch, RouteNodeInstance initialNodeInstance) {
32 Branch branch = new Branch();
33 branch.setName(name);
34 branch.setParentBranch(parentBranch);
35 branch.setInitialNode(initialNodeInstance);
36 initialNodeInstance.setBranch(branch);
37 return branch;
38 }
39
40 public RouteNodeInstance createRouteNodeInstance(String documentId, RouteNode node) {
41 RouteNodeInstance nodeInstance = new RouteNodeInstance();
42 nodeInstance.setActive(false);
43 nodeInstance.setComplete(false);
44 nodeInstance.setRouteNode(node);
45 nodeInstance.setDocumentId(documentId);
46 return nodeInstance;
47 }
48
49 public RouteNode getRouteNode(RouteContext context, String name) {
50 return KEWServiceLocator.getRouteNodeService().findRouteNodeByName(context.getDocument().getDocumentType().getDocumentTypeId(), name);
51 }
52
53 }