org.jbpm
Interface TaskService


public interface TaskService

Human task management facility.

Author:
Alejandro Guizar, Heiko Braun

Method Summary
 Comment addReplyComment(long commentDbid, java.lang.String message)
          add a reply to another comment
 Comment addTaskComment(long taskDbid, java.lang.String message)
          add a comment to a task
 void addTaskParticipatingGroup(long taskDbid, java.lang.String groupId, java.lang.String participationType)
          add a role to a given task.
 void addTaskParticipatingUser(long taskDbid, java.lang.String userId, java.lang.String participationType)
          add a role to a given task.
 void assignTask(long taskDbid, java.lang.String userId)
          assigns this task to the given assignee.
 void cancelTask(long taskDbid)
          Deletes the task.
 void cancelTask(long taskDbid, java.lang.String reason)
          Deletes the task providing an indication of the reason.
 void completeTask(long taskDbid)
          Deletes this task, marks the related history task as completed.
 void completeTask(long taskDbid, java.lang.String outcome)
          Deletes this task, marks the related history task as completed with the specified outcome.
 TaskQuery createTaskQuery()
          create a new query for tasks
 void deleteComment(long commentDbid)
          delete a comment.
 java.util.List<Task> findAssignedTasks(java.lang.String userId)
          list of tasks that are assigned to the given user.
 java.util.List<Task> findTakableTasks(java.lang.String userId)
          list of tasks that can be taken by the given user.
 java.util.List<Task> getSubTasks(long taskDbid)
          get the subtasks for this task.
 Task getTask(long taskDbid)
          Retrieves the task with the given identifier from persistent storage.
 java.util.List<Comment> getTaskComments(long taskDbid)
          get the list of comments made to a task.
 java.util.List<Participation> getTaskParticipations(long taskDbid)
          get roles related to a given task.
 java.lang.Object getVariable(long taskDbid, java.lang.String variableName)
          retrieves a variable
 java.util.Set<java.lang.String> getVariableNames(long taskDbid)
          all the variables visible in the given task
 java.util.Map<java.lang.String,java.lang.Object> getVariables(long taskDbid, java.util.Set<java.lang.String> variableNames)
          retrieves a map of variables
 Task newTask()
          Creates a task.
 Task newTask(long parentTaskDbid)
          Creates a new subtask for the given task.
 void removeTaskParticipatingGroup(long taskDbid, java.lang.String groupId, java.lang.String participationType)
          removes a role to a given task.
 void removeTaskParticipatingUser(long taskDbid, java.lang.String userId, java.lang.String participationType)
          removes a role to a given task.
 long saveTask(Task task)
          Saves the given task to persistent storage.
 void setVariable(long taskDbid, java.lang.String name, java.lang.Object value)
          creates or overwrites a variable value on the given task
 void setVariables(long taskDbid, java.util.Map<java.lang.String,java.lang.Object> variables)
          creates or overwrites the variable values on the given task
 void takeTask(long taskDbid, 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.getDbid() property will be initialized.


newTask

Task newTask(long parentTaskDbid)
Creates a new subtask for the given task. Make sure that the parent task is saved before the dbid is taken. The returned task will be transient. Use saveTask(Task) to persist the task.


saveTask

long saveTask(Task task)
Saves the given task to persistent storage.

Returns:
the taskDbid

getTask

Task getTask(long taskDbid)
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(long taskDbid,
                java.lang.String userId)
assigns this task to the given assignee.


takeTask

void takeTask(long taskDbid,
              java.lang.String userId)
taking this task will prevent all other candidates from taking and working on this task.

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

completeTask

void completeTask(long taskDbid)
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(long taskDbid,
                  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.


cancelTask

void cancelTask(long taskDbid)
Deletes the task. If this task was created in the context of a process execution, one of three things might happen depending on configurations of the task in the process definition: a) process executions resumes b) whole process execution is cancelled as well. c) exception is thrown


cancelTask

void cancelTask(long taskDbid,
                java.lang.String reason)
Deletes the task providing an indication of the reason. Example reasons could be: "failed", "error", "exited", "obsolete" or "deleted". If this task was created in the context of a process execution, one of three things might happen depending on configurations of the task in the process definition: a) process executions resumes b) whole process execution is cancelled as well. c) exception is thrown


addTaskParticipatingUser

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

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

addTaskParticipatingGroup

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

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

getTaskParticipations

java.util.List<Participation> getTaskParticipations(long taskDbid)
get roles related to a given task.


removeTaskParticipatingUser

void removeTaskParticipatingUser(long taskDbid,
                                 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:
participation - specifies the kind of involvement of the participatingUser in this task. see Participation for default constants.

removeTaskParticipatingGroup

void removeTaskParticipatingGroup(long taskDbid,
                                  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:
participation - 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


findAssignedTasks

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


findTakableTasks

java.util.List<Task> findTakableTasks(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(long taskDbid)
get the subtasks for this task. Only goes one level deep at a time.


addTaskComment

Comment addTaskComment(long taskDbid,
                       java.lang.String message)
add a comment to a task


getTaskComments

java.util.List<Comment> getTaskComments(long taskDbid)
get the list of comments made to a task. this will fetch all the comments and recursively all replies to those comments.


addReplyComment

Comment addReplyComment(long commentDbid,
                        java.lang.String message)
add a reply to another comment


deleteComment

void deleteComment(long commentDbid)
delete a comment. this will recursively delete all replies to this comment.


setVariable

void setVariable(long taskDbid,
                 java.lang.String name,
                 java.lang.Object value)
creates or overwrites a variable value on the given task


setVariables

void setVariables(long taskDbid,
                  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(long taskDbid,
                             java.lang.String variableName)
retrieves a variable


getVariableNames

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


getVariables

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



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