return conditionElement.getText();
}
}
public void execute(ExecutionContext executionContext) {
Transition transition = null;
try {
if (decisionDelegation!=null) {
DecisionHandler decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
String transitionName = decisionHandler.decide(executionContext);
transition = getLeavingTransition(transitionName);
if (transition==null) {
throw new JbpmException("decision '"+name+"' selected non existing transition '"+transitionName+"'" );
}
} else if (decisionExpression!=null) {
Object result = JbpmExpressionEvaluator.evaluate(decisionExpression, executionContext);
if (result==null) {
throw new JbpmException("decision expression '"+decisionExpression+"' returned null");
}
String transitionName = result.toString();
transition = getLeavingTransition(transitionName);
if (transition==null) {
throw new JbpmException("decision '"+name+"' selected non existing transition '"+transitionName+"'" );
}
} else if (decisionConditions!=null && !decisionConditions.isEmpty()) {
// backwards compatible mode based on separate DecisionCondition's
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);
}
}
} else {
// new mode based on conditions in the transition itself
Iterator iter = leavingTransitions.iterator();
while (iter.hasNext() && (transition==null)) {
Transition candidate = (Transition) iter.next();
String conditionExpression = candidate.getCondition();
if (conditionExpression!=null) {
Object result = JbpmExpressionEvaluator.evaluate(conditionExpression, executionContext);
if (Boolean.TRUE.equals(result)) {
transition = candidate;
}