Class DbElementInstanceState
- All Implemented Interfaces:
ElementInstanceState
,MutableElementInstanceState
-
Constructor Summary
ConstructorsConstructorDescriptionDbElementInstanceState
(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext, MutableVariableState variableState) -
Method Summary
Modifier and TypeMethodDescriptionvoid
createInstance
(ElementInstance instance) void
decrementNumberOfTakenSequenceFlows
(long flowScopeKey, org.agrona.DirectBuffer gatewayElementId) Decrements the numbers that counts how often a sequence flow of the given gateway has been taken.void
deleteProcessInstanceKeyByDefinitionKey
(long processInstanceKey, long processDefinitionKey) Deletes the reference between process instance key and process definition key.void
forEachChild
(long parentKey, long startAtKey, BiFunction<Long, ElementInstance, Boolean> visitor) Applies the provided visitor to each child element of the given parent.getAwaitResultRequestMetadata
(long processInstanceKey) getChildren
(long parentKey) getInstance
(long key) int
getNumberOfTakenSequenceFlows
(long flowScopeKey, org.agrona.DirectBuffer gatewayElementId) Returns the number of the taken sequence flows that are connected to the given parallel (joining) gateway.getProcessInstanceKeysByDefinitionKey
(long processDefinitionKey) Returns a list of process instance keys that belong to a specific process definition.boolean
hasActiveProcessInstances
(long processDefinitionKey, List<Long> bannedInstances) Verifies if there are active process instances for a given process definitionvoid
incrementNumberOfTakenSequenceFlows
(long flowScopeKey, org.agrona.DirectBuffer gatewayElementId, org.agrona.DirectBuffer sequenceFlowElementId) Increments the number that counts how often the given sequence flow has been taken.void
insertProcessInstanceKeyByDefinitionKey
(long processInstanceKey, long processDefinitionKey) Inserts a new reference from process instance key to process definition key.newInstance
(long key, ProcessInstanceRecord value, ProcessInstanceIntent state) newInstance
(ElementInstance parent, long key, ProcessInstanceRecord value, ProcessInstanceIntent state) void
removeInstance
(long key) void
setAwaitResultRequestMetadata
(long processInstanceKey, AwaitProcessInstanceResultMetadata metadata) void
updateInstance
(long key, Consumer<ElementInstance> modifier) void
updateInstance
(ElementInstance scopeInstance)
-
Constructor Details
-
DbElementInstanceState
public DbElementInstanceState(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext, MutableVariableState variableState)
-
-
Method Details
-
newInstance
public ElementInstance newInstance(long key, ProcessInstanceRecord value, ProcessInstanceIntent state) - Specified by:
newInstance
in interfaceMutableElementInstanceState
-
newInstance
public ElementInstance newInstance(ElementInstance parent, long key, ProcessInstanceRecord value, ProcessInstanceIntent state) - Specified by:
newInstance
in interfaceMutableElementInstanceState
-
removeInstance
public void removeInstance(long key) - Specified by:
removeInstance
in interfaceMutableElementInstanceState
-
createInstance
- Specified by:
createInstance
in interfaceMutableElementInstanceState
-
updateInstance
- Specified by:
updateInstance
in interfaceMutableElementInstanceState
-
updateInstance
- Specified by:
updateInstance
in interfaceMutableElementInstanceState
-
setAwaitResultRequestMetadata
public void setAwaitResultRequestMetadata(long processInstanceKey, AwaitProcessInstanceResultMetadata metadata) - Specified by:
setAwaitResultRequestMetadata
in interfaceMutableElementInstanceState
-
incrementNumberOfTakenSequenceFlows
public void incrementNumberOfTakenSequenceFlows(long flowScopeKey, org.agrona.DirectBuffer gatewayElementId, org.agrona.DirectBuffer sequenceFlowElementId) Description copied from interface:MutableElementInstanceState
Increments the number that counts how often the given sequence flow has been taken.The number helps to determine if a parallel gateway can be activated or not. It should be incremented when one of the incoming sequence flows is taken.
- Specified by:
incrementNumberOfTakenSequenceFlows
in interfaceMutableElementInstanceState
- Parameters:
flowScopeKey
- the key of the flow scope that contains the gatewaygatewayElementId
- the element id of the gateway that is the target of the sequence flowsequenceFlowElementId
- the element id of the sequence flow that is taken
-
decrementNumberOfTakenSequenceFlows
public void decrementNumberOfTakenSequenceFlows(long flowScopeKey, org.agrona.DirectBuffer gatewayElementId) Description copied from interface:MutableElementInstanceState
Decrements the numbers that counts how often a sequence flow of the given gateway has been taken.The number helps to determine if a parallel gateway can be activated or not. It should be decremented when the gateway is activated.
- Specified by:
decrementNumberOfTakenSequenceFlows
in interfaceMutableElementInstanceState
- Parameters:
flowScopeKey
- the key of the flow scope that contains the gatewaygatewayElementId
- the element id of the gateway
-
insertProcessInstanceKeyByDefinitionKey
public void insertProcessInstanceKeyByDefinitionKey(long processInstanceKey, long processDefinitionKey) Description copied from interface:MutableElementInstanceState
Inserts a new reference from process instance key to process definition key.This makes it possible to query for all process instances of a specific process definition using
ElementInstanceState.getProcessInstanceKeysByDefinitionKey(long)
.- Specified by:
insertProcessInstanceKeyByDefinitionKey
in interfaceMutableElementInstanceState
- Parameters:
processInstanceKey
- the key of the process instance to insert the reference forprocessDefinitionKey
- the key of the process definition to insert the reference for
-
deleteProcessInstanceKeyByDefinitionKey
public void deleteProcessInstanceKeyByDefinitionKey(long processInstanceKey, long processDefinitionKey) Description copied from interface:MutableElementInstanceState
Deletes the reference between process instance key and process definition key.This makes it possible to query for all process instances of a specific process definition using
ElementInstanceState.getProcessInstanceKeysByDefinitionKey(long)
.- Specified by:
deleteProcessInstanceKeyByDefinitionKey
in interfaceMutableElementInstanceState
- Parameters:
processInstanceKey
- the key of the process instance to delete the reference forprocessDefinitionKey
- the key of the process definition to delete the reference for
-
getInstance
- Specified by:
getInstance
in interfaceElementInstanceState
-
getChildren
- Specified by:
getChildren
in interfaceElementInstanceState
-
forEachChild
public void forEachChild(long parentKey, long startAtKey, BiFunction<Long, ElementInstance, Boolean> visitor) Description copied from interface:ElementInstanceState
Applies the provided visitor to each child element of the given parent. The visitor can indicate via the return value, whether the iteration should continue or not. This means if the visitor returns false the iteration will stop.The given
startAtKey
indicates where the iteration should start. If the key exists, the first key-value-pair will contain the equal key asstartAtKey
. If the key doesn't exist it will start after.- Specified by:
forEachChild
in interfaceElementInstanceState
- Parameters:
parentKey
- the key of the parent element instancestartAtKey
- the element instance key of child the iteration should start atvisitor
- the visitor which is applied for each child
-
getAwaitResultRequestMetadata
- Specified by:
getAwaitResultRequestMetadata
in interfaceElementInstanceState
-
getNumberOfTakenSequenceFlows
public int getNumberOfTakenSequenceFlows(long flowScopeKey, org.agrona.DirectBuffer gatewayElementId) Description copied from interface:ElementInstanceState
Returns the number of the taken sequence flows that are connected to the given parallel (joining) gateway. Each sequence flow counts only as one, even if it is taken multiple times.The number helps to determine if a parallel gateway can be activated or not.
- Specified by:
getNumberOfTakenSequenceFlows
in interfaceElementInstanceState
- Parameters:
flowScopeKey
- the key of the flow scope that contains the gatewaygatewayElementId
- the element id of the gateway- Returns:
- the number of taken sequence flows of the given gateway
-
getProcessInstanceKeysByDefinitionKey
Description copied from interface:ElementInstanceState
Returns a list of process instance keys that belong to a specific process definition.Caution: This will also return the keys of banned process instances!
- Specified by:
getProcessInstanceKeysByDefinitionKey
in interfaceElementInstanceState
- Parameters:
processDefinitionKey
- the key of the process definition- Returns:
- a list of process instance keys
-
hasActiveProcessInstances
Description copied from interface:ElementInstanceState
Verifies if there are active process instances for a given process definition- Specified by:
hasActiveProcessInstances
in interfaceElementInstanceState
- Parameters:
processDefinitionKey
- the key of the process definitionbannedInstances
- a list of banned process instance keys- Returns:
- a boolean indicating if there are running instances
-