[
http://jira.jboss.com/jira/browse/JBPM-1173?page=all ]
Thomas Diesler updated JBPM-1173:
---------------------------------
Assignee: (was: Tom Baeyens)
Fork Node doesn't support conditions on Transitions
---------------------------------------------------
Key: JBPM-1173
URL:
http://jira.jboss.com/jira/browse/JBPM-1173
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2
Reporter: Britt Miner
Documentation does not clearly provide any limits to where conditions on Transitions can
be used, but the Fork Node doesn't support Transition conditions. For instance
<fork name='FORK_1' >
<transition name='t1' to='NODE_A'>
<condition>#{false}</condition>
</transition>
<transition name='t2' to='NODE_B'/>
</fork>
will fail with a "transition condition #{false} evaluated to 'false'"
error when the fork attempts to take transition 't1'. Why provide for this?
Someone might want to:
<fork name='FORK_1' >
<transition name='startMyProject' to='...'/>
<transition name='orderEngine to='...'>
<condition>#{needsEngine}</condition>
</transition>
<transition name='orderWheels to='...'>
<condition>#{needsWheels}</condition>
</transition>
...etc...
</fork>
Correcting the issue is as simple as making the following change to
org.jbpm.graph.node.Fork.java:
// BRITT --replace the following line with the code below
// to check conditions before adding valid transitions...
//transitionNames = getLeavingTransitionsMap().keySet(); //original line
Iterator iter = leavingTransitions.iterator();
while (iter.hasNext()) {
Transition candidate = (Transition) iter.next();
String conditionExpression = candidate.getCondition();
if (conditionExpression != null) {
Object result = JbpmExpressionEvaluator.evaluate(conditionExpression,
executionContext);
if (Boolean.TRUE.equals(result)) {
transitionNames.add(candidate.getName());
}
}else{
transitionNames.add(candidate.getName());
}
}
if (transitionNames.size() == 0) {
transitionNames.add(this.getDefaultLeavingTransition().getName());
this.getDefaultLeavingTransition().removeConditionEnforcement();
log.warn("All transition conditions have evaluated to
'false'. Taking the default transition.");
}
// --BRITT
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira