Node/State don't provide any support for Conditions on Transitions
------------------------------------------------------------------
Key: JBPM-1183
URL:
http://jira.jboss.com/jira/browse/JBPM-1183
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2.2
Reporter: Britt Miner
Assigned To: Tom Baeyens
Node and State don't provide any preliminary check for conditions provided on
transitions. No check is performed until the transition is signaled, at which point the
process will barf if the condition evaluates to false. Regardless if a person
"should" be using transition conditions in Node or State, the schema allows it,
the documentation doesn't forbid it, and the current behavior of a Transition element
in the jpdl is inconsistent. The fix to make everything consistent is fairly simple--only
org.jbpm.graph.def.Node needs to be altered:
// BRITT --replace the following line with the code below
// to check conditions before selecting the transition to take...
//leave(executionContext); //original line
boolean hasTransitioned = false;
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)) {
leave(executionContext, candidate);
hasTransitioned = true;
break;
}
} else {
leave(executionContext, candidate);
hasTransitioned = true;
break;
}
}
if (!hasTransitioned) {
this.getDefaultLeavingTransition().removeConditionEnforcement();
log.warn("All transition conditions have evaluated to
'false'. Taking the default transition.");
leave(executionContext, this.getDefaultLeavingTransition());
}
// --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