[JBoss JIRA] Commented: (JBPM-1016) ProcessState 'leave' method always returns default transition
by Ronald van Kuijk (JIRA)
[ https://jira.jboss.org/jira/browse/JBPM-1016?page=com.atlassian.jira.plug... ]
Ronald van Kuijk commented on JBPM-1016:
----------------------------------------
Is there a new issue made than to track this? Just closing and mentioning it will be in 4.0 is plain wrong.
> 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: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 3 months
[JBoss JIRA] Created: (JBPM-1375) Provide a way to determine the node type
by Mauro Molinari (JIRA)
Provide a way to determine the node type
----------------------------------------
Key: JBPM-1375
URL: http://jira.jboss.com/jira/browse/JBPM-1375
Project: JBoss jBPM
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: API
Affects Versions: jPDL 3.2.3
Reporter: Mauro Molinari
If you need to iterate over the nodes of a ProcessDefinition:
final List processNodes = processDefinition.getNodes ();
for (int x = 0; x < processNodes.size (); x++) {
final org.jbpm.graph.def.Node node = (org.jbpm.graph.def.Node) processNodes.get (x);
// ...
}
and you need to determine the actual type of a node, you cannot use instanceof because of the potential use of CGLIB proxies.
So, there's no *clean* way to determine the actual type of a node!!
Using the HibernateProxy workaround cited in the JBoss Forum reference attached, is not acceptable IMHO, because you're loosing the transparency against the underlying persistence technology. Moreover, it doesn't seem to work in the tests we're doing.
Using the alternative toString() workaround is also a dirty trick, because the toString() implementation might change and toString() shouldn't be used for this kind of things.
In another discussion:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156233
another user is experiencing our exact problem with the StartState: but we're not guaranteed that the same issue doesn't happen with other node types.
I can hardly accept the fact that a XXNode instance can't be cast to an XXNode object reference, however if this is the case, I think a clean way to determine the type of a node should then be provided by the jBPM API.
--
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
17 years, 3 months