decision节点可以实现多路选择。

<?xml version="1.0" encoding="UTF-8"?>

<process-definition name="testDecision">

<start-state name="s">
<transition to="inputScore" />
</start-state>

<state name="inputScore">
<script>System.out.println("The process is at "+node);</script>
<transition to="decision1" />
</state>

<decision name="decision1">
<handler class="test.decision.ScoreDecisionHandler" />
<transition name="t1" to="s1" />
<transition name="t2" to="s2" />
</decision>

<node name="s1">
<script>
System.out.println("The process is at "+node);
token.signal();
</script>
<transition name="" to="End" />
</node>

<node name="s2">
<script>
System.out.println("The process is at "+node);
token.signal();
</script>
<transition name="" to="End" />
</node>

<end-state name="End"></end-state>

</process-definition>




public class ScoreDecisionHandler implements DecisionHandler {

private static final long serialVersionUID = 1L;

@Override
public String decide(ExecutionContext executionContext) throws Exception {

int score = (Integer) executionContext.getVariable("score");
if (score < 50)
return "t1";
return "t2";
}