public abstract class VariableScopeImpl extends Object implements Serializable, VariableScope
Modifier and Type | Field and Description |
---|---|
protected ELContext |
cachedElContext |
protected String |
id |
protected Map<String,VariableInstanceEntity> |
usedVariablesCache |
protected Map<String,VariableInstanceEntity> |
variableInstances |
Constructor and Description |
---|
VariableScopeImpl() |
Modifier and Type | Method and Description |
---|---|
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) |
void |
deleteVariablesInstanceForLeavingScope() |
protected void |
ensureVariableInstancesInitialized() |
ELContext |
getCachedElContext() |
String |
getId() |
protected abstract VariableScopeImpl |
getParentVariableScope() |
protected ExecutionEntity |
getSourceActivityExecution() |
protected abstract VariableInstanceEntity |
getSpecificVariable(String variableName) |
protected abstract List<VariableInstanceEntity> |
getSpecificVariables(Collection<String> variableNames) |
Map<String,VariableInstanceEntity> |
getUsedVariablesCache() |
Object |
getVariable(String variableName) |
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) |
VariableInstance |
getVariableInstance(String variableName) |
VariableInstance |
getVariableInstance(String variableName,
boolean fetchAllVariables) |
Map<String,VariableInstanceEntity> |
getVariableInstanceEntities() |
VariableInstance |
getVariableInstanceLocal(String variableName) |
VariableInstance |
getVariableInstanceLocal(String variableName,
boolean fetchAllVariables) |
Map<String,VariableInstance> |
getVariableInstances() |
Map<String,VariableInstance> |
getVariableInstances(Collection<String> variableNames) |
Map<String,VariableInstance> |
getVariableInstances(Collection<String> variableNames,
boolean fetchAllVariables) |
Map<String,VariableInstance> |
getVariableInstancesLocal() |
Map<String,VariableInstance> |
getVariableInstancesLocal(Collection<String> variableNames) |
Map<String,VariableInstance> |
getVariableInstancesLocal(Collection<String> variableNames,
boolean fetchAllVariables) |
Object |
getVariableLocal(String variableName) |
Object |
getVariableLocal(String variableName,
boolean fetchAllVariables) |
<T> T |
getVariableLocal(String variableName,
Class<T> variableClass) |
Set<String> |
getVariableNames() |
Set<String> |
getVariableNamesLocal() |
Map<String,Object> |
getVariables() |
Map<String,Object> |
getVariables(Collection<String> variableNames) |
Map<String,Object> |
getVariables(Collection<String> variableNames,
boolean fetchAllVariables) |
Map<String,Object> |
getVariablesLocal() |
Map<String,Object> |
getVariablesLocal(Collection<String> variableNames) |
Map<String,Object> |
getVariablesLocal(Collection<String> variableNames,
boolean fetchAllVariables) |
Map<String,Object> |
getVariableValues() |
boolean |
hasVariable(String variableName) |
boolean |
hasVariableLocal(String variableName) |
boolean |
hasVariables() |
boolean |
hasVariablesLocal() |
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 List<VariableInstanceEntity> |
loadVariableInstances() |
void |
removeVariable(String variableName)
Removes the variable and creates a new
HistoricVariableUpdateEntity
. |
protected void |
removeVariable(String variableName,
ExecutionEntity sourceActivityExecution) |
void |
removeVariableLocal(String variableName)
Removes the local variable and creates a new
HistoricVariableUpdateEntity . |
protected void |
removeVariableLocal(String variableName,
ExecutionEntity sourceActivityExecution) |
void |
removeVariables()
Removes the (local) variables and creates a new
HistoricVariableUpdateEntity for each of them. |
void |
removeVariables(Collection<String> variableNames)
Removes the variables and creates a new
HistoricVariableUpdateEntity for each of them. |
void |
removeVariablesLocal()
Removes the (local) variables and creates a new
HistoricVariableUpdateEntity for each of them. |
void |
removeVariablesLocal(Collection<String> variableNames)
Removes the local variables and creates a new
HistoricVariableUpdateEntity for each of them. |
void |
setCachedElContext(ELContext cachedElContext) |
void |
setId(String id) |
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 sourceActivityExecution,
boolean fetchAllVariables) |
Object |
setVariableLocal(String variableName,
Object value) |
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) |
protected void |
updateVariableInstance(VariableInstanceEntity variableInstance,
Object value,
ExecutionEntity sourceActivityExecution) |
protected Map<String,VariableInstanceEntity> variableInstances
protected Map<String,VariableInstanceEntity> usedVariablesCache
protected ELContext cachedElContext
protected String id
protected abstract List<VariableInstanceEntity> loadVariableInstances()
protected abstract VariableScopeImpl getParentVariableScope()
protected abstract void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)
protected void ensureVariableInstancesInitialized()
public Map<String,Object> getVariables()
getVariables
in interface VariableScope
public Map<String,VariableInstance> getVariableInstances()
getVariableInstances
in interface VariableScope
public Map<String,Object> getVariables(Collection<String> variableNames)
getVariables
in interface VariableScope
public Map<String,VariableInstance> getVariableInstances(Collection<String> variableNames)
getVariableInstances
in interface VariableScope
public Map<String,Object> getVariables(Collection<String> variableNames, boolean fetchAllVariables)
getVariables
in interface VariableScope
public Map<String,VariableInstance> getVariableInstances(Collection<String> variableNames, boolean fetchAllVariables)
getVariableInstances
in interface VariableScope
protected Map<String,VariableInstance> collectVariableInstances(HashMap<String,VariableInstance> variables)
public Object getVariable(String variableName)
getVariable
in interface VariableScope
public VariableInstance getVariableInstance(String variableName)
getVariableInstance
in interface VariableScope
public 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 VariableScope
public VariableInstance getVariableInstance(String variableName, boolean fetchAllVariables)
getVariableInstance
in interface VariableScope
protected abstract VariableInstanceEntity getSpecificVariable(String variableName)
public Object getVariableLocal(String variableName)
getVariableLocal
in interface VariableScope
public VariableInstance getVariableInstanceLocal(String variableName)
getVariableInstanceLocal
in interface VariableScope
public Object getVariableLocal(String variableName, boolean fetchAllVariables)
getVariableLocal
in interface VariableScope
public VariableInstance getVariableInstanceLocal(String variableName, boolean fetchAllVariables)
getVariableInstanceLocal
in interface VariableScope
public boolean hasVariables()
hasVariables
in interface VariableScope
public boolean hasVariablesLocal()
hasVariablesLocal
in interface VariableScope
public boolean hasVariable(String variableName)
hasVariable
in interface VariableScope
public boolean hasVariableLocal(String variableName)
hasVariableLocal
in interface VariableScope
public Set<String> getVariableNames()
getVariableNames
in interface VariableScope
public Map<String,Object> getVariablesLocal()
getVariablesLocal
in interface VariableScope
public Map<String,VariableInstance> getVariableInstancesLocal()
getVariableInstancesLocal
in interface VariableScope
public Map<String,Object> getVariablesLocal(Collection<String> variableNames)
getVariablesLocal
in interface VariableScope
public Map<String,VariableInstance> getVariableInstancesLocal(Collection<String> variableNames)
getVariableInstancesLocal
in interface VariableScope
public Map<String,Object> getVariablesLocal(Collection<String> variableNames, boolean fetchAllVariables)
getVariablesLocal
in interface VariableScope
public Map<String,VariableInstance> getVariableInstancesLocal(Collection<String> variableNames, boolean fetchAllVariables)
getVariableInstancesLocal
in interface VariableScope
protected abstract List<VariableInstanceEntity> getSpecificVariables(Collection<String> variableNames)
public Set<String> getVariableNamesLocal()
getVariableNamesLocal
in interface VariableScope
public 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 VariableScope
variables
- a map of keys and values for the variables to be set{@link VariableScope#setVariable(String, Object)}
public void setVariablesLocal(Map<String,? extends Object> variables)
setVariablesLocal
in interface VariableScope
public void removeVariables()
VariableScope
HistoricVariableUpdateEntity
for each of them.removeVariables
in interface VariableScope
public void removeVariablesLocal()
VariableScope
HistoricVariableUpdateEntity
for each of them.removeVariablesLocal
in interface VariableScope
public void deleteVariablesInstanceForLeavingScope()
public void removeVariables(Collection<String> variableNames)
VariableScope
HistoricVariableUpdateEntity
for each of them.removeVariables
in interface VariableScope
public void removeVariablesLocal(Collection<String> variableNames)
VariableScope
HistoricVariableUpdateEntity
for each of them.removeVariablesLocal
in interface VariableScope
public void setVariable(String variableName, Object value)
VariableScope
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.
setVariable
in interface VariableScope
variableName
- 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 VariableScope
protected void setVariable(String variableName, Object value, ExecutionEntity sourceActivityExecution, boolean fetchAllVariables)
public Object setVariableLocal(String variableName, Object value)
setVariableLocal
in interface VariableScope
public 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 VariableScope
public Object setVariableLocal(String variableName, Object value, ExecutionEntity sourceActivityExecution, boolean fetchAllVariables)
public void createVariableLocal(String variableName, Object value)
createVariableLocal
in interface VariableScope
protected void createVariableLocal(String variableName, Object value, ExecutionEntity sourceActivityExecution)
public void removeVariable(String variableName)
VariableScope
HistoricVariableUpdateEntity
.removeVariable
in interface VariableScope
protected void removeVariable(String variableName, ExecutionEntity sourceActivityExecution)
public void removeVariableLocal(String variableName)
VariableScope
HistoricVariableUpdateEntity
.removeVariableLocal
in interface VariableScope
protected 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)
protected boolean isActivityIdUsedForDetails()
public ELContext getCachedElContext()
public void setCachedElContext(ELContext cachedElContext)
public String getId()
public void setId(String id)
public <T> T getVariable(String variableName, Class<T> variableClass)
getVariable
in interface VariableScope
public <T> T getVariableLocal(String variableName, Class<T> variableClass)
getVariableLocal
in interface VariableScope
Copyright © 2016 Alfresco. All rights reserved.