API: tasks
Source:
bpm/tasks.ts
API Tasks
Classes
Tasks
API Tasks
Methods
list
list ():TaskData[]
getVariable
getVariable (taskId:string, variableName:string):any
getVariables
getVariables (taskId:string):Map<string,any>Returns all variables. This will include all variables of parent scopes too.
setVariable
setVariable (taskId:string, variableName:string, value:any):voidReturns all variables. This will include all variables of parent scopes too.
setVariables
setVariables (taskId:string, variables:Map<string, any>):void
complete
complete (taskId:string, variables:{[key:string]:any}={}):void
getTaskService
getTaskService ():TaskService
TaskService
Service which provides access to {@link Task} and form related operations.
Methods
newTask
newTask (taskId?:string):TaskCreates a new task that is not related to any process instance.
The returned task is transient and must be saved with {@link #saveTask(Task)} 'manually'.
createTaskBuilder
createTaskBuilder ():TaskBuilderCreate a builder for the task
@return task builder
saveTask
saveTask (task:Task):voidSaves the given task to the persistent data store. If the task is already present in the persistent store, it is updated. After a new task has been saved, the task instance passed into this
method is updated with the id of the newly created task.
@param task
the task, cannot be null.
bulkSaveTasks
bulkSaveTasks (taskList:Task[]):voidSaves the given tasks to the persistent data store. If the tasks are already present in the persistent store, it is updated. After a new task has been saved, the task instance passed into this
method is updated with the id of the newly created task.
@param taskList the list of task instances, cannot be null.
deleteTask
deleteTask (taskId:string, cascade?:boolean):voidDeletes the given task, not deleting historic information that is related to this task.
@param taskId
The id of the task that will be deleted, cannot be null. If no task exists with the given taskId, the operation is ignored.
@param cascade
If cascade is true, also the historic information related to this task is deleted.
@throws FlowableObjectNotFoundException
when the task with given id does not exist.
@throws FlowableException
when an error occurs while deleting the task or in case the task is part of a running process.
deleteTasks
deleteTasks (taskIds:string[], cascade?:boolean):voidDeletes all tasks of the given collection, not deleting historic information that is related to these tasks.
@param taskIds
The id's of the tasks that will be deleted, cannot be null. All id's in the list that don't have an existing task will be ignored.
@param cascade
If cascade is true, also the historic information related to this task is deleted.
@throws FlowableObjectNotFoundException
when one of the task does not exist.
@throws FlowableException
when an error occurs while deleting the tasks or in case one of the tasks is part of a running process.
deleteTaskWithReason
deleteTaskWithReason (taskId:string, deleteReason:string):voidDeletes the given task, not deleting historic information that is related to this task..
@param taskId
The id of the task that will be deleted, cannot be null. If no task exists with the given taskId, the operation is ignored.
@param deleteReason
reason the task is deleted. Is recorded in history, if enabled.
@throws FlowableObjectNotFoundException
when the task with given id does not exist.
@throws FlowableException
when an error occurs while deleting the task or in case the task is part of a running process
deleteTasksWithReason
deleteTasksWithReason (taskIds:string[], deleteReason:string):voidDeletes all tasks of the given collection, not deleting historic information that is related to these tasks.
@param taskIds
The id's of the tasks that will be deleted, cannot be null. All id's in the list that don't have an existing task will be ignored.
@param deleteReason
reason the task is deleted. Is recorded in history, if enabled.
@throws FlowableObjectNotFoundException
when one of the tasks does not exist.
@throws FlowableException
when an error occurs while deleting the tasks or in case one of the tasks is part of a running process.
claim
claim (taskId:string, userId:string):voidClaim responsibility for a task: the given user is made assignee for the task. The difference with {@link #setAssignee(String, String)} is that here a check is done if the task already has a
user assigned to it. No check is done whether the user is known by the identity component.
@param taskId
task to claim, cannot be null.
@param userId
user that claims the task. When userId is null the task is unclaimed, assigned to no one.
@throws FlowableObjectNotFoundException
when the task doesn't exist.
@throws org.flowable.common.engine.api.FlowableTaskAlreadyClaimedException
when the task is already claimed by another user
unclaim
unclaim (taskId:string):voidA shortcut to {@link #claim} with null user in order to unclaim the task
@param taskId
task to unclaim, cannot be null.
@throws FlowableObjectNotFoundException
when the task doesn't exist.
startProgress
startProgress (taskId:string, userId:string):voidSet the task state to in progress. No check is done whether the user is known by the identity component.
@param taskId
task to change the state, cannot be null.
@param userId
user that puts the task in progress.
@throws FlowableObjectNotFoundException
when the task doesn't exist.
suspendTask
suspendTask (taskId:string, userId:string):voidSuspends the task. No check is done whether the user is known by the identity component.
@param taskId
task to suspend, cannot be null.
@param userId
user that suspends the task.
@throws FlowableObjectNotFoundException
when the task doesn't exist.
activateTask
activateTask (taskId:string, userId:string):voidActivates the task. No check is done whether the user is known by the identity component.
@param taskId
task to activate, cannot be null.
@param userId
user that activates the task.
@throws FlowableObjectNotFoundException
when the task doesn't exist.
delegateTask
delegateTask (taskId:string, userId:string):voidDelegates the task to another user. This means that the assignee is set and the delegation state is set to {@link DelegationState#PENDING}. If no owner is set on the task, the owner is set to
the current assignee of the task.
@param taskId
The id of the task that will be delegated.
@param userId
The id of the user that will be set as assignee.
@throws FlowableObjectNotFoundException
when no task exists with the given id.
resolveTask
resolveTask (taskId:string, variables?:Map<string, any>, transientVariables?:Map<string, any>):voidMarks that the assignee is done with this task and that it can be send back to the owner. Can only be called when this task is {@link DelegationState#PENDING} delegation. After this method
returns, the {@link Task#getDelegationState() delegationState} is set to {@link DelegationState#RESOLVED}.
@param taskId
the id of the task to resolve, cannot be null.
@param variables
@param transientVariables
@throws FlowableObjectNotFoundException
when no task exists with the given id.
complete
complete (taskId:string, userId?:string, variables?:Map<string, any>, transientVariables?:Map<string, any>, localScope?:boolean):voidCalled when the task is successfully executed.
@param taskId
the id of the task to complete, cannot be null.
@param userId
user that completes the task.
@param variables
task parameters. May be null or empty.
@param transientVariables
task parameters. May be null or empty.
@param localScope
If true, the provided variables will be stored task-local, instead of process instance wide (which is the default behaviour).
@throws FlowableObjectNotFoundException
when no task exists with the given id.
@throws FlowableException
when this task is {@link DelegationState#PENDING} delegation.
completeTaskWithForm
completeTaskWithForm (taskId:string, formDefinitionId:string, outcome:string, variables:Map<String, any>, userId?:string, transientVariables?:Map<String, any>, localScope?:boolean):voidCalled when the task is successfully executed, and the task form has been submitted.
@param taskId
the id of the task to complete, cannot be null.
@param formDefinitionId
the id of the form definition that is filled-in to complete the task, cannot be null.
@param outcome
the outcome of the completed form, can be null.
@param variables
values of the completed form. May be null or empty.
@param userId
user that completes the task.
@param transientVariables
additional transient values that need to added to the process instance transient variables. May be null or empty.
@param localScope
If true, the provided variables will be stored task-local, instead of process instance wide (which is the default for {@link #complete(String, Map)}).
@throws FlowableObjectNotFoundException
when no task exists with the given id.
getTaskFormModel
getTaskFormModel (taskId:string, ignoreVariables?:boolean):FormInfoGets a Form model instance of the task form of a specific task
@param taskId
id of the task, cannot be null.
@param ignoreVariables
should the variables be ignored when fetching the form model?
@throws FlowableObjectNotFoundException
when the task or form definition doesn't exist.
setAssignee
setAssignee (taskId:string, userId:string):voidChanges the assignee of the given task to the given userId. No check is done whether the user is known by the identity component.
@param taskId
id of the task, cannot be null.
@param userId
id of the user to use as assignee.
@throws FlowableObjectNotFoundException
when the task or user doesn't exist.
setOwner
setOwner (taskId:string, userId:string):voidTransfers ownership of this task to another user. No check is done whether the user is known by the identity component.
@param taskId
id of the task, cannot be null.
@param userId
of the person that is receiving ownership.
@throws FlowableObjectNotFoundException
when the task or user doesn't exist.
getIdentityLinksForTask
getIdentityLinksForTask (taskId:string):IdentityLink[]Retrieves the {@link IdentityLink}s associated with the given task. Such an {@link IdentityLink} informs how a certain identity (eg. group or user) is associated with a certain task (eg. as
candidate, assignee, etc.)
addCandidateUser
addCandidateUser (taskId:string, userId:string):voidConvenience shorthand for {@link #addUserIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
@param taskId
id of the task, cannot be null.
@param userId
id of the user to use as candidate, cannot be null.
@throws FlowableObjectNotFoundException
when the task or user doesn't exist.
addCandidateGroup
addCandidateGroup (taskId:string, groupId:string):voidConvenience shorthand for {@link #addGroupIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
@param taskId
id of the task, cannot be null.
@param groupId
id of the group to use as candidate, cannot be null.
@throws FlowableObjectNotFoundException
when the task or group doesn't exist.
addUserIdentityLink
addUserIdentityLink (taskId:string, userId:string, identityLinkType:string):voidInvolves a user with a task. The type of identity link is defined by the given identityLinkType.
@param taskId
id of the task, cannot be null.
@param userId
id of the user involve, cannot be null.
@param identityLinkType
type of identityLink, cannot be null (@see {@link IdentityLinkType}).
@throws FlowableObjectNotFoundException
when the task or user doesn't exist.
addGroupIdentityLink
addGroupIdentityLink (taskId:string, groupId:string, identityLinkType:string):voidInvolves a group with a task. The type of identityLink is defined by the given identityLink.
@param taskId
id of the task, cannot be null.
@param groupId
id of the group to involve, cannot be null.
@param identityLinkType
type of identity, cannot be null (@see {@link IdentityLinkType}).
@throws FlowableObjectNotFoundException
when the task or group doesn't exist.
deleteCandidateUser
deleteCandidateUser (taskId:string, userId:string):voidConvenience shorthand for {@link #deleteUserIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
@param taskId
id of the task, cannot be null.
@param userId
id of the user to use as candidate, cannot be null.
@throws FlowableObjectNotFoundException
when the task or user doesn't exist.
deleteCandidateGroup
deleteCandidateGroup (taskId:string, groupId:string):voidConvenience shorthand for {@link #deleteGroupIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
@param taskId
id of the task, cannot be null.
@param groupId
id of the group to use as candidate, cannot be null.
@throws FlowableObjectNotFoundException
when the task or group doesn't exist.
deleteUserIdentityLink
deleteUserIdentityLink (taskId:string, userId:string, identityLinkType:string):voidRemoves the association between a user and a task for the given identityLinkType.
@param taskId
id of the task, cannot be null.
@param userId
id of the user involve, cannot be null.
@param identityLinkType
type of identityLink, cannot be null (@see {@link IdentityLinkType}).
@throws FlowableObjectNotFoundException
when the task or user doesn't exist.
deleteGroupIdentityLink
deleteGroupIdentityLink (taskId:string, groupId:string, identityLinkType:string):voidRemoves the association between a group and a task for the given identityLinkType.
@param taskId
id of the task, cannot be null.
@param groupId
id of the group to involve, cannot be null.
@param identityLinkType
type of identity, cannot be null (@see {@link IdentityLinkType}).
@throws FlowableObjectNotFoundException
when the task or group doesn't exist.
setPriority
setPriority (taskId:string, priority:number):voidChanges the priority of the task.
Authorization: actual owner / business admin
@param taskId
id of the task, cannot be null.
@param priority
the new priority for the task.
@throws FlowableObjectNotFoundException
when the task doesn't exist.
setDueDate
setDueDate (taskId:string, dueDate:Date):voidChanges the due date of the task
@param taskId
id of the task, cannot be null.
@param dueDate
the new due date for the task
@throws FlowableException
when the task doesn't exist.
setVariable
setVariable (taskId:string, variableName:string, value:any):voidset variable on a task. If the variable is not already existing, it will be created in the most outer scope. This means the process instance in case this task is related to an execution.
setVariables
setVariables (taskId:string, variables:Map<string, any>):voidset variables on a task. If the variable is not already existing, it will be created in the most outer scope. This means the process instance in case this task is related to an execution.
setVariableLocal
setVariableLocal (taskId:string, variableName:string, value:any):voidset variable on a task. If the variable is not already existing, it will be created in the task.
setVariablesLocal
setVariablesLocal (taskId:string, variables:Map<string, any>):voidset variables on a task. If the variable is not already existing, it will be created in the task.
getVariable
getVariable (taskId:string, variableName:string):anyget a variables and search in the task scope and if available also the execution scopes.
getVariableInstance
getVariableInstance (taskId:string, variableName:string):VariableInstanceThe variable. Searching for the variable is done in all scopes that are visible to the given task (including parent scopes). Returns null when no variable value is found with the given name.
@param taskId
id of task, cannot be null.
@param variableName
name of variable, cannot be null.
@return the variable or null if the variable is undefined.
@throws FlowableObjectNotFoundException
when no execution is found for the given taskId.
hasVariable
hasVariable (taskId:string, variableName:string):booleanchecks whether or not the task has a variable defined with the given name, in the task scope and if available also the execution scopes.
getVariableLocal
getVariableLocal (taskId:string, variableName:string):anychecks whether or not the task has a variable defined with the given name.
getVariableInstanceLocal
getVariableInstanceLocal (taskId:string, variableName:string):VariableInstanceThe variable for a task. Returns the variable when it is set for the task (and not searching parent scopes). Returns null when no variable is found with the given name.
@param taskId
id of task, cannot be null.
@param variableName
name of variable, cannot be null.
@return the variable or null if the variable is undefined.
@throws FlowableObjectNotFoundException
when no task is found for the given taskId.
hasVariableLocal
hasVariableLocal (taskId:string, variableName:string):booleanchecks whether or not the task has a variable defined with the given name, local task scope only.
getVariables
getVariables (taskId:string, variableNames?:string[]):Map<string,any>get all variables and search in the task scope and if available also the execution scopes. If you have many variables and you only need a few, consider using
{@link #getVariables(String, Collection)} for better performance.
getVariableInstances
getVariableInstances (taskId:string, variableNames?:string[]):Map<string,VariableInstance>All variables visible from the given task scope (including parent scopes).
@param taskId
id of task, cannot be null.
@param variableNames
the collection of variable names that should be retrieved.
@return the variable instances or an empty map if no such variables are found.
@throws FlowableObjectNotFoundException
when no task is found for the given taskId.
getVariablesLocal
getVariablesLocal (taskId:string, variableNames?:string[]):Map<string,any>get all variables and search only in the task scope. If you have many task local variables and you only need a few, consider using {@link #getVariablesLocal(String, Collection)} for better
performance.
getVariableInstancesLocalByTaskIds
getVariableInstancesLocalByTaskIds (taskIds:Set<string>):VariableInstance[]get all variables and search only in the task scope.
getVariableInstancesLocal
getVariableInstancesLocal (taskId:string, variableNames?:string[]):Map<string,VariableInstance>All variable values that are defined in the task scope, without taking outer scopes into account. If you have many task local variables and you only need a few, consider using
{@link #getVariableInstancesLocal(String, Collection)} for better performance.
@param taskId
id of task, cannot be null.
@return the variables or an empty map if no such variables are found.
@throws FlowableObjectNotFoundException
when no task is found for the given taskId.
removeVariable
removeVariable (taskId:string, variableName:string):voidRemoves the variable from the task. When the variable does not exist, nothing happens.
removeVariableLocal
removeVariableLocal (taskId:string, variableName:string):voidRemoves the variable from the task (not considering parent scopes). When the variable does not exist, nothing happens.
removeVariables
removeVariables (taskId:string, variableNames:string[]):voidRemoves all variables in the given collection from the task. Non existing variable names are simply ignored.
removeVariablesLocal
removeVariablesLocal (taskId:string, variableNames:string[]):voidRemoves all variables in the given collection from the task (not considering parent scopes). Non existing variable names are simply ignored.
getDataObjects
getDataObjects (taskId:string, dataObjectNames?:string[], locale?:string, withLocalizationFallback?:boolean):Map<string,DataObject>All DataObjects visible from the given execution scope (including parent scopes).
@param taskId
id of task, cannot be null.
@param dataObjectNames
the collection of DataObject names that should be retrieved.
@param locale
locale the DataObject name and description should be returned in (if available).
@param withLocalizationFallback
When true localization will fallback to more general locales if the specified locale is not found.
@return the DataObjects or an empty map if no such variables are found.
@throws FlowableObjectNotFoundException
when no task is found for the given taskId.
getDataObject
getDataObject (taskId:string, dataObject:string, locale?:string, withLocalizationFallback?:boolean):DataObjectThe DataObject. Searching for the DataObject is done in all scopes that are visible to the given task (including parent scopes). Returns null when no DataObject value is found with the given
name.
@param taskId
id of task, cannot be null.
@param dataObject
name of DataObject, cannot be null.
@param locale
locale the DataObject name and description should be returned in (if available).
@param withLocalizationFallback
When true localization will fallback to more general locales including the default locale of the JVM if the specified locale is not found.
@return the DataObject or null if the variable is undefined.
@throws FlowableObjectNotFoundException
when no task is found for the given taskId.
addComment
addComment (taskId:string, processInstanceId:string, message:string, type?:string):CommentAdd a comment to a task and/or process instance.
saveComment
saveComment (comment:Comment):voidUpdate a comment to a task and/or process instance.
getComment
getComment (commentId:string):CommentReturns an individual comment with the given id. Returns null if no comment exists with the given id.
deleteComments
deleteComments (taskId:string, processInstanceId:string):voidRemoves all comments from the provided task and/or process instance
deleteComment
deleteComment (commentId:string):voidRemoves an individual comment with the given id.
@throws FlowableObjectNotFoundException
when no comment exists with the given id.
getTaskComments
getTaskComments (taskId:string, type?:string):Comment[]The comments related to the given task.
getCommentsByType
getCommentsByType (type:string):Comment[]All comments of a given type.
getTaskEvents
getTaskEvents (taskId:string):TaskEvent[]The all events related to the given task.
getEvent
getEvent (eventId:string):TaskEventReturns an individual event with the given id. Returns null if no event exists with the given id.
getProcessInstanceComments
getProcessInstanceComments (processInstanceId:string, type?:string):Comment[]The comments related to the given process instance.
createAttachment
createAttachment (attachmentType:string, taskId:string, processInstanceId:string, attachmentName:string, attachmentDescription:string, content?:any[], url?:string):AttachmentAdd a new attachment to a task and/or a process instance and use an input stream to provide the content
saveAttachment
saveAttachment (attachment:Attachment):voidUpdate the name and description of an attachment
getAttachment
getAttachment (attachmentId:string):AttachmentRetrieve a particular attachment
getAttachmentContent
getAttachmentContent (attachmentId:string):any[]Retrieve stream content of a particular attachment
getTaskAttachments
getTaskAttachments (taskId:string):Attachment[]The list of attachments associated to a task
getProcessInstanceAttachments
getProcessInstanceAttachments (processInstanceId:string):Attachment[]The list of attachments associated to a process instance
deleteAttachment
deleteAttachment (attachmentId:string):voidDelete an attachment
getSubTasks
getSubTasks (parentTaskId:string):Task[]The list of subtasks for this parent task
isNotNull
isNotNull (property:any):booleanThe list of subtasks for this parent task
TaskData
Methods
getId
getId ():string|undefined
getRevision
getRevision ():number
getOwner
getOwner ():string|undefined
getAssigneeUpdatedCount
getAssigneeUpdatedCount ():number
getOriginalAssignee
getOriginalAssignee ():string|undefined
getAssignee
getAssignee ():string|undefined
getDelegationState
getDelegationState ():string|undefined
getParentTaskId
getParentTaskId ():string|undefined
getName
getName ():string|undefined
getLocalizedName
getLocalizedName ():string|undefined
getDescription
getDescription ():string|undefined
getLocalizedDescription
getLocalizedDescription ():string|undefined
getPriority
getPriority ():number
getCreateTime
getCreateTime ():Date|undefined
getDueDate
getDueDate ():Date|undefined
getSuspensionState
getSuspensionState ():number
getCategory
getCategory ():string|undefined
isIdentityLinksInitialized
isIdentityLinksInitialized ():boolean
getExecutionId
getExecutionId ():string|undefined
getProcessInstanceId
getProcessInstanceId ():string|undefined
getProcessDefinitionId
getProcessDefinitionId ():string|undefined
getScopeId
getScopeId ():string|undefined
getSubScopeId
getSubScopeId ():string|undefined
getScopeType
getScopeType ():string|undefined
getScopeDefinitionId
getScopeDefinitionId ():string|undefined
getTaskDefinitionKey
getTaskDefinitionKey ():string|undefined
getFormKey
getFormKey ():string|undefined
isDeleted
isDeleted ():boolean
isCanceled
isCanceled ():boolean
isCountEnabled
isCountEnabled ():boolean
getVariableCount
getVariableCount ():number
getIdentityLinkCount
getIdentityLinkCount ():number
getClaimTime
getClaimTime ():Date|undefined
getTenantId
getTenantId ():string
getEventName
getEventName ():string|undefined
getEventHandlerId
getEventHandlerId ():string|undefined
isForcedUpdate
isForcedUpdate ():boolean