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
      • id

        protected java.lang.String id
      • revision

        protected int revision
      • topicName

        protected java.lang.String topicName
      • workerId

        protected java.lang.String workerId
      • lockExpirationTime

        protected java.util.Date lockExpirationTime
      • retries

        protected java.lang.Integer retries
      • errorMessage

        protected java.lang.String errorMessage
      • errorDetailsByteArrayId

        protected java.lang.String errorDetailsByteArrayId
      • suspensionState

        protected int suspensionState
      • executionId

        protected java.lang.String executionId
      • processInstanceId

        protected java.lang.String processInstanceId
      • processDefinitionId

        protected java.lang.String processDefinitionId
      • processDefinitionKey

        protected java.lang.String processDefinitionKey
      • processDefinitionVersionTag

        protected java.lang.String processDefinitionVersionTag
      • activityId

        protected java.lang.String activityId
      • activityInstanceId

        protected java.lang.String activityInstanceId
      • tenantId

        protected java.lang.String tenantId
      • priority

        protected long priority
      • extensionProperties

        protected java.util.Map<java.lang.String,​java.lang.String> extensionProperties
      • businessKey

        protected java.lang.String businessKey
      • lastFailureLogId

        protected java.lang.String lastFailureLogId
    • Constructor Detail

      • ExternalTaskEntity

        public ExternalTaskEntity()
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface DbEntity
        Specified by:
        getId in interface ExternalTask
        Returns:
        the id of the task
      • setId

        public void setId​(java.lang.String id)
        Specified by:
        setId in interface DbEntity
      • getTopicName

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

        public void setTopicName​(java.lang.String topic)
      • getWorkerId

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

        public void setWorkerId​(java.lang.String workerId)
      • getLockExpirationTime

        public java.util.Date getLockExpirationTime()
        Specified by:
        getLockExpirationTime in interface ExternalTask
        Returns:
        the absolute time at which the lock expires
      • setLockExpirationTime

        public void setLockExpirationTime​(java.util.Date lockExpirationTime)
      • getExecutionId

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

        public void setExecutionId​(java.lang.String executionId)
      • getProcessDefinitionKey

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

        public void setProcessDefinitionKey​(java.lang.String processDefinitionKey)
      • getProcessDefinitionVersionTag

        public java.lang.String getProcessDefinitionVersionTag()
        Specified by:
        getProcessDefinitionVersionTag in interface ExternalTask
        Returns:
        the version tag of the process definition the tasks activity belongs to
      • setProcessDefinitionVersionTag

        public void setProcessDefinitionVersionTag​(java.lang.String processDefinitionVersionTag)
      • getActivityId

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

        public void setActivityId​(java.lang.String activityId)
      • getActivityInstanceId

        public java.lang.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​(java.lang.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
      • getProcessInstanceId

        public java.lang.String getProcessInstanceId()
        Specified by:
        getProcessInstanceId in interface ExternalTask
        Returns:
        the id of the process instance the task exists in
      • setProcessInstanceId

        public void setProcessInstanceId​(java.lang.String processInstanceId)
      • getProcessDefinitionId

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

        public void setProcessDefinitionId​(java.lang.String processDefinitionId)
      • getTenantId

        public java.lang.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​(java.lang.String tenantId)
      • getRetries

        public java.lang.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​(java.lang.Integer retries)
      • getErrorMessage

        public java.lang.String getErrorMessage()
        Specified by:
        getErrorMessage in interface ExternalTask
        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:
        To get the full error details, use
      • 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 java.lang.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​(java.lang.String businessKey)
      • getExtensionProperties

        public java.util.Map<java.lang.String,​java.lang.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​(java.util.Map<java.lang.String,​java.lang.String> extensionProperties)
      • getPersistentState

        public java.lang.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 java.lang.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​(java.lang.String errorMessage)
      • setErrorDetails

        protected void setErrorDetails​(java.lang.String exception)
      • getErrorDetailsByteArrayId

        public java.lang.String getErrorDetailsByteArrayId()
      • ensureErrorByteArrayInitialized

        protected void ensureErrorByteArrayInitialized()
      • delete

        public void delete()
      • deleteFromExecutionAndRuntimeTable

        protected void deleteFromExecutionAndRuntimeTable​(boolean incidentResolved)
      • removeIncidents

        protected void removeIncidents​(boolean incidentResolved)
      • complete

        public void complete​(java.util.Map<java.lang.String,​java.lang.Object> variables,
                             java.util.Map<java.lang.String,​java.lang.Object> localVariables)
      • failed

        public void failed​(java.lang.String errorMessage,
                           java.lang.String errorDetails,
                           int retries,
                           long retryDuration,
                           java.util.Map<java.lang.String,​java.lang.Object> variables,
                           java.util.Map<java.lang.String,​java.lang.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
      • bpmnError

        public void bpmnError​(java.lang.String errorCode,
                              java.lang.String errorMessage,
                              java.util.Map<java.lang.String,​java.lang.Object> variables)
      • setRetriesAndManageIncidents

        public void setRetriesAndManageIncidents​(int retries)
      • createIncident

        protected void createIncident()
      • createIncidentContext

        protected IncidentContext createIncidentContext()
      • lock

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

        public ExecutionEntity getExecution​(boolean validateExistence)
      • ensureExecutionInitialized

        protected void ensureExecutionInitialized​(boolean validateExistence)
      • ensureActive

        protected void ensureActive()
      • ensureVariablesSet

        protected void ensureVariablesSet​(ExecutionEntity execution,
                                          java.util.Map<java.lang.String,​java.lang.Object> variables,
                                          java.util.Map<java.lang.String,​java.lang.Object> localVariables)
      • evaluateThrowBpmnError

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

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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 java.util.Set<java.lang.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 java.util.Map<java.lang.String,​java.lang.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 java.lang.String getLastFailureLogId()
      • setLastFailureLogId

        public void setLastFailureLogId​(java.lang.String lastFailureLogId)