public interface TaskService
| Modifier and Type | Method and Description |
|---|---|
Task |
cancelClaim(String taskId)
Cancel the claim of an existing task if it was claimed by the current user before.
|
Task |
cancelTask(String taskId)
Cancels a task.
|
Task |
claim(String taskId)
Claim an existing task for the current user.
|
Task |
completeTask(String taskId)
Complete a claimed Task as owner/admin and update State and Timestamps.
|
BulkOperationResults<String,TaskanaException> |
completeTasks(List<String> taskIds)
Completes a list of tasks.
|
Task |
createTask(Task taskToCreate)
Persists a not persisted Task which does not exist already.
|
TaskComment |
createTaskComment(TaskComment taskComment)
Create a task comment.
|
TaskQuery |
createTaskQuery()
This method provides a query builder for quering the database.
|
void |
deleteTask(String taskId)
Deletes the task with the given Id.
|
void |
deleteTaskComment(String taskCommentId)
Deletes the task comment with the given Id.
|
BulkOperationResults<String,TaskanaException> |
deleteTasks(List<String> tasks)
Deletes a list of tasks.
|
Task |
forceCancelClaim(String taskId)
Cancel the claim of an existing task even if it was claimed by another user.
|
Task |
forceClaim(String taskId)
Claim an existing task for the current user even if it is already claimed by someone else.
|
Task |
forceCompleteTask(String taskId)
Complete a Task and update State and Timestamps in every case if the Task exists.
|
BulkOperationResults<String,TaskanaException> |
forceCompleteTasks(List<String> taskIds)
Completes a list of tasks.
|
void |
forceDeleteTask(String taskId)
Deletes the task with the given Id even if it is not completed.
|
Task |
getTask(String taskId)
Get the details of a task by Id without checking permissions.
|
TaskComment |
getTaskComment(String taskCommentId)
Retrieves a task comment for a given taskCommentId.
|
List<TaskComment> |
getTaskComments(String taskId)
Retrieves a list of task comments for a given taskId.
|
Attachment |
newAttachment()
Returns a not persisted instance of
Attachment. |
Task |
newTask()
Returns a not persisted instance of
Task. |
Task |
newTask(String workbasketId)
Returns a not persisted instance of
Task. |
Task |
newTask(String workbasketKey,
String domain)
Returns a not persisted instance of
Task. |
TaskComment |
newTaskComment(String taskId)
Returns a not persisted instance of
TaskComment. |
Task |
selectAndClaim(TaskQuery taskQuery)
Selects and claims the first task which is returned by the task query.
|
BulkOperationResults<String,TaskanaException> |
setCallbackStateForTasks(List<String> externalIds,
CallbackState state)
Sets the callback state on a list of tasks.
|
BulkOperationResults<String,TaskanaException> |
setOwnerOfTasks(String owner,
List<String> taskIds)
Sets the owner on a list of tasks.
|
BulkOperationResults<String,TaskanaException> |
setPlannedPropertyOfTasks(Instant planned,
List<String> taskIds)
Sets the planned property on a list of tasks.
|
Task |
setTaskRead(String taskId,
boolean isRead)
Marks a task as read.
|
Task |
terminateTask(String taskId)
Terminates a task.
|
Task |
transfer(String taskId,
String destinationWorkbasketId)
Transfer a task to another work basket.
|
Task |
transfer(String taskId,
String workbasketKey,
String domain)
Transfer a task to another work basket.
|
BulkOperationResults<String,TaskanaException> |
transferTasks(String destinationWorkbasketId,
List<String> taskIds)
Transfers a list of tasks to an other workbasket.
|
BulkOperationResults<String,TaskanaException> |
transferTasks(String destinationWorkbasketKey,
String destinationWorkbasketDomain,
List<String> taskIds)
Transfers a list of tasks to an other workbasket.
|
Task |
updateTask(Task task)
Update a task.
|
TaskComment |
updateTaskComment(TaskComment taskComment)
Update a task comment.
|
List<String> |
updateTasks(List<String> taskIds,
Map<TaskCustomField,String> customFieldsToUpdate)
Updates tasks with matching taskIds.
|
List<String> |
updateTasks(ObjectReference selectionCriteria,
Map<TaskCustomField,String> customFieldsToUpdate)
Updates tasks with a matching
ObjectReference. |
Task claim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
taskId - the id of the task to be claimedTaskNotFoundException - if the task with taskId was not foundInvalidStateException - if the state of the task with taskId is not READYInvalidOwnerException - if the task with taskId is claimed by some elseNotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTask forceClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
taskId - the id of the task to be claimedTaskNotFoundException - if the task with taskId was not foundInvalidStateException - if the state of the task with taskId is not READYInvalidOwnerException - if the task with taskId is claimed by someone elseNotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTask cancelClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
taskId - id of the task which should be unclaimed.TaskNotFoundException - if the task can´t be found or does not existInvalidStateException - when the task is already completed.InvalidOwnerException - when the task is claimed by another user.NotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTask forceCancelClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
taskId - id of the task which should be unclaimed.TaskNotFoundException - if the task can´t be found or does not existInvalidStateException - when the task is already completed.InvalidOwnerException - when forceCancel is false and the task is claimed by another
user.NotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTask completeTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException
taskId - - Id of the Task which should be completed.InvalidStateException - when Task wasn´t claimed before.TaskNotFoundException - if the given Task can´t be found in DB.InvalidOwnerException - if current user is not the task-owner or administrator.NotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTask forceCompleteTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException
taskId - - Id of the Task which should be completed.InvalidStateException - when Task wasn´t claimed before.TaskNotFoundException - if the given Task can´t be found in DB.InvalidOwnerException - if current user is not the task-owner or administrator.NotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTask createTask(Task taskToCreate) throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException
taskToCreate - the transient task object to be persistedTaskAlreadyExistException - when the Task does already exist.NotAuthorizedException - thrown if the current user is not authorized to create that taskWorkbasketNotFoundException - thrown if the work basket referenced by the task is not
foundClassificationNotFoundException - thrown if the Classification referenced by the
task is not foundInvalidArgumentException - thrown if the primary ObjectReference is invalidTask getTask(String taskId) throws TaskNotFoundException, NotAuthorizedException
taskId - the id of the taskTaskNotFoundException - thrown of the Task with taskId is not foundNotAuthorizedException - if the current user has no READ permission for the workbasket
the task is in.Task transfer(String taskId, String destinationWorkbasketId) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException
taskId - The id of the Task to be transferreddestinationWorkbasketId - The Id of the target work basketTaskNotFoundException - Thrown if the Task with taskId was not found.WorkbasketNotFoundException - Thrown if the target work basket was not found.NotAuthorizedException - Thrown if the current user is not authorized to transfer this
Task to the target work basketInvalidStateException - Thrown if the task is in a state which does not allow
transferringTask transfer(String taskId, String workbasketKey, String domain) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException
taskId - The id of the Task to be transferredworkbasketKey - The key of the target work basketdomain - The domain of the target work basketTaskNotFoundException - Thrown if the Task with taskId was not found.WorkbasketNotFoundException - Thrown if the target work basket was not found.NotAuthorizedException - Thrown if the current user is not authorized to transfer this
Task to the target work basketInvalidStateException - Thrown if the task is in a state which does not allow
transferringTask setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedException
taskId - the id of the task to be updatedisRead - the new status of the read flag.TaskNotFoundException - Thrown if the Task with taskId was not foundNotAuthorizedException - if the current user has no read permission for the workbasket
the task is inTaskQuery createTaskQuery()
TaskQueryTask newTask()
Task. The returned task has no workbasket Id set.
When createTask() is invoked for this task, TaskService will call the TaskRouting SPI to
determine a workbasket for the task. If the TaskRouting API is not active, e.g. because no
TaskRouter is registered, or the TaskRouter(s) don't find a workbasket, the task will not be
persisted.Task newTask(String workbasketId)
Task.workbasketId - the id of the workbasket to which the task belongsTask newTask(String workbasketKey, String domain)
Task.workbasketKey - the key of the workbasket to which the task belongsdomain - the domain of the workbasket to which the task belongsTaskComment newTaskComment(String taskId)
TaskComment.taskId - The id of the task to which the task comment belongsAttachment newAttachment()
Attachment.Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, ClassificationNotFoundException, NotAuthorizedException, AttachmentPersistenceException, InvalidStateException
task - the task to be updated in the databaseInvalidArgumentException - if the task to be updated contains invalid properties like
e.g. invalid object referencesTaskNotFoundException - if the id of the task is not found in the databaseConcurrencyException - if the task has already been updated by another userClassificationNotFoundException - if the updated task refers to a classification that
cannot be foundNotAuthorizedException - if the current user is not authorized to update the taskAttachmentPersistenceException - if an Attachment with ID will be added multiple times
without using the task-methodsInvalidStateException - if an attempt is made to change the owner of the task and the
task is not in state READY .BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException
destinationWorkbasketId - target workbasket idtaskIds - source task which will be movedNotAuthorizedException - if the caller hasn´t permissions on tarket WB.InvalidArgumentException - if the method paramesters are EMPTY or NULL.WorkbasketNotFoundException - if the target WB can´t be found.BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException
destinationWorkbasketKey - target workbasket keydestinationWorkbasketDomain - target workbasket domaintaskIds - source task which will be movedNotAuthorizedException - if the caller hasn´t permissions on tarket WB.InvalidArgumentException - if the method paramesters are EMPTY or NULL.WorkbasketNotFoundException - if the target WB can´t be found.void deleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
taskId - The Id of the task to delete.TaskNotFoundException - If the given Id does not refer to an existing task.InvalidStateException - If the state of the referenced task is not Completed.NotAuthorizedException - if the current user is not member of role ADMINvoid forceDeleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
taskId - The Id of the task to delete.TaskNotFoundException - If the given Id does not refer to an existing task.InvalidStateException - If the state of the referenced task is not Completed and
forceDelet is false.NotAuthorizedException - if the current user is not member of role ADMINTask selectAndClaim(TaskQuery taskQuery) throws NotAuthorizedException, InvalidOwnerException
taskQuery - the task query.InvalidOwnerException - if the task is claimed by someone elseNotAuthorizedException - if the current user has no read permission for the workbasket
the task is inBulkOperationResults<String,TaskanaException> deleteTasks(List<String> tasks) throws InvalidArgumentException, NotAuthorizedException
tasks - the ids of the tasks to delete.InvalidArgumentException - if the TaskIds parameter is NULLNotAuthorizedException - if the current user is not member of role ADMINBulkOperationResults<String,TaskanaException> completeTasks(List<String> taskIds) throws InvalidArgumentException
taskIds - of the tasks which should be completed.InvalidArgumentException - If the taskId parameter is NULL.BulkOperationResults<String,TaskanaException> forceCompleteTasks(List<String> taskIds) throws InvalidArgumentException
taskIds - of the tasks which should be completed.InvalidArgumentException - If the taskId parameter is NULL.forceCompleteTask(java.lang.String)List<String> updateTasks(ObjectReference selectionCriteria, Map<TaskCustomField,String> customFieldsToUpdate) throws InvalidArgumentException
ObjectReference.selectionCriteria - the ObjectReference that is used to select the tasks.customFieldsToUpdate - a Map that contains as key the identification of the custom
field and as value the corresponding new value of that custom field.InvalidArgumentException - if the given selectionCriteria is invalid or the given
customFieldsToUpdate are null or empty.List<String> updateTasks(List<String> taskIds, Map<TaskCustomField,String> customFieldsToUpdate) throws InvalidArgumentException
taskIds - the taskIds that are used to select the tasks.customFieldsToUpdate - a Map that contains as key the identification of the custom
field and as value the corresponding new value of that custom field.InvalidArgumentException - if the given customFieldsToUpdate are null or empty.TaskComment createTaskComment(TaskComment taskComment) throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException
taskComment - the task comment to be created.NotAuthorizedException - If the current user has no authorization to create a task
comment for the given taskId in the TaskComment or is not authorized to access the task.TaskNotFoundException - If the given taskId in the TaskComment does not refer to an
existing task.InvalidArgumentException - If the given taskCommentId from the provided task comment is
not null or emptyTaskComment updateTaskComment(TaskComment taskComment) throws NotAuthorizedException, ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException
taskComment - the task comment to be updated in the database.NotAuthorizedException - If the current user has no authorization to update a task
comment or is not authorized to access the task.ConcurrencyException - if an attempt is made to update the task comment and another user.
updated it already.TaskCommentNotFoundException - If the given taskCommentId in the TaskComment does not
refer to an existing taskComment.TaskNotFoundException - If the given taskId in the TaskComment does not refer to an
existing task.InvalidArgumentException - If the given taskCommentId from the provided task comment is
null or emptyvoid deleteTaskComment(String taskCommentId) throws NotAuthorizedException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException
taskCommentId - The id of the task comment to delete.NotAuthorizedException - If the current user has no authorization to delete a task
comment or is not authorized to access the task.InvalidArgumentException - If the taskCommentId is null/emptyTaskCommentNotFoundException - If the given taskCommentId in the TaskComment does not
refer to an existing taskComment.TaskNotFoundException - If the given taskId in the TaskComment does not refer to an
existing task.InvalidArgumentException - If the given taskCommentId is null or emptyTaskComment getTaskComment(String taskCommentId) throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException, InvalidArgumentException
taskCommentId - The id of the task comment which should be retrievedTaskCommentNotFoundException - If the given taskCommentId in the TaskComment does not
refer to an existing taskComment.NotAuthorizedException - If the current user has no authorization to retrieve a
taskComment from a certain task or is not authorized to access the task.TaskNotFoundException - If the given taskId in the TaskComment does not refer to an
existing task.InvalidArgumentException - If the given taskCommentId is null or emptyList<TaskComment> getTaskComments(String taskId) throws NotAuthorizedException, TaskNotFoundException
taskId - The id of the task for which all task comments should be retrievedNotAuthorizedException - If the current user has no authorization to retrieve a
taskComment from a certain task or is not authorized to access the task.TaskNotFoundException - If the given taskId in the TaskComment does not refer to an
existing task.BulkOperationResults<String,TaskanaException> setCallbackStateForTasks(List<String> externalIds, CallbackState state)
externalIds - the EXTERNAL_IDs of the tasks on which the callback state is set.state - the callback state that is to be set on the tasksBulkOperationResults<String,TaskanaException> setOwnerOfTasks(String owner, List<String> taskIds)
owner - the new owner of the taskstaskIds - the IDs of the tasks on which the owner is to be set.BulkOperationResults<String,TaskanaException> setPlannedPropertyOfTasks(Instant planned, List<String> taskIds)
planned - the new 'PLANNED" property of the taskstaskIds - the IDs of the tasks on which the new planned property is to be set.Task cancelTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
taskId - the id of the task to cancel.TaskNotFoundException - if the Task with Id TaskId is not foundInvalidStateException - if the task is not in state READY or CLAIMEDNotAuthorizedException - if the current user is not authorized to see the taskTask terminateTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
taskId - the id of the task to cancel.TaskNotFoundException - if the Task with Id TaskId is not foundInvalidStateException - if the task is not in state READY or CLAIMEDNotAuthorizedException - if the current user is not authorized to see the taskCopyright © 2020. All rights reserved.