public class TaskServiceImpl extends Object implements TaskService
| Constructor and Description |
|---|
TaskServiceImpl(TaskanaEngine taskanaEngine,
TaskMapper taskMapper,
ObjectReferenceMapper objectReferenceMapper) |
| Modifier and Type | Method and Description |
|---|---|
Task |
claim(String taskId)
Claim an existing task for the current user.
|
Task |
claim(String taskId,
boolean forceClaim)
Claim an existing task for the current user.
|
Task |
completeTask(String taskId)
Complete a claimed Task as owner/admin and update State and Timestamps.
|
Task |
completeTask(String taskId,
boolean isForced)
Complete a claimed Task and update State and Timestamps.
|
Task |
createTask(Task taskToCreate)
Persists a not persisted Task which does not exist already.
|
TaskQuery |
createTaskQuery()
This method provides a query builder for quering the database.
|
Task |
getTaskById(String id)
Get the details of a task by Id.
|
List<Task> |
getTasksByWorkbasketKeyAndState(String workbasketKey,
TaskState taskState)
Getting a list of all Tasks which got matching workbasketIds and states.
|
List<TaskSummary> |
getTaskSummariesByWorkbasketKey(String workbasketKey)
Getting a short summary of all tasks in a specific work basket.
|
Task |
newTask()
Returns a not persisted instance of
Task. |
Task |
setTaskRead(String taskId,
boolean isRead)
Marks a task as read.
|
Task |
transfer(String taskId,
String destinationWorkbasketKey)
Transfer a task to another work basket.
|
public TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper, ObjectReferenceMapper objectReferenceMapper)
public Task claim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException
TaskServiceclaim in interface TaskServicetaskId - 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 TaskState.READYInvalidOwnerException - if the task with taskId is claimed by some elsepublic Task claim(String taskId, boolean forceClaim) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException
TaskServiceclaim in interface TaskServicetaskId - the id of the task to be claimedforceClaim - if true, claim is performed even if the task is already claimed by someone elseTaskNotFoundException - if the task with taskId was not foundInvalidStateException - if the state of the task with taskId is not TaskState.READYInvalidOwnerException - if the task with taskId is claimed by someone elsepublic Task completeTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException
TaskServicecompleteTask in interface TaskServicetaskId - - Id of the Task which should be completed.TaskNotFoundException - if the given Task can´t be found in DB.InvalidOwnerException - if current user is not the task-owner or administrator.InvalidStateException - when Task wasn´t claimed before.public Task completeTask(String taskId, boolean isForced) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException
TaskServicecompleteTask in interface TaskServicetaskId - - Id of the Task which should be completed.isForced - - Flag which can complete a Task in every case if Task does exist.TaskNotFoundException - if the given Task can´t be found in DB.InvalidOwnerException - if current user is not the task-owner or administrator.InvalidStateException - when Task wasn´t claimed before.public Task createTask(Task taskToCreate) throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException
TaskServicecreateTask in interface TaskServicetaskToCreate - the transient task object to be persistedNotAuthorizedException - 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 foundTaskAlreadyExistException - when the Task does already exist.InvalidWorkbasketException - thrown if the referenced Workbasket has missing required propertiespublic Task getTaskById(String id) throws TaskNotFoundException
TaskServicegetTaskById in interface TaskServiceid - the id of the taskTaskNotFoundException - thrown of the Task with taskId is not foundpublic Task transfer(String taskId, String destinationWorkbasketKey) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException
TaskServicetransfer in interface TaskServicetaskId - The id of the Task to be transferreddestinationWorkbasketKey - The key 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 basketInvalidWorkbasketException - Thrown if either the source or the target workbasket has a missing required propertypublic Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException
TaskServicesetTaskRead in interface TaskServicetaskId - the id of the task to be updatedisRead - the new status of the read flag.TaskNotFoundException - Thrown if the Task with taskId was not foundpublic TaskQuery createTaskQuery()
TaskServicecreateTaskQuery in interface TaskServiceTaskQuerypublic List<Task> getTasksByWorkbasketKeyAndState(String workbasketKey, TaskState taskState) throws WorkbasketNotFoundException, NotAuthorizedException
TaskServicegetTasksByWorkbasketKeyAndState in interface TaskServiceworkbasketKey - the key of the workbasket where the tasks need to be in.taskState - which is required for the request,WorkbasketNotFoundException - if the workbasketId can´t be resolved to a existing work basket.NotAuthorizedException - if the current user got no rights for reading on this work basket.public List<TaskSummary> getTaskSummariesByWorkbasketKey(String workbasketKey) throws WorkbasketNotFoundException, InvalidWorkbasketException
TaskServicegetTaskSummariesByWorkbasketKey in interface TaskServiceworkbasketKey - Key of work basket where tasks are located.WorkbasketNotFoundException - if a Work basket can´t be located.InvalidWorkbasketException - thrown if the Workbasket specified with workbasketId has a missing required propertypublic Task newTask()
TaskServiceTask.newTask in interface TaskServiceCopyright © 2017. All rights reserved.