[jboss-user] [JBoss jBPM] - Re: A question to the DecisionNode

Olivier_Debels do-not-reply at jboss.com
Tue Jun 10 04:36:38 EDT 2008


The reason why it doesn't work is because when you don't add the condition part in your second transition, you end up with a decision node which only contains a single DecisionCondition.

When you look into the code of the decision node (the execute method), you will see it loops over all DecisionConditions (in your case only 1!), and checks if it can find one which is true:

Iterator iter = decisionConditions.iterator();
  |         while (iter.hasNext() && (transition==null)) {
  |           DecisionCondition decisionCondition = (DecisionCondition) iter.next();
  |           Object result = JbpmExpressionEvaluator.evaluate(decisionCondition.getExpression(), executionContext);
  |           if (Boolean.TRUE.equals(result)) {
  |             if (transition!=null) {
  |               transition.removeConditionEnforcement();
  |             }
  |             String transitionName = decisionCondition.getTransitionName();
  |             transition = getLeavingTransition(transitionName);
  |           }
  |         }

Since this condition fails, it will take the default leaving transition (the first transition.

if (transition==null) {
  |         transition = getDefaultLeavingTransition();
  |         log.debug("decision didn't select transition, taking default "+transition);
  |       }

What you can do to go around this behaviour:
- Make a condition for your second one which is always true (like you did before but you can also use dummy expression's like 1==1).
- Move your second condition first, and make sure it always fails (by placing and EMPTY conditiion f.e. ), when all other condition's fail, the default leaving transition will be choosen, and guess this will be the first one, the one with the empty condition element.

I would choose the second option.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156928#4156928

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156928

More information about the jboss-user mailing list