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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected Dateprotected ByteArrayEntityprotected Stringprotected Stringprotected ExecutionEntityprotected Stringprotected Stringprotected Stringprotected Dateprotected static final EnginePersistenceLoggerstatic final intNote:String.length()counts Unicode supplementary characters twice, so for a String consisting only of those, the limit is effectively MAX_EXCEPTION_MESSAGE_LENGTH / 2protected longprotected Stringprotected Stringprotected Stringprotected Stringprotected Integerprotected intprotected intprotected Stringprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidvoidstatic ExternalTaskEntitycreateAndInsert(ExecutionEntity execution, String topic, long priority) protected voidprotected IncidentContextvoiddelete()protected voiddeleteFromExecutionAndRuntimeTable(boolean incidentResolved) protected voidprotected voidprotected voidensureExecutionInitialized(boolean validateExistence) protected voidensureVariablesSet(ExecutionEntity execution, Map<String, Object> variables, Map<String, Object> localVariables) protected booleanerrorEventDefinitionMatches(CamundaErrorEventDefinition camundaErrorEventDefinition, boolean continueOnException) protected booleanevaluateThrowBpmnError(ExecutionEntity execution, boolean continueOnException) voidextendLock(long newLockExpirationTime) voidfailed(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 ByteArrayEntityMethod 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.longReturns the priority of the external task.Scope: IN-MEMORY referencesScope: IN-MEMORY referencesintintintvoidinsert()booleanvoidprotected voidprotected voidprotected voidprotected voidprotected voidremoveIncidents(boolean incidentResolved) voidsetActivityId(String activityId) voidsetActivityInstanceId(String activityInstanceId) voidsetBusinessKey(String businessKey) voidsetCreateTime(Date createTime) protected voidsetErrorDetails(String exception) voidsetErrorMessage(String errorMessage) voidsetExecution(ExecutionEntity execution) voidsetExecutionId(String executionId) voidsetExtensionProperties(Map<String, String> extensionProperties) voidvoidsetLastFailureLogId(String lastFailureLogId) voidsetLockExpirationTime(Date lockExpirationTime) voidsetPriority(long priority) voidsetProcessDefinitionId(String processDefinitionId) voidsetProcessDefinitionKey(String processDefinitionKey) voidsetProcessDefinitionVersionTag(String processDefinitionVersionTag) voidsetProcessInstanceId(String processInstanceId) voidsetRetries(Integer retries) voidsetRetriesAndManageIncidents(int retries) voidsetRevision(int revision) voidsetSuspensionState(int suspensionState) voidsetTenantId(String tenantId) voidsetTopicName(String topic) voidsetWorkerId(String workerId) toString()voidunlock()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
-
createTime
-
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:
getIdin interfaceDbEntity- Specified by:
getIdin interfaceExternalTask- Returns:
- the id of the task
-
setId
-
getTopicName
- Specified by:
getTopicNamein interfaceExternalTask- Returns:
- the name of the topic the task belongs to
-
setTopicName
-
getWorkerId
- Specified by:
getWorkerIdin interfaceExternalTask- Returns:
- the id of the worker that has locked the task
-
setWorkerId
-
getLockExpirationTime
- Specified by:
getLockExpirationTimein interfaceExternalTask- Returns:
- the absolute time at which the lock expires
-
setLockExpirationTime
-
getCreateTime
- Specified by:
getCreateTimein interfaceExternalTask- Returns:
- the absolute time at which the task was created
-
setCreateTime
-
getExecutionId
- Specified by:
getExecutionIdin interfaceExternalTask- Returns:
- the id of the execution that the task is assigned to
-
setExecutionId
-
getProcessDefinitionKey
- Specified by:
getProcessDefinitionKeyin interfaceExternalTask- Returns:
- the key of the process definition the tasks activity belongs to
-
setProcessDefinitionKey
-
getProcessDefinitionVersionTag
- Specified by:
getProcessDefinitionVersionTagin interfaceExternalTask- Returns:
- the version tag of the process definition the tasks activity belongs to
-
setProcessDefinitionVersionTag
-
getActivityId
- Specified by:
getActivityIdin interfaceExternalTask- Returns:
- the id of the activity for which the task is created
-
setActivityId
-
getActivityInstanceId
- Specified by:
getActivityInstanceIdin interfaceExternalTask- Returns:
- the id of the activity instance in which context the task exists
-
setActivityInstanceId
-
getRevision
public int getRevision()- Specified by:
getRevisionin interfaceHasDbRevision
-
setRevision
public void setRevision(int revision) - Specified by:
setRevisionin interfaceHasDbRevision
-
getRevisionNext
public int getRevisionNext()- Specified by:
getRevisionNextin interfaceHasDbRevision
-
getSuspensionState
public int getSuspensionState() -
setSuspensionState
public void setSuspensionState(int suspensionState) -
isSuspended
public boolean isSuspended()- Specified by:
isSuspendedin interfaceExternalTask- Returns:
- true if the external task is suspended; a suspended external task cannot be completed, thereby preventing process continuation
-
getProcessInstanceId
- Specified by:
getProcessInstanceIdin interfaceExternalTask- Returns:
- the id of the process instance the task exists in
-
setProcessInstanceId
-
getProcessDefinitionId
- Specified by:
getProcessDefinitionIdin interfaceExternalTask- Returns:
- the id of the process definition the tasks activity belongs to
-
setProcessDefinitionId
-
getTenantId
- Specified by:
getTenantIdin interfaceExternalTask- Returns:
- the id of the tenant the task belongs to. Can be
nullif the task belongs to no single tenant.
-
setTenantId
-
getRetries
- Specified by:
getRetriesin 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:
getErrorMessagein interfaceExternalTask- Returns:
- short error message submitted with the latest reported failure executing this task;
nullif 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:ExternalTaskReturns the priority of the external task.- Specified by:
getPriorityin interfaceExternalTask- Returns:
- the priority of the external task
-
setPriority
public void setPriority(long priority) -
getBusinessKey
Description copied from interface:ExternalTaskReturns the business key of the process instance the external task belongs to- Specified by:
getBusinessKeyin interfaceExternalTask- Returns:
- the business key
-
setBusinessKey
-
getExtensionProperties
Description copied from interface:ExternalTaskReturns a map containing all custom extension properties of the external task.- Specified by:
getExtensionPropertiesin interfaceExternalTask- Returns:
- the properties, never
null
-
setExtensionProperties
-
getPersistentState
Description copied from interface:DbEntityReturns 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:
getPersistentStatein 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:HasDbReferencesScope: IN-MEMORY references
- Specified by:
getReferencedEntityIdsin 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:HasDbReferencesScope: IN-MEMORY references
- Specified by:
getReferencedEntitiesIdAndClassin 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
-