Class VariableScopeImpl
- java.lang.Object
-
- org.activiti.engine.impl.persistence.entity.AbstractEntity
-
- org.activiti.engine.impl.persistence.entity.VariableScopeImpl
-
- All Implemented Interfaces:
java.io.Serializable,VariableScope,HasRevision,Entity
- Direct Known Subclasses:
ExecutionEntityImpl,TaskEntityImpl
public abstract class VariableScopeImpl extends AbstractEntity implements java.io.Serializable, VariableScope
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.el.ELContextcachedElContextprotected java.util.Map<java.lang.String,VariableInstance>transientVariabesprotected java.util.Map<java.lang.String,VariableInstanceEntity>usedVariablesCacheprotected java.util.Map<java.lang.String,VariableInstanceEntity>variableInstances-
Fields inherited from class org.activiti.engine.impl.persistence.entity.AbstractEntity
id, isDeleted, isInserted, isUpdated, revision
-
-
Constructor Summary
Constructors Constructor Description VariableScopeImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.lang.Object>collectTransientVariables(java.util.HashMap<java.lang.String,java.lang.Object> variables)protected java.util.Map<java.lang.String,VariableInstance>collectVariableInstances(java.util.HashMap<java.lang.String,VariableInstance> variables)protected java.util.Set<java.lang.String>collectVariableNames(java.util.Set<java.lang.String> variableNames)protected java.util.Map<java.lang.String,java.lang.Object>collectVariables(java.util.HashMap<java.lang.String,java.lang.Object> variables)protected VariableInstanceEntitycreateVariableInstance(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceActivityExecution)voidcreateVariableLocal(java.lang.String variableName, java.lang.Object value)protected voidcreateVariableLocal(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceActivityExecution)only called when a new variable is created on this variable scope.voidcreateVariablesLocal(java.util.Map<java.lang.String,? extends java.lang.Object> variables)protected voiddeleteVariableInstanceForExplicitUserCall(VariableInstanceEntity variableInstance, ExecutionEntity sourceActivityExecution)protected voidensureVariableInstancesInitialized()javax.el.ELContextgetCachedElContext()protected abstract VariableScopeImplgetParentVariableScope()protected ExecutionEntitygetSourceActivityExecution()protected abstract VariableInstanceEntitygetSpecificVariable(java.lang.String variableName)protected abstract java.util.List<VariableInstanceEntity>getSpecificVariables(java.util.Collection<java.lang.String> variableNames)java.lang.ObjectgetTransientVariable(java.lang.String variableName)Similar toVariableScope.getVariable(String), including the searching via the parent scopes, but for transient variables only.java.lang.ObjectgetTransientVariableLocal(java.lang.String variableName)Similar toVariableScope.getVariableLocal(String), but for a transient variable.java.util.Map<java.lang.String,java.lang.Object>getTransientVariables()Similar toVariableScope.getVariables(), but for transient variables only.java.util.Map<java.lang.String,java.lang.Object>getTransientVariablesLocal()Similar toVariableScope.getVariableLocal(String), but for transient variables only.java.util.Map<java.lang.String,VariableInstanceEntity>getUsedVariablesCache()java.lang.ObjectgetVariable(java.lang.String variableName)Returns the variable value for one specific variable.java.lang.ObjectgetVariable(java.lang.String variableName, boolean fetchAllVariables)The same operation asgetVariable(String), but with an extra parameter to indicate whether or not all variables need to be fetched.<T> TgetVariable(java.lang.String variableName, java.lang.Class<T> variableClass)Typed version of theVariableScope.getVariable(String)method.VariableInstancegetVariableInstance(java.lang.String variableName)Similar toVariableScope.getVariable(String), but returns aVariableInstanceinstance, which contains more information than just the value.VariableInstancegetVariableInstance(java.lang.String variableName, boolean fetchAllVariables)Similar toVariableScope.getVariable(String, boolean), but returns an instance ofVariableInstance, which has some additional information beyond the value.java.util.Map<java.lang.String,VariableInstanceEntity>getVariableInstanceEntities()VariableInstancegetVariableInstanceLocal(java.lang.String variableName)Similar toVariableScope.getVariableLocal(String), but returns an instance ofVariableInstance, which has some additional information beyond the value.VariableInstancegetVariableInstanceLocal(java.lang.String variableName, boolean fetchAllVariables)Similar toVariableScope.getVariableLocal(String, boolean), but returns an instance ofVariableInstance, which has some additional information beyond the value.java.util.Map<java.lang.String,VariableInstance>getVariableInstances()Returns all variables, as instances of theVariableInstanceinterface, which gives more information than only the the value (type, execution id, etc.)java.util.Map<java.lang.String,VariableInstance>getVariableInstances(java.util.Collection<java.lang.String> variableNames)Similar toVariableScope.getVariableInstances(), but limited to only the variables with the provided names.java.util.Map<java.lang.String,VariableInstance>getVariableInstances(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)Similar toVariableScope.getVariables(Collection, boolean)but returns the variables as instances of theVariableInstanceinterface, which gives more information than only the the value (type, execution id, etc.)java.util.Map<java.lang.String,VariableInstance>getVariableInstancesLocal()Returns the variables local to this scope as instances of theVariableInstanceinterface, which provided additional information about the variable.java.util.Map<java.lang.String,VariableInstance>getVariableInstancesLocal(java.util.Collection<java.lang.String> variableNames)Similar toVariableScope.getVariableInstances(Collection), but only for variables local to this scope.java.util.Map<java.lang.String,VariableInstance>getVariableInstancesLocal(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)Similar toVariableScope.getVariableInstances(Collection, boolean), but only for variables local to this scope.java.lang.ObjectgetVariableLocal(java.lang.String variableName)Returns the value for the specific variable and only checks this scope and not any parent scope.java.lang.ObjectgetVariableLocal(java.lang.String variableName, boolean fetchAllVariables)Similar toVariableScope.getVariableLocal(String), but has an extra flag that indicates whether or not all variables need to be fetched when getting one variable.<T> TgetVariableLocal(java.lang.String variableName, java.lang.Class<T> variableClass)Typed version of theVariableScope.getVariableLocal(String)method.java.util.Set<java.lang.String>getVariableNames()Returns all the names of the variables for this scope and all parent scopes.java.util.Set<java.lang.String>getVariableNamesLocal()Returns all the names of the variables for this scope (no parent scopes).java.util.Map<java.lang.String,java.lang.Object>getVariables()Returns all variables.java.util.Map<java.lang.String,java.lang.Object>getVariables(java.util.Collection<java.lang.String> variableNames)Similar toVariableScope.getVariables(), but limited to only the variables with the provided names.java.util.Map<java.lang.String,java.lang.Object>getVariables(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)Similar to {@link #getVariables(Collection))}, but with a flag that indicates that all variables should be fetched when fetching the specific variables.java.util.Map<java.lang.String,java.lang.Object>getVariablesLocal()Returns the variable local to this scope only.java.util.Map<java.lang.String,java.lang.Object>getVariablesLocal(java.util.Collection<java.lang.String> variableNames)Similar toVariableScope.getVariables(Collection), but only for variables local to this scope.java.util.Map<java.lang.String,java.lang.Object>getVariablesLocal(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)Similar toVariableScope.getVariables(Collection, boolean), but only for variables local to this scope.booleanhasVariable(java.lang.String variableName)Returns whether this scope or any parent scope has a specific variable.booleanhasVariableLocal(java.lang.String variableName)Returns whether this scope has a specific variable.booleanhasVariables()Returns whether this scope or any parent scope has variables.booleanhasVariablesLocal()Returns whether this scope has variables.protected abstract voidinitializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)protected booleanisActivityIdUsedForDetails()Execution variable updates have activity instance ids, but historic task variable updates don't.protected abstract java.util.Collection<VariableInstanceEntity>loadVariableInstances()voidremoveTransientVariable(java.lang.String variableName)Removes a specific transient variable.voidremoveTransientVariableLocal(java.lang.String variableName)Removes a specific transient variable (also searching parent scopes).voidremoveTransientVariables()Remove all transient variable of this scope and its parent scopes.voidremoveTransientVariablesLocal()Removes all local transient variables.voidremoveVariable(java.lang.String variableName)Removes the variable and creates a new;@link HistoricVariableUpdateEntity}protected voidremoveVariable(java.lang.String variableName, ExecutionEntity sourceActivityExecution)voidremoveVariableLocal(java.lang.String variableName)Removes the local variable and creates a newHistoricVariableUpdate.protected voidremoveVariableLocal(java.lang.String variableName, ExecutionEntity sourceActivityExecution)voidremoveVariables()Removes the (local) variables and creates a newHistoricVariableUpdatefor each of them.voidremoveVariables(java.util.Collection<java.lang.String> variableNames)Removes the variables and creates a newHistoricVariableUpdatefor each of them.voidremoveVariablesLocal()Removes the (local) variables and creates a newHistoricVariableUpdatefor each of them.voidremoveVariablesLocal(java.util.Collection<java.lang.String> variableNames)Removes the local variables and creates a newHistoricVariableUpdatefor each of them.voidsetCachedElContext(javax.el.ELContext cachedElContext)voidsetTransientVariable(java.lang.String variableName, java.lang.Object variableValue)Similar toVariableScope.setVariable(String, Object), but the variable is transient: - no history is kept for the variable - the variable is only available until a waitstate is reached in the process - transient variables 'shadow' persistent variable (when getVariable('abc') where 'abc' is both persistent and transient, the transient value is returned.voidsetTransientVariableLocal(java.lang.String variableName, java.lang.Object variableValue)Similar toVariableScope.setVariableLocal(String, Object), but for a transient variable.voidsetTransientVariables(java.util.Map<java.lang.String,java.lang.Object> transientVariables)Similar toVariableScope.setVariables(Map), but for transient variables.voidsetTransientVariablesLocal(java.util.Map<java.lang.String,java.lang.Object> transientVariables)Similar toVariableScope.setVariablesLocal(Map), but for transient variables.voidsetVariable(java.lang.String variableName, java.lang.Object value)Sets the variable with the provided name to the provided value.voidsetVariable(java.lang.String variableName, java.lang.Object value, boolean fetchAllVariables)The defaultsetVariable(String, Object)fetches all variables (for historical and backwards compatible reasons) while setting the variables.protected voidsetVariable(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceExecution, boolean fetchAllVariables)Sets a variable as high as possible (highest parent).java.lang.ObjectsetVariableLocal(java.lang.String variableName, java.lang.Object value)Similar toVariableScope.setVariable(String, Object), but the variable is set to this scope specifically.java.lang.ObjectsetVariableLocal(java.lang.String variableName, java.lang.Object value, boolean fetchAllVariables)The defaultsetVariableLocal(String, Object)fetches all variables (for historical and backwards compatible reasons) while setting the variables.java.lang.ObjectsetVariableLocal(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceActivityExecution, boolean fetchAllVariables)voidsetVariables(java.util.Map<java.lang.String,? extends java.lang.Object> variables)Sets the provided variables to the variable scope.voidsetVariablesLocal(java.util.Map<java.lang.String,? extends java.lang.Object> variables)Similar toVariableScope.setVariables(Map), but the variable are set on this scope specifically.protected voidupdateVariableInstance(VariableInstanceEntity variableInstance, java.lang.Object value, ExecutionEntity sourceActivityExecution)-
Methods inherited from class org.activiti.engine.impl.persistence.entity.AbstractEntity
getId, getRevision, getRevisionNext, isDeleted, isInserted, isUpdated, setDeleted, setId, setInserted, setRevision, setUpdated
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.activiti.engine.impl.persistence.entity.Entity
getPersistentState
-
-
-
-
Field Detail
-
variableInstances
protected java.util.Map<java.lang.String,VariableInstanceEntity> variableInstances
-
usedVariablesCache
protected java.util.Map<java.lang.String,VariableInstanceEntity> usedVariablesCache
-
transientVariabes
protected java.util.Map<java.lang.String,VariableInstance> transientVariabes
-
cachedElContext
protected javax.el.ELContext cachedElContext
-
-
Method Detail
-
loadVariableInstances
protected abstract java.util.Collection<VariableInstanceEntity> loadVariableInstances()
-
getParentVariableScope
protected abstract VariableScopeImpl getParentVariableScope()
-
initializeVariableInstanceBackPointer
protected abstract void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)
-
ensureVariableInstancesInitialized
protected void ensureVariableInstancesInitialized()
-
getVariables
public java.util.Map<java.lang.String,java.lang.Object> getVariables()
Description copied from interface:VariableScopeReturns all variables. This will include all variables of parent scopes too.- Specified by:
getVariablesin interfaceVariableScope
-
getVariableInstances
public java.util.Map<java.lang.String,VariableInstance> getVariableInstances()
Description copied from interface:VariableScopeReturns all variables, as instances of theVariableInstanceinterface, which gives more information than only the the value (type, execution id, etc.)- Specified by:
getVariableInstancesin interfaceVariableScope
-
getVariables
public java.util.Map<java.lang.String,java.lang.Object> getVariables(java.util.Collection<java.lang.String> variableNames)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariables(), but limited to only the variables with the provided names.- Specified by:
getVariablesin interfaceVariableScope
-
getVariableInstances
public java.util.Map<java.lang.String,VariableInstance> getVariableInstances(java.util.Collection<java.lang.String> variableNames)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableInstances(), but limited to only the variables with the provided names.- Specified by:
getVariableInstancesin interfaceVariableScope
-
getVariables
public java.util.Map<java.lang.String,java.lang.Object> getVariables(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)Description copied from interface:VariableScopeSimilar to {@link #getVariables(Collection))}, but with a flag that indicates that all variables should be fetched when fetching the specific variables. If set to false, only the specific variables will be fetched. Dependening on the use case, this can be better for performance, as it avoids fetching and processing the other variables. However, if the other variables are needed further on, getting them in one go is probably better (and the variables are cached during oneCommandexecution).- Specified by:
getVariablesin interfaceVariableScope
-
getVariableInstances
public java.util.Map<java.lang.String,VariableInstance> getVariableInstances(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariables(Collection, boolean)but returns the variables as instances of theVariableInstanceinterface, which gives more information than only the the value (type, execution id, etc.)- Specified by:
getVariableInstancesin interfaceVariableScope
-
collectVariables
protected java.util.Map<java.lang.String,java.lang.Object> collectVariables(java.util.HashMap<java.lang.String,java.lang.Object> variables)
-
collectVariableInstances
protected java.util.Map<java.lang.String,VariableInstance> collectVariableInstances(java.util.HashMap<java.lang.String,VariableInstance> variables)
-
getVariable
public java.lang.Object getVariable(java.lang.String variableName)
Description copied from interface:VariableScopeReturns the variable value for one specific variable. Will look in parent scopes when the variable does not exist on this particular scope.- Specified by:
getVariablein interfaceVariableScope
-
getVariableInstance
public VariableInstance getVariableInstance(java.lang.String variableName)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariable(String), but returns aVariableInstanceinstance, which contains more information than just the value.- Specified by:
getVariableInstancein interfaceVariableScope
-
getVariable
public java.lang.Object getVariable(java.lang.String variableName, boolean fetchAllVariables)The same operation asgetVariable(String), but with an extra parameter to indicate whether or not all variables need to be fetched. Note that the default Activiti way (because of backwards compatibility) is to fetch all the variables when doing a get/set of variables. So this means 'true' is the default value for this method, and in fact it will simply delegate togetVariable(String). This can also be the most performant, if you're doing a lot of variable gets in the same transaction (eg in service tasks). In case 'false' is used, only the specific variable will be fetched.- Specified by:
getVariablein interfaceVariableScope
-
getVariableInstance
public VariableInstance getVariableInstance(java.lang.String variableName, boolean fetchAllVariables)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariable(String, boolean), but returns an instance ofVariableInstance, which has some additional information beyond the value.- Specified by:
getVariableInstancein interfaceVariableScope
-
getSpecificVariable
protected abstract VariableInstanceEntity getSpecificVariable(java.lang.String variableName)
-
getVariableLocal
public java.lang.Object getVariableLocal(java.lang.String variableName)
Description copied from interface:VariableScopeReturns the value for the specific variable and only checks this scope and not any parent scope.- Specified by:
getVariableLocalin interfaceVariableScope
-
getVariableInstanceLocal
public VariableInstance getVariableInstanceLocal(java.lang.String variableName)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableLocal(String), but returns an instance ofVariableInstance, which has some additional information beyond the value.- Specified by:
getVariableInstanceLocalin interfaceVariableScope
-
getVariableLocal
public java.lang.Object getVariableLocal(java.lang.String variableName, boolean fetchAllVariables)Description copied from interface:VariableScopeSimilar toVariableScope.getVariableLocal(String), but has an extra flag that indicates whether or not all variables need to be fetched when getting one variable. By default true (for backwards compatibility reasons), which means that callingVariableScope.getVariableLocal(String)will fetch all variables, of the current scope. Setting this flag to false can thus be better for performance. However, variables are cached, and if other variables are used later on, setting this true might actually be better for performance.- Specified by:
getVariableLocalin interfaceVariableScope
-
getVariableInstanceLocal
public VariableInstance getVariableInstanceLocal(java.lang.String variableName, boolean fetchAllVariables)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableLocal(String, boolean), but returns an instance ofVariableInstance, which has some additional information beyond the value.- Specified by:
getVariableInstanceLocalin interfaceVariableScope
-
hasVariables
public boolean hasVariables()
Description copied from interface:VariableScopeReturns whether this scope or any parent scope has variables.- Specified by:
hasVariablesin interfaceVariableScope
-
hasVariablesLocal
public boolean hasVariablesLocal()
Description copied from interface:VariableScopeReturns whether this scope has variables.- Specified by:
hasVariablesLocalin interfaceVariableScope
-
hasVariable
public boolean hasVariable(java.lang.String variableName)
Description copied from interface:VariableScopeReturns whether this scope or any parent scope has a specific variable.- Specified by:
hasVariablein interfaceVariableScope
-
hasVariableLocal
public boolean hasVariableLocal(java.lang.String variableName)
Description copied from interface:VariableScopeReturns whether this scope has a specific variable.- Specified by:
hasVariableLocalin interfaceVariableScope
-
collectVariableNames
protected java.util.Set<java.lang.String> collectVariableNames(java.util.Set<java.lang.String> variableNames)
-
getVariableNames
public java.util.Set<java.lang.String> getVariableNames()
Description copied from interface:VariableScopeReturns all the names of the variables for this scope and all parent scopes.- Specified by:
getVariableNamesin interfaceVariableScope
-
getVariablesLocal
public java.util.Map<java.lang.String,java.lang.Object> getVariablesLocal()
Description copied from interface:VariableScopeReturns the variable local to this scope only. So, in contrary toVariableScope.getVariables(), the variables from the parent scope won't be returned.- Specified by:
getVariablesLocalin interfaceVariableScope
-
getVariableInstancesLocal
public java.util.Map<java.lang.String,VariableInstance> getVariableInstancesLocal()
Description copied from interface:VariableScopeReturns the variables local to this scope as instances of theVariableInstanceinterface, which provided additional information about the variable.- Specified by:
getVariableInstancesLocalin interfaceVariableScope
-
getVariablesLocal
public java.util.Map<java.lang.String,java.lang.Object> getVariablesLocal(java.util.Collection<java.lang.String> variableNames)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariables(Collection), but only for variables local to this scope.- Specified by:
getVariablesLocalin interfaceVariableScope
-
getVariableInstancesLocal
public java.util.Map<java.lang.String,VariableInstance> getVariableInstancesLocal(java.util.Collection<java.lang.String> variableNames)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableInstances(Collection), but only for variables local to this scope.- Specified by:
getVariableInstancesLocalin interfaceVariableScope
-
getVariablesLocal
public java.util.Map<java.lang.String,java.lang.Object> getVariablesLocal(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)Description copied from interface:VariableScopeSimilar toVariableScope.getVariables(Collection, boolean), but only for variables local to this scope.- Specified by:
getVariablesLocalin interfaceVariableScope
-
getVariableInstancesLocal
public java.util.Map<java.lang.String,VariableInstance> getVariableInstancesLocal(java.util.Collection<java.lang.String> variableNames, boolean fetchAllVariables)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableInstances(Collection, boolean), but only for variables local to this scope.- Specified by:
getVariableInstancesLocalin interfaceVariableScope
-
getSpecificVariables
protected abstract java.util.List<VariableInstanceEntity> getSpecificVariables(java.util.Collection<java.lang.String> variableNames)
-
getVariableNamesLocal
public java.util.Set<java.lang.String> getVariableNamesLocal()
Description copied from interface:VariableScopeReturns all the names of the variables for this scope (no parent scopes).- Specified by:
getVariableNamesLocalin interfaceVariableScope
-
getVariableInstanceEntities
public java.util.Map<java.lang.String,VariableInstanceEntity> getVariableInstanceEntities()
-
getUsedVariablesCache
public java.util.Map<java.lang.String,VariableInstanceEntity> getUsedVariablesCache()
-
createVariablesLocal
public void createVariablesLocal(java.util.Map<java.lang.String,? extends java.lang.Object> variables)
-
setVariables
public void setVariables(java.util.Map<java.lang.String,? extends java.lang.Object> variables)
Description copied from interface:VariableScopeSets the provided variables to the variable scope.Variables are set according algorithm for
VariableScope.setVariable(String, Object), applied separately to each variable.- Specified by:
setVariablesin interfaceVariableScope- Parameters:
variables- a map of keys and values for the variables to be set
-
setVariablesLocal
public void setVariablesLocal(java.util.Map<java.lang.String,? extends java.lang.Object> variables)
Description copied from interface:VariableScopeSimilar toVariableScope.setVariables(Map), but the variable are set on this scope specifically.- Specified by:
setVariablesLocalin interfaceVariableScope
-
removeVariables
public void removeVariables()
Description copied from interface:VariableScopeRemoves the (local) variables and creates a newHistoricVariableUpdatefor each of them.- Specified by:
removeVariablesin interfaceVariableScope
-
removeVariablesLocal
public void removeVariablesLocal()
Description copied from interface:VariableScopeRemoves the (local) variables and creates a newHistoricVariableUpdatefor each of them.- Specified by:
removeVariablesLocalin interfaceVariableScope
-
removeVariables
public void removeVariables(java.util.Collection<java.lang.String> variableNames)
Description copied from interface:VariableScopeRemoves the variables and creates a newHistoricVariableUpdatefor each of them.- Specified by:
removeVariablesin interfaceVariableScope
-
removeVariablesLocal
public void removeVariablesLocal(java.util.Collection<java.lang.String> variableNames)
Description copied from interface:VariableScopeRemoves the local variables and creates a newHistoricVariableUpdatefor each of them.- Specified by:
removeVariablesLocalin interfaceVariableScope
-
setVariable
public void setVariable(java.lang.String variableName, java.lang.Object value)Description copied from interface:VariableScopeSets the variable with the provided name to the provided value.A variable is set according to the following algorithm:
- If this scope already contains a variable by the provided name as a local variable, its value is overwritten to the provided value.
- If this scope does not contain a variable by the provided name as a local variable, the variable is set to this scope's parent scope, if there is one. If there is no parent scope (meaning this scope is the root scope of the hierarchy it belongs to), this scope is used. This applies recursively up the parent scope chain until, if no scope contains a local variable by the provided name, ultimately the root scope is reached and the variable value is set on that scope.
In practice for most cases, this algorithm will set variables to the scope of the execution at the process instance’s root level, if there is no execution-local variable by the provided name.
- Specified by:
setVariablein interfaceVariableScope- Parameters:
variableName- the name of the variable to be setvalue- the value of the variable to be set
-
setVariable
public void setVariable(java.lang.String variableName, java.lang.Object value, boolean fetchAllVariables)The defaultsetVariable(String, Object)fetches all variables (for historical and backwards compatible reasons) while setting the variables. Setting the fetchAllVariables parameter to true is the default behaviour (ie fetching all variables) Setting the fetchAllVariables parameter to false does not do that.- Specified by:
setVariablein interfaceVariableScope
-
setVariable
protected void setVariable(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceExecution, boolean fetchAllVariables)Sets a variable as high as possible (highest parent).- Parameters:
sourceExecution- The execution where the variable was originally set, used for history data.fetchAllVariables- If true, all existing variables will be fetched when setting the variable.
-
setVariableLocal
public java.lang.Object setVariableLocal(java.lang.String variableName, java.lang.Object value)Description copied from interface:VariableScopeSimilar toVariableScope.setVariable(String, Object), but the variable is set to this scope specifically.- Specified by:
setVariableLocalin interfaceVariableScope
-
setVariableLocal
public java.lang.Object setVariableLocal(java.lang.String variableName, java.lang.Object value, boolean fetchAllVariables)The defaultsetVariableLocal(String, Object)fetches all variables (for historical and backwards compatible reasons) while setting the variables. Setting the fetchAllVariables parameter to true is the default behaviour (ie fetching all variables) Setting the fetchAllVariables parameter to false does not do that.- Specified by:
setVariableLocalin interfaceVariableScope
-
setVariableLocal
public java.lang.Object setVariableLocal(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceActivityExecution, boolean fetchAllVariables)
-
createVariableLocal
public void createVariableLocal(java.lang.String variableName, java.lang.Object value)
-
createVariableLocal
protected void createVariableLocal(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceActivityExecution)only called when a new variable is created on this variable scope. This method is also responsible for propagating the creation of this variable to the history.
-
removeVariable
public void removeVariable(java.lang.String variableName)
Description copied from interface:VariableScopeRemoves the variable and creates a new;@link HistoricVariableUpdateEntity}- Specified by:
removeVariablein interfaceVariableScope
-
removeVariable
protected void removeVariable(java.lang.String variableName, ExecutionEntity sourceActivityExecution)
-
removeVariableLocal
public void removeVariableLocal(java.lang.String variableName)
Description copied from interface:VariableScopeRemoves the local variable and creates a newHistoricVariableUpdate.- Specified by:
removeVariableLocalin interfaceVariableScope
-
getSourceActivityExecution
protected ExecutionEntity getSourceActivityExecution()
-
removeVariableLocal
protected void removeVariableLocal(java.lang.String variableName, ExecutionEntity sourceActivityExecution)
-
deleteVariableInstanceForExplicitUserCall
protected void deleteVariableInstanceForExplicitUserCall(VariableInstanceEntity variableInstance, ExecutionEntity sourceActivityExecution)
-
updateVariableInstance
protected void updateVariableInstance(VariableInstanceEntity variableInstance, java.lang.Object value, ExecutionEntity sourceActivityExecution)
-
createVariableInstance
protected VariableInstanceEntity createVariableInstance(java.lang.String variableName, java.lang.Object value, ExecutionEntity sourceActivityExecution)
-
setTransientVariablesLocal
public void setTransientVariablesLocal(java.util.Map<java.lang.String,java.lang.Object> transientVariables)
Description copied from interface:VariableScopeSimilar toVariableScope.setVariablesLocal(Map), but for transient variables. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
setTransientVariablesLocalin interfaceVariableScope
-
setTransientVariableLocal
public void setTransientVariableLocal(java.lang.String variableName, java.lang.Object variableValue)Description copied from interface:VariableScopeSimilar toVariableScope.setVariableLocal(String, Object), but for a transient variable. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
setTransientVariableLocalin interfaceVariableScope
-
setTransientVariables
public void setTransientVariables(java.util.Map<java.lang.String,java.lang.Object> transientVariables)
Description copied from interface:VariableScopeSimilar toVariableScope.setVariables(Map), but for transient variables. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
setTransientVariablesin interfaceVariableScope
-
setTransientVariable
public void setTransientVariable(java.lang.String variableName, java.lang.Object variableValue)Description copied from interface:VariableScopeSimilar toVariableScope.setVariable(String, Object), but the variable is transient: - no history is kept for the variable - the variable is only available until a waitstate is reached in the process - transient variables 'shadow' persistent variable (when getVariable('abc') where 'abc' is both persistent and transient, the transient value is returned.- Specified by:
setTransientVariablein interfaceVariableScope
-
getTransientVariableLocal
public java.lang.Object getTransientVariableLocal(java.lang.String variableName)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableLocal(String), but for a transient variable. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
getTransientVariableLocalin interfaceVariableScope
-
getTransientVariablesLocal
public java.util.Map<java.lang.String,java.lang.Object> getTransientVariablesLocal()
Description copied from interface:VariableScopeSimilar toVariableScope.getVariableLocal(String), but for transient variables only. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
getTransientVariablesLocalin interfaceVariableScope
-
getTransientVariable
public java.lang.Object getTransientVariable(java.lang.String variableName)
Description copied from interface:VariableScopeSimilar toVariableScope.getVariable(String), including the searching via the parent scopes, but for transient variables only. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
getTransientVariablein interfaceVariableScope
-
getTransientVariables
public java.util.Map<java.lang.String,java.lang.Object> getTransientVariables()
Description copied from interface:VariableScopeSimilar toVariableScope.getVariables(), but for transient variables only. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
getTransientVariablesin interfaceVariableScope
-
collectTransientVariables
protected java.util.Map<java.lang.String,java.lang.Object> collectTransientVariables(java.util.HashMap<java.lang.String,java.lang.Object> variables)
-
removeTransientVariableLocal
public void removeTransientVariableLocal(java.lang.String variableName)
Description copied from interface:VariableScopeRemoves a specific transient variable (also searching parent scopes). SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
removeTransientVariableLocalin interfaceVariableScope
-
removeTransientVariablesLocal
public void removeTransientVariablesLocal()
Description copied from interface:VariableScopeRemoves all local transient variables. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
removeTransientVariablesLocalin interfaceVariableScope
-
removeTransientVariable
public void removeTransientVariable(java.lang.String variableName)
Description copied from interface:VariableScopeRemoves a specific transient variable. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
removeTransientVariablein interfaceVariableScope
-
removeTransientVariables
public void removeTransientVariables()
Description copied from interface:VariableScopeRemove all transient variable of this scope and its parent scopes. SeeVariableScope.setTransientVariable(String, Object)for the rules on 'transient' variables.- Specified by:
removeTransientVariablesin interfaceVariableScope
-
isActivityIdUsedForDetails
protected boolean isActivityIdUsedForDetails()
Execution variable updates have activity instance ids, but historic task variable updates don't.
-
getCachedElContext
public javax.el.ELContext getCachedElContext()
-
setCachedElContext
public void setCachedElContext(javax.el.ELContext cachedElContext)
-
getVariable
public <T> T getVariable(java.lang.String variableName, java.lang.Class<T> variableClass)Description copied from interface:VariableScopeTyped version of theVariableScope.getVariable(String)method.- Specified by:
getVariablein interfaceVariableScope
-
getVariableLocal
public <T> T getVariableLocal(java.lang.String variableName, java.lang.Class<T> variableClass)Description copied from interface:VariableScopeTyped version of theVariableScope.getVariableLocal(String)method.- Specified by:
getVariableLocalin interfaceVariableScope
-
-