Class NoExecutionVariableScope
java.lang.Object
org.flowable.variable.service.impl.el.NoExecutionVariableScope
- All Implemented Interfaces:
VariableContainer
,VariableScope
Variable-scope only used to resolve variables when NO execution is active but expression-resolving is needed. This occurs eg. when start-form properties have default's defined. Even though
variables are not available yet, expressions should be resolved anyway.
- Author:
- Frederik Heremans, Joram Barrez
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createVariableLocal
(String variableName, Object value) void
createVariablesLocal
(Map<String, ? extends Object> variables) static NoExecutionVariableScope
Since aNoExecutionVariableScope
has no state, it's safe to use the same instance to prevent too many useless instances created.getTransientVariable
(String variableName) Similar toVariableScope.getVariable(String)
, including the searching via the parent scopes, but for transient variables only.getTransientVariableLocal
(String variableName) Similar toVariableScope.getVariableLocal(String)
, but for a transient variable.Similar toVariableScope.getVariables()
, but for transient variables only.Similar toVariableScope.getVariableLocal(String)
, but for transient variables only.getVariable
(String variableName) Returns the variable value for one specific variable.getVariable
(String variableName, boolean fetchAllVariables) Similar toVariableScope.getVariable(String)
, but has an extra flag that indicates whether or not all variables need to be fetched when getting one variable.<T> T
getVariable
(String variableName, Class<T> variableClass) Typed version of theVariableScope.getVariable(String)
method.getVariableInstance
(String variableName) Similar toVariableScope.getVariable(String)
, but returns aVariableInstance
instance, which contains more information than just the value.getVariableInstance
(String variableName, boolean fetchAllVariables) Similar toVariableScope.getVariable(String, boolean)
, but returns an instance ofVariableInstance
, which has some additional information beyond the value.getVariableInstanceLocal
(String variableName) Similar toVariableScope.getVariableLocal(String)
, but returns an instance ofVariableInstance
, which has some additional information beyond the value.getVariableInstanceLocal
(String variableName, boolean fetchAllVariables) Similar toVariableScope.getVariableLocal(String, boolean)
, but returns an instance ofVariableInstance
, which has some additional information beyond the value.Returns all variables, as instances of theVariableInstance
interface, which gives more information than only the value (type, execution id, etc.)getVariableInstances
(Collection<String> variableNames) Similar toVariableScope.getVariableInstances()
, but limited to only the variables with the provided names.getVariableInstances
(Collection<String> variableNames, boolean fetchAllVariables) Similar toVariableScope.getVariables(Collection, boolean)
but returns the variables as instances of theVariableInstance
interface, which gives more information than only the value (type, execution id, etc.)Returns the variables local to this scope as instances of theVariableInstance
interface, which provided additional information about the variable.getVariableInstancesLocal
(Collection<String> variableNames) Similar toVariableScope.getVariableInstances(Collection)
, but only for variables local to this scope.getVariableInstancesLocal
(Collection<String> variableNames, boolean fetchAllVariables) Similar toVariableScope.getVariableInstances(Collection, boolean)
, but only for variables local to this scope.getVariableLocal
(String variableName) Returns the value for the specific variable and only checks this scope and not any parent scope.getVariableLocal
(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> T
getVariableLocal
(String variableName, Class<T> variableClass) Typed version of theVariableScope.getVariableLocal(String)
method.Returns all the names of the variables for this scope and all parent scopes.Returns all the names of the variables for this scope (no parent scopes).Returns all variables.getVariables
(Collection<String> variableNames) Similar toVariableScope.getVariables()
, but limited to only the variables with the provided names.getVariables
(Collection<String> variableNames, boolean fetchAllVariables) Similar toVariableScope.getVariables(Collection)
, but with a flag that indicates that all variables should be fetched when fetching the specific variables.Returns the variable local to this scope only.getVariablesLocal
(Collection<String> variableNames) Similar toVariableScope.getVariables(Collection)
, but only for variables local to this scope.getVariablesLocal
(Collection<String> variableNames, boolean fetchAllVariables) Similar toVariableScope.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
Returns whether this scope or any parent scope has variables.boolean
Returns whether this scope has variables.void
removeTransientVariable
(String variableName) Removes a specific transient variable.void
removeTransientVariableLocal
(String variableName) Removes a specific transient variable (also searching parent scopes).void
Remove all transient variable of this scope and its parent scopes.void
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
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
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
setTransientVariable
(String variableName, 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.void
setTransientVariableLocal
(String variableName, Object variableValue) Similar toVariableScope.setVariableLocal(String, Object)
, but for a transient variable.void
setTransientVariables
(Map<String, Object> transientVariables) Similar toVariableScope.setVariables(Map)
, but for transient variables.void
setTransientVariablesLocal
(Map<String, Object> transientVariables) Similar toVariableScope.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) Similar toVariableScope.setVariable(String, Object)
, but with an extra flag to indicate whether all variables should be fetched while doing this or not.setVariableLocal
(String variableName, Object value) Similar toVariableScope.setVariable(String, Object)
, but the variable is set to this scope specifically.setVariableLocal
(String variableName, Object value, boolean fetchAllVariables) Similar toVariableScope.setVariableLocal(String, Object)
, but with an extra flag to indicate whether all variables should be fetched while doing this or not.void
setVariables
(Map<String, ? extends Object> variables) Sets the provided variables to the variable scope.void
setVariablesLocal
(Map<String, ? extends Object> variables) Similar toVariableScope.setVariables(Map)
, but the variable are set on this scope specifically.
-
Constructor Details
-
NoExecutionVariableScope
public NoExecutionVariableScope()
-
-
Method Details
-
getVariables
Description copied from interface:VariableScope
Returns all variables. This will include all variables of parent scopes too.- Specified by:
getVariables
in interfaceVariableScope
-
getVariablesLocal
Description copied from interface:VariableScope
Returns the variable local to this scope only. So, in contrary toVariableScope.getVariables()
, the variables from the parent scope won't be returned.- Specified by:
getVariablesLocal
in interfaceVariableScope
-
getVariables
Description copied from interface:VariableScope
Similar toVariableScope.getVariables()
, but limited to only the variables with the provided names.- Specified by:
getVariables
in interfaceVariableScope
-
getVariables
Description copied from interface:VariableScope
Similar toVariableScope.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).- Specified by:
getVariables
in interfaceVariableScope
-
getVariablesLocal
Description copied from interface:VariableScope
Similar toVariableScope.getVariables(Collection)
, but only for variables local to this scope.- Specified by:
getVariablesLocal
in interfaceVariableScope
-
getVariablesLocal
public Map<String,Object> getVariablesLocal(Collection<String> variableNames, boolean fetchAllVariables) Description copied from interface:VariableScope
Similar toVariableScope.getVariables(Collection, boolean)
, but only for variables local to this scope.- Specified by:
getVariablesLocal
in interfaceVariableScope
-
getVariable
Description copied from interface:VariableScope
Returns the variable value for one specific variable. Will look in parent scopes when the variable does not exist on this particular scope.- Specified by:
getVariable
in interfaceVariableContainer
- Specified by:
getVariable
in interfaceVariableScope
-
getVariable
Description copied from interface:VariableScope
Similar toVariableScope.getVariable(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.getVariable(String)
will fetch all variables, of the current scope and all parent scopes. 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:
getVariable
in interfaceVariableScope
-
getVariableLocal
Description copied from interface:VariableScope
Returns the value for the specific variable and only checks this scope and not any parent scope.- Specified by:
getVariableLocal
in interfaceVariableScope
-
getVariableLocal
Description copied from interface:VariableScope
Similar 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:
getVariableLocal
in interfaceVariableScope
-
getVariable
Description copied from interface:VariableScope
Typed version of theVariableScope.getVariable(String)
method.- Specified by:
getVariable
in interfaceVariableScope
-
getVariableLocal
Description copied from interface:VariableScope
Typed version of theVariableScope.getVariableLocal(String)
method.- Specified by:
getVariableLocal
in interfaceVariableScope
-
getVariableInstances
Description copied from interface:VariableScope
Returns all variables, as instances of theVariableInstance
interface, which gives more information than only the value (type, execution id, etc.)- Specified by:
getVariableInstances
in interfaceVariableScope
-
getVariableInstances
Description copied from interface:VariableScope
Similar toVariableScope.getVariableInstances()
, but limited to only the variables with the provided names.- Specified by:
getVariableInstances
in interfaceVariableScope
-
getVariableInstances
public Map<String,VariableInstance> getVariableInstances(Collection<String> variableNames, boolean fetchAllVariables) Description copied from interface:VariableScope
Similar toVariableScope.getVariables(Collection, boolean)
but returns the variables as instances of theVariableInstance
interface, which gives more information than only the value (type, execution id, etc.)- Specified by:
getVariableInstances
in interfaceVariableScope
-
getVariableInstancesLocal
Description copied from interface:VariableScope
Returns the variables local to this scope as instances of theVariableInstance
interface, which provided additional information about the variable.- Specified by:
getVariableInstancesLocal
in interfaceVariableScope
-
getVariableInstancesLocal
Description copied from interface:VariableScope
Similar toVariableScope.getVariableInstances(Collection)
, but only for variables local to this scope.- Specified by:
getVariableInstancesLocal
in interfaceVariableScope
-
getVariableInstancesLocal
public Map<String,VariableInstance> getVariableInstancesLocal(Collection<String> variableNames, boolean fetchAllVariables) Description copied from interface:VariableScope
Similar toVariableScope.getVariableInstances(Collection, boolean)
, but only for variables local to this scope.- Specified by:
getVariableInstancesLocal
in interfaceVariableScope
-
getVariableInstance
Description copied from interface:VariableScope
Similar toVariableScope.getVariable(String)
, but returns aVariableInstance
instance, which contains more information than just the value.- Specified by:
getVariableInstance
in interfaceVariableScope
-
getVariableInstance
Description copied from interface:VariableScope
Similar toVariableScope.getVariable(String, boolean)
, but returns an instance ofVariableInstance
, which has some additional information beyond the value.- Specified by:
getVariableInstance
in interfaceVariableScope
-
getVariableInstanceLocal
Description copied from interface:VariableScope
Similar toVariableScope.getVariableLocal(String)
, but returns an instance ofVariableInstance
, which has some additional information beyond the value.- Specified by:
getVariableInstanceLocal
in interfaceVariableScope
-
getVariableInstanceLocal
Description copied from interface:VariableScope
Similar toVariableScope.getVariableLocal(String, boolean)
, but returns an instance ofVariableInstance
, which has some additional information beyond the value.- Specified by:
getVariableInstanceLocal
in interfaceVariableScope
-
getVariableNames
Description copied from interface:VariableScope
Returns all the names of the variables for this scope and all parent scopes.- Specified by:
getVariableNames
in interfaceVariableScope
-
getVariableNamesLocal
Description copied from interface:VariableScope
Returns all the names of the variables for this scope (no parent scopes).- Specified by:
getVariableNamesLocal
in interfaceVariableScope
-
setVariable
Description copied from interface:VariableScope
Sets the variable with the provided name to the provided value. In the case when variable name is an expression which is resolved by expression manager, the value is set in the object resolved from the expression.A variable is set according to the following algorithm:
- If variable name is an expression, resolve expression and set the value on the resolved object.
- 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.
- Specified by:
setVariable
in interfaceVariableContainer
- Specified by:
setVariable
in interfaceVariableScope
- Parameters:
variableName
- the name of the variable to be setvalue
- the value of the variable to be set
-
setVariable
Description copied from interface:VariableScope
Similar toVariableScope.setVariable(String, Object)
, but with an extra flag to indicate whether all variables should be fetched while doing this or not. Variable name expression is not resolved. The variable will be put on the highest possible scope. For an execution this is the process instance execution. If this is not wanted, use theVariableScope.setVariableLocal(String, Object)
method instead. The default (e.g. when callingVariableScope.setVariable(String, Object)
), is true, for backwards compatibility reasons. However, in some use cases, it might make sense not to fetch any other variables when setting one variable (for example when doing nothing more than just setting one variable).- Specified by:
setVariable
in interfaceVariableScope
-
setVariableLocal
Description copied from interface:VariableScope
Similar toVariableScope.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.- Specified by:
setVariableLocal
in interfaceVariableScope
-
setVariableLocal
Description copied from interface:VariableScope
Similar toVariableScope.setVariableLocal(String, Object)
, but with an extra flag to indicate whether all variables should be fetched while doing this or not.- Specified by:
setVariableLocal
in interfaceVariableScope
-
setVariables
Description copied from interface:VariableScope
Sets the provided variables to the variable scope.Variables are set according algorithm for
VariableScope.setVariable(String, Object)
, applied separately to each variable.- Specified by:
setVariables
in interfaceVariableScope
- Parameters:
variables
- a map of keys and values for the variables to be set
-
setVariablesLocal
Description copied from interface:VariableScope
Similar toVariableScope.setVariables(Map)
, but the variable are set on this scope specifically.- Specified by:
setVariablesLocal
in interfaceVariableScope
-
hasVariables
public boolean hasVariables()Description copied from interface:VariableScope
Returns whether this scope or any parent scope has variables.- Specified by:
hasVariables
in interfaceVariableScope
-
hasVariablesLocal
public boolean hasVariablesLocal()Description copied from interface:VariableScope
Returns whether this scope has variables.- Specified by:
hasVariablesLocal
in interfaceVariableScope
-
hasVariable
Description copied from interface:VariableScope
Returns whether this scope or any parent scope has a specific variable.- Specified by:
hasVariable
in interfaceVariableContainer
- Specified by:
hasVariable
in interfaceVariableScope
-
hasVariableLocal
Description copied from interface:VariableScope
Returns whether this scope has a specific variable.- Specified by:
hasVariableLocal
in interfaceVariableScope
-
createVariableLocal
-
createVariablesLocal
-
removeVariable
Description copied from interface:VariableScope
Removes the variable and creates a new HistoricVariableUpdate.- Specified by:
removeVariable
in interfaceVariableScope
-
removeVariableLocal
Description copied from interface:VariableScope
Removes the local variable and creates a new HistoricVariableUpdate.- Specified by:
removeVariableLocal
in interfaceVariableScope
-
removeVariables
public void removeVariables()Description copied from interface:VariableScope
Removes the (local) variables and creates a new HistoricVariableUpdate for each of them.- Specified by:
removeVariables
in interfaceVariableScope
-
removeVariablesLocal
public void removeVariablesLocal()Description copied from interface:VariableScope
Removes the (local) variables and creates a new HistoricVariableUpdate for each of them.- Specified by:
removeVariablesLocal
in interfaceVariableScope
-
removeVariables
Description copied from interface:VariableScope
Removes the variables and creates a new HistoricVariableUpdate for each of them.- Specified by:
removeVariables
in interfaceVariableScope
-
removeVariablesLocal
Description copied from interface:VariableScope
Removes the local variables and creates a new HistoricVariableUpdate for each of them.- Specified by:
removeVariablesLocal
in interfaceVariableScope
-
setTransientVariablesLocal
Description copied from interface:VariableScope
Similar toVariableScope.setVariablesLocal(Map)
, but for transient variables. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
setTransientVariablesLocal
in interfaceVariableScope
-
setTransientVariableLocal
Description copied from interface:VariableScope
Similar toVariableScope.setVariableLocal(String, Object)
, but for a transient variable. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
setTransientVariableLocal
in interfaceVariableScope
-
setTransientVariables
Description copied from interface:VariableScope
Similar toVariableScope.setVariables(Map)
, but for transient variables. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
setTransientVariables
in interfaceVariableScope
-
setTransientVariable
Description copied from interface:VariableScope
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.- Specified by:
setTransientVariable
in interfaceVariableContainer
- Specified by:
setTransientVariable
in interfaceVariableScope
-
getTransientVariableLocal
Description copied from interface:VariableScope
Similar toVariableScope.getVariableLocal(String)
, but for a transient variable. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
getTransientVariableLocal
in interfaceVariableScope
-
getTransientVariablesLocal
Description copied from interface:VariableScope
Similar toVariableScope.getVariableLocal(String)
, but for transient variables only. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
getTransientVariablesLocal
in interfaceVariableScope
-
getTransientVariable
Description copied from interface:VariableScope
Similar 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:
getTransientVariable
in interfaceVariableScope
-
getTransientVariables
Description copied from interface:VariableScope
Similar toVariableScope.getVariables()
, but for transient variables only. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
getTransientVariables
in interfaceVariableScope
-
removeTransientVariableLocal
Description copied from interface:VariableScope
Removes a specific transient variable (also searching parent scopes). SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
removeTransientVariableLocal
in interfaceVariableScope
-
removeTransientVariablesLocal
public void removeTransientVariablesLocal()Description copied from interface:VariableScope
Removes all local transient variables. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
removeTransientVariablesLocal
in interfaceVariableScope
-
removeTransientVariable
Description copied from interface:VariableScope
Removes a specific transient variable. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
removeTransientVariable
in interfaceVariableScope
-
removeTransientVariables
public void removeTransientVariables()Description copied from interface:VariableScope
Remove all transient variable of this scope and its parent scopes. SeeVariableScope.setTransientVariable(String, Object)
for the rules on 'transient' variables.- Specified by:
removeTransientVariables
in interfaceVariableScope
-
getTenantId
- Specified by:
getTenantId
in interfaceVariableContainer