public abstract class VariableScopeImpl extends AbstractEntity implements Serializable, VariableScope
| Modifier and Type | Field and Description |
|---|---|
protected ELContext |
cachedElContext |
protected Map<String,VariableInstance> |
transientVariables |
protected Map<String,VariableInstanceEntity> |
usedVariablesCache |
protected Map<String,VariableInstanceEntity> |
variableInstances |
id, isDeleted, isInserted, isUpdated, originalPersistentState, revision| Constructor and Description |
|---|
VariableScopeImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
addLoggingSessionInfo(com.fasterxml.jackson.databind.node.ObjectNode loggingNode) |
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) |
protected void |
createVariableLocal(String variableName,
Object value)
only called when a new variable is created on this variable scope.
|
void |
createVariablesLocal(Map<String,? extends Object> variables) |
protected void |
deleteVariableInstanceForExplicitUserCall(VariableInstanceEntity variableInstance) |
protected void |
ensureVariableInstancesInitialized() |
ELContext |
getCachedElContext() |
protected abstract VariableScopeImpl |
getParentVariableScope() |
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 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 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
VariableScope.getVariables(Collection), but with a flag that indicates that all variables should be fetched when fetching the specific variables. |
protected abstract VariableServiceConfiguration |
getVariableServiceConfiguration() |
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) |
void |
internalSetVariableInstances(Map<String,VariableInstanceEntity> variableInstances)
Only to be used when creating a new entity, to avoid an extra call to the database.
|
protected boolean |
isExpression(String variableName) |
protected abstract boolean |
isPropagateToHistoricVariable()
Return whether changes to the variables are propagated to the history storage.
|
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 HistoricVariableUpdate.
|
void |
removeVariableLocal(String variableName)
Removes the local variable and creates a new HistoricVariableUpdate.
|
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(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. |
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. |
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 boolean |
storeVariableLocal(String variableName) |
protected void |
updateVariableInstance(VariableInstanceEntity variableInstance,
Object value) |
getId, getOriginalPersistentState, getRevision, getRevisionNext, isDeleted, isInserted, isUpdated, setDeleted, setId, setInserted, setOriginalPersistentState, setRevision, setUpdatedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTenantIdgetIdPrefix, getPersistentStateprotected Map<String,VariableInstanceEntity> variableInstances
protected Map<String,VariableInstanceEntity> usedVariablesCache
protected Map<String,VariableInstance> transientVariables
protected ELContext cachedElContext
protected abstract Collection<VariableInstanceEntity> loadVariableInstances()
protected abstract VariableScopeImpl getParentVariableScope()
protected abstract void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)
protected abstract void addLoggingSessionInfo(com.fasterxml.jackson.databind.node.ObjectNode loggingNode)
protected void ensureVariableInstancesInitialized()
public void internalSetVariableInstances(Map<String,VariableInstanceEntity> variableInstances)
public Map<String,Object> getVariables()
VariableScopegetVariables in interface VariableScopepublic Map<String,VariableInstance> getVariableInstances()
VariableScopeVariableInstance interface, which gives more information than only 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)
VariableScopeVariableScope.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. Depending 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 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 VariableContainergetVariable 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 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 VariableContainerhasVariable 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()
VariableScoperemoveVariables in interface VariableScopepublic void removeVariablesLocal()
VariableScoperemoveVariablesLocal in interface VariableScopepublic void removeVariables(Collection<String> variableNames)
VariableScoperemoveVariables in interface VariableScopepublic void removeVariablesLocal(Collection<String> variableNames)
VariableScoperemoveVariablesLocal in interface VariableScopepublic void setVariable(String variableName, Object value)
VariableScopeA variable is set according to the following algorithm:
setVariable in interface VariableContainersetVariable 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 VariableScopepublic Object setVariableLocal(String variableName, Object value)
VariableScopeVariableScope.setVariable(String, Object), but the variable is set to this scope specifically. Variable name
is handled as a variable name string without resolving an expression.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 VariableScopeprotected void createVariableLocal(String variableName, Object value)
public void removeVariable(String variableName)
VariableScoperemoveVariable in interface VariableScopepublic void removeVariableLocal(String variableName)
VariableScoperemoveVariableLocal in interface VariableScopeprotected void deleteVariableInstanceForExplicitUserCall(VariableInstanceEntity variableInstance)
protected void updateVariableInstance(VariableInstanceEntity variableInstance, Object value)
protected VariableInstanceEntity createVariableInstance(String variableName, Object value)
protected boolean storeVariableLocal(String variableName)
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 VariableContainersetTransientVariable 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 abstract boolean isPropagateToHistoricVariable()
protected abstract VariableServiceConfiguration getVariableServiceConfiguration()
public ELContext getCachedElContext()
public void setCachedElContext(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 VariableScopeprotected boolean isExpression(String variableName)
Copyright © 2023 Flowable. All rights reserved.