Package pro.taskana.task.internal
Class TaskServiceImpl
- java.lang.Object
-
- pro.taskana.task.internal.TaskServiceImpl
-
- All Implemented Interfaces:
TaskService
public class TaskServiceImpl extends Object implements TaskService
This is the implementation of TaskService.
-
-
Constructor Summary
Constructors Constructor Description TaskServiceImpl(InternalTaskanaEngine taskanaEngine, TaskMapper taskMapper, TaskCommentMapper taskCommentMapper, AttachmentMapper attachmentMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaskcancelClaim(String taskId)Cancel the claim of an existing task if it was claimed by the current user before.TaskcancelTask(String taskId)Cancels a task.Taskclaim(String taskId)Claim an existing task for the current user.TaskcompleteTask(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.TaskcreateTask(Task taskToCreate)Inserts a not existing Task.TaskCommentcreateTaskComment(TaskComment taskComment)Create a task comment.TaskQuerycreateTaskQuery()This method provides a query builder for querying the database.voiddeleteTask(String taskId)Deletes the task with the given Id.voiddeleteTaskComment(String taskCommentId)Deletes the task comment with the given Id.BulkOperationResults<String,TaskanaException>deleteTasks(List<String> taskIds)Deletes a list of tasks.List<String>findTasksIdsAffectedByClassificationChange(String classificationId)TaskforceCancelClaim(String taskId)Cancel the claim of an existing task even if it was claimed by another user.TaskforceClaim(String taskId)Claim an existing task for the current user even if it is already claimed by someone else.TaskforceCompleteTask(String taskId)Completes a Task and updates State and Timestamps in every case if the Task exists.BulkOperationResults<String,TaskanaException>forceCompleteTasks(List<String> taskIds)Completes a list of tasks.voidforceDeleteTask(String taskId)Deletes the task with the given Id even if it is not completed.TaskgetTask(String id)Gets the details of a task by Id without checking permissions.TaskCommentgetTaskComment(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.AttachmentnewAttachment()Returns a not inserted instance ofAttachment.TasknewTask()Returns a not inserted instance ofTask.TasknewTask(String workbasketId)Returns a not inserted instance ofTask.TasknewTask(String workbasketKey, String domain)Returns a not inserted instance ofTask.TaskCommentnewTaskComment(String taskId)Returns a not inserted instance ofTaskComment.voidrefreshPriorityAndDueDatesOfTasksOnClassificationUpdate(List<String> taskIds, boolean serviceLevelChanged, boolean priorityChanged)TaskselectAndClaim(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> argTaskIds)Sets the planned property on a list of tasks.TasksetTaskRead(String taskId, boolean isRead)Marks a task as read.TaskterminateTask(String taskId)Terminates a task.Tasktransfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag)Transfers a Task to another Workbasket.Tasktransfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag)Transfers a Task to another Workbasket.BulkOperationResults<String,TaskanaException>transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, boolean setTransferFlag)Transfers a list of Tasks to another Workbasket.BulkOperationResults<String,TaskanaException>transferTasks(String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag)Transfers a list of Tasks to another Workbasket.TaskupdateTask(Task task)Update a task.TaskCommentupdateTaskComment(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 matchingObjectReference.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface pro.taskana.task.api.TaskService
transfer, transfer, transferTasks, transferTasks
-
-
-
-
Constructor Detail
-
TaskServiceImpl
public TaskServiceImpl(InternalTaskanaEngine taskanaEngine, TaskMapper taskMapper, TaskCommentMapper taskCommentMapper, AttachmentMapper attachmentMapper)
-
-
Method Detail
-
claim
public Task claim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
Description copied from interface:TaskServiceClaim an existing task for the current user.- Specified by:
claimin interfaceTaskService- Parameters:
taskId- the id of the task to be claimed- Returns:
- claimed Task
- Throws:
TaskNotFoundException- 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 in
-
forceClaim
public Task forceClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
Description copied from interface:TaskServiceClaim an existing task for the current user even if it is already claimed by someone else.- Specified by:
forceClaimin interfaceTaskService- Parameters:
taskId- the id of the task to be claimed- Returns:
- claimed Task
- Throws:
TaskNotFoundException- 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 in
-
cancelClaim
public Task cancelClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
Description copied from interface:TaskServiceCancel the claim of an existing task if it was claimed by the current user before.- Specified by:
cancelClaimin interfaceTaskService- Parameters:
taskId- id of the task which should be unclaimed.- Returns:
- updated unclaimed task
- Throws:
TaskNotFoundException- if the task can't be found or does not existInvalidStateException- if the task is already in an end state.InvalidOwnerException- if the task is claimed by another user.NotAuthorizedException- if the current user has no read permission for the workbasket the task is in
-
forceCancelClaim
public Task forceCancelClaim(String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException
Description copied from interface:TaskServiceCancel the claim of an existing task even if it was claimed by another user.- Specified by:
forceCancelClaimin interfaceTaskService- Parameters:
taskId- id of the task which should be unclaimed.- Returns:
- updated unclaimed task
- Throws:
TaskNotFoundException- if the task can't be found or does not existInvalidStateException- if the task is already in an end state.InvalidOwnerException- if 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 in
-
completeTask
public Task completeTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceComplete a claimed Task as owner/admin and update State and Timestamps. If task is already completed, the task is returned as itself.- Specified by:
completeTaskin interfaceTaskService- Parameters:
taskId- - Id of the Task which should be completed.- Returns:
- Task - updated task after completion.
- Throws:
TaskNotFoundException- if the given Task can't be found in DB.InvalidOwnerException- if current user is not the task-owner or administrator.InvalidStateException- if Task wasn't claimed before.NotAuthorizedException- if the current user has no read permission for the workbasket the task is in
-
forceCompleteTask
public Task forceCompleteTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceCompletes a Task and updates State and Timestamps in every case if the Task exists. If task is already completed, the task is returned as itself.- Specified by:
forceCompleteTaskin interfaceTaskService- Parameters:
taskId- - Id of the Task which should be completed.- Returns:
- Task - updated task after completion.
- Throws:
TaskNotFoundException- if the given Task can't be found in DB.InvalidOwnerException- if current user is not the task-owner or administrator.InvalidStateException- if Task wasn't claimed before.NotAuthorizedException- if the current user has no read permission for the workbasket the task is in
-
createTask
public Task createTask(Task taskToCreate) throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException
Description copied from interface:TaskServiceInserts a not existing Task.
The default values of the created Task are:- id - generated by IdGenerator
- externalId - generated by IdGenerator
- businessProcessId - generated by IdGenerator
- name - name of its Classification
- description - description of its Classification
- creator - id of current user
- state - 'READY'
- isRead -
false - isTransferred -
false
- Specified by:
createTaskin interfaceTaskService- Parameters:
taskToCreate- the transient task object to be inserted- Returns:
- the created and inserted task
- Throws:
NotAuthorizedException- thrown if the current user is not authorized to create that taskWorkbasketNotFoundException- thrown if the workbasket referenced by the task is not foundClassificationNotFoundException- thrown if the Classification referenced by the task is not foundTaskAlreadyExistException- if the Task does already exist.InvalidArgumentException- thrown if the primary ObjectReference is invalidAttachmentPersistenceException- if an Attachment with ID will be added multiple times without using the task-methods
-
getTask
public Task getTask(String id) throws NotAuthorizedException, TaskNotFoundException
Description copied from interface:TaskServiceGets the details of a task by Id without checking permissions.- Specified by:
getTaskin interfaceTaskService- Parameters:
id- the id of the task- Returns:
- the Task
- Throws:
NotAuthorizedException- if the current user has no READ permission for the workbasket the task is in.TaskNotFoundException- thrown of theTaskwith taskId is not found
-
transfer
public Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException
Description copied from interface:TaskServiceTransfers a Task to another Workbasket.The transfer resets the read flag and sets the transfer flag if
setTransferFlagistrue.- Specified by:
transferin interfaceTaskService- Parameters:
taskId- the id of the Task which should be transferreddestinationWorkbasketId- the id of the target WorkbasketsetTransferFlag- the control about whether to set the TaskSummary.isTransferred() flag or not- Returns:
- the transferred Task
- Throws:
TaskNotFoundException- Thrown if the Task with taskId was not found.WorkbasketNotFoundException- Thrown if the target Workbasket was not found.NotAuthorizedException- Thrown if the current user is not authorized to transfer this Task to the target WorkbasketInvalidStateException- Thrown if the Task is in a state which does not allow transferring
-
transfer
public Task transfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException
Description copied from interface:TaskServiceTransfers a Task to another Workbasket.The transfer resets the read flag and sets the transfer flag if
setTransferFlagistrue.- Specified by:
transferin interfaceTaskService- Parameters:
taskId- the id of the Task which should be transferredworkbasketKey- the key of the target Workbasketdomain- the domain of the target WorkbasketsetTransferFlag- the control about whether to set the TaskSummary.isTransferred() flag or not- Returns:
- the transferred Task
- Throws:
TaskNotFoundException- Thrown if theTaskwith taskId was not found.WorkbasketNotFoundException- Thrown if the target Workbasket was not found.NotAuthorizedException- Thrown if the current user is not authorized to transfer this Task to the target WorkbasketInvalidStateException- Thrown if the Task is in a state which does not allow transferring
-
setTaskRead
public Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedException
Description copied from interface:TaskServiceMarks a task as read.- Specified by:
setTaskReadin interfaceTaskService- Parameters:
taskId- the id of the task to be updatedisRead- the new status of the read flag.- Returns:
- the updated Task
- Throws:
TaskNotFoundException- Thrown if theTaskwith taskId was not foundNotAuthorizedException- if the current user has no read permission for the workbasket the task is in
-
createTaskQuery
public TaskQuery createTaskQuery()
Description copied from interface:TaskServiceThis method provides a query builder for querying the database.- Specified by:
createTaskQueryin interfaceTaskService- Returns:
- a
TaskQuery
-
newTask
public Task newTask()
Description copied from interface:TaskServiceReturns a not inserted instance ofTask. 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 inserted.- Specified by:
newTaskin interfaceTaskService- Returns:
- an empty new Task
-
newTask
public Task newTask(String workbasketId)
Description copied from interface:TaskServiceReturns a not inserted instance ofTask.- Specified by:
newTaskin interfaceTaskService- Parameters:
workbasketId- the id of the workbasket to which the task belongs- Returns:
- an empty new Task
-
newTask
public Task newTask(String workbasketKey, String domain)
Description copied from interface:TaskServiceReturns a not inserted instance ofTask.- Specified by:
newTaskin interfaceTaskService- Parameters:
workbasketKey- the key of the workbasket to which the task belongsdomain- the domain of the workbasket to which the task belongs- Returns:
- an empty new Task
-
newTaskComment
public TaskComment newTaskComment(String taskId)
Description copied from interface:TaskServiceReturns a not inserted instance ofTaskComment.- Specified by:
newTaskCommentin interfaceTaskService- Parameters:
taskId- The id of the task to which the task comment belongs- Returns:
- an empty new TaskComment
-
newAttachment
public Attachment newAttachment()
Description copied from interface:TaskServiceReturns a not inserted instance ofAttachment.- Specified by:
newAttachmentin interfaceTaskService- Returns:
- an empty new Attachment
-
updateTask
public Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException, InvalidStateException, ClassificationNotFoundException
Description copied from interface:TaskServiceUpdate a task.- Specified by:
updateTaskin interfaceTaskService- Parameters:
task- the task to be updated in the database- Returns:
- the updated task
- Throws:
InvalidArgumentException- 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 userNotAuthorizedException- 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 .ClassificationNotFoundException- if the updated task refers to a classification that cannot be found
-
transferTasks
public BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException
Description copied from interface:TaskServiceTransfers a list of Tasks to another Workbasket.The transfer resets the read flag and sets the transfer flag if
setTransferFlagistrue. Exceptions will be thrown if the caller got no permissions on the target or it does not exist. Other Exceptions will be stored and returned in the end.- Specified by:
transferTasksin interfaceTaskService- Parameters:
destinationWorkbasketId- target Workbasket idtaskIds- list of source Tasks which will be movedsetTransferFlag- the control about whether to set the TaskSummary.isTransferred() flag or not- Returns:
- Bulkresult with ID and Error in it for failed transactions.
- Throws:
NotAuthorizedException- if the caller has no permissions on target Workbasket.InvalidArgumentException- if the method parameters are EMPTY or NULL.WorkbasketNotFoundException- if the target Workbasket can not be found.
-
transferTasks
public BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, boolean setTransferFlag) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException
Description copied from interface:TaskServiceTransfers a list of Tasks to another Workbasket.The transfer resets the read flag and sets the transfer flag if
setTransferFlagistrue. Exceptions will be thrown if the caller got no permissions on the target or it does not exist. Other Exceptions will be stored and returned in the end.- Specified by:
transferTasksin interfaceTaskService- Parameters:
destinationWorkbasketKey- target Workbasket keydestinationWorkbasketDomain- target Workbasket domaintaskIds- list of source Tasks which will be movedsetTransferFlag- the control about whether to set the TaskSummary.isTransferred() flag or not- Returns:
- BulkResult with ID and Error in it for failed transactions.
- Throws:
NotAuthorizedException- if the caller has no permissions on target Workbasket.InvalidArgumentException- if the method parameters are EMPTY or NULL.WorkbasketNotFoundException- if the target Workbasket can not be found.
-
deleteTask
public void deleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceDeletes the task with the given Id.- Specified by:
deleteTaskin interfaceTaskService- Parameters:
taskId- The Id of the task to delete.- Throws:
TaskNotFoundException- If the given Id does not refer to an existing task.InvalidStateException- If the state of the referenced task is not an end state.NotAuthorizedException- if the current user is not member of role ADMIN
-
forceDeleteTask
public void forceDeleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceDeletes the task with the given Id even if it is not completed.- Specified by:
forceDeleteTaskin interfaceTaskService- Parameters:
taskId- The Id of the task to delete.- Throws:
TaskNotFoundException- If the given Id does not refer to an existing task.InvalidStateException- If the state of the referenced task is not an end state and forceDelete is false.NotAuthorizedException- if the current user is not member of role ADMIN
-
selectAndClaim
public Task selectAndClaim(TaskQuery taskQuery) throws NotAuthorizedException, InvalidOwnerException
Description copied from interface:TaskServiceSelects and claims the first task which is returned by the task query.- Specified by:
selectAndClaimin interfaceTaskService- Parameters:
taskQuery- the task query.- Returns:
- the task that got selected and claimed
- Throws:
NotAuthorizedException- if the current user has no read permission for the workbasket the task is inInvalidOwnerException- if the task is claimed by someone else
-
deleteTasks
public BulkOperationResults<String,TaskanaException> deleteTasks(List<String> taskIds) throws InvalidArgumentException, NotAuthorizedException
Description copied from interface:TaskServiceDeletes a list of tasks.- Specified by:
deleteTasksin interfaceTaskService- Parameters:
taskIds- the ids of the tasks to delete.- Returns:
- the result of the operations with Id and Exception for each failed task deletion.
- Throws:
InvalidArgumentException- if the TaskIds parameter is NULLNotAuthorizedException- if the current user is not member of role ADMIN
-
completeTasks
public BulkOperationResults<String,TaskanaException> completeTasks(List<String> taskIds) throws InvalidArgumentException
Description copied from interface:TaskServiceCompletes a list of tasks.- Specified by:
completeTasksin interfaceTaskService- Parameters:
taskIds- of the tasks which should be completed.- Returns:
- the result of the operations with Id and Exception for each failed task completion.
- Throws:
InvalidArgumentException- If the taskId parameter is NULL.
-
forceCompleteTasks
public BulkOperationResults<String,TaskanaException> forceCompleteTasks(List<String> taskIds) throws InvalidArgumentException
Description copied from interface:TaskServiceCompletes a list of tasks.- Specified by:
forceCompleteTasksin interfaceTaskService- Parameters:
taskIds- of the tasks which should be completed.- Returns:
- the result of the operations with Id and Exception for each failed task completion.
- Throws:
InvalidArgumentException- If the taskId parameter is NULL.- See Also:
TaskService.forceCompleteTask(java.lang.String)
-
updateTasks
public List<String> updateTasks(ObjectReference selectionCriteria, Map<TaskCustomField,String> customFieldsToUpdate) throws InvalidArgumentException
Description copied from interface:TaskServiceUpdates tasks with a matchingObjectReference.- Specified by:
updateTasksin interfaceTaskService- Parameters:
selectionCriteria- theObjectReferencethat is used to select the tasks.customFieldsToUpdate- aMapthat contains as key the identification of the custom field and as value the corresponding new value of that custom field.- Returns:
- a list of the Ids of all modified tasks
- Throws:
InvalidArgumentException- if the given selectionCriteria is invalid or the given customFieldsToUpdate are null or empty.
-
updateTasks
public List<String> updateTasks(List<String> taskIds, Map<TaskCustomField,String> customFieldsToUpdate) throws InvalidArgumentException
Description copied from interface:TaskServiceUpdates tasks with matching taskIds.- Specified by:
updateTasksin interfaceTaskService- Parameters:
taskIds- the taskIds that are used to select the tasks.customFieldsToUpdate- aMapthat contains as key the identification of the custom field and as value the corresponding new value of that custom field.- Returns:
- a list of the Ids of all modified tasks
- Throws:
InvalidArgumentException- if the given customFieldsToUpdate are null or empty.
-
createTaskComment
public TaskComment createTaskComment(TaskComment taskComment) throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceCreate a task comment.- Specified by:
createTaskCommentin interfaceTaskService- Parameters:
taskComment- the task comment to be created.- Returns:
- the created task comment.
- Throws:
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 empty
-
updateTaskComment
public TaskComment updateTaskComment(TaskComment taskComment) throws NotAuthorizedException, ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceUpdate a task comment.- Specified by:
updateTaskCommentin interfaceTaskService- Parameters:
taskComment- the task comment to be updated in the database.- Returns:
- the updated task comment.
- Throws:
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 empty
-
deleteTaskComment
public void deleteTaskComment(String taskCommentId) throws NotAuthorizedException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceDeletes the task comment with the given Id.- Specified by:
deleteTaskCommentin interfaceTaskService- Parameters:
taskCommentId- The id of the task comment to delete.- Throws:
NotAuthorizedException- If the current user has no authorization to delete a task comment or is not authorized to access the task.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 taskCommentId is null/empty
-
getTaskComment
public TaskComment getTaskComment(String taskCommentid) throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceRetrieves a task comment for a given taskCommentId.- Specified by:
getTaskCommentin interfaceTaskService- Parameters:
taskCommentid- The id of the task comment which should be retrieved- Returns:
- the task comment identified by taskCommentId
- Throws:
TaskCommentNotFoundException- 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 empty
-
getTaskComments
public List<TaskComment> getTaskComments(String taskId) throws NotAuthorizedException, TaskNotFoundException
Description copied from interface:TaskServiceRetrieves a list of task comments for a given taskId.- Specified by:
getTaskCommentsin interfaceTaskService- Parameters:
taskId- The id of the task for which all task comments should be retrieved- Returns:
- the list of task comments attached to task with id taskId
- Throws:
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.
-
setCallbackStateForTasks
public BulkOperationResults<String,TaskanaException> setCallbackStateForTasks(List<String> externalIds, CallbackState state)
Description copied from interface:TaskServiceSets the callback state on a list of tasks. Note: this method is primarily intended to be used by the TaskanaAdapter- Specified by:
setCallbackStateForTasksin interfaceTaskService- Parameters:
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 tasks- Returns:
- the result of the operations with Id and Exception for each failed task deletion.
-
setOwnerOfTasks
public BulkOperationResults<String,TaskanaException> setOwnerOfTasks(String owner, List<String> taskIds)
Description copied from interface:TaskServiceSets the owner on a list of tasks. The owner will only be set on tasks that are in state READY.- Specified by:
setOwnerOfTasksin interfaceTaskService- Parameters:
owner- the new owner of the taskstaskIds- the IDs of the tasks on which the owner is to be set.- Returns:
- the result of the operations with Id and Exception for each failed task update.
-
setPlannedPropertyOfTasks
public BulkOperationResults<String,TaskanaException> setPlannedPropertyOfTasks(Instant planned, List<String> argTaskIds)
Description copied from interface:TaskServiceSets the planned property on a list of tasks. Only tasks in state READY and CLAIMED will be affected by this method. On each task, the corresponding due date is set according to the shortest service level in the classifications of the task and the task's attachments.- Specified by:
setPlannedPropertyOfTasksin interfaceTaskService- Parameters:
planned- the new 'PLANNED" property of the tasksargTaskIds- the IDs of the tasks on which the new planned property is to be set.- Returns:
- the result of the operations with Id and Exception for each failed task update.
-
cancelTask
public Task cancelTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceCancels a task. Cancellation means a task is obsolete from a business perspective an does not need to be completed anymore.- Specified by:
cancelTaskin interfaceTaskService- Parameters:
taskId- the id of the task to cancel.- Returns:
- the updated task.
- Throws:
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 task
-
terminateTask
public Task terminateTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceTerminates a task. Termination is a administrative action to complete a task. This is typically done by an administration to correct any technical issue.- Specified by:
terminateTaskin interfaceTaskService- Parameters:
taskId- the id of the task to cancel.- Returns:
- the updated task.
- Throws:
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 task
-
findTasksIdsAffectedByClassificationChange
public List<String> findTasksIdsAffectedByClassificationChange(String classificationId)
-
-