]
Tom Baeyens resolved JBPM-1016.
-------------------------------
Fix Version/s: (was: jBPM 3.3.2 GA )
Resolution: Rejected
this new feature will only be added in jbpm 4
ProcessState 'leave' method always returns default transition
--------------------------------------------------------------
Key: JBPM-1016
URL:
https://jira.jboss.org/jira/browse/JBPM-1016
Project: JBoss jBPM
Issue Type: Patch
Components: Core Engine
Affects Versions: jBPM 3.2.0
Reporter: Randy Gullett
Assignee: Alejandro Guizar
The leave method for ProcessStates currently automatically takes the default transition
despite taking a transition as a parameter. Can it be modified so that it leaves by the
transition passed in (if it isn't null) like you'd expect it to? I want to be
able to short-circuit my subprocesses in certain scenarios. See the method as it's
currently coded below.
public void leave(ExecutionContext executionContext, Transition transition) {
ProcessInstance subProcessInstance = executionContext.getSubProcessInstance();
Token superProcessToken = subProcessInstance.getSuperProcessToken();
// feed the readable variableInstances
if ((variableAccesses != null) && (!variableAccesses.isEmpty())) {
ContextInstance superContextInstance = executionContext.getContextInstance();
ContextInstance subContextInstance = subProcessInstance.getContextInstance();
// loop over all the variable accesses
Iterator iter = variableAccesses.iterator();
while (iter.hasNext()) {
VariableAccess variableAccess = (VariableAccess) iter.next();
// if this variable access is writable
if (variableAccess.isWritable()) {
// the variable is copied from the sub process mapped name
// to the super process variable name
String mappedName = variableAccess.getMappedName();
Object value = subContextInstance.getVariable(mappedName);
String variableName = variableAccess.getVariableName();
log.debug("copying sub process var '"+mappedName+"' to
super process var '"+variableName+"': "+value);
if (value!=null) {
superContextInstance.setVariable(variableName, value, superProcessToken);
}
}
}
}
// fire the subprocess ended event
fireEvent(Event.EVENTTYPE_SUBPROCESS_END, executionContext);
// remove the subprocess reference
superProcessToken.setSubProcessInstance(null);
// We replaced the normal log generation of super.leave() by creating the log here
// and overriding the addNodeLog method with an empty version
superProcessToken.addLog(new ProcessStateLog(this, superProcessToken.getNodeEnter(),
new Date(), subProcessInstance));
// call the subProcessEndAction
[b]super.leave(executionContext, getDefaultLeavingTransition());[/b] }
The bold line could be replaced by something like:
if(transition != null) {
super.leave(executionContext, transition);
} else {
super.leave(executionContext, getDefaultLeavingTransition());
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: