Class ExternalTaskEntity
java.lang.Object
org.camunda.bpm.engine.impl.persistence.entity.ExternalTaskEntity
- All Implemented Interfaces:
ExternalTask
,DbEntity
,HasDbReferences
,HasDbRevision
public class ExternalTaskEntity
extends Object
implements ExternalTask, DbEntity, HasDbRevision, HasDbReferences
- Author:
- Thorben Lindhauer, Askar Akhmerov
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
protected String
protected ByteArrayEntity
protected String
protected String
protected ExecutionEntity
protected String
protected String
protected String
protected Date
protected static final EnginePersistenceLogger
static final int
Note:String.length()
counts Unicode supplementary characters twice, so for a String consisting only of those, the limit is effectively MAX_EXCEPTION_MESSAGE_LENGTH / 2protected long
protected String
protected String
protected String
protected String
protected Integer
protected int
protected int
protected String
protected String
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
void
static ExternalTaskEntity
createAndInsert
(ExecutionEntity execution, String topic, long priority) protected void
protected IncidentContext
void
delete()
protected void
deleteFromExecutionAndRuntimeTable
(boolean incidentResolved) protected void
protected void
protected void
ensureExecutionInitialized
(boolean validateExistence) protected void
ensureVariablesSet
(ExecutionEntity execution, Map<String, Object> variables, Map<String, Object> localVariables) protected boolean
errorEventDefinitionMatches
(CamundaErrorEventDefinition camundaErrorEventDefinition, boolean continueOnException) protected boolean
evaluateThrowBpmnError
(ExecutionEntity execution, boolean continueOnException) void
extendLock
(long newLockExpirationTime) void
failed
(String errorMessage, String errorDetails, int retries, long retryDuration, Map<String, Object> variables, Map<String, Object> localVariables) process failed state, make sure that binary entity is created for the errorMessage, shortError message does not exceed limit, handle properly retry counts and incidentsReturns the business key of the process instance the external task belongs toprotected ByteArrayEntity
Method implementation relies on the command context object, therefore should be invoked from the commands onlygetExecution
(boolean validateExistence) Returns a map containing all custom extension properties of the external task.getId()
Returns a representation of the object, as would be stored in the database.long
Returns the priority of the external task.Scope: IN-MEMORY referencesScope: IN-MEMORY referencesint
int
int
void
insert()
boolean
void
protected void
protected void
protected void
protected void
protected void
removeIncidents
(boolean incidentResolved) void
setActivityId
(String activityId) void
setActivityInstanceId
(String activityInstanceId) void
setBusinessKey
(String businessKey) protected void
setErrorDetails
(String exception) void
setErrorMessage
(String errorMessage) void
setExecution
(ExecutionEntity execution) void
setExecutionId
(String executionId) void
setExtensionProperties
(Map<String, String> extensionProperties) void
void
setLastFailureLogId
(String lastFailureLogId) void
setLockExpirationTime
(Date lockExpirationTime) void
setPriority
(long priority) void
setProcessDefinitionId
(String processDefinitionId) void
setProcessDefinitionKey
(String processDefinitionKey) void
setProcessDefinitionVersionTag
(String processDefinitionVersionTag) void
setProcessInstanceId
(String processInstanceId) void
setRetries
(Integer retries) void
setRetriesAndManageIncidents
(int retries) void
setRevision
(int revision) void
setSuspensionState
(int suspensionState) void
setTenantId
(String tenantId) void
setTopicName
(String topic) void
setWorkerId
(String workerId) toString()
void
unlock()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.camunda.bpm.engine.impl.db.HasDbReferences
getDependentEntities
-
Field Details
-
LOG
-
MAX_EXCEPTION_MESSAGE_LENGTH
public static final int MAX_EXCEPTION_MESSAGE_LENGTHNote:String.length()
counts Unicode supplementary characters twice, so for a String consisting only of those, the limit is effectively MAX_EXCEPTION_MESSAGE_LENGTH / 2- See Also:
-
id
-
revision
protected int revision -
topicName
-
workerId
-
lockExpirationTime
-
retries
-
errorMessage
-
errorDetailsByteArray
-
errorDetailsByteArrayId
-
suspensionState
protected int suspensionState -
executionId
-
processInstanceId
-
processDefinitionId
-
processDefinitionKey
-
processDefinitionVersionTag
-
activityId
-
activityInstanceId
-
tenantId
-
priority
protected long priority -
extensionProperties
-
execution
-
businessKey
-
lastFailureLogId
-
-
Constructor Details
-
ExternalTaskEntity
public ExternalTaskEntity()
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceDbEntity
- Specified by:
getId
in interfaceExternalTask
- Returns:
- the id of the task
-
setId
-
getTopicName
- Specified by:
getTopicName
in interfaceExternalTask
- Returns:
- the name of the topic the task belongs to
-
setTopicName
-
getWorkerId
- Specified by:
getWorkerId
in interfaceExternalTask
- Returns:
- the id of the worker that has locked the task
-
setWorkerId
-
getLockExpirationTime
- Specified by:
getLockExpirationTime
in interfaceExternalTask
- Returns:
- the absolute time at which the lock expires
-
setLockExpirationTime
-
getExecutionId
- Specified by:
getExecutionId
in interfaceExternalTask
- Returns:
- the id of the execution that the task is assigned to
-
setExecutionId
-
getProcessDefinitionKey
- Specified by:
getProcessDefinitionKey
in interfaceExternalTask
- Returns:
- the key of the process definition the tasks activity belongs to
-
setProcessDefinitionKey
-
getProcessDefinitionVersionTag
- Specified by:
getProcessDefinitionVersionTag
in interfaceExternalTask
- Returns:
- the version tag of the process definition the tasks activity belongs to
-
setProcessDefinitionVersionTag
-
getActivityId
- Specified by:
getActivityId
in interfaceExternalTask
- Returns:
- the id of the activity for which the task is created
-
setActivityId
-
getActivityInstanceId
- Specified by:
getActivityInstanceId
in interfaceExternalTask
- Returns:
- the id of the activity instance in which context the task exists
-
setActivityInstanceId
-
getRevision
public int getRevision()- Specified by:
getRevision
in interfaceHasDbRevision
-
setRevision
public void setRevision(int revision) - Specified by:
setRevision
in interfaceHasDbRevision
-
getRevisionNext
public int getRevisionNext()- Specified by:
getRevisionNext
in interfaceHasDbRevision
-
getSuspensionState
public int getSuspensionState() -
setSuspensionState
public void setSuspensionState(int suspensionState) -
isSuspended
public boolean isSuspended()- Specified by:
isSuspended
in interfaceExternalTask
- Returns:
- true if the external task is suspended; a suspended external task cannot be completed, thereby preventing process continuation
-
getProcessInstanceId
- Specified by:
getProcessInstanceId
in interfaceExternalTask
- Returns:
- the id of the process instance the task exists in
-
setProcessInstanceId
-
getProcessDefinitionId
- Specified by:
getProcessDefinitionId
in interfaceExternalTask
- Returns:
- the id of the process definition the tasks activity belongs to
-
setProcessDefinitionId
-
getTenantId
- Specified by:
getTenantId
in interfaceExternalTask
- Returns:
- the id of the tenant the task belongs to. Can be
null
if the task belongs to no single tenant.
-
setTenantId
-
getRetries
- Specified by:
getRetries
in interfaceExternalTask
- Returns:
- the number of retries left. The number of retries is provided by
a task client, therefore the initial value is
null
.
-
setRetries
-
getErrorMessage
- Specified by:
getErrorMessage
in interfaceExternalTask
- Returns:
- short error message submitted with the latest reported failure executing this task;
null
if no failure was reported previously or if no error message was submitted - See Also:
-
areRetriesLeft
public boolean areRetriesLeft() -
getPriority
public long getPriority()Description copied from interface:ExternalTask
Returns the priority of the external task.- Specified by:
getPriority
in interfaceExternalTask
- Returns:
- the priority of the external task
-
setPriority
public void setPriority(long priority) -
getBusinessKey
Description copied from interface:ExternalTask
Returns the business key of the process instance the external task belongs to- Specified by:
getBusinessKey
in interfaceExternalTask
- Returns:
- the business key
-
setBusinessKey
-
getExtensionProperties
Description copied from interface:ExternalTask
Returns a map containing all custom extension properties of the external task.- Specified by:
getExtensionProperties
in interfaceExternalTask
- Returns:
- the properties, never
null
-
setExtensionProperties
-
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
-
insert
public void insert() -
getErrorDetails
Method implementation relies on the command context object, therefore should be invoked from the commands only- Returns:
- error details persisted in byte array table
-
setErrorMessage
-
setErrorDetails
-
getErrorDetailsByteArrayId
-
getErrorByteArray
-
ensureErrorByteArrayInitialized
protected void ensureErrorByteArrayInitialized() -
delete
public void delete() -
deleteFromExecutionAndRuntimeTable
protected void deleteFromExecutionAndRuntimeTable(boolean incidentResolved) -
removeIncidents
protected void removeIncidents(boolean incidentResolved) -
complete
-
failed
public void failed(String errorMessage, String errorDetails, int retries, long retryDuration, Map<String, Object> variables, Map<String, Object> localVariables) process failed state, make sure that binary entity is created for the errorMessage, shortError message does not exceed limit, handle properly retry counts and incidents- Parameters:
errorMessage
- - short error message texterrorDetails
- - full error detailsretries
- - updated value of retries leftretryDuration
- - used for lockExpirationTime calculation
-
bpmnError
-
setRetriesAndManageIncidents
public void setRetriesAndManageIncidents(int retries) -
createIncident
protected void createIncident() -
createIncidentContext
-
lock
-
getExecution
-
getExecution
-
setExecution
-
ensureExecutionInitialized
protected void ensureExecutionInitialized(boolean validateExistence) -
ensureActive
protected void ensureActive() -
ensureVariablesSet
-
evaluateThrowBpmnError
-
errorEventDefinitionMatches
protected boolean errorEventDefinitionMatches(CamundaErrorEventDefinition camundaErrorEventDefinition, boolean continueOnException) -
toString
-
unlock
public void unlock() -
createAndInsert
public static ExternalTaskEntity createAndInsert(ExecutionEntity execution, String topic, long priority) -
produceHistoricExternalTaskCreatedEvent
protected void produceHistoricExternalTaskCreatedEvent() -
produceHistoricExternalTaskFailedEvent
protected void produceHistoricExternalTaskFailedEvent() -
produceHistoricExternalTaskSuccessfulEvent
protected void produceHistoricExternalTaskSuccessfulEvent() -
produceHistoricExternalTaskDeletedEvent
protected void produceHistoricExternalTaskDeletedEvent() -
extendLock
public void extendLock(long newLockExpirationTime) -
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.
-
getLastFailureLogId
-
setLastFailureLogId
-