execution.setVariable() doesnt set on Parent process

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2011 11:04 AM
I have two processes, one of which is being called as a subprocess from the other.
When i call setVariable on the execution from within a java task delegate of the sub-process, It is only setting the variable locally, and not on the parent processes variables map.
This means that when I try to set a variable to signal success or failure of the sub-process to the calling process, the calling process is not seeing the variable and so is falling over with an exception.
In order to get the variable to propogate up to the parent process, I am having to cast the execution parameter from DelegateExecution to ExecutionEntity, call getSuperExecution() and then set the variables on that.
From the below source code (VariableScopeImpl.java), it looks like setVariable should set the variable on the parent variable scope if it doesnt exist as a local variable. When I debug my code though, parentVariableScope is null, because parent is null on the ExecutionEntity instance.
My question is… is this the expected behaviour? or should a call to setVariable on a sub-process execution, propogate the variable up to the calling process?
Also, is there some element or attribute required in the callActivity xml to achieve this?
When i call setVariable on the execution from within a java task delegate of the sub-process, It is only setting the variable locally, and not on the parent processes variables map.
This means that when I try to set a variable to signal success or failure of the sub-process to the calling process, the calling process is not seeing the variable and so is falling over with an exception.
In order to get the variable to propogate up to the parent process, I am having to cast the execution parameter from DelegateExecution to ExecutionEntity, call getSuperExecution() and then set the variables on that.
From the below source code (VariableScopeImpl.java), it looks like setVariable should set the variable on the parent variable scope if it doesnt exist as a local variable. When I debug my code though, parentVariableScope is null, because parent is null on the ExecutionEntity instance.
My question is… is this the expected behaviour? or should a call to setVariable on a sub-process execution, propogate the variable up to the calling process?
Also, is there some element or attribute required in the callActivity xml to achieve this?
variableScopeImplpublic void setVariable(String variableName, Object value) { if (hasVariableLocal(variableName)) { setVariableLocal(variableName, value); return; } VariableScope parentVariableScope = getParentVariableScope(); if (parentVariableScope!=null) { parentVariableScope.setVariable(variableName, value); return; } createVariableLocal(variableName, value); }
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2011 06:14 AM
The 5.2 release will contain a way of mapping process variables to parent processes.
Currently, your workaround is indeed the way to go.
Currently, your workaround is indeed the way to go.
