public interface VariableScope
DelegateExecution
for example is often used
in JavaDelegate
implementation to get and set variables.
Variables are typically stored on the 'highest parent'. For executions, this
means that when called on an execution the variable will be stored on the process instance
execution. Variables can be stored on the actual scope itself though, by calling the xxLocal methods.Modifier and Type | Method and Description |
---|---|
Object |
getTransientVariable(String variableName)
Similar to
getVariable(String) , including the searching via the parent scopes, but
for transient variables only. |
Object |
getTransientVariableLocal(String variableName)
Similar to
getVariableLocal(String) , but for a transient variable. |
Map<String,Object> |
getTransientVariables()
Similar to
getVariables() , but for transient variables only. |
Map<String,Object> |
getTransientVariablesLocal()
Similar to
getVariableLocal(String) , but for transient variables only. |
Object |
getVariable(String variableName)
Returns the variable value for one specific variable.
|
Object |
getVariable(String variableName,
boolean fetchAllVariables)
Similar to
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 the
getVariable(String) method. |
org.activiti.engine.impl.persistence.entity.VariableInstance |
getVariableInstance(String variableName)
Similar to
getVariable(String) , but returns a VariableInstance instance,
which contains more information than just the value. |
org.activiti.engine.impl.persistence.entity.VariableInstance |
getVariableInstance(String variableName,
boolean fetchAllVariables)
Similar to
getVariable(String, boolean) , but returns an instance of VariableInstance ,
which has some additional information beyond the value. |
org.activiti.engine.impl.persistence.entity.VariableInstance |
getVariableInstanceLocal(String variableName)
Similar to
getVariableLocal(String) , but returns an instance of VariableInstance ,
which has some additional information beyond the value. |
org.activiti.engine.impl.persistence.entity.VariableInstance |
getVariableInstanceLocal(String variableName,
boolean fetchAllVariables)
Similar to
getVariableLocal(String, boolean) , but returns an instance of VariableInstance ,
which has some additional information beyond the value. |
Map<String,org.activiti.engine.impl.persistence.entity.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,org.activiti.engine.impl.persistence.entity.VariableInstance> |
getVariableInstances(Collection<String> variableNames)
Similar to
getVariableInstances() , but limited to only the variables with the provided names. |
Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> |
getVariableInstances(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
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,org.activiti.engine.impl.persistence.entity.VariableInstance> |
getVariableInstancesLocal()
Returns the variables local to this scope as instances of the
VariableInstance interface,
which provided additional information about the variable. |
Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> |
getVariableInstancesLocal(Collection<String> variableNames)
Similar to
getVariableInstances(Collection) , but only for variables local to this scope. |
Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> |
getVariableInstancesLocal(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
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
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
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
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
getVariables(Collection) , but only for variables local to this scope. |
Map<String,Object> |
getVariablesLocal(Collection<String> variableNames,
boolean fetchAllVariables)
Similar to
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.
|
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}
|
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 |
setTransientVariable(String variableName,
Object variableValue)
Similar to
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
setVariableLocal(String, Object) , but for a transient variable. |
void |
setTransientVariables(Map<String,Object> transientVariables)
Similar to
setVariables(Map) , but for transient variables. |
void |
setTransientVariablesLocal(Map<String,Object> transientVariables)
Similar to
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 to
setVariable(String, Object) , but with an extra flag to indicate whether
all variables should be fetched while doing this or not. |
Object |
setVariableLocal(String variableName,
Object value)
Similar to
setVariable(String, Object) , but the variable is set to this scope specifically. |
Object |
setVariableLocal(String variableName,
Object value,
boolean fetchAllVariables)
Similar to
setVariableLocal(String, Object, boolean) , but the variable is set to this scope specifically. |
void |
setVariables(Map<String,? extends Object> variables)
Sets the provided variables to the variable scope.
|
void |
setVariablesLocal(Map<String,? extends Object> variables)
Similar to
setVariables(Map) , but the variable are set on this scope specifically. |
Map<String,Object> getVariables()
Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> getVariableInstances()
VariableInstance
interface,
which gives more information than only the the value (type, execution id, etc.)Map<String,Object> getVariables(Collection<String> variableNames)
getVariables()
, but limited to only the variables with the provided names.Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> getVariableInstances(Collection<String> variableNames)
getVariableInstances()
, but limited to only the variables with the provided names.Map<String,Object> getVariables(Collection<String> variableNames, boolean fetchAllVariables)
#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).Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> getVariableInstances(Collection<String> variableNames, boolean fetchAllVariables)
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,Object> getVariablesLocal()
getVariables()
, the variables from the parent scope won't be returned.Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> getVariableInstancesLocal()
VariableInstance
interface,
which provided additional information about the variable.Map<String,Object> getVariablesLocal(Collection<String> variableNames)
getVariables(Collection)
, but only for variables local to this scope.Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> getVariableInstancesLocal(Collection<String> variableNames)
getVariableInstances(Collection)
, but only for variables local to this scope.Map<String,Object> getVariablesLocal(Collection<String> variableNames, boolean fetchAllVariables)
getVariables(Collection, boolean)
, but only for variables local to this scope.Map<String,org.activiti.engine.impl.persistence.entity.VariableInstance> getVariableInstancesLocal(Collection<String> variableNames, boolean fetchAllVariables)
getVariableInstances(Collection, boolean)
, but only for variables local to this scope.Object getVariable(String variableName)
org.activiti.engine.impl.persistence.entity.VariableInstance getVariableInstance(String variableName)
getVariable(String)
, but returns a VariableInstance
instance,
which contains more information than just the value.Object getVariable(String variableName, boolean fetchAllVariables)
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 calling 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.org.activiti.engine.impl.persistence.entity.VariableInstance getVariableInstance(String variableName, boolean fetchAllVariables)
getVariable(String, boolean)
, but returns an instance of VariableInstance
,
which has some additional information beyond the value.Object getVariableLocal(String variableName)
org.activiti.engine.impl.persistence.entity.VariableInstance getVariableInstanceLocal(String variableName)
getVariableLocal(String)
, but returns an instance of VariableInstance
,
which has some additional information beyond the value.Object getVariableLocal(String variableName, boolean fetchAllVariables)
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 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.org.activiti.engine.impl.persistence.entity.VariableInstance getVariableInstanceLocal(String variableName, boolean fetchAllVariables)
getVariableLocal(String, boolean)
, but returns an instance of VariableInstance
,
which has some additional information beyond the value.<T> T getVariable(String variableName, Class<T> variableClass)
getVariable(String)
method.<T> T getVariableLocal(String variableName, Class<T> variableClass)
getVariableLocal(String)
method.Set<String> getVariableNames()
Set<String> getVariableNamesLocal()
void setVariable(String variableName, Object value)
A 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.
variableName
- the name of the variable to be setvalue
- the value of the variable to be setvoid setVariable(String variableName, Object value, boolean fetchAllVariables)
setVariable(String, Object)
, but with an extra flag to indicate whether
all variables should be fetched while doing this or not.
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 the setVariableLocal(String, Object)
method instead.
The default (e.g. when calling 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).Object setVariableLocal(String variableName, Object value)
setVariable(String, Object)
, but the variable is set to this scope specifically.Object setVariableLocal(String variableName, Object value, boolean fetchAllVariables)
setVariableLocal(String, Object, boolean)
, but the variable is set to this scope specifically.void setVariables(Map<String,? extends Object> variables)
Variables are set according algorithm for setVariable(String, Object)
, applied separately to each variable.
variables
- a map of keys and values for the variables to be setvoid setVariablesLocal(Map<String,? extends Object> variables)
setVariables(Map)
, but the variable are set on this scope specifically.boolean hasVariables()
boolean hasVariablesLocal()
boolean hasVariable(String variableName)
boolean hasVariableLocal(String variableName)
void removeVariable(String variableName)
void removeVariableLocal(String variableName)
HistoricVariableUpdate
.void removeVariables(Collection<String> variableNames)
HistoricVariableUpdate
for each of them.void removeVariablesLocal(Collection<String> variableNames)
HistoricVariableUpdate
for each of them.void removeVariables()
HistoricVariableUpdate
for each of them.void removeVariablesLocal()
HistoricVariableUpdate
for each of them.void setTransientVariable(String variableName, Object variableValue)
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)
setVariableLocal(String, Object)
, but for a transient variable.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.void setTransientVariables(Map<String,Object> transientVariables)
setVariables(Map)
, but for transient variables.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.Object getTransientVariable(String variableName)
getVariable(String)
, including the searching via the parent scopes, but
for transient variables only.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.Map<String,Object> getTransientVariables()
getVariables()
, but for transient variables only.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.void setTransientVariablesLocal(Map<String,Object> transientVariables)
setVariablesLocal(Map)
, but for transient variables.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.Object getTransientVariableLocal(String variableName)
getVariableLocal(String)
, but for a transient variable.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.Map<String,Object> getTransientVariablesLocal()
getVariableLocal(String)
, but for transient variables only.
See setTransientVariable(String, Object)
for the rules on 'transient' variables.void removeTransientVariableLocal(String variableName)
setTransientVariable(String, Object)
for the rules on 'transient' variables.void removeTransientVariable(String variableName)
setTransientVariable(String, Object)
for the rules on 'transient' variables.void removeTransientVariables()
setTransientVariable(String, Object)
for the rules on 'transient' variables.void removeTransientVariablesLocal()
setTransientVariable(String, Object)
for the rules on 'transient' variables.Copyright © 2017 Alfresco. All rights reserved.