org.jbpm.api
Interface TaskService


public interface TaskService

task management.

Author:
Tom Baeyens, Alejandro Guizar, Heiko Braun

Method Summary
 HistoryComment addReplyComment(java.lang.String commentId, java.lang.String message)
          add a reply to another comment
 HistoryComment addTaskComment(java.lang.String taskId, java.lang.String message)
          add a comment to a task
 void addTaskParticipatingGroup(java.lang.String taskId, java.lang.String groupId, java.lang.String participationType)
          add a role to a given task.
 void addTaskParticipatingUser(java.lang.String taskId, java.lang.String userId, java.lang.String participationType)
          add a role to a given task.
 void assignTask(java.lang.String taskId, java.lang.String userId)
          assigns this task to the given assignee.
 void completeTask(java.lang.String taskId)
          Deletes this task, marks the related history task as completed.
 void completeTask(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.Object> variables)
          Deletes this task and marks the related history task as completed.
 void completeTask(java.lang.String taskId, java.lang.String outcome)
          Deletes this task, marks the related history task as completed with the specified outcome.
 void completeTask(java.lang.String taskId, java.lang.String outcome, java.util.Map<java.lang.String,java.lang.Object> variables)
          Deletes this task, marks the related history task as completed with the specified outcome.
 TaskQuery createTaskQuery()
          create a new query for tasks
 void deleteComment(java.lang.String commentId)
          delete a comment.
 void deleteTask(java.lang.String taskId)
          Deletes the task without completing it.
 void deleteTask(java.lang.String taskId, java.lang.String reason)
          Deletes the task without completing indicating the reason.
 void deleteTaskCascade(java.lang.String taskId)
          deletes this task, including all history information
 java.util.List<Task> findGroupTasks(java.lang.String userId)
          list of tasks that can be taken by the given user.
 java.util.List<Task> findPersonalTasks(java.lang.String userId)
          list of tasks that are assigned to the given user.
 java.util.Set<java.lang.String> getOutcomes(java.lang.String taskId)
          the set of possible valid outcomes for this task.
 java.util.List<Task> getSubTasks(java.lang.String taskId)
          get the subtasks for this task.
 Task getTask(java.lang.String taskId)
          Retrieves the task with the given identifier from persistent storage.
 java.util.List<HistoryComment> getTaskComments(java.lang.String taskId)
          get the list of comments made to a task.
 java.util.List<Participation> getTaskParticipations(java.lang.String taskId)
          get roles related to a given task.
 java.lang.Object getVariable(java.lang.String taskId, java.lang.String variableName)
          retrieves a variable
 java.util.Set<java.lang.String> getVariableNames(java.lang.String taskId)
          all the variables visible in the given task
 java.util.Map<java.lang.String,java.lang.Object> getVariables(java.lang.String taskId, java.util.Set<java.lang.String> variableNames)
          retrieves a map of variables
 Task newTask()
          Creates a task.
 Task newTask(java.lang.String parentTaskId)
          Creates a new subtask for the given task.
 void removeTaskParticipatingGroup(java.lang.String taskId, java.lang.String groupId, java.lang.String participationType)
          removes a role to a given task.
 void removeTaskParticipatingUser(java.lang.String taskId, java.lang.String userId, java.lang.String participationType)
          removes a role to a given task.
 java.lang.String saveTask(Task task)
          Saves the given task to persistent storage.
 void setVariables(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.Object> variables)
          creates or overwrites the variable values on the given task
 void takeTask(java.lang.String taskId, java.lang.String userId)
          taking this task will prevent all other candidates from taking and working on this task.
 

Method Detail

newTask

Task newTask()
Creates a task. The returned task will be transient. Use saveTask(Task) to persist the task. Only after the invocation of saveTask(Task), the Task.getId() property will be initialized.


newTask

Task newTask(java.lang.String parentTaskId)
Creates a new subtask for the given task. Make sure that the parent task is saved before the Id is taken. The returned task will be transient. Use saveTask(Task) to persist the task.


saveTask

java.lang.String saveTask(Task task)
Saves the given task to persistent storage.

Returns:
the taskId

getTask

Task getTask(java.lang.String taskId)
Retrieves the task with the given identifier from persistent storage. If no task with the given identifier exists, the call returns null.


assignTask

void assignTask(java.lang.String taskId,
                java.lang.String userId)
assigns this task to the given assignee.


takeTask

void takeTask(java.lang.String taskId,
              java.lang.String userId)
taking this task will prevent all other candidates from taking and working on this task. The inverse operation of putting the task back into the group for someone else to take it, can be done by providing a null value for userId in the assignTask(String, String) method: taskService.assignTask(taskId, null);

Throws:
JbpmException - if this task already has been taken.

completeTask

void completeTask(java.lang.String taskId)
Deletes this task, marks the related history task as completed. If the task was created in the context of a process execution, this operation may result in a process instance being triggered.


completeTask

void completeTask(java.lang.String taskId,
                  java.util.Map<java.lang.String,java.lang.Object> variables)
Deletes this task and marks the related history task as completed. The given variables are created (or they overwrite existing values) as task variables. If the task was created in the context of a process execution, this operation may result in a process instance being triggered to continue.


completeTask

void completeTask(java.lang.String taskId,
                  java.lang.String outcome)
Deletes this task, marks the related history task as completed with the specified outcome. If the task was created in the context of a process execution, this operation may result in a process instance being triggered. The outcome in that case corresponds to an outgoing transition in the process.


completeTask

void completeTask(java.lang.String taskId,
                  java.lang.String outcome,
                  java.util.Map<java.lang.String,java.lang.Object> variables)
Deletes this task, marks the related history task as completed with the specified outcome. The given variables are created (or they overwrite existing values) as task variables. If the task was created in the context of a process execution, this operation may result in a process instance being triggered. The outcome in that case corresponds to an outgoing transition in the process.


deleteTask

void deleteTask(java.lang.String taskId)
Deletes the task without completing it. The history information is kept in the DB. If this task was created in the context of a process execution, the execution remains active and the ExecutionService.signalExecutionById(String) is to be given explicitly.


deleteTaskCascade

void deleteTaskCascade(java.lang.String taskId)
deletes this task, including all history information


deleteTask

void deleteTask(java.lang.String taskId,
                java.lang.String reason)
Deletes the task without completing indicating the reason. Example reasons could be: "failed", "error", "exited", "obsolete" or "deleted". The history information is kept in the DB. The reason ends up as the state in the HistoryActivityInstance. If this task was created in the context of a process execution, the execution remains active and the ExecutionService.signalExecutionById(String) is to be given explicitly.


addTaskParticipatingUser

void addTaskParticipatingUser(java.lang.String taskId,
                              java.lang.String userId,
                              java.lang.String participationType)
add a role to a given task.

Parameters:
participationType - specifies the kind of involvement of the participatingUser in this task. see Participation for default constants.

addTaskParticipatingGroup

void addTaskParticipatingGroup(java.lang.String taskId,
                               java.lang.String groupId,
                               java.lang.String participationType)
add a role to a given task.

Parameters:
participationType - specifies the kind of involvement of the participatingUser in this task. see Participation for default constants.

getTaskParticipations

java.util.List<Participation> getTaskParticipations(java.lang.String taskId)
get roles related to a given task.


removeTaskParticipatingUser

void removeTaskParticipatingUser(java.lang.String taskId,
                                 java.lang.String userId,
                                 java.lang.String participationType)
removes a role to a given task. Nothing happens (no exception) if the role does not exist.

Parameters:
participationType - specifies the kind of involvement of the participatingUser in this task. see Participation for default constants.

removeTaskParticipatingGroup

void removeTaskParticipatingGroup(java.lang.String taskId,
                                  java.lang.String groupId,
                                  java.lang.String participationType)
removes a role to a given task. Nothing happens (no exception) if the role does not exist.

Parameters:
participationType - specifies the kind of involvement of the participatingUser in this task. see Participation for default constants.

createTaskQuery

TaskQuery createTaskQuery()
create a new query for tasks


findPersonalTasks

java.util.List<Task> findPersonalTasks(java.lang.String userId)
list of tasks that are assigned to the given user. Returns an empty list in case no such tasks exist.


findGroupTasks

java.util.List<Task> findGroupTasks(java.lang.String userId)
list of tasks that can be taken by the given user. Returns an empty list in case no such tasks exist.


getSubTasks

java.util.List<Task> getSubTasks(java.lang.String taskId)
get the subtasks for this task. Only goes one level deep at a time.


addTaskComment

HistoryComment addTaskComment(java.lang.String taskId,
                              java.lang.String message)
add a comment to a task


getTaskComments

java.util.List<HistoryComment> getTaskComments(java.lang.String taskId)
get the list of comments made to a task. this will fetch all the comments and recursively all replies to those comments.


addReplyComment

HistoryComment addReplyComment(java.lang.String commentId,
                               java.lang.String message)
add a reply to another comment


deleteComment

void deleteComment(java.lang.String commentId)
delete a comment. this will recursively delete all replies to this comment.


setVariables

void setVariables(java.lang.String taskId,
                  java.util.Map<java.lang.String,java.lang.Object> variables)
creates or overwrites the variable values on the given task


getVariable

java.lang.Object getVariable(java.lang.String taskId,
                             java.lang.String variableName)
retrieves a variable


getVariableNames

java.util.Set<java.lang.String> getVariableNames(java.lang.String taskId)
all the variables visible in the given task


getVariables

java.util.Map<java.lang.String,java.lang.Object> getVariables(java.lang.String taskId,
                                                              java.util.Set<java.lang.String> variableNames)
retrieves a map of variables


getOutcomes

java.util.Set<java.lang.String> getOutcomes(java.lang.String taskId)
the set of possible valid outcomes for this task. An empty set means that any value is possible.



Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.