Interface TaskService

All Known Implementing Classes:
TaskServiceImpl

public interface TaskService
Service which provides access to Task and form related operations.
Author:
Tom Baeyens, Joram Barrez, Thorben Lindhauer
  • getVariableTyped

    <T extends TypedValue> T getVariableTyped(String taskId, String variableName, boolean deserializeValue)
    Get a variables and search in the task scope and if available also the execution scopes.
    Parameters:
    taskId - the id of the task
    variableName - the name of the variable to fetch
    deserializeValue - if false a, SerializableValue will not be deserialized.
    Returns:
    the TypedValue for the variable or 'null' in case no such variable exists.
    Throws:
    ClassCastException - in case the value is not of the requested type
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariableLocal

    Object getVariableLocal(String taskId, String variableName)
    Get a variables and only search in the task scope.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • getVariableLocalTyped

    <T extends TypedValue> T getVariableLocalTyped(String taskId, String variableName)
    Get a variables and only search in the task scope.
    Parameters:
    taskId - the id of the task
    variableName - the name of the variable to fetch
    Returns:
    the TypedValue for the variable or 'null' in case no such variable exists.
    Throws:
    ClassCastException - in case the value is not of the requested type
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariableLocalTyped

    <T extends TypedValue> T getVariableLocalTyped(String taskId, String variableName, boolean deserializeValue)
    Get a variables and only search in the task scope.
    Parameters:
    taskId - the id of the task
    variableName - the name of the variable to fetch
    deserializeValue - if false a, SerializableValue will not be deserialized.
    Returns:
    the TypedValue for the variable or 'null' in case no such variable exists.
    Throws:
    ClassCastException - in case the value is not of the requested type
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariables

    Map<String,Object> getVariables(String taskId)
    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 getVariables(String, Collection) for better performance.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • getVariablesTyped

    VariableMap getVariablesTyped(String taskId)
    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 getVariables(String, Collection) for better performance.
    Parameters:
    taskId - the id of the task
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariablesTyped

    VariableMap getVariablesTyped(String taskId, boolean deserializeValues)
    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 getVariables(String, Collection) for better performance.
    Parameters:
    taskId - the id of the task
    deserializeValues - if false, SerializableValues will not be deserialized.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariablesLocal

    Map<String,Object> getVariablesLocal(String taskId)
    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 getVariablesLocal(String, Collection) for better performance.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • getVariablesLocalTyped

    VariableMap getVariablesLocalTyped(String taskId)
    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 getVariablesLocal(String, Collection) for better performance.
    Parameters:
    taskId - the id of the task
    deserializeValues - if false, SerializableValues will not be deserialized.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariablesLocalTyped

    VariableMap getVariablesLocalTyped(String taskId, boolean deserializeValues)
    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 getVariablesLocal(String, Collection) for better performance.
    Parameters:
    taskId - the id of the task
    deserializeValues - if false, SerializableValues will not be deserialized.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariables

    Map<String,Object> getVariables(String taskId, Collection<String> variableNames)
    Get values for all given variableNames
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • getVariablesTyped

    VariableMap getVariablesTyped(String taskId, Collection<String> variableNames, boolean deserializeValues)
    Get values for all given variableName
    Parameters:
    taskId - the id of the task
    variableNames - only fetch variables whose names are in the collection.
    deserializeValues - if false, SerializableValues will not be deserialized.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • getVariablesLocal

    Map<String,Object> getVariablesLocal(String taskId, Collection<String> variableNames)
    Get a variable on a task
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • getVariablesLocalTyped

    VariableMap getVariablesLocalTyped(String taskId, Collection<String> variableNames, boolean deserializeValues)
    Get values for all given variableName. Only search in the local task scope.
    Parameters:
    taskId - the id of the task
    variableNames - only fetch variables whose names are in the collection.
    deserializeValues - if false, SerializableValues will not be deserialized.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException -

    In case of standalone tasks:

  • if the user has no Permissions.READ permission on Resources.TASK or
  • if this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK
  • In case the task is part of a running process instance:

  • if the user has no Permissions.READ permission on Resources.TASK and no Permissions.READ_TASK permission on Resources.PROCESS_DEFINITION
  • in case this configuration is enabled and the user has no TaskPermissions.READ_VARIABLE permission on Resources.TASK and no ProcessDefinitionPermissions.READ_TASK_VARIABLE permission on Resources.PROCESS_DEFINITION
  • Since:
    7.2
  • removeVariable

    void removeVariable(String taskId, String variableName)
    Removes the variable from the task. When the variable does not exist, nothing happens.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException - If the user has none of the following:
  • TaskPermissions.UPDATE_VARIABLE permission on Resources.TASK
  • Permissions.UPDATE permission on Resources.TASK
  • or if the task is part of a running process instance:
  • removeVariableLocal

    void removeVariableLocal(String taskId, String variableName)
    Removes the variable from the task (not considering parent scopes). When the variable does not exist, nothing happens.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException - If the user has none of the following:
  • TaskPermissions.UPDATE_VARIABLE permission on Resources.TASK
  • Permissions.UPDATE permission on Resources.TASK
  • or if the task is part of a running process instance:
  • removeVariables

    void removeVariables(String taskId, Collection<String> variableNames)
    Removes all variables in the given collection from the task. Non existing variable names are simply ignored.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException - If the user has none of the following:
  • TaskPermissions.UPDATE_VARIABLE permission on Resources.TASK
  • Permissions.UPDATE permission on Resources.TASK
  • or if the task is part of a running process instance:
  • removeVariablesLocal

    void removeVariablesLocal(String taskId, Collection<String> variableNames)
    Removes all variables in the given collection from the task (not considering parent scopes). Non existing variable names are simply ignored.
    Throws:
    ProcessEngineException - when the task doesn't exist.
    AuthorizationException - If the user has none of the following:
  • TaskPermissions.UPDATE_VARIABLE permission on Resources.TASK
  • Permissions.UPDATE permission on Resources.TASK
  • or if the task is part of a running process instance:
  • addComment

    @Deprecated void addComment(String taskId, String processInstanceId, String message)
    Deprecated.
    Add a comment to a task and/or process instance.
  • createComment

    Comment createComment(String taskId, String processInstanceId, String message)
    Creates a comment to a task and/or process instance and returns the comment.
  • getTaskComments

    List<Comment> getTaskComments(String taskId)
    The comments related to the given task.
  • getTaskComment

    Comment getTaskComment(String taskId, String commentId)
    Retrieve a particular task comment
  • getTaskEvents

    @Deprecated List<Event> getTaskEvents(String taskId)
    Deprecated.
    This method has been deprecated as of Camunda Platform 7.1. It has been replaced with the operation log. See UserOperationLogEntry and UserOperationLogQuery.

    The all events related to the given task.

    As of Camunda Platform 7.4 task events are only written in context of a logged in user. This behavior can be toggled in the process engine configuration using the property legacyUserOperationLog (default false). To restore the engine's previous behavior, set the flag to true.

    See Also:
  • getProcessInstanceComments

    List<Comment> getProcessInstanceComments(String processInstanceId)
    The comments related to the given process instance.
  • createAttachment

    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 please use method in runtime service to operate on process instance. Either taskId or processInstanceId has to be provided
    Parameters:
    taskId - - task that should have an attachment
    processInstanceId - - id of a process to use if task id is null
    attachmentType - - name of the attachment, can be null
    attachmentName - - name of the attachment, can be null
    attachmentDescription - - full text description, can be null
    content - - byte array with content of attachment
  • createAttachment

    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 please use method in runtime service to operate on process instance Either taskId or processInstanceId has to be provided
    Parameters:
    taskId - - task that should have an attachment
    processInstanceId - - id of a process to use if task id is null
    attachmentType - - name of the attachment, can be null
    attachmentName - - name of the attachment, can be null
    attachmentDescription - - full text description, can be null
    url - - url of the attachment, can be null
  • saveAttachment

    void saveAttachment(Attachment attachment)
    Update the name and decription of an attachment
  • getAttachment

    Attachment getAttachment(String attachmentId)
    Retrieve a particular attachment
  • getTaskAttachment

    Attachment getTaskAttachment(String taskId, String attachmentId)
    Retrieve a particular attachment to the given task id and attachment id
  • getAttachmentContent

    InputStream getAttachmentContent(String attachmentId)
    Retrieve stream content of a particular attachment
  • getTaskAttachmentContent

    InputStream getTaskAttachmentContent(String taskId, String attachmentId)
    Retrieve stream content of a particular attachment to the given task id and attachment id
  • getTaskAttachments

    List<Attachment> getTaskAttachments(String taskId)
    The list of attachments associated to a task
  • getProcessInstanceAttachments

    List<Attachment> getProcessInstanceAttachments(String processInstanceId)
    The list of attachments associated to a process instance
  • deleteAttachment

    void deleteAttachment(String attachmentId)
    Delete an attachment
  • deleteTaskAttachment

    void deleteTaskAttachment(String taskId, String attachmentId)
    Delete an attachment to the given task id and attachment id
  • getSubTasks

    List<Task> getSubTasks(String parentTaskId)
    The list of subtasks for this parent task
  • createTaskReport

    TaskReport createTaskReport()
    Instantiate a task report
  • handleBpmnError

    void handleBpmnError(String taskId, String errorCode)
    Signals that a business error appears, which should be handled by the process engine.
    Parameters:
    taskId - the id of an existing active task
    errorCode - the error code of the corresponding bmpn error
    Throws:
    NotFoundException - if no task with the given id exists
    BadUserRequestException - if task id or error code were null or empty
    SuspendedEntityInteractionException - if the task is suspended
    AuthorizationException - if the user has none of the following permissions:
  • Permissions.TASK_WORK permission on Resources.TASK or Resources.PROCESS_DEFINITION resource
  • Permissions.UPDATE permission on Resources.TASK resource
  • Permissions.UPDATE_TASK permission on Resources.PROCESS_DEFINITION resource
  • handleBpmnError

    void handleBpmnError(String taskId, String errorCode, String errorMessage)
    Parameters:
    taskId - the id of an existing active task
    errorCode - the error code of the corresponding bmpn error
    errorMessage - the error message of the corresponding bmpn error
    See Also:
  • handleBpmnError

    void handleBpmnError(String taskId, String errorCode, String errorMessage, Map<String,Object> variables)
    Parameters:
    taskId - the id of an existing active task
    errorCode - the error code of the corresponding bmpn error
    errorMessage - the error message of the corresponding bmpn error
    variables - the variables to pass to the execution
    See Also:
  • handleEscalation

    void handleEscalation(String taskId, String escalationCode)
    Signals that an escalation appears, which should be handled by the process engine.
    Parameters:
    taskId - the id of an existing active task
    escalationCode - the escalation code of the corresponding escalation
    variables - the variables to pass to the execution
    Throws:
    NotFoundException - if no task with the given id exists
    BadUserRequestException - if task id or escalation code were null or empty
    SuspendedEntityInteractionException - if the task is suspended
    AuthorizationException - if the user has none of the following permissions:
  • Permissions.TASK_WORK permission on Resources.TASK or Resources.PROCESS_DEFINITION resource
  • Permissions.UPDATE permission on Resources.TASK resource
  • Permissions.UPDATE_TASK permission on Resources.PROCESS_DEFINITION resource
  • handleEscalation

    void handleEscalation(String taskId, String escalationCode, Map<String,Object> variables)
    Signals that an escalation appears, which should be handled by the process engine.
    Parameters:
    taskId - the id of an existing active task
    escalationCode - the escalation code of the corresponding escalation
    variables - the variables to pass to the execution
    Throws:
    NotFoundException - if no task with the given id exists
    BadUserRequestException - if task id or escalation code were null or empty
    SuspendedEntityInteractionException - if the task is suspended
    AuthorizationException - if the user has none of the following permissions:
  • Permissions.TASK_WORK permission on Resources.TASK or Resources.PROCESS_DEFINITION resource
  • Permissions.UPDATE permission on Resources.TASK resource
  • Permissions.UPDATE_TASK permission on Resources.PROCESS_DEFINITION resource