public abstract class VariableScopeImpl extends AbstractEntity implements Serializable, VariableScope
| Modifier and Type | Field and Description |
|---|---|
protected javax.el.ELContext |
cachedElContext |
protected Map<String,VariableInstance> |
transientVariabes |
protected Map<String,VariableInstanceEntity> |
usedVariablesCache |
protected Map<String,VariableInstanceEntity> |
variableInstances |
id, isDeleted, isInserted, isUpdated, revision| Constructor and Description |
|---|
VariableScopeImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected Map<String,Object> |
collectTransientVariables(HashMap<String,Object> variables) |
protected Map<String,VariableInstance> |
collectVariableInstances(HashMap<String,VariableInstance> variables) |
protected Set<String> |
collectVariableNames(Set<String> variableNames) |
protected Map<String,Object> |
collectVariables(HashMap<String,Object> variables) |
protected VariableInstanceEntity |
createVariableInstance(String variableName,
Object value,
ExecutionEntity sourceActivityExecution) |
void |
createVariableLocal(String variableName,
Object value) |
protected void |
createVariableLocal(String variableName,
Object value,
ExecutionEntity sourceActivityExecution)
only called when a new variable is created on this variable scope.
|
void |
createVariablesLocal(Map<String,? extends Object> variables) |
protected void |
deleteVariableInstanceForExplicitUserCall(VariableInstanceEntity variableInstance,
ExecutionEntity sourceActivityExecution) |
protected void |
ensureVariableInstancesInitialized() |
javax.el.ELContext |
getCachedElContext() |
protected abstract VariableScopeImpl |
getParentVariableScope() |
protected ExecutionEntity |
getSourceActivityExecution() |
protected abstract VariableInstanceEntity |
getSpecificVariable(String variableName) |
protected abstract List<VariableInstanceEntity> |
getSpecificVariables(Collection<String> variableNames) |
Object |
getTransientVariable(String variableName)
Similar to
VariableScope.getVariable(String), including the searching via the parent scopes, but
for transient variables only. |
Object |
getTransientVariableLocal(String variableName)
Similar to
VariableScope.getVariableLocal(String), but for a transient variable. |
Map<String,Object> |
getTransientVariables()
Similar to
VariableScope.getVariables(), but for transient variables only. |
Map<String,Object> |
getTransientVariablesLocal()
Similar to
VariableScope.getVariableLocal(String), but for transient variables only. |
Map<String,VariableInstanceEntity> |
getUsedVariablesCache() |
Object |
getVariable(String variableName)
Returns the variable value for one specific variable.
|
Object |
getVariable(String variableName,
boolean fetchAllVariables)
The same operation as
getVariable(String),
but with an extra parameter to indicate whether or not all variables need to be fetched. |
<T> T |
getVariable(String variableName,
Class<T> variableClass)
Typed version of the
VariableScope.getVariable(String) method. |
VariableInstance |
getVariableInstance(String variableName)
Similar to
VariableScope.getVariable(String), but returns a VariableInstance instance,
which contains more information than just the value. |
VariableInstance |
getVariableInstance(String variableName,
boolean fetchAllVariables)
Similar to
VariableScope.getVariable(String, boolean), but returns an instance of VariableInstance,
which has some additional information beyond the value. |
Map<String,VariableInstanceEntity> |
getVariableInstanceEntities() |
VariableInstance |
getVariableInstanceLocal(String variableName)
Similar to
VariableScope.getVariableLocal(String), but returns an instance of VariableInstance,
which has some additional information beyond the value. |
VariableInstance |
getVariableInstanceLocal(String variableName,
boolean fetchAllVariables)
Similar to
VariableScope.getVariableLocal(String, boolean), but returns an instance of VariableInstance,
which has some additional information beyond the value. |
Map<String,VariableInstance> |
getVariableInstances()
Returns all variables, as instances of the
VariableInstance interface,
which gives more information than only the the value (type, execution id, etc.) |
Map<String,VariableInstance> |
getVariableInstances(Collection<String> variableNames)
Similar to
VariableScope.getVariableInstances(), but limited to only the variables with the provided names. |
Map<String,VariableInstance> |
getVariableInstances(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
VariableScope.getVariables(Collection, boolean) but returns the variables
as instances of the VariableInstance interface,
which gives more information than only the the value (type, execution id, etc.) |
Map<String,VariableInstance> |
getVariableInstancesLocal()
Returns the variables local to this scope as instances of the
VariableInstance interface,
which provided additional information about the variable. |
Map<String,VariableInstance> |
getVariableInstancesLocal(Collection<String> variableNames)
Similar to
VariableScope.getVariableInstances(Collection), but only for variables local to this scope. |
Map<String,VariableInstance> |
getVariableInstancesLocal(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
VariableScope.getVariableInstances(Collection, boolean), but only for variables local to this scope. |
Object |
getVariableLocal(String variableName)
Returns the value for the specific variable and only checks this scope and not any parent scope.
|
Object |
getVariableLocal(String variableName,
boolean fetchAllVariables)
Similar to
VariableScope.getVariableLocal(String), but has an extra flag that indicates whether or not
all variables need to be fetched when getting one variable. |
<T> T |
getVariableLocal(String variableName,
Class<T> variableClass)
Typed version of the
VariableScope.getVariableLocal(String) method. |
Set<String> |
getVariableNames()
Returns all the names of the variables for this scope and all parent scopes.
|
Set<String> |
getVariableNamesLocal()
Returns all the names of the variables for this scope (no parent scopes).
|
Map<String,Object> |
getVariables()
Returns all variables.
|
Map<String,Object> |
getVariables(Collection<String> variableNames)
Similar to
VariableScope.getVariables(), but limited to only the variables with the provided names. |
Map<String,Object> |
getVariables(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
#getVariables(Collection)), but with a flag that indicates that all
variables should be fetched when fetching the specific variables. |
Map<String,Object> |
getVariablesLocal()
Returns the variable local to this scope only.
|
Map<String,Object> |
getVariablesLocal(Collection<String> variableNames)
Similar to
VariableScope.getVariables(Collection), but only for variables local to this scope. |
Map<String,Object> |
getVariablesLocal(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
VariableScope.getVariables(Collection, boolean), but only for variables local to this scope. |
boolean |
hasVariable(String variableName)
Returns whether this scope or any parent scope has a specific variable.
|
boolean |
hasVariableLocal(String variableName)
Returns whether this scope has a specific variable.
|
boolean |
hasVariables()
Returns whether this scope or any parent scope has variables.
|
boolean |
hasVariablesLocal()
Returns whether this scope has variables.
|
protected abstract void |
initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance) |
protected boolean |
isActivityIdUsedForDetails()
Execution variable updates have activity instance ids, but historic task variable updates don't.
|
protected abstract Collection<VariableInstanceEntity> |
loadVariableInstances() |
void |
removeTransientVariable(String variableName)
Removes a specific transient variable.
|
void |
removeTransientVariableLocal(String variableName)
Removes a specific transient variable (also searching parent scopes).
|
void |
removeTransientVariables()
Remove all transient variable of this scope and its parent scopes.
|
void |
removeTransientVariablesLocal()
Removes all local transient variables.
|
void |
removeVariable(String variableName)
Removes the variable and creates a new;@link HistoricVariableUpdateEntity}
|
protected void |
removeVariable(String variableName,
ExecutionEntity sourceActivityExecution) |
void |
removeVariableLocal(String variableName)
Removes the local variable and creates a new
HistoricVariableUpdate. |
protected void |
removeVariableLocal(String variableName,
ExecutionEntity sourceActivityExecution) |
void |
removeVariables()
Removes the (local) variables and creates a new
HistoricVariableUpdate for each of them. |
void |
removeVariables(Collection<String> variableNames)
Removes the variables and creates a new
HistoricVariableUpdate for each of them. |
void |
removeVariablesLocal()
Removes the (local) variables and creates a new
HistoricVariableUpdate for each of them. |
void |
removeVariablesLocal(Collection<String> variableNames)
Removes the local variables and creates a new
HistoricVariableUpdate for each of them. |
void |
setCachedElContext(javax.el.ELContext cachedElContext) |
void |
setTransientVariable(String variableName,
Object variableValue)
Similar to
VariableScope.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. |
void |
setTransientVariableLocal(String variableName,
Object variableValue)
Similar to
VariableScope.setVariableLocal(String, Object), but for a transient variable. |
void |
setTransientVariables(Map<String,Object> transientVariables)
Similar to
VariableScope.setVariables(Map), but for transient variables. |
void |
setTransientVariablesLocal(Map<String,Object> transientVariables)
Similar to
VariableScope.setVariablesLocal(Map), but for transient variables. |
void |
setVariable(String variableName,
Object value)
Sets the variable with the provided name to the provided value.
|
void |
setVariable(String variableName,
Object value,
boolean fetchAllVariables)
The default
setVariable(String, Object) fetches all variables
(for historical and backwards compatible reasons) while setting the variables. |
protected void |
setVariable(String variableName,
Object value,
ExecutionEntity sourceExecution,
boolean fetchAllVariables)
Sets a variable as high as possible (highest parent).
|
Object |
setVariableLocal(String variableName,
Object value)
Similar to
VariableScope.setVariable(String, Object), but the variable is set to this scope specifically. |
Object |
setVariableLocal(String variableName,
Object value,
boolean fetchAllVariables)
The default
setVariableLocal(String, Object) fetches all variables (for historical and backwards compatible reasons) while setting the variables. |
Object |
setVariableLocal(String variableName,
Object value,
ExecutionEntity sourceActivityExecution,
boolean fetchAllVariables) |
void |
setVariables(Map<String,? extends Object> variables)
Sets the provided variables to the variable scope.
|
void |
setVariablesLocal(Map<String,? extends Object> variables)
Similar to
VariableScope.setVariables(Map), but the variable are set on this scope specifically. |
protected void |
updateVariableInstance(VariableInstanceEntity variableInstance,
Object value,
ExecutionEntity sourceActivityExecution) |
getId, getRevision, getRevisionNext, isDeleted, isInserted, isUpdated, setDeleted, setId, setInserted, setRevision, setUpdatedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPersistentStateprotected Map<String,VariableInstanceEntity> variableInstances
protected Map<String,VariableInstanceEntity> usedVariablesCache
protected Map<String,VariableInstance> transientVariabes
protected javax.el.ELContext cachedElContext
protected abstract Collection<VariableInstanceEntity> loadVariableInstances()
protected abstract VariableScopeImpl getParentVariableScope()
protected abstract void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)
protected void ensureVariableInstancesInitialized()
public Map<String,Object> getVariables()
VariableScopegetVariables in interface VariableScopepublic Map<String,VariableInstance> getVariableInstances()
VariableScopeVariableInstance interface,
which gives more information than only the the value (type, execution id, etc.)getVariableInstances in interface VariableScopepublic Map<String,Object> getVariables(Collection<String> variableNames)
VariableScopeVariableScope.getVariables(), but limited to only the variables with the provided names.getVariables in interface VariableScopepublic Map<String,VariableInstance> getVariableInstances(Collection<String> variableNames)
VariableScopeVariableScope.getVariableInstances(), but limited to only the variables with the provided names.getVariableInstances in interface VariableScopepublic Map<String,Object> getVariables(Collection<String> variableNames, boolean fetchAllVariables)
VariableScope#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 one Command execution).getVariables in interface VariableScopepublic Map<String,VariableInstance> getVariableInstances(Collection<String> variableNames, boolean fetchAllVariables)
VariableScopeVariableScope.getVariables(Collection, boolean) but returns the variables
as instances of the VariableInstance interface,
which gives more information than only the the value (type, execution id, etc.)getVariableInstances in interface VariableScopeprotected Map<String,VariableInstance> collectVariableInstances(HashMap<String,VariableInstance> variables)
public Object getVariable(String variableName)
VariableScopegetVariable in interface VariableScopepublic VariableInstance getVariableInstance(String variableName)
VariableScopeVariableScope.getVariable(String), but returns a VariableInstance instance,
which contains more information than just the value.getVariableInstance in interface VariableScopepublic Object getVariable(String variableName, boolean fetchAllVariables)
getVariable(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 to getVariable(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.getVariable in interface VariableScopepublic VariableInstance getVariableInstance(String variableName, boolean fetchAllVariables)
VariableScopeVariableScope.getVariable(String, boolean), but returns an instance of VariableInstance,
which has some additional information beyond the value.getVariableInstance in interface VariableScopeprotected abstract VariableInstanceEntity getSpecificVariable(String variableName)
public Object getVariableLocal(String variableName)
VariableScopegetVariableLocal in interface VariableScopepublic VariableInstance getVariableInstanceLocal(String variableName)
VariableScopeVariableScope.getVariableLocal(String), but returns an instance of VariableInstance,
which has some additional information beyond the value.getVariableInstanceLocal in interface VariableScopepublic Object getVariableLocal(String variableName, boolean fetchAllVariables)
VariableScopeVariableScope.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 calling VariableScope.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.getVariableLocal in interface VariableScopepublic VariableInstance getVariableInstanceLocal(String variableName, boolean fetchAllVariables)
VariableScopeVariableScope.getVariableLocal(String, boolean), but returns an instance of VariableInstance,
which has some additional information beyond the value.getVariableInstanceLocal in interface VariableScopepublic boolean hasVariables()
VariableScopehasVariables in interface VariableScopepublic boolean hasVariablesLocal()
VariableScopehasVariablesLocal in interface VariableScopepublic boolean hasVariable(String variableName)
VariableScopehasVariable in interface VariableScopepublic boolean hasVariableLocal(String variableName)
VariableScopehasVariableLocal in interface VariableScopepublic Set<String> getVariableNames()
VariableScopegetVariableNames in interface VariableScopepublic Map<String,Object> getVariablesLocal()
VariableScopeVariableScope.getVariables(), the variables from the parent scope won't be returned.getVariablesLocal in interface VariableScopepublic Map<String,VariableInstance> getVariableInstancesLocal()
VariableScopeVariableInstance interface,
which provided additional information about the variable.getVariableInstancesLocal in interface VariableScopepublic Map<String,Object> getVariablesLocal(Collection<String> variableNames)
VariableScopeVariableScope.getVariables(Collection), but only for variables local to this scope.getVariablesLocal in interface VariableScopepublic Map<String,VariableInstance> getVariableInstancesLocal(Collection<String> variableNames)
VariableScopeVariableScope.getVariableInstances(Collection), but only for variables local to this scope.getVariableInstancesLocal in interface VariableScopepublic Map<String,Object> getVariablesLocal(Collection<String> variableNames, boolean fetchAllVariables)
VariableScopeVariableScope.getVariables(Collection, boolean), but only for variables local to this scope.getVariablesLocal in interface VariableScopepublic Map<String,VariableInstance> getVariableInstancesLocal(Collection<String> variableNames, boolean fetchAllVariables)
VariableScopeVariableScope.getVariableInstances(Collection, boolean), but only for variables local to this scope.getVariableInstancesLocal in interface VariableScopeprotected abstract List<VariableInstanceEntity> getSpecificVariables(Collection<String> variableNames)
public Set<String> getVariableNamesLocal()
VariableScopegetVariableNamesLocal in interface VariableScopepublic Map<String,VariableInstanceEntity> getVariableInstanceEntities()
public Map<String,VariableInstanceEntity> getUsedVariablesCache()
public void setVariables(Map<String,? extends Object> variables)
VariableScope
Variables are set according algorithm for VariableScope.setVariable(String, Object), applied separately to each variable.
setVariables in interface VariableScopevariables - a map of keys and values for the variables to be setpublic void setVariablesLocal(Map<String,? extends Object> variables)
VariableScopeVariableScope.setVariables(Map), but the variable are set on this scope specifically.setVariablesLocal in interface VariableScopepublic void removeVariables()
VariableScopeHistoricVariableUpdate for each of them.removeVariables in interface VariableScopepublic void removeVariablesLocal()
VariableScopeHistoricVariableUpdate for each of them.removeVariablesLocal in interface VariableScopepublic void removeVariables(Collection<String> variableNames)
VariableScopeHistoricVariableUpdate for each of them.removeVariables in interface VariableScopepublic void removeVariablesLocal(Collection<String> variableNames)
VariableScopeHistoricVariableUpdate for each of them.removeVariablesLocal in interface VariableScopepublic void setVariable(String variableName, Object value)
VariableScopeA variable is set according to the following algorithm:
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.
setVariable in interface VariableScopevariableName - the name of the variable to be setvalue - the value of the variable to be setpublic void setVariable(String variableName, Object value, boolean fetchAllVariables)
setVariable(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.setVariable in interface VariableScopeprotected void setVariable(String variableName, Object value, ExecutionEntity sourceExecution, boolean fetchAllVariables)
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.public Object setVariableLocal(String variableName, Object value)
VariableScopeVariableScope.setVariable(String, Object), but the variable is set to this scope specifically.setVariableLocal in interface VariableScopepublic Object setVariableLocal(String variableName, Object value, boolean fetchAllVariables)
setVariableLocal(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.setVariableLocal in interface VariableScopepublic Object setVariableLocal(String variableName, Object value, ExecutionEntity sourceActivityExecution, boolean fetchAllVariables)
protected void createVariableLocal(String variableName, Object value, ExecutionEntity sourceActivityExecution)
public void removeVariable(String variableName)
VariableScoperemoveVariable in interface VariableScopeprotected void removeVariable(String variableName, ExecutionEntity sourceActivityExecution)
public void removeVariableLocal(String variableName)
VariableScopeHistoricVariableUpdate.removeVariableLocal in interface VariableScopeprotected ExecutionEntity getSourceActivityExecution()
protected void removeVariableLocal(String variableName, ExecutionEntity sourceActivityExecution)
protected void deleteVariableInstanceForExplicitUserCall(VariableInstanceEntity variableInstance, ExecutionEntity sourceActivityExecution)
protected void updateVariableInstance(VariableInstanceEntity variableInstance, Object value, ExecutionEntity sourceActivityExecution)
protected VariableInstanceEntity createVariableInstance(String variableName, Object value, ExecutionEntity sourceActivityExecution)
public void setTransientVariablesLocal(Map<String,Object> transientVariables)
VariableScopeVariableScope.setVariablesLocal(Map), but for transient variables.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.setTransientVariablesLocal in interface VariableScopepublic void setTransientVariableLocal(String variableName, Object variableValue)
VariableScopeVariableScope.setVariableLocal(String, Object), but for a transient variable.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.setTransientVariableLocal in interface VariableScopepublic void setTransientVariables(Map<String,Object> transientVariables)
VariableScopeVariableScope.setVariables(Map), but for transient variables.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.setTransientVariables in interface VariableScopepublic void setTransientVariable(String variableName, Object variableValue)
VariableScopeVariableScope.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.setTransientVariable in interface VariableScopepublic Object getTransientVariableLocal(String variableName)
VariableScopeVariableScope.getVariableLocal(String), but for a transient variable.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.getTransientVariableLocal in interface VariableScopepublic Map<String,Object> getTransientVariablesLocal()
VariableScopeVariableScope.getVariableLocal(String), but for transient variables only.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.getTransientVariablesLocal in interface VariableScopepublic Object getTransientVariable(String variableName)
VariableScopeVariableScope.getVariable(String), including the searching via the parent scopes, but
for transient variables only.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.getTransientVariable in interface VariableScopepublic Map<String,Object> getTransientVariables()
VariableScopeVariableScope.getVariables(), but for transient variables only.
See VariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.getTransientVariables in interface VariableScopeprotected Map<String,Object> collectTransientVariables(HashMap<String,Object> variables)
public void removeTransientVariableLocal(String variableName)
VariableScopeVariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.removeTransientVariableLocal in interface VariableScopepublic void removeTransientVariablesLocal()
VariableScopeVariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.removeTransientVariablesLocal in interface VariableScopepublic void removeTransientVariable(String variableName)
VariableScopeVariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.removeTransientVariable in interface VariableScopepublic void removeTransientVariables()
VariableScopeVariableScope.setTransientVariable(String, Object) for the rules on 'transient' variables.removeTransientVariables in interface VariableScopeprotected boolean isActivityIdUsedForDetails()
public javax.el.ELContext getCachedElContext()
public void setCachedElContext(javax.el.ELContext cachedElContext)
public <T> T getVariable(String variableName, Class<T> variableClass)
VariableScopeVariableScope.getVariable(String) method.getVariable in interface VariableScopepublic <T> T getVariableLocal(String variableName, Class<T> variableClass)
VariableScopeVariableScope.getVariableLocal(String) method.getVariableLocal in interface VariableScopeCopyright © 2016 Alfresco. All rights reserved.