Class ExternalTaskEntity

    • Field Detail

      • MAX_EXCEPTION_MESSAGE_LENGTH

        public static final int MAX_EXCEPTION_MESSAGE_LENGTH
        Note: 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:
        Constant Field Values
      • revision

        protected int revision
      • topicName

        protected String topicName
      • workerId

        protected String workerId
      • lockExpirationTime

        protected Date lockExpirationTime
      • retries

        protected Integer retries
      • errorMessage

        protected String errorMessage
      • errorDetailsByteArrayId

        protected String errorDetailsByteArrayId
      • suspensionState

        protected int suspensionState
      • executionId

        protected String executionId
      • processInstanceId

        protected String processInstanceId
      • processDefinitionId

        protected String processDefinitionId
      • processDefinitionKey

        protected String processDefinitionKey
      • processDefinitionVersionTag

        protected String processDefinitionVersionTag
      • activityId

        protected String activityId
      • activityInstanceId

        protected String activityInstanceId
      • tenantId

        protected String tenantId
      • priority

        protected long priority
      • businessKey

        protected String businessKey
      • lastFailureLogId

        protected String lastFailureLogId
    • Constructor Detail

      • ExternalTaskEntity

        public ExternalTaskEntity()
    • Method Detail

      • getTopicName

        public String getTopicName()
        Specified by:
        getTopicName in interface ExternalTask
        Returns:
        the name of the topic the task belongs to
      • setTopicName

        public void setTopicName​(String topic)
      • getWorkerId

        public String getWorkerId()
        Specified by:
        getWorkerId in interface ExternalTask
        Returns:
        the id of the worker that has locked the task
      • setWorkerId

        public void setWorkerId​(String workerId)
      • setLockExpirationTime

        public void setLockExpirationTime​(Date lockExpirationTime)
      • getExecutionId

        public String getExecutionId()
        Specified by:
        getExecutionId in interface ExternalTask
        Returns:
        the id of the execution that the task is assigned to
      • setExecutionId

        public void setExecutionId​(String executionId)
      • getProcessDefinitionKey

        public String getProcessDefinitionKey()
        Specified by:
        getProcessDefinitionKey in interface ExternalTask
        Returns:
        the key of the process definition the tasks activity belongs to
      • setProcessDefinitionKey

        public void setProcessDefinitionKey​(String processDefinitionKey)
      • setProcessDefinitionVersionTag

        public void setProcessDefinitionVersionTag​(String processDefinitionVersionTag)
      • getActivityId

        public String getActivityId()
        Specified by:
        getActivityId in interface ExternalTask
        Returns:
        the id of the activity for which the task is created
      • setActivityId

        public void setActivityId​(String activityId)
      • getActivityInstanceId

        public String getActivityInstanceId()
        Specified by:
        getActivityInstanceId in interface ExternalTask
        Returns:
        the id of the activity instance in which context the task exists
      • setActivityInstanceId

        public void setActivityInstanceId​(String activityInstanceId)
      • getSuspensionState

        public int getSuspensionState()
      • setSuspensionState

        public void setSuspensionState​(int suspensionState)
      • isSuspended

        public boolean isSuspended()
        Specified by:
        isSuspended in interface ExternalTask
        Returns:
        true if the external task is suspended; a suspended external task cannot be completed, thereby preventing process continuation
      • setProcessInstanceId

        public void setProcessInstanceId​(String processInstanceId)
      • getProcessDefinitionId

        public String getProcessDefinitionId()
        Specified by:
        getProcessDefinitionId in interface ExternalTask
        Returns:
        the id of the process definition the tasks activity belongs to
      • setProcessDefinitionId

        public void setProcessDefinitionId​(String processDefinitionId)
      • getTenantId

        public String getTenantId()
        Specified by:
        getTenantId in interface ExternalTask
        Returns:
        the id of the tenant the task belongs to. Can be null if the task belongs to no single tenant.
      • setTenantId

        public void setTenantId​(String tenantId)
      • getRetries

        public Integer getRetries()
        Specified by:
        getRetries in interface ExternalTask
        Returns:
        the number of retries left. The number of retries is provided by a task client, therefore the initial value is null.
      • setRetries

        public void setRetries​(Integer retries)
      • areRetriesLeft

        public boolean areRetriesLeft()
      • getPriority

        public long getPriority()
        Description copied from interface: ExternalTask
        Returns the priority of the external task.
        Specified by:
        getPriority in interface ExternalTask
        Returns:
        the priority of the external task
      • setPriority

        public void setPriority​(long priority)
      • getBusinessKey

        public String getBusinessKey()
        Description copied from interface: ExternalTask
        Returns the business key of the process instance the external task belongs to
        Specified by:
        getBusinessKey in interface ExternalTask
        Returns:
        the business key
      • setBusinessKey

        public void setBusinessKey​(String businessKey)
      • getExtensionProperties

        public Map<String,​String> getExtensionProperties()
        Description copied from interface: ExternalTask
        Returns a map containing all custom extension properties of the external task.
        Specified by:
        getExtensionProperties in interface ExternalTask
        Returns:
        the properties, never null
      • setExtensionProperties

        public void setExtensionProperties​(Map<String,​String> extensionProperties)
      • getPersistentState

        public Object 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 interface DbEntity
      • insert

        public void insert()
      • getErrorDetails

        public String 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

        public void setErrorMessage​(String errorMessage)
      • setErrorDetails

        protected void setErrorDetails​(String exception)
      • getErrorDetailsByteArrayId

        public String getErrorDetailsByteArrayId()
      • ensureErrorByteArrayInitialized

        protected void ensureErrorByteArrayInitialized()
      • delete

        public void delete()
      • deleteFromExecutionAndRuntimeTable

        protected void deleteFromExecutionAndRuntimeTable​(boolean incidentResolved)
      • removeIncidents

        protected void removeIncidents​(boolean incidentResolved)
      • 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 text
        errorDetails - - full error details
        retries - - updated value of retries left
        retryDuration - - used for lockExpirationTime calculation
      • setRetriesAndManageIncidents

        public void setRetriesAndManageIncidents​(int retries)
      • createIncident

        protected void createIncident()
      • createIncidentContext

        protected IncidentContext createIncidentContext()
      • lock

        public void lock​(String workerId,
                         long lockDuration)
      • getExecution

        public ExecutionEntity getExecution​(boolean validateExistence)
      • ensureExecutionInitialized

        protected void ensureExecutionInitialized​(boolean validateExistence)
      • ensureActive

        protected void ensureActive()
      • evaluateThrowBpmnError

        protected boolean evaluateThrowBpmnError​(ExecutionEntity execution,
                                                 boolean continueOnException)
      • errorEventDefinitionMatches

        protected boolean errorEventDefinitionMatches​(CamundaErrorEventDefinition camundaErrorEventDefinition,
                                                      boolean continueOnException)
      • unlock

        public void unlock()
      • produceHistoricExternalTaskCreatedEvent

        protected void produceHistoricExternalTaskCreatedEvent()
      • produceHistoricExternalTaskFailedEvent

        protected void produceHistoricExternalTaskFailedEvent()
      • produceHistoricExternalTaskSuccessfulEvent

        protected void produceHistoricExternalTaskSuccessfulEvent()
      • produceHistoricExternalTaskDeletedEvent

        protected void produceHistoricExternalTaskDeletedEvent()
      • extendLock

        public void extendLock​(long newLockExpirationTime)
      • getReferencedEntityIds

        public Set<String> getReferencedEntityIds()
        Description copied from interface: HasDbReferences

        Scope: IN-MEMORY references

        Specified by:
        getReferencedEntityIds in interface HasDbReferences
        Returns:
        the ids of the entities that this entity references. Should only return ids for entities of the same type
      • getReferencedEntitiesIdAndClass

        public Map<String,​Class> getReferencedEntitiesIdAndClass()
        Description copied from interface: HasDbReferences

        Scope: IN-MEMORY references

        Specified by:
        getReferencedEntitiesIdAndClass in interface HasDbReferences
        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

        public String getLastFailureLogId()
      • setLastFailureLogId

        public void setLastFailureLogId​(String lastFailureLogId)