Class VariableInstanceEntity
java.lang.Object
org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity
- All Implemented Interfaces:
Serializable
,CoreVariableInstance
,DbEntity
,DbEntityLifecycleAware
,HasDbReferences
,HasDbRevision
,Nameable
,TypedValueUpdateListener
,ValueFields
,VariableInstance
public class VariableInstanceEntity
extends Object
implements VariableInstance, CoreVariableInstance, ValueFields, DbEntity, DbEntityLifecycleAware, TypedValueUpdateListener, HasDbRevision, HasDbReferences, Serializable
- Author:
- Tom Baeyens
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
protected ByteArrayField
protected String
protected String
protected String
protected Double
protected ExecutionEntity
protected String
protected String
protected boolean
Determines whether this variable is supposed to be a local variable in case of concurrency in its scope.protected boolean
Determines whether this variable is stored in the data base.protected static final EnginePersistenceLogger
protected Long
protected String
protected String
protected String
protected int
protected long
protected String
protected String
protected String
protected String
protected TypedValueField
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearValueFields
(boolean deleteVariable) static VariableInstanceEntity
create
(String name, TypedValue value, boolean isTransient) static VariableInstanceEntity
createAndInsert
(String name, TypedValue value) void
delete()
protected void
protected void
boolean
Returns the corresponding activity instance id.Returns the corresponding batch id.byte[]
Returns the corresponding case execution id.Returns the corresponding case instance id.protected ProcessApplicationReference
If the variable value could not be loaded, this returns the error message.Returns the corresponding execution id.protected VariableSerializerFactory
getId()
getName()
Returns the name of this variable instance.Returns a representation of the object, as would be stored in the database.Return the corresponding process definition id.Returns the corresponding process instance id.Scope: IN-MEMORY referencesScope: IN-MEMORY referencesint
int
long
protected TaskEntity
getTask()
Returns the corresponding task id.The id of the tenant this variable belongs to.Returns the TypedValue of this variable instance.getTypedValue
(boolean deserializeValue) Returns the name of the type of this variable instancegetValue()
Returns the value of this variable instance.protected VariableScope
int
hashCode()
void
static void
insert
(VariableInstanceEntity variableInstance) boolean
protected boolean
isObjectTyped
(ValueType newType, String oldTypeAsString) The engine should only remove byte arrays in case the type changes but keep it when old and new types are object.boolean
void
onImplicitValueUpdate
(TypedValue updatedValue) Called when an implicit update to a typed value is detectedvoid
postLoad()
void
setActivityInstanceId
(String activityInstanceId) void
setBatchId
(String batchId) void
setByteArrayValue
(byte[] bytes) void
setByteArrayValueId
(String byteArrayValueId) void
setCaseExecution
(CaseExecutionEntity caseExecution) void
setCaseExecutionId
(String caseExecutionId) void
setCaseInstanceId
(String caseInstanceId) void
setConcurrentLocal
(boolean isConcurrentLocal) void
setDoubleValue
(Double doubleValue) void
setExecution
(ExecutionEntity execution) void
setExecutionId
(String executionId) void
void
setLongValue
(Long longValue) void
void
setProcessDefinitionId
(String processDefinitionId) void
setProcessInstanceId
(String processInstanceId) void
setRevision
(int revision) void
setSequenceCounter
(long sequenceCounter) void
setSerializer
(TypedValueSerializer<?> serializer) void
setSerializerName
(String type) void
setTask
(TaskEntity task) void
void
setTenantId
(String tenantId) void
setTextValue
(String textValue) void
setTextValue2
(String textValue2) void
setTransient
(boolean isTransient) void
setValue
(TypedValue value) void
setVariableScopeId
(String variableScopeId) toString()
boolean
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.camunda.bpm.engine.impl.db.HasDbReferences
getDependentEntities
-
Field Details
-
LOG
-
id
-
revision
protected int revision -
name
-
processDefinitionId
-
processInstanceId
-
executionId
-
taskId
-
batchId
-
caseInstanceId
-
caseExecutionId
-
activityInstanceId
-
tenantId
-
longValue
-
doubleValue
-
textValue
-
textValue2
-
variableScopeId
-
byteArrayField
-
typedValueField
-
configuration
-
sequenceCounter
protected long sequenceCounter -
isConcurrentLocal
protected boolean isConcurrentLocalDetermines whether this variable is supposed to be a local variable in case of concurrency in its scope. This affects
- tree expansion (not evaluated yet by the engine)
- activity instance IDs of variable instances: concurrentLocal variables always receive the activity instance id of their execution (which may not be the scope execution), while non-concurrentLocal variables always receive the activity instance id of their scope (which is set in the parent execution)
In the future, this field could be used for restoring the variable distribution when the tree is expanded/compacted multiple times. On expansion, the goal would be to keep concurrentLocal variables always with their concurrent replacing executions while non-concurrentLocal variables stay in the scope execution
-
isTransient
protected boolean isTransientDetermines whether this variable is stored in the data base. -
execution
-
-
Constructor Details
-
VariableInstanceEntity
public VariableInstanceEntity() -
VariableInstanceEntity
-
-
Method Details
-
createAndInsert
-
insert
-
create
-
delete
public void delete() -
getPersistentState
Description copied from interface:DbEntity
Returns a representation of the object, as would be stored in the database. Used when deciding if updates have occurred to the object or not since it was last loaded.- Specified by:
getPersistentState
in interfaceDbEntity
-
getRevisionNext
public int getRevisionNext()- Specified by:
getRevisionNext
in interfaceHasDbRevision
-
setProcessInstanceId
-
setProcessDefinitionId
-
setExecutionId
-
setCaseInstanceId
-
setCaseExecutionId
-
setCaseExecution
-
getByteArrayValueId
-
setByteArrayValueId
-
getByteArrayValue
public byte[] getByteArrayValue()- Specified by:
getByteArrayValue
in interfaceValueFields
-
setByteArrayValue
public void setByteArrayValue(byte[] bytes) - Specified by:
setByteArrayValue
in interfaceValueFields
-
deleteByteArrayValue
protected void deleteByteArrayValue() -
getValue
Description copied from interface:VariableInstance
Returns the value of this variable instance.- Specified by:
getValue
in interfaceVariableInstance
-
getTypedValue
Description copied from interface:VariableInstance
Returns the TypedValue of this variable instance.- Specified by:
getTypedValue
in interfaceVariableInstance
-
getTypedValue
- Specified by:
getTypedValue
in interfaceCoreVariableInstance
-
setValue
- Specified by:
setValue
in interfaceCoreVariableInstance
-
isObjectTyped
The engine should only remove byte arrays in case the type changes but keep it when old and new types are object.- Parameters:
newType
- of the variable overriding the old.oldTypeAsString
- of the variable previously set.- Returns:
true
if old and new variable are both object typed.
-
getFallbackSerializerFactory
-
clearValueFields
public void clearValueFields(boolean deleteVariable) -
getTypeName
Description copied from interface:VariableInstance
Returns the name of the type of this variable instance- Specified by:
getTypeName
in interfaceVariableInstance
- Returns:
- the type name of the variable
-
postLoad
public void postLoad()- Specified by:
postLoad
in interfaceDbEntityLifecycleAware
-
ensureExecutionInitialized
protected void ensureExecutionInitialized() -
getExecution
-
setExecution
-
getCaseExecution
-
getId
- Specified by:
getId
in interfaceDbEntity
- Specified by:
getId
in interfaceVariableInstance
- Returns:
- the Id of this variable instance
-
setId
-
getTextValue
- Specified by:
getTextValue
in interfaceValueFields
-
getProcessInstanceId
Description copied from interface:VariableInstance
Returns the corresponding process instance id.- Specified by:
getProcessInstanceId
in interfaceVariableInstance
-
getProcessDefinitionId
Description copied from interface:VariableInstance
Return the corresponding process definition id.- Specified by:
getProcessDefinitionId
in interfaceVariableInstance
-
getExecutionId
Description copied from interface:VariableInstance
Returns the corresponding execution id.- Specified by:
getExecutionId
in interfaceVariableInstance
-
getCaseInstanceId
Description copied from interface:VariableInstance
Returns the corresponding case instance id.- Specified by:
getCaseInstanceId
in interfaceVariableInstance
-
getCaseExecutionId
Description copied from interface:VariableInstance
Returns the corresponding case execution id.- Specified by:
getCaseExecutionId
in interfaceVariableInstance
-
getLongValue
- Specified by:
getLongValue
in interfaceValueFields
-
setLongValue
- Specified by:
setLongValue
in interfaceValueFields
-
getDoubleValue
- Specified by:
getDoubleValue
in interfaceValueFields
-
setDoubleValue
- Specified by:
setDoubleValue
in interfaceValueFields
-
setName
-
setTextValue
- Specified by:
setTextValue
in interfaceValueFields
-
getName
Description copied from interface:VariableInstance
Returns the name of this variable instance.- Specified by:
getName
in interfaceCoreVariableInstance
- Specified by:
getName
in interfaceNameable
- Specified by:
getName
in interfaceVariableInstance
-
getRevision
public int getRevision()- Specified by:
getRevision
in interfaceHasDbRevision
-
setRevision
public void setRevision(int revision) - Specified by:
setRevision
in interfaceHasDbRevision
-
setSerializer
-
setSerializerName
-
getSerializer
-
getTextValue2
- Specified by:
getTextValue2
in interfaceValueFields
-
setTextValue2
- Specified by:
setTextValue2
in interfaceValueFields
-
getTaskId
Description copied from interface:VariableInstance
Returns the corresponding task id.- Specified by:
getTaskId
in interfaceVariableInstance
-
setTaskId
-
getBatchId
Description copied from interface:VariableInstance
Returns the corresponding batch id.- Specified by:
getBatchId
in interfaceVariableInstance
-
setBatchId
-
setTask
-
getActivityInstanceId
Description copied from interface:VariableInstance
Returns the corresponding activity instance id.- Specified by:
getActivityInstanceId
in interfaceVariableInstance
-
setActivityInstanceId
-
getSerializerName
-
getErrorMessage
Description copied from interface:VariableInstance
If the variable value could not be loaded, this returns the error message.- Specified by:
getErrorMessage
in interfaceVariableInstance
- Returns:
- an error message indicating why the variable value could not be loaded.
-
getVariableScopeId
-
setVariableScopeId
-
getVariableScope
-
getTask
-
getSequenceCounter
public long getSequenceCounter() -
setSequenceCounter
public void setSequenceCounter(long sequenceCounter) -
incrementSequenceCounter
public void incrementSequenceCounter() -
isConcurrentLocal
public boolean isConcurrentLocal() -
setConcurrentLocal
public void setConcurrentLocal(boolean isConcurrentLocal) -
onImplicitValueUpdate
Description copied from interface:TypedValueUpdateListener
Called when an implicit update to a typed value is detected- Specified by:
onImplicitValueUpdate
in interfaceTypedValueUpdateListener
-
getContextProcessApplication
-
toString
-
hashCode
public int hashCode() -
equals
-
setTransient
public void setTransient(boolean isTransient) - Parameters:
isTransient
-true
, if the variable is not stored in the data base. Default isfalse
.
-
isTransient
public boolean isTransient()- Returns:
true
, if the variable is transient. A transient variable is not stored in the data base.
-
getTenantId
Description copied from interface:VariableInstance
The id of the tenant this variable belongs to. Can benull
if the variable belongs to no single tenant.- Specified by:
getTenantId
in interfaceVariableInstance
-
setTenantId
-
getReferencedEntityIds
Description copied from interface:HasDbReferences
Scope: IN-MEMORY references
- Specified by:
getReferencedEntityIds
in interfaceHasDbReferences
- Returns:
- the ids of the entities that this entity references. Should only return ids for entities of the same type
-
getReferencedEntitiesIdAndClass
Description copied from interface:HasDbReferences
Scope: IN-MEMORY references
- Specified by:
getReferencedEntitiesIdAndClass
in interfaceHasDbReferences
- Returns:
- a map of the ids and the entities' classes that this entity references. It's used when trying to determine if there was an Optimistic Locking occurrence on an INSERT or UPDATE of an object of this type.
-
wasCreatedBefore713
public boolean wasCreatedBefore713()- Returns:
true
processDefinitionId
is introduced in 7.13, the check is used to created missing history atLegacyBehavior#createMissingHistoricVariables
-