[JBoss JIRA] Created: (JBPM-1185) Node, State and ProcessState don't support Conditions on Transitions
by Britt Miner (JIRA)
Node, State and ProcessState don't support Conditions on Transitions
--------------------------------------------------------------------
Key: JBPM-1185
URL: http://jira.jboss.com/jira/browse/JBPM-1185
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2.2
Reporter: Britt Miner
Assigned To: Tom Baeyens
Node, State, and ProcessState 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 a condition is present on the default transition, and that 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 really be altered (and a one-liner in ProcessState):
In org.jbpm.graph.def.Node, add the following method:
// BRITT--
public Transition calculateLeavingTransition(ExecutionContext executionContext) {
Transition transition = null;
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)) {
transition = candidate;
}
} else {
transition = candidate;
}
}
if (!hasTransitioned) {
this.getDefaultLeavingTransition().removeConditionEnforcement();
log.warn("All transition conditions have evaluated to 'false'. Taking the default transition.");
transition = this.getDefaultLeavingTransition();
}
return transition;
}
// --BRITT
...and modify "leave(ExecutionContext executionContext)":
// BRITT --replace the following line with the code below
// to check conditions before selecting the transition to take...
//leave(executionContext, getDefaultLeavingTransition()); //original line
leave(executionContext, calculateLeavingTransition(executionContext));
// --BRITT
For consistency, ProcessState should also have one line modified at the very end of it's "leave(ExecutionContext, Transition)" method:
// BRITT-- rather than specify which transition, let the super class decide...
//super.leave(executionContext, getDefaultLeavingTransition());
super.leave(executionContext, calculateLeavingTransition(executionContext));
// --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
15 years, 9 months
[JBoss JIRA] Created: (JBPM-1471) Do not signal ENDED super process token when ending process instance
by Pavel Kadlec (JIRA)
Do not signal ENDED super process token when ending process instance
--------------------------------------------------------------------
Key: JBPM-1471
URL: https://jira.jboss.org/jira/browse/JBPM-1471
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: jPDL 3.2.3
Reporter: Pavel Kadlec
The path of execution of the super process token should not continue when the token was ended. If it is not tested, the ended super process token is signalled and the path of execution continues. I think it should not.
I suggest following fix to org.jbpm.graph.exe.ProcessInstance.end() method. There is one change in if statement bellow...
/**
* ends (=cancels) this process instance and all the tokens in it.
*/
public void end() {
// end the main path of execution
rootToken.end();
if (end==null) {
// mark this process instance as ended
end = Clock.getCurrentTime();
// fire the process-end event
ExecutionContext executionContext = new ExecutionContext(rootToken);
processDefinition.fireEvent(Event.EVENTTYPE_PROCESS_END, executionContext);
// add the process instance end log
rootToken.addLog(new ProcessInstanceEndLog());
// check if this process was started as a subprocess of a super process
if (superProcessToken!=null && !superProcessToken.hasEnded()) { // THIS IS THE FIX, TEST IF SUPER PROCESS TOKEN HAS ENDED
addCascadeProcessInstance(superProcessToken.getProcessInstance());
ExecutionContext superExecutionContext = new ExecutionContext(superProcessToken);
superExecutionContext.setSubProcessInstance(this);
superProcessToken.signal(superExecutionContext);
}
// make sure all the timers for this process instance are cancelled when the process end updates get saved in the database.
// TODO route this directly through the jobSession. just like the suspend and resume.
// NOTE Only timers should be deleted, messages-type of jobs should be kept.
SchedulerService schedulerService = (SchedulerService) Services.getCurrentService(Services.SERVICENAME_SCHEDULER, false);
if (schedulerService!=null) schedulerService.deleteTimersByProcessInstance(this);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 10 months