1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.engine.transition; |
18 | |
|
19 | |
import org.jdom.Document; |
20 | |
import org.kuali.rice.kew.engine.RouteContext; |
21 | |
import org.kuali.rice.kew.engine.node.ProcessResult; |
22 | |
import org.kuali.rice.kew.engine.node.RouteNode; |
23 | |
import org.kuali.rice.kew.engine.node.RouteNodeInstance; |
24 | |
import org.kuali.rice.kew.engine.node.SimpleResult; |
25 | |
import org.kuali.rice.kew.exception.InvalidXmlException; |
26 | |
import org.kuali.rice.kew.exception.WorkflowRuntimeException; |
27 | |
import org.kuali.rice.kew.util.XmlHelper; |
28 | |
|
29 | |
import java.io.StringReader; |
30 | |
import java.util.ArrayList; |
31 | |
import java.util.List; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | 0 | public class LoopTransitionEngine extends TransitionEngine { |
40 | |
|
41 | |
@Override |
42 | |
public ProcessResult isComplete(RouteContext context) throws Exception { |
43 | 0 | return new SimpleResult(true); |
44 | |
} |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
protected List<RouteNodeInstance> resolveNextNodeInstances(RouteNodeInstance nodeInstance, List<RouteNode> nextRouteNodes) { |
52 | |
|
53 | |
try { |
54 | 0 | Document doc = XmlHelper.buildJDocument(new StringReader(nodeInstance.getRouteNode().getContentFragment())); |
55 | |
|
56 | |
|
57 | 0 | } catch (InvalidXmlException e) { |
58 | 0 | throw new WorkflowRuntimeException(e); |
59 | 0 | } |
60 | |
|
61 | |
|
62 | 0 | List<RouteNodeInstance> nextNodeInstances = new ArrayList<RouteNodeInstance>(); |
63 | 0 | for (RouteNode nextRouteNode : nextRouteNodes) |
64 | |
{ |
65 | 0 | RouteNodeInstance nextNodeInstance = getRouteHelper().getNodeFactory().createRouteNodeInstance(nodeInstance.getDocumentId(), nextRouteNode); |
66 | 0 | nextNodeInstance.setBranch(nodeInstance.getBranch()); |
67 | 0 | nextNodeInstance.setProcess(nodeInstance.getProcess()); |
68 | 0 | nextNodeInstances.add(nextNodeInstance); |
69 | 0 | } |
70 | 0 | return nextNodeInstances; |
71 | |
} |
72 | |
|
73 | |
} |