public class TaskServiceImpl extends Object implements TaskService
| Constructor and Description |
|---|
TaskServiceImpl(TaskanaEngine taskanaEngine,
TaskMapper taskMapper,
AttachmentMapper attachmentMapper) |
| 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 |
getTask(String id)
Get the details of a task by Id without checking permissions.
|
List<TaskSummary> |
getTasksByWorkbasketKeyAndState(String workbasketKey,
TaskState taskState)
Getting a list of all Task summaries which got matching workbasketIds and states.
|
List<TaskSummary> |
getTaskSummariesByWorkbasketKey(String workbasketKey)
Getting a short summary of all tasks in a specific work basket.
|
Attachment |
newAttachment()
Returns a not persisted instance of
Attachment. |
Task |
newTask(String workbasketKey)
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.
|
Task |
updateTask(Task task)
Update a task.
|
public TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper, AttachmentMapper attachmentMapper)
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, InvalidArgumentException
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 propertiesInvalidArgumentException - thrown if the primary ObjectReference is invalidpublic Task getTask(String id) throws TaskNotFoundException
TaskServicegetTask 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<TaskSummary> getTasksByWorkbasketKeyAndState(String workbasketKey, TaskState taskState) throws WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException
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.ClassificationNotFoundException - if a single Classification can not be found for a task which is returnedpublic Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException
TaskServiceupdateTask in interface TaskServicetask - 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 userWorkbasketNotFoundException - if the updated task refers to a work basket that cannot be foundClassificationNotFoundException - if the updated task refers to a classification that cannot be foundInvalidWorkbasketException - if the updated task refers to a workbasket that has missing required propertiesNotAuthorizedException - 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-methods.public List<TaskSummary> getTaskSummariesByWorkbasketKey(String workbasketKey) throws WorkbasketNotFoundException, NotAuthorizedException
TaskServicegetTaskSummariesByWorkbasketKey in interface TaskServiceworkbasketKey - Key of work basket where tasks are located.WorkbasketNotFoundException - if a Work basket can´t be located.NotAuthorizedException - if the current user got no rights for reading on this work basket.public Task newTask(String workbasketKey)
TaskServiceTask.newTask in interface TaskServiceworkbasketKey - the key of the workbasket to which the task belongspublic Attachment newAttachment()
TaskServiceAttachment.newAttachment in interface TaskServiceCopyright © 2018. All rights reserved.