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