Interface HvlBpmnTaskService

All Known Implementing Classes:
HvlBpmnTaskServiceImpl

@Validated public interface HvlBpmnTaskService
This service provides operational and retrieve methods.
  • Method Details

    • newTask

      org.flowable.task.api.Task newTask()
      Creates a new task that is not related to any process instance.

      The returned task is transient and must be saved with saveTask(Task) 'manually'.

      Returns:
      the task
    • newTask

      org.flowable.task.api.Task newTask(@NotBlank @NotBlank String taskId)
      create a new task with a user defined task id
      Parameters:
      taskId - the task id
      Returns:
      the task
    • createTaskBuilder

      org.flowable.task.api.TaskBuilder createTaskBuilder()
      Create a builder for the task
      Returns:
      task builder
    • createTaskCompletionBuilder

      org.flowable.task.api.TaskCompletionBuilder createTaskCompletionBuilder()
      Create a completion builder for the task
      Returns:
      task completion builder
    • saveTask

      void saveTask(@NotNull @NotNull org.flowable.task.api.Task task)
      Saves 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.
      Parameters:
      task - the task, cannot be null.
    • deleteTask

      void deleteTask(@NotNull @NotNull HvlBpmnDeleteTaskModel deleteTaskModel)
      Deletes the given task, not deleting historic information that is related to this task.
      Parameters:
      deleteTaskModel - the delete task model
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task with given id does not exist.
      org.flowable.common.engine.api.FlowableException - when an error occurs while deleting the task or in case the task is part of a running process.
    • claim

      void claim(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId)
      Claim responsibility for a task: the given user is made assignee for the task. The difference with 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.
      Parameters:
      taskId - task to claim, cannot be null.
      userId - user that claims the task. When userId is null the task is unclaimed, assigned to no one.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task doesn't exist.
      org.flowable.common.engine.api.FlowableTaskAlreadyClaimedException - when the task is already claimed by another user
    • unclaim

      void unclaim(@NotBlank @NotBlank String taskId)
      A shortcut to claim(java.lang.String, java.lang.String) with null user in order to unclaim the task
      Parameters:
      taskId - task to unclaim, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task doesn't exist.
    • complete

      void complete(@NotNull @NotNull HvlBpmnCompleteTaskModel completeTaskModel)
      Called when the task is successfully executed.
      Parameters:
      completeTaskModel - the complete task model
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no task exists with the given id.
      org.flowable.common.engine.api.FlowableException - when this task is DelegationState.PENDING delegation.
    • delegateTask

      void delegateTask(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId)
      Delegates the task to another user. This means that the assignee is set and the delegation state is set to DelegationState.PENDING. If no owner is set on the task, the owner is set to the current assignee of the task.
      Parameters:
      taskId - The id of the task that will be delegated.
      userId - The id of the user that will be set as assignee.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no task exists with the given id.
    • resolveTask

      void resolveTask(@NotNull @NotNull HvlBpmnResolveTaskModel resolveTaskModel)
      Marks 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 DelegationState.PENDING delegation. After this method returns, the delegationState is set to DelegationState.RESOLVED.
      Parameters:
      resolveTaskModel - the resolve task model
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no task exists with the given id.
    • setAssignee

      void setAssignee(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId)
      Changes the assignee of the given task to the given userId. No check is done whether the user is known by the identity component.
      Parameters:
      taskId - id of the task, cannot be null.
      userId - id of the user to use as assignee.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • setOwner

      void setOwner(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId)
      Transfers ownership of this task to another user. No check is done whether the user is known by the identity component.
      Parameters:
      taskId - id of the task, cannot be null.
      userId - of the person that is receiving ownership.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • getIdentityLinksForTask

      List<org.flowable.identitylink.api.IdentityLink> getIdentityLinksForTask(@NotBlank @NotBlank String taskId)
      Retrieves the IdentityLinks associated with the given task. Such an IdentityLink informs how a certain identity (eg. group or user) is associated with a certain task (eg. as candidate, assignee, etc.)
      Parameters:
      taskId - the task id
      Returns:
      the identity links for task
    • addCandidateUser

      void addCandidateUser(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId)
      Convenience shorthand for addUserIdentityLink(String, String, String); with type IdentityLinkType.CANDIDATE
      Parameters:
      taskId - id of the task, cannot be null.
      userId - id of the user to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • addCandidateGroup

      void addCandidateGroup(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String groupId)
      Convenience shorthand for addGroupIdentityLink(String, String, String); with type IdentityLinkType.CANDIDATE
      Parameters:
      taskId - id of the task, cannot be null.
      groupId - id of the group to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • addUserIdentityLink

      void addUserIdentityLink(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId, @NotBlank @NotBlank String identityLinkType)
      Involves a user with a task. The type of identity link is defined by the given identityLinkType.
      Parameters:
      taskId - id of the task, cannot be null.
      userId - id of the user involve, cannot be null.
      identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • addGroupIdentityLink

      void addGroupIdentityLink(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String groupId, @NotBlank @NotBlank String identityLinkType)
      Involves a group with a task. The type of identityLink is defined by the given identityLink.
      Parameters:
      taskId - id of the task, cannot be null.
      groupId - id of the group to involve, cannot be null.
      identityLinkType - type of identity, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • deleteCandidateUser

      void deleteCandidateUser(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId)
      Convenience shorthand for deleteUserIdentityLink(String, String, String); with type IdentityLinkType.CANDIDATE
      Parameters:
      taskId - id of the task, cannot be null.
      userId - id of the user to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • deleteCandidateGroup

      void deleteCandidateGroup(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String groupId)
      Convenience shorthand for deleteGroupIdentityLink(String, String, String); with type IdentityLinkType.CANDIDATE
      Parameters:
      taskId - id of the task, cannot be null.
      groupId - id of the group to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • deleteUserIdentityLink

      void deleteUserIdentityLink(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String userId, @NotBlank @NotBlank String identityLinkType)
      Removes the association between a user and a task for the given identityLinkType.
      Parameters:
      taskId - id of the task, cannot be null.
      userId - id of the user involve, cannot be null.
      identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • deleteGroupIdentityLink

      void deleteGroupIdentityLink(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String groupId, @NotBlank @NotBlank String identityLinkType)
      Removes the association between a group and a task for the given identityLinkType.
      Parameters:
      taskId - id of the task, cannot be null.
      groupId - id of the group to involve, cannot be null.
      identityLinkType - type of identity, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • setPriority

      void setPriority(@NotBlank @NotBlank String taskId, int priority)
      Changes the priority of the task.

      Authorization: actual owner / business admin

      Parameters:
      taskId - id of the task, cannot be null.
      priority - the new priority for the task.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task doesn't exist.
    • setDueDate

      void setDueDate(@NotBlank @NotBlank String taskId, Date dueDate)
      Changes the due date of the task
      Parameters:
      taskId - id of the task, cannot be null.
      dueDate - the new due date for the task
      Throws:
      org.flowable.common.engine.api.FlowableException - when the task doesn't exist.
    • createTaskQuery

      org.flowable.task.api.TaskQuery createTaskQuery()
      Returns a new TaskQuery that can be used to dynamically query tasks.
      Returns:
      the task query
    • createNativeTaskQuery

      org.flowable.task.api.NativeTaskQuery createNativeTaskQuery()
      Returns a new NativeQuery for tasks.
      Returns:
      the native task query
    • setVariable

      void setVariable(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String variableName, Object value)
      set 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.
      Parameters:
      taskId - the task id
      variableName - the variable name
      value - the value
    • setVariables

      void setVariables(@NotBlank @NotBlank String taskId, @NotEmpty @NotEmpty Map<String,? extends Object> variables)
      set 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.
      Parameters:
      taskId - the task id
      variables - the variables
    • setVariableLocal

      void setVariableLocal(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String variableName, Object value)
      set variable on a task. If the variable is not already existing, it will be created in the task.
      Parameters:
      taskId - the task id
      variableName - the variable name
      value - the value
    • setVariablesLocal

      void setVariablesLocal(@NotBlank @NotBlank String taskId, @NotEmpty @NotEmpty Map<String,? extends Object> variables)
      set variables on a task. If the variable is not already existing, it will be created in the task.
      Parameters:
      taskId - the task id
      variables - the variables
    • queryVariables

      Map<String,Object> queryVariables(@NotNull @NotNull HvlBpmnTaskVariableQueryModel taskVariableQueryModel)
      Query variable objects map.
      Parameters:
      taskVariableQueryModel - the task variable query model
      Returns:
      the map
    • queryVariableInstances

      Map<String,org.flowable.variable.api.persistence.entity.VariableInstance> queryVariableInstances(@NotNull @NotNull HvlBpmnTaskVariableQueryModel taskVariableQueryModel)
      Query variable instances map.
      Parameters:
      taskVariableQueryModel - the task variable query model
      Returns:
      the map
    • getVariable

      Object getVariable(@NotNull @NotNull HvlBpmnTaskVariableQueryModel taskVariableQueryModel)
      get a variables and search in the task scope and if available also the execution scopes.
      Parameters:
      taskVariableQueryModel - the task variable query model
      Returns:
      the variable
    • getVariable

      <T> T getVariable(@NotNull @NotNull HvlBpmnTaskVariableQueryModel taskVariableQueryModel, @NotNull @NotNull Class<T> variableClass)
      get a variables and search in the task scope and if available also the execution scopes.
      Type Parameters:
      T - the type parameter
      Parameters:
      taskVariableQueryModel - the task variable query model
      variableClass - the variable class
      Returns:
      the variable
    • getVariableInstance

      org.flowable.variable.api.persistence.entity.VariableInstance getVariableInstance(@NotNull @NotNull HvlBpmnTaskVariableQueryModel taskVariableQueryModel)
      The 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.
      Parameters:
      taskVariableQueryModel - the task variable query model
      Returns:
      the variable or null if the variable is undefined.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given taskId.
    • getVariableInstancesLocalByTaskIds

      List<org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstancesLocalByTaskIds(@NotEmpty @NotEmpty Set<String> taskIds)
      get all variables and search only in the task scope.
      Parameters:
      taskIds - the task ids
      Returns:
      the variable instances local by task ids
    • hasVariable

      boolean hasVariable(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String variableName)
      checks whether or not the task has a variable defined with the given name, in the task scope and if available also the execution scopes.
      Parameters:
      taskId - the task id
      variableName - the variable name
      Returns:
      the boolean
    • hasVariableLocal

      boolean hasVariableLocal(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String variableName)
      checks whether or not the task has a variable defined with the given name, local task scope only.
      Parameters:
      taskId - the task id
      variableName - the variable name
      Returns:
      the boolean
    • removeVariable

      void removeVariable(@NotNull @NotNull HvlBpmnTaskVariableQueryModel taskVariableQueryModel)
      Removes the variable from the task. When the variable does not exist, nothing happens.
      Parameters:
      taskVariableQueryModel - the task variable query model
    • getDataObjects

      Map<String,org.flowable.engine.runtime.DataObject> getDataObjects(@NotNull @NotNull HvlBpmnTaskDataObjectQueryModel taskDataObjectQueryModel)
      All DataObjects visible from the given execution scope (including parent scopes).
      Parameters:
      taskDataObjectQueryModel - the task data object query model
      Returns:
      the DataObjects or an empty map if no such variables are found.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no task is found for the given taskId.
    • getDataObject

      org.flowable.engine.runtime.DataObject getDataObject(@NotNull @NotNull HvlBpmnTaskDataObjectQueryModel taskDataObjectQueryModel)
      The 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.
      Parameters:
      taskDataObjectQueryModel - the task data object query model
      Returns:
      the DataObject or null if the variable is undefined.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no task is found for the given taskId.
    • addComment

      org.flowable.engine.task.Comment addComment(String taskId, String processInstanceId, @NotBlank @NotBlank String message)
      Add a comment to a task and/or process instance.
      Parameters:
      taskId - the task id
      processInstanceId - the process instance id
      message - the message
      Returns:
      the comment
    • addComment

      org.flowable.engine.task.Comment addComment(String taskId, String processInstanceId, String type, @NotBlank @NotBlank String message)
      Add a comment to a task and/or process instance with a custom type.
      Parameters:
      taskId - the task id
      processInstanceId - the process instance id
      type - the type
      message - the message
      Returns:
      the comment
    • saveComment

      void saveComment(@NotNull @NotNull org.flowable.engine.task.Comment comment)
      Update a comment to a task and/or process instance.
      Parameters:
      comment - the comment
    • getComment

      org.flowable.engine.task.Comment getComment(@NotBlank @NotBlank String commentId)
      Returns an individual comment with the given id. Returns null if no comment exists with the given id.
      Parameters:
      commentId - the comment id
      Returns:
      the comment
    • deleteComments

      void deleteComments(String taskId, String processInstanceId)
      Removes all comments from the provided task and/or process instance
      Parameters:
      taskId - the task id
      processInstanceId - the process instance id
    • deleteComment

      void deleteComment(@NotBlank @NotBlank String commentId)
      Removes an individual comment with the given id.
      Parameters:
      commentId - the comment id
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no comment exists with the given id.
    • getTaskComments

      List<org.flowable.engine.task.Comment> getTaskComments(@NotBlank @NotBlank String taskId)
      The comments related to the given task.
      Parameters:
      taskId - the task id
      Returns:
      the task comments
    • getTaskComments

      List<org.flowable.engine.task.Comment> getTaskComments(@NotBlank @NotBlank String taskId, @NotBlank @NotBlank String type)
      The comments related to the given task of the given type.
      Parameters:
      taskId - the task id
      type - the type
      Returns:
      the task comments
    • getCommentsByType

      List<org.flowable.engine.task.Comment> getCommentsByType(@NotBlank @NotBlank String type)
      All comments of a given type.
      Parameters:
      type - the type
      Returns:
      the comments by type
    • getTaskEvents

      List<org.flowable.engine.task.Event> getTaskEvents(@NotBlank @NotBlank String taskId)
      The all events related to the given task.
      Parameters:
      taskId - the task id
      Returns:
      the task events
    • getEvent

      org.flowable.engine.task.Event getEvent(@NotBlank @NotBlank String eventId)
      Returns an individual event with the given id. Returns null if no event exists with the given id.
      Parameters:
      eventId - the event id
      Returns:
      the event
    • getProcessInstanceComments

      List<org.flowable.engine.task.Comment> getProcessInstanceComments(@NotBlank @NotBlank String processInstanceId)
      The comments related to the given process instance.
      Parameters:
      processInstanceId - the process instance id
      Returns:
      the process instance comments
    • getProcessInstanceComments

      List<org.flowable.engine.task.Comment> getProcessInstanceComments(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String type)
      The comments related to the given process instance.
      Parameters:
      processInstanceId - the process instance id
      type - the type
      Returns:
      the process instance comments
    • createAttachment

      org.flowable.engine.task.Attachment createAttachment(String attachmentType, String taskId, String processInstanceId, String attachmentName, String attachmentDescription, InputStream content)
      Add a new attachment to a task and/or a process instance and use an input stream to provide the content
      Parameters:
      attachmentType - the attachment type
      taskId - the task id
      processInstanceId - the process instance id
      attachmentName - the attachment name
      attachmentDescription - the attachment description
      content - the content
      Returns:
      the attachment
    • createAttachment

      org.flowable.engine.task.Attachment createAttachment(String attachmentType, String taskId, String processInstanceId, String attachmentName, String attachmentDescription, String url)
      Add a new attachment to a task and/or a process instance and use an url as the content
      Parameters:
      attachmentType - the attachment type
      taskId - the task id
      processInstanceId - the process instance id
      attachmentName - the attachment name
      attachmentDescription - the attachment description
      url - the url
      Returns:
      the attachment
    • saveAttachment

      void saveAttachment(@NotNull @NotNull org.flowable.engine.task.Attachment attachment)
      Update the name and description of an attachment
      Parameters:
      attachment - the attachment
    • getAttachment

      org.flowable.engine.task.Attachment getAttachment(@NotBlank @NotBlank String attachmentId)
      Retrieve a particular attachment
      Parameters:
      attachmentId - the attachment id
      Returns:
      the attachment
    • getAttachmentContent

      InputStream getAttachmentContent(@NotBlank @NotBlank String attachmentId)
      Retrieve stream content of a particular attachment
      Parameters:
      attachmentId - the attachment id
      Returns:
      the attachment content
    • getTaskAttachments

      List<org.flowable.engine.task.Attachment> getTaskAttachments(@NotBlank @NotBlank String taskId)
      The list of attachments associated to a task
      Parameters:
      taskId - the task id
      Returns:
      the task attachments
    • getProcessInstanceAttachments

      List<org.flowable.engine.task.Attachment> getProcessInstanceAttachments(@NotBlank @NotBlank String processInstanceId)
      The list of attachments associated to a process instance
      Parameters:
      processInstanceId - the process instance id
      Returns:
      the process instance attachments
    • deleteAttachment

      void deleteAttachment(@NotBlank @NotBlank String attachmentId)
      Delete an attachment
      Parameters:
      attachmentId - the attachment id
    • getSubTasks

      List<org.flowable.task.api.Task> getSubTasks(@NotBlank @NotBlank String parentTaskId)
      The list of subtasks for this parent task
      Parameters:
      parentTaskId - the parent task id
      Returns:
      the sub tasks