org.camunda.bpm.engine.impl.persistence.entity
Class TaskEntity

java.lang.Object
  extended by org.camunda.bpm.engine.impl.persistence.entity.VariableScopeImpl
      extended by org.camunda.bpm.engine.impl.persistence.entity.TaskEntity
All Implemented Interfaces:
Serializable, DelegateTask, VariableScope, HasRevision, PersistentObject, CommandContextCloseListener, Task

public class TaskEntity
extends VariableScopeImpl
implements Task, DelegateTask, Serializable, PersistentObject, HasRevision, CommandContextCloseListener

Author:
Tom Baeyens, Joram Barrez, Falko Menge
See Also:
Serialized Form

Field Summary
protected  String assignee
           
protected  Date createTime
           
protected  DelegationState delegationState
           
static String DELETE_REASON_COMPLETED
           
static String DELETE_REASON_DELETED
           
protected  String description
           
protected  Date dueDate
           
protected  String eventName
           
protected  ExecutionEntity execution
           
protected  String executionId
           
protected  Date followUpDate
           
protected  boolean isDeleted
           
protected  boolean isIdentityLinksInitialized
           
protected  String name
           
protected  String owner
           
protected  String parentTaskId
           
protected  int priority
           
protected  String processDefinitionId
           
protected  ExecutionEntity processInstance
           
protected  String processInstanceId
           
protected  int revision
           
protected  int suspensionState
           
protected  TaskDefinition taskDefinition
           
protected  String taskDefinitionKey
           
protected  List<IdentityLinkEntity> taskIdentityLinkEntities
           
 
Fields inherited from class org.camunda.bpm.engine.impl.persistence.entity.VariableScopeImpl
cachedElContext, id, variableInstances
 
Fields inherited from interface org.camunda.bpm.engine.task.Task
PRIORITY_MAXIMUM, PRIORITY_MINIUM, PRIORITY_NORMAL
 
Constructor Summary
TaskEntity()
           
TaskEntity(String taskId)
           
 
Method Summary
 void addCandidateGroup(String groupId)
          Adds the given group as candidate group to this task
 void addCandidateGroups(Collection<String> candidateGroups)
          Adds multiple groups as candidate group to this task.
 void addCandidateUser(String userId)
          Adds the given user as a candidate user to this task.
 void addCandidateUsers(Collection<String> candidateUsers)
          Adds multiple users as candidate user to this task.
 void addGroupIdentityLink(String groupId, String identityLinkType)
          Involves a group with group task.
 IdentityLinkEntity addIdentityLink(String userId, String groupId, String type)
           
 void addUserIdentityLink(String userId, String identityLinkType)
          Involves a user with a task.
 void complete()
           
static TaskEntity create()
          new task.
static TaskEntity createAndInsert(ActivityExecution execution)
          creates and initializes a new persistent task.
 void delegate(String userId)
          delegates this task to the given user and sets the delegationState to DelegationState.PENDING.
 void deleteCandidateGroup(String groupId)
          Convenience shorthand for #deleteGroupIdentityLink(String, String, String); with type IdentityLinkType.CANDIDATE
 void deleteCandidateUser(String userId)
          Convenience shorthand for DelegateTask.deleteUserIdentityLink(String, String); with type IdentityLinkType.CANDIDATE
 void deleteGroupIdentityLink(String groupId, String identityLinkType)
          Removes the association between a group and a task for the given identityLinkType.
 void deleteIdentityLink(String userId, String groupId, String type)
           
 void deleteUserIdentityLink(String userId, String identityLinkType)
          Removes the association between a user and a task for the given identityLinkType.
protected  void ensureParentTaskActive()
           
protected  void ensureTaskActive()
           
 void fireEvent(String taskEventName)
           
 Map<String,Object> getActivityInstanceVariables()
           
 String getAssignee()
          The userId of the person to which this task is assigned or delegated.
 Set<IdentityLink> getCandidates()
          Retrieves the candidate users and groups associated with the task.
 Date getCreateTime()
          The date/time when this task was created
 DelegationState getDelegationState()
          The current DelegationState for this task.
 String getDelegationStateString()
           
 String getDescription()
          Free text description of the task.
 Date getDueDate()
          Due date of the task.
 String getEventName()
          Returns the event name which triggered the task listener to fire for this task.
 ExecutionEntity getExecution()
          Returns the execution currently at the task.
 String getExecutionId()
          Reference to the path of execution or null if it is not related to a process instance.
 Date getFollowUpDate()
          Follow-up date of the task.
 List<IdentityLinkEntity> getIdentityLinks()
           
 String getName()
          Name or title of the task.
 String getOwner()
          The userId of the person that is responsible for this task.
 String getParentTaskId()
          the parent task for which this task is a subtask
protected  VariableScopeImpl getParentVariableScope()
           
 Object getPersistentState()
          Returns a representation of the object, as would be stored in the database.
 int getPriority()
          indication of how important/urgent this task is with a number between 0 and 100 where higher values mean a higher priority and lower values mean lower priority: [0..19] lowest, [20..39] low, [40..59] normal, [60..79] high [80..100] highest
 String getProcessDefinitionId()
          Reference to the process definition or null if it is not related to a process.
 ExecutionEntity getProcessInstance()
           
 String getProcessInstanceId()
          Reference to the process instance or null if it is not related to a process instance.
 int getRevision()
           
 int getRevisionNext()
           
 int getSuspensionState()
           
 TaskDefinition getTaskDefinition()
           
 String getTaskDefinitionKey()
          The id of the activity in the process defining this task or null if this is not related to a process
 Map<String,VariableInstanceEntity> getVariableInstances()
           
protected  void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)
           
 void insert(ExecutionEntity execution)
           
 boolean isDeleted()
           
 boolean isSuspended()
          Indicated whether this task is suspended or not.
protected  List<VariableInstanceEntity> loadVariableInstances()
           
 void onCommandContextClose(CommandContext commandContext)
           
protected  void registerCommandContextCloseListener()
           
 void resolve()
           
 void setAssignee(String assignee)
          The userId of the person to which this task is assigned or delegated.
 void setAssigneeWithoutCascade(String assignee)
           
 void setCreateTime(Date createTime)
           
 void setDelegationState(DelegationState delegationState)
          The current DelegationState for this task.
 void setDelegationStateString(String delegationStateString)
           
 void setDeleted(boolean isDeleted)
           
 void setDescription(String description)
          Change the description of the task
 void setDescriptionWithoutCascade(String description)
           
 void setDueDate(Date dueDate)
          Change due date of the task.
 void setDueDateWithoutCascade(Date dueDate)
           
 void setEventName(String eventName)
           
 void setExecution(DelegateExecution execution)
           
 void setExecution(ExecutionEntity execution)
           
 void setExecutionId(String executionId)
           
 void setExecutionVariables(Map<String,Object> parameters)
           
 void setFollowUpDate(Date followUpDate)
          Change follow-up date of the task.
 void setFollowUpDateWithoutCascade(Date followUpDate)
           
 void setName(String taskName)
          Name or title of the task.
 void setNameWithoutCascade(String taskName)
           
 void setOwner(String owner)
          The userId of the person that is responsible for this task.
 void setOwnerWithoutCascade(String owner)
           
 void setParentTaskId(String parentTaskId)
          the parent task for which this task is a subtask
 void setParentTaskIdWithoutCascade(String parentTaskId)
           
 void setPriority(int priority)
          indication of how important/urgent this task is with a number between 0 and 100 where higher values mean a higher priority and lower values mean lower priority: [0..19] lowest, [20..39] low, [40..59] normal, [60..79] high [80..100] highest
 void setPriorityWithoutCascade(int priority)
           
 void setProcessDefinitionId(String processDefinitionId)
           
 void setProcessInstance(ExecutionEntity processInstance)
           
 void setProcessInstanceId(String processInstanceId)
           
 void setRevision(int revision)
           
 void setSuspensionState(int suspensionState)
           
 void setTaskDefinition(TaskDefinition taskDefinition)
           
 void setTaskDefinitionKey(String taskDefinitionKey)
           
 void setTaskDefinitionKeyWithoutCascade(String taskDefinitionKey)
           
 String toString()
           
 void update()
           
 
Methods inherited from class org.camunda.bpm.engine.impl.persistence.entity.VariableScopeImpl
collectVariableNames, collectVariables, createVariableInstance, createVariableLocal, createVariableLocal, createVariablesLocal, deleteVariableInstanceForExplicitUserCall, deleteVariablesInstanceForLeavingScope, ensureVariableInstancesInitialized, fireHistoricVariableInstanceCreate, fireHistoricVariableInstanceDelete, fireHistoricVariableInstanceUpdate, getCachedElContext, getId, getSourceActivityExecution, getVariable, getVariableLocal, getVariableNames, getVariableNamesLocal, getVariables, getVariablesLocal, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, isAutoFireHistoryEvents, removeVariable, removeVariable, removeVariableLocal, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setCachedElContext, setId, setVariable, setVariable, setVariableLocal, setVariableLocal, setVariables, setVariablesLocal, updateVariableInstance
 
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.task.Task
getId
 
Methods inherited from interface org.camunda.bpm.engine.delegate.DelegateTask
getId
 
Methods inherited from interface org.camunda.bpm.engine.delegate.VariableScope
getVariable, getVariableLocal, getVariableNames, getVariableNamesLocal, getVariables, getVariablesLocal, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, removeVariable, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setVariable, setVariableLocal, setVariables, setVariablesLocal
 
Methods inherited from interface org.camunda.bpm.engine.impl.db.PersistentObject
getId, setId
 

Field Detail

DELETE_REASON_COMPLETED

public static final String DELETE_REASON_COMPLETED
See Also:
Constant Field Values

DELETE_REASON_DELETED

public static final String DELETE_REASON_DELETED
See Also:
Constant Field Values

revision

protected int revision

owner

protected String owner

assignee

protected String assignee

delegationState

protected DelegationState delegationState

parentTaskId

protected String parentTaskId

name

protected String name

description

protected String description

priority

protected int priority

createTime

protected Date createTime

dueDate

protected Date dueDate

followUpDate

protected Date followUpDate

suspensionState

protected int suspensionState

isIdentityLinksInitialized

protected boolean isIdentityLinksInitialized

taskIdentityLinkEntities

protected List<IdentityLinkEntity> taskIdentityLinkEntities

executionId

protected String executionId

execution

protected ExecutionEntity execution

processInstanceId

protected String processInstanceId

processInstance

protected ExecutionEntity processInstance

processDefinitionId

protected String processDefinitionId

taskDefinition

protected TaskDefinition taskDefinition

taskDefinitionKey

protected String taskDefinitionKey

isDeleted

protected boolean isDeleted

eventName

protected String eventName
Constructor Detail

TaskEntity

public TaskEntity()

TaskEntity

public TaskEntity(String taskId)
Method Detail

createAndInsert

public static TaskEntity createAndInsert(ActivityExecution execution)
creates and initializes a new persistent task.


insert

public void insert(ExecutionEntity execution)

update

public void update()

create

public static TaskEntity create()
new task. Embedded state and create time will be initialized. But this task still will have to be persisted with TransactionContext .getCurrent() .getPersistenceSession() .insert(task);


complete

public void complete()

delegate

public void delegate(String userId)
Description copied from interface: Task
delegates this task to the given user and sets the delegationState to DelegationState.PENDING. If no owner is set on the task, the owner is set to the current assignee of the task.

Specified by:
delegate in interface Task

resolve

public void resolve()

getPersistentState

public Object getPersistentState()
Description copied from interface: PersistentObject
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 PersistentObject

getRevisionNext

public int getRevisionNext()
Specified by:
getRevisionNext in interface HasRevision

ensureParentTaskActive

protected void ensureParentTaskActive()

ensureTaskActive

protected void ensureTaskActive()

getParentVariableScope

protected VariableScopeImpl getParentVariableScope()
Specified by:
getParentVariableScope in class VariableScopeImpl

initializeVariableInstanceBackPointer

protected void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance)
Specified by:
initializeVariableInstanceBackPointer in class VariableScopeImpl

loadVariableInstances

protected List<VariableInstanceEntity> loadVariableInstances()
Specified by:
loadVariableInstances in class VariableScopeImpl

getExecution

public ExecutionEntity getExecution()
Description copied from interface: DelegateTask
Returns the execution currently at the task.

Specified by:
getExecution in interface DelegateTask

setExecution

public void setExecution(DelegateExecution execution)

addIdentityLink

public IdentityLinkEntity addIdentityLink(String userId,
                                          String groupId,
                                          String type)

deleteIdentityLink

public void deleteIdentityLink(String userId,
                               String groupId,
                               String type)

getCandidates

public Set<IdentityLink> getCandidates()
Description copied from interface: DelegateTask
Retrieves the candidate users and groups associated with the task.

Specified by:
getCandidates in interface DelegateTask
Returns:
set of IdentityLinks of type IdentityLinkType.CANDIDATE.

addCandidateUser

public void addCandidateUser(String userId)
Description copied from interface: DelegateTask
Adds the given user as a candidate user to this task.

Specified by:
addCandidateUser in interface DelegateTask

addCandidateUsers

public void addCandidateUsers(Collection<String> candidateUsers)
Description copied from interface: DelegateTask
Adds multiple users as candidate user to this task.

Specified by:
addCandidateUsers in interface DelegateTask

addCandidateGroup

public void addCandidateGroup(String groupId)
Description copied from interface: DelegateTask
Adds the given group as candidate group to this task

Specified by:
addCandidateGroup in interface DelegateTask

addCandidateGroups

public void addCandidateGroups(Collection<String> candidateGroups)
Description copied from interface: DelegateTask
Adds multiple groups as candidate group to this task.

Specified by:
addCandidateGroups in interface DelegateTask

addGroupIdentityLink

public void addGroupIdentityLink(String groupId,
                                 String identityLinkType)
Description copied from interface: DelegateTask
Involves a group with group task. The type of identityLink is defined by the given identityLink.

Specified by:
addGroupIdentityLink in interface DelegateTask
Parameters:
groupId - id of the group to involve, cannot be null.
identityLinkType - type of identity, cannot be null (@see IdentityLinkType).

addUserIdentityLink

public void addUserIdentityLink(String userId,
                                String identityLinkType)
Description copied from interface: DelegateTask
Involves a user with a task. The type of identity link is defined by the given identityLinkType.

Specified by:
addUserIdentityLink in interface DelegateTask
Parameters:
userId - id of the user involve, cannot be null.
identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).

deleteCandidateGroup

public void deleteCandidateGroup(String groupId)
Description copied from interface: DelegateTask
Convenience shorthand for #deleteGroupIdentityLink(String, String, String); with type IdentityLinkType.CANDIDATE

Specified by:
deleteCandidateGroup in interface DelegateTask
Parameters:
groupId - id of the group to use as candidate, cannot be null.

deleteCandidateUser

public void deleteCandidateUser(String userId)
Description copied from interface: DelegateTask
Convenience shorthand for DelegateTask.deleteUserIdentityLink(String, String); with type IdentityLinkType.CANDIDATE

Specified by:
deleteCandidateUser in interface DelegateTask
Parameters:
userId - id of the user to use as candidate, cannot be null.

deleteGroupIdentityLink

public void deleteGroupIdentityLink(String groupId,
                                    String identityLinkType)
Description copied from interface: DelegateTask
Removes the association between a group and a task for the given identityLinkType.

Specified by:
deleteGroupIdentityLink in interface DelegateTask
Parameters:
groupId - id of the group to involve, cannot be null.
identityLinkType - type of identity, cannot be null (@see IdentityLinkType).

deleteUserIdentityLink

public void deleteUserIdentityLink(String userId,
                                   String identityLinkType)
Description copied from interface: DelegateTask
Removes the association between a user and a task for the given identityLinkType.

Specified by:
deleteUserIdentityLink in interface DelegateTask
Parameters:
userId - id of the user involve, cannot be null.
identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).

getIdentityLinks

public List<IdentityLinkEntity> getIdentityLinks()

getActivityInstanceVariables

public Map<String,Object> getActivityInstanceVariables()

setExecutionVariables

public void setExecutionVariables(Map<String,Object> parameters)

toString

public String toString()
Overrides:
toString in class Object

setName

public void setName(String taskName)
Description copied from interface: Task
Name or title of the task.

Specified by:
setName in interface DelegateTask
Specified by:
setName in interface Task

setNameWithoutCascade

public void setNameWithoutCascade(String taskName)

setDescription

public void setDescription(String description)
Description copied from interface: Task
Change the description of the task

Specified by:
setDescription in interface DelegateTask
Specified by:
setDescription in interface Task

setDescriptionWithoutCascade

public void setDescriptionWithoutCascade(String description)

setAssignee

public void setAssignee(String assignee)
Description copied from interface: Task
The userId of the person to which this task is assigned or delegated.

Specified by:
setAssignee in interface DelegateTask
Specified by:
setAssignee in interface Task

setAssigneeWithoutCascade

public void setAssigneeWithoutCascade(String assignee)

setOwner

public void setOwner(String owner)
Description copied from interface: Task
The userId of the person that is responsible for this task. This is used when a task is delegated.

Specified by:
setOwner in interface DelegateTask
Specified by:
setOwner in interface Task

setOwnerWithoutCascade

public void setOwnerWithoutCascade(String owner)

setDueDate

public void setDueDate(Date dueDate)
Description copied from interface: Task
Change due date of the task.

Specified by:
setDueDate in interface DelegateTask
Specified by:
setDueDate in interface Task

setDueDateWithoutCascade

public void setDueDateWithoutCascade(Date dueDate)

setPriority

public void setPriority(int priority)
Description copied from interface: Task
indication of how important/urgent this task is with a number between 0 and 100 where higher values mean a higher priority and lower values mean lower priority: [0..19] lowest, [20..39] low, [40..59] normal, [60..79] high [80..100] highest

Specified by:
setPriority in interface DelegateTask
Specified by:
setPriority in interface Task

setPriorityWithoutCascade

public void setPriorityWithoutCascade(int priority)

setParentTaskId

public void setParentTaskId(String parentTaskId)
Description copied from interface: Task
the parent task for which this task is a subtask

Specified by:
setParentTaskId in interface Task

setParentTaskIdWithoutCascade

public void setParentTaskIdWithoutCascade(String parentTaskId)

setTaskDefinitionKeyWithoutCascade

public void setTaskDefinitionKeyWithoutCascade(String taskDefinitionKey)

fireEvent

public void fireEvent(String taskEventName)

setTaskDefinition

public void setTaskDefinition(TaskDefinition taskDefinition)

getTaskDefinition

public TaskDefinition getTaskDefinition()

getRevision

public int getRevision()
Specified by:
getRevision in interface HasRevision

setRevision

public void setRevision(int revision)
Specified by:
setRevision in interface HasRevision

getName

public String getName()
Description copied from interface: Task
Name or title of the task.

Specified by:
getName in interface DelegateTask
Specified by:
getName in interface Task

getDescription

public String getDescription()
Description copied from interface: Task
Free text description of the task.

Specified by:
getDescription in interface DelegateTask
Specified by:
getDescription in interface Task

getDueDate

public Date getDueDate()
Description copied from interface: Task
Due date of the task.

Specified by:
getDueDate in interface DelegateTask
Specified by:
getDueDate in interface Task

getPriority

public int getPriority()
Description copied from interface: Task
indication of how important/urgent this task is with a number between 0 and 100 where higher values mean a higher priority and lower values mean lower priority: [0..19] lowest, [20..39] low, [40..59] normal, [60..79] high [80..100] highest

Specified by:
getPriority in interface DelegateTask
Specified by:
getPriority in interface Task

getCreateTime

public Date getCreateTime()
Description copied from interface: Task
The date/time when this task was created

Specified by:
getCreateTime in interface DelegateTask
Specified by:
getCreateTime in interface Task

setCreateTime

public void setCreateTime(Date createTime)

getExecutionId

public String getExecutionId()
Description copied from interface: Task
Reference to the path of execution or null if it is not related to a process instance.

Specified by:
getExecutionId in interface DelegateTask
Specified by:
getExecutionId in interface Task

getProcessInstanceId

public String getProcessInstanceId()
Description copied from interface: Task
Reference to the process instance or null if it is not related to a process instance.

Specified by:
getProcessInstanceId in interface DelegateTask
Specified by:
getProcessInstanceId in interface Task

getProcessDefinitionId

public String getProcessDefinitionId()
Description copied from interface: Task
Reference to the process definition or null if it is not related to a process.

Specified by:
getProcessDefinitionId in interface DelegateTask
Specified by:
getProcessDefinitionId in interface Task

setProcessDefinitionId

public void setProcessDefinitionId(String processDefinitionId)

getAssignee

public String getAssignee()
Description copied from interface: Task
The userId of the person to which this task is assigned or delegated.

Specified by:
getAssignee in interface DelegateTask
Specified by:
getAssignee in interface Task

getTaskDefinitionKey

public String getTaskDefinitionKey()
Description copied from interface: Task
The id of the activity in the process defining this task or null if this is not related to a process

Specified by:
getTaskDefinitionKey in interface DelegateTask
Specified by:
getTaskDefinitionKey in interface Task

setTaskDefinitionKey

public void setTaskDefinitionKey(String taskDefinitionKey)

getEventName

public String getEventName()
Description copied from interface: DelegateTask
Returns the event name which triggered the task listener to fire for this task.

Specified by:
getEventName in interface DelegateTask

setEventName

public void setEventName(String eventName)

setExecutionId

public void setExecutionId(String executionId)

getProcessInstance

public ExecutionEntity getProcessInstance()

setProcessInstance

public void setProcessInstance(ExecutionEntity processInstance)

setExecution

public void setExecution(ExecutionEntity execution)

setProcessInstanceId

public void setProcessInstanceId(String processInstanceId)

getOwner

public String getOwner()
Description copied from interface: Task
The userId of the person that is responsible for this task. This is used when a task is delegated.

Specified by:
getOwner in interface DelegateTask
Specified by:
getOwner in interface Task

getDelegationState

public DelegationState getDelegationState()
Description copied from interface: Task
The current DelegationState for this task.

Specified by:
getDelegationState in interface Task

setDelegationState

public void setDelegationState(DelegationState delegationState)
Description copied from interface: Task
The current DelegationState for this task.

Specified by:
setDelegationState in interface Task

getDelegationStateString

public String getDelegationStateString()

setDelegationStateString

public void setDelegationStateString(String delegationStateString)

isDeleted

public boolean isDeleted()

setDeleted

public void setDeleted(boolean isDeleted)

getParentTaskId

public String getParentTaskId()
Description copied from interface: Task
the parent task for which this task is a subtask

Specified by:
getParentTaskId in interface Task

getVariableInstances

public Map<String,VariableInstanceEntity> getVariableInstances()

getSuspensionState

public int getSuspensionState()

setSuspensionState

public void setSuspensionState(int suspensionState)

isSuspended

public boolean isSuspended()
Description copied from interface: Task
Indicated whether this task is suspended or not.

Specified by:
isSuspended in interface Task

getFollowUpDate

public Date getFollowUpDate()
Description copied from interface: Task
Follow-up date of the task.

Specified by:
getFollowUpDate in interface Task

setFollowUpDate

public void setFollowUpDate(Date followUpDate)
Description copied from interface: Task
Change follow-up date of the task.

Specified by:
setFollowUpDate in interface Task

setFollowUpDateWithoutCascade

public void setFollowUpDateWithoutCascade(Date followUpDate)

onCommandContextClose

public void onCommandContextClose(CommandContext commandContext)
Specified by:
onCommandContextClose in interface CommandContextCloseListener

registerCommandContextCloseListener

protected void registerCommandContextCloseListener()


Copyright © 2014 camunda services GmbH. All Rights Reserved.