use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.
the class AbstractVariableScope method getVariableInstance.
public CoreVariableInstance getVariableInstance(String variableName) {
CoreVariableInstance variableInstance = getVariableInstanceLocal(variableName);
if (variableInstance != null) {
return variableInstance;
}
AbstractVariableScope parentScope = getParentVariableScope();
if (parentScope != null) {
return parentScope.getVariableInstance(variableName);
}
return null;
}
use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.
the class AbstractVariableScope method collectVariables.
public void collectVariables(VariableMapImpl resultVariables, Collection<String> variableNames, boolean isLocal, boolean deserializeValues) {
boolean collectAll = (variableNames == null);
List<CoreVariableInstance> localVariables = getVariableInstancesLocal(variableNames);
for (CoreVariableInstance var : localVariables) {
if (!resultVariables.containsKey(var.getName()) && (collectAll || variableNames.contains(var.getName()))) {
resultVariables.put(var.getName(), var.getTypedValue(deserializeValues));
}
}
if (!isLocal) {
AbstractVariableScope parentScope = getParentVariableScope();
// Do not propagate to parent if all variables in 'variableNames' are already collected!
if (parentScope != null && (collectAll || !resultVariables.keySet().equals(variableNames))) {
parentScope.collectVariables(resultVariables, variableNames, isLocal, deserializeValues);
}
}
}
use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.
the class AbstractVariableScope method setVariableLocal.
public void setVariableLocal(String variableName, TypedValue value, AbstractVariableScope sourceActivityExecution) {
checkJavaSerialization(variableName, value);
VariableStore<CoreVariableInstance> variableStore = getVariableStore();
if (variableStore.containsKey(variableName)) {
CoreVariableInstance existingInstance = variableStore.getVariable(variableName);
existingInstance.setValue(value);
invokeVariableLifecycleListenersUpdate(existingInstance, sourceActivityExecution);
} else if (variableStore.isRemoved(variableName)) {
CoreVariableInstance existingInstance = variableStore.getRemovedVariable(variableName);
existingInstance.setValue(value);
getVariableStore().addVariable(existingInstance);
invokeVariableLifecycleListenersUpdate(existingInstance, sourceActivityExecution);
DbEntityManager dbEntityManager = Context.getCommandContext().getDbEntityManager();
dbEntityManager.undoDelete((VariableInstanceEntity) existingInstance);
} else {
CoreVariableInstance variableValue = getVariableInstanceFactory().build(variableName, value, false);
getVariableStore().addVariable(variableValue);
invokeVariableLifecycleListenersCreate(variableValue, sourceActivityExecution);
}
}
Aggregations