]
Jesse Sweetland commented on JBPM-462:
--------------------------------------
I'm using 3.1.2 and I noticed that subProcessInstance is set to null when a process
completes. The superProcessToken value of the sub process is still intact. Is this the
intended behavior?
the token's subProcessInstance attribute is not set on
subprocess-end event if a process is loaded from db
----------------------------------------------------------------------------------------------------------
Key: JBPM-462
URL:
http://jira.jboss.com/jira/browse/JBPM-462
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM 3.0.1, jBPM 3.0.2
Reporter: Eduardo Jimenez
Assigned To: Tom Baeyens
Fix For: jBPM 3.1
Token.subprocessinstance is not a persistent field, which means that if the subprocess is
started, saved, then loaded in a different hibernate session later, the
token.subprocessinstance field is null, which means that if you have an action on a
subprocess-end event, its not going to know which subprocess ended.
making the list of subprocesses is great, but it doesn't solve this problem. My gut
feeling is that this should be treated as it is treated during subprocess creation:
Code:
public void execute(ExecutionContext executionContext) {
Token superProcessToken = executionContext.getToken();
// create the subprocess
ProcessInstance subProcessInstance = new ProcessInstance(subProcessDefinition);
// bind the subprocess to the super-process-token
superProcessToken.setSubProcessInstance(subProcessInstance);
subProcessInstance.setSuperProcessToken(superProcessToken);
// fire the subprocess created event
fireEvent(Event.EVENTTYPE_SUBPROCESS_CREATED, executionContext);
.....
See how the superProcessToken gets a nice setSubProcessInstance? That way the
subprocess-created event knows which subprocess was created.
The current code on notifySubProcessEnd is:
Code:
public void notifySubProcessEnd(ProcessInstance subProcessInstance) {
Token superProcessToken = subProcessInstance.getSuperProcessToken();
ExecutionContext executionContext = new ExecutionContext(superProcessToken);
// feed the readable variables
if ((variableAccesses != null) && (!variableAccesses.isEmpty())) {
....
....
}
// feed the readable variables
fireEvent(Event.EVENTTYPE_SUBPROCESS_END, executionContext);
....
I think it is very reasonable to do instead
Code:
public void notifySubProcessEnd(ProcessInstance subProcessInstance) {
Token superProcessToken = subProcessInstance.getSuperProcessToken();
superProcessToken.setSubProcessInstance(subProcessInstance);
ExecutionContext executionContext = new ExecutionContext(superProcessToken);
// feed the readable variables
if ((variableAccesses != null) && (!variableAccesses.isEmpty())) {
....
....
}
// fire the subprocess ended event
fireEvent(Event.EVENTTYPE_SUBPROCESS_END, executionContext);
....
In this way, the subprocess-end event will pass a context where the token correctly
contains the subprocess instance even if being loaded after being persisted while the
subprocess was going on.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: