[jboss-jira] [JBoss JIRA] Updated: (JBPM-1016) ProcessState 'leave' method always returns default transition

Tom Baeyens (JIRA) jira-events at lists.jboss.org
Mon Sep 3 07:56:18 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBPM-1016?page=all ]

Tom Baeyens updated JBPM-1016:
------------------------------

    Fix Version/s: jBPM 3.3

a mapping could be added between the state (or a variable value) of the sub process and a transition leaving the process-state

> ProcessState 'leave' method always returns default transition 
> --------------------------------------------------------------
>
>                 Key: JBPM-1016
>                 URL: http://jira.jboss.com/jira/browse/JBPM-1016
>             Project: JBoss jBPM
>          Issue Type: Patch
>          Components: Core Engine
>    Affects Versions: jBPM jPDL 3.2
>            Reporter: Randy Gullett
>         Assigned To: Tom Baeyens
>             Fix For: jBPM 3.3
>
>
> 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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list