AnsweredAssumed Answered

VariableScope#getVariables

Question asked by etienne on Jul 11, 2011
Latest reply on Jul 14, 2011 by etienne
Hi

I've gone through the implementation of org.activiti.engine.delegate.VariableScope#getVariables and the following question came up: if the same name is used for a variable on different scopes in the scope hierarchy, why does the variable furthest up the tree have precedence? Intuitively, I would have imagined that a more 'local' scope has precedence.

This is the code I mean:

for (VariableInstanceEntity variableInstance: variableInstances.values()) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
VariableScopeImpl parentScope = getParentVariableScope();
if (parentScope!=null) {
return parentScope.collectVariables(variables);
}

Thanks for sharing the thoughts behind this implementation 'strategy'.

Regards, Etienne

Outcomes