public class TaskServiceImpl extends Object implements TaskService
| Constructor and Description |
|---|
TaskServiceImpl(InternalTaskanaEngine taskanaEngine,
TaskMapper taskMapper,
AttachmentMapper attachmentMapper) |
| 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 |
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> taskIdsToBeCompleted)
Completes a list of tasks.
|
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.
|
void |
deleteTask(String taskId)
Deletes the task with the given Id.
|
BulkOperationResults<String,TaskanaException> |
deleteTasks(List<String> taskIds)
Deletes a list of tasks.
|
Set<String> |
findTasksIdsAffectedByClassificationChange(String classificationId) |
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.
|
void |
forceDeleteTask(String taskId)
Deletes the task with the given Id even if it is not completed.
|
Task |
getTask(String id)
Get the details of a task by Id without checking permissions.
|
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. |
void |
refreshPriorityAndDueDate(String taskId) |
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> argTaskIds)
Sets the owner on a list of tasks.
|
BulkOperationResults<String,TaskanaException> |
setPlannedPropertyOfTasks(Instant planned,
List<String> argTaskIds)
Sets the planned property on a list of tasks.
|
Task |
setTaskRead(String taskId,
boolean isRead)
Marks a task as read.
|
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.
|
List<String> |
updateTasks(List<String> taskIds,
Map<String,String> customFieldsToUpdate)
Updates tasks with matching taskIds.
|
List<String> |
updateTasks(ObjectReference selectionCriteria,
Map<String,String> customFieldsToUpdate)
Updates tasks with a matching
ObjectReference. |
public TaskServiceImpl(InternalTaskanaEngine taskanaEngine, TaskMapper taskMapper, AttachmentMapper attachmentMapper)
public Task claim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
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 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 inpublic Task forceClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
TaskServiceforceClaim 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 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 inpublic Task cancelClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
TaskServicecancelClaim in interface TaskServicetaskId - 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 inpublic Task forceCancelClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
TaskServiceforceCancelClaim in interface TaskServicetaskId - 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 inpublic Task completeTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException
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.NotAuthorizedException - if the current user has no read permission for the workbasket
the task is inpublic Task forceCompleteTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException
TaskServiceforceCompleteTask 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.NotAuthorizedException - if the current user has no read permission for the workbasket
the task is inpublic Task createTask(Task taskToCreate) throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, 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.InvalidArgumentException - thrown if the primary ObjectReference is invalidpublic Task getTask(String id) throws TaskNotFoundException, NotAuthorizedException
TaskServicegetTask in interface TaskServiceid - 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.public Task transfer(String taskId, String destinationWorkbasketId) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException
TaskServicetransfer in interface TaskServicetaskId - 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
transferringpublic Task transfer(String taskId, String workbasketKey, String domain) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException
TaskServicetransfer in interface TaskServicetaskId - 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
transferringpublic Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedException
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 foundNotAuthorizedException - if the current user has no read permission for the workbasket
the task is inpublic TaskQuery createTaskQuery()
TaskServicecreateTaskQuery in interface TaskServiceTaskQuerypublic Task newTask()
TaskServiceTask. 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.newTask in interface TaskServicepublic Task newTask(String workbasketId)
TaskServiceTask.newTask in interface TaskServiceworkbasketId - the id of the workbasket to which the task belongspublic Task newTask(String workbasketKey, String domain)
TaskServiceTask.newTask in interface TaskServiceworkbasketKey - the key of the workbasket to which the task belongsdomain - the domain of the workbasket to which the task belongspublic Attachment newAttachment()
TaskServiceAttachment.newAttachment in interface TaskServicepublic Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, ClassificationNotFoundException, NotAuthorizedException, AttachmentPersistenceException, InvalidStateException
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 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 .public BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException
TaskServicetransferTasks in interface TaskServicedestinationWorkbasketId - 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.public BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException
TaskServicetransferTasks in interface TaskServicedestinationWorkbasketKey - 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.public void deleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
TaskServicedeleteTask in interface TaskServicetaskId - 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 ADMINpublic void forceDeleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
TaskServiceforceDeleteTask in interface TaskServicetaskId - 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 ADMINpublic BulkOperationResults<String,TaskanaException> deleteTasks(List<String> taskIds) throws InvalidArgumentException
TaskServicedeleteTasks in interface TaskServicetaskIds - the ids of the tasks to delete.InvalidArgumentException - if the TaskIds parameter is NULLpublic BulkOperationResults<String,TaskanaException> completeTasks(List<String> taskIdsToBeCompleted) throws InvalidArgumentException
TaskServicecompleteTasks in interface TaskServicetaskIdsToBeCompleted - of the tasks which should be completed.InvalidArgumentException - If the taskId parameter is NULL.public List<String> updateTasks(ObjectReference selectionCriteria, Map<String,String> customFieldsToUpdate) throws InvalidArgumentException
TaskServiceObjectReference.updateTasks in interface TaskServiceselectionCriteria - 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. The key for
identification of the custom field must be a String with value "1", "2" ... "16" as in the
setCustomAttribute or getCustomAttribute method of TaskInvalidArgumentException - If the customFieldsToUpdate map contains an invalid key or if
the selectionCriteria is invalidpublic List<String> updateTasks(List<String> taskIds, Map<String,String> customFieldsToUpdate) throws InvalidArgumentException
TaskServiceupdateTasks in interface TaskServicetaskIds - 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. The key for
identification of the custom field must be a String with value "1", "2" ... "16" as in the
setCustomAttribute or getCustomAttribute method of TaskInvalidArgumentException - If the customFieldsToUpdate map contains an invalid key or if
the selectionCriteria is invalidpublic BulkOperationResults<String,TaskanaException> setCallbackStateForTasks(List<String> externalIds, CallbackState state)
TaskServicesetCallbackStateForTasks in interface TaskServiceexternalIds - the EXTERNAL_IDs of the tasks on which the callback state is set.state - the callback state that is to be set on the taskspublic BulkOperationResults<String,TaskanaException> setOwnerOfTasks(String owner, List<String> argTaskIds)
TaskServicesetOwnerOfTasks in interface TaskServiceowner - the new owner of the tasksargTaskIds - the IDs of the tasks on which the owner is to be set.public BulkOperationResults<String,TaskanaException> setPlannedPropertyOfTasks(Instant planned, List<String> argTaskIds)
TaskServicesetPlannedPropertyOfTasks in interface TaskServiceplanned - the new 'PLANNED" property of the tasksargTaskIds - the IDs of the tasks on which the new planned property is to be set.public Set<String> findTasksIdsAffectedByClassificationChange(String classificationId)
public void refreshPriorityAndDueDate(String taskId) throws ClassificationNotFoundException
ClassificationNotFoundExceptionCopyright © 2020. All rights reserved.