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, ObjectReferenceMapper objectReferenceMapper, UserMapper userMapper)
-
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)Taskclaim(String taskId)Claim an existing Task for the current user.TaskcompleteTask(String taskId)BulkOperationResults<String,TaskanaException>completeTasks(List<String> taskIds)Completes a List of Tasks.TaskcreateTask(Task taskToCreate)Inserts a Task that doesn't exist in the database yet.TaskCommentcreateTaskComment(TaskComment taskComment)Inserts the specified TaskComment into the database.TaskCommentQuerycreateTaskCommentQuery()Creates an empty TaskCommentQuery.TaskQuerycreateTaskQuery()Creates an empty TaskQuery.voiddeleteTask(String taskId)voiddeleteTaskComment(String taskCommentId)Deletes the TaskComment 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)BulkOperationResults<String,TaskanaException>forceCompleteTasks(List<String> taskIds)voidforceDeleteTask(String taskId)TaskgetTask(String id)TaskCommentgetTaskComment(String taskCommentid)Retrieves the TaskComment with the given id.List<TaskComment>getTaskComments(String taskId)AttachmentnewAttachment()Instantiates a non-persistent/non-inserted Attachment.ObjectReferencenewObjectReference()Instantiates a non-persistent/non-inserted ObjectReference.ObjectReferencenewObjectReference(String company, String system, String systemInstance, String type, String value)Instantiates a non-persistent/non-inserted ObjectReference.TasknewTask()Instantiates a non-persistent/non-inserted Task.TasknewTask(String workbasketId)Instantiates a non-persistent/non-inserted Task.TasknewTask(String workbasketKey, String domain)Instantiates a non-persistent/non-inserted Task.TaskCommentnewTaskComment(String taskId)Instantiates a non-persistent/non-inserted TaskComment.voidrefreshPriorityAndDueDatesOfTasksOnClassificationUpdate(List<String> taskIds, boolean serviceLevelChanged, boolean priorityChanged)TaskselectAndClaim(TaskQuery taskQuery)BulkOperationResults<String,TaskanaException>setCallbackStateForTasks(List<String> externalIds, CallbackState state)Sets the specified CallbackState on a List of Tasks.BulkOperationResults<String,TaskanaException>setOwnerOfTasks(String owner, List<String> taskIds)BulkOperationResults<String,TaskanaException>setPlannedPropertyOfTasks(Instant planned, List<String> argTaskIds)TasksetTaskRead(String taskId, boolean isRead)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)Updates the specified TaskComment.List<String>updateTasks(List<String> taskIds, Map<TaskCustomField,String> customFieldsToUpdate)Updates specified TaskCustomFields for all given Tasks.List<String>updateTasks(ObjectReference selectionCriteria, Map<TaskCustomField,String> customFieldsToUpdate)-
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, ObjectReferenceMapper objectReferenceMapper, UserMapper userMapper)
-
-
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:
- the claimed Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundInvalidStateException- if the state of the Task with taskId isn't TaskState.READYInvalidOwnerException- if the Task with taskId is claimed by some elseNotAuthorizedException- if the current user has no WorkbasketPermission.READ 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:
- the claimed Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundInvalidStateException- if the state of the Task with taskId isn't TaskState.READYInvalidOwnerException- if the Task with taskId is claimed by someone elseNotAuthorizedException- if the current user has no WorkbasketPermission.READ 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- the id of the Task which should be unclaimed- Returns:
- the unclaimed Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundInvalidStateException- if the Task is already in one of the TaskState.END_STATESInvalidOwnerException- if the Task is claimed by another userNotAuthorizedException- if the current user has no WorkbasketPermission.READ 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- the id of the Task which should be unclaimed- Returns:
- the unclaimed Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundInvalidStateException- if the Task is already in one of the TaskState.END_STATESInvalidOwnerException- if forceCancel is false and the Task is claimed by another userNotAuthorizedException- if the current user has no WorkbasketPermission.READ 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 or TaskanaRole.ADMIN and update state and timestamps.If the Task is already completed, the Task is returned unchanged.
- Specified by:
completeTaskin interfaceTaskService- Parameters:
taskId- the id of the Task which should be completed- Returns:
- the completed Task
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundInvalidOwnerException- if current user isn't the owner of the Task or TaskanaRole.ADMINInvalidStateException- if the state of the Task with taskId is neither TaskState.CLAIMED nor TaskState.COMPLETEDNotAuthorizedException- if the current user has no WorkbasketPermission.READ 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 the Task is already completed, the Task is returned unchanged.
- Specified by:
forceCompleteTaskin interfaceTaskService- Parameters:
taskId- the id of the Task which should be completed- Returns:
- the updated Task after completion
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundInvalidOwnerException- if current user isn't the owner of the Task or TaskanaRole.ADMINInvalidStateException- if the Task with taskId wasn't claimed beforeNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
createTask
public Task createTask(Task taskToCreate) throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException, ObjectReferencePersistenceException
Description copied from interface:TaskServiceInserts a Task that doesn't exist in the database yet.If the workbasketSummary of the given Task is NULL, TaskService will call the TaskRoutingProvider to determine a Workbasket for the Task. If the TaskRoutingProvider is not active, e.g. because no TaskRoutingProvider is registered, or the TaskRoutingProvider doesn't find a Workbasket, the Task will not be inserted.
The default values of the created Task are:
- id - generated automatically
- externalId - if NULL, then generated automatically, else unchanged
- businessProcessId - generated automatically
- name - if NULL then the name of its Classification, else unchanged
- description - if NULL then description of its Classification, else unchanged
- creator - id of current user
- state - TaskState.READY
- isRead - false
- isTransferred - false
- Specified by:
createTaskin interfaceTaskService- Parameters:
taskToCreate- the transient Task to be inserted- Returns:
- the created and inserted Task
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.APPEND for the Workbasket the Task is inWorkbasketNotFoundException- if the Workbasket referenced by the workbasketSummary of the Task isn't foundClassificationNotFoundException- if the Classification referenced by classificationSummary of the Task isn't foundTaskAlreadyExistException- if the Task already existsInvalidArgumentException- if the primaryObjRef is invalidAttachmentPersistenceException- if an Attachment with the same id was added to the Task multiple times without using Task.addAttachment(Attachment)ObjectReferencePersistenceException- if an ObjectReference with the same id was added to the Task multiple times without using TaskSummary.addSecondaryObjectReference(ObjectReference)
-
getTask
public Task getTask(String id) throws NotAuthorizedException, TaskNotFoundException
Description copied from interface:TaskService- Specified by:
getTaskin interfaceTaskService- Parameters:
id- the id of the Task- Returns:
- the Task with the specified taskId
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inTaskNotFoundException- if the Task with taskId wasn't 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 isRead and sets isTransferred if setTransferFlag is true.
- Specified by:
transferin interfaceTaskService- Parameters:
taskId- the id of the Task which should be transferreddestinationWorkbasketId- the id of the target WorkbasketsetTransferFlag- controls whether to set isTransferred to true or not- Returns:
- the transferred Task
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundWorkbasketNotFoundException- if the target Workbasket was not foundNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target WorkbasketInvalidStateException- if the Task is in one of the TaskState.END_STATES
-
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 isRead and sets isTransferred if setTransferFlag is true.
- 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- controls whether to set isTransferred or not- Returns:
- the transferred Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundWorkbasketNotFoundException- if the target Workbasket was not foundNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target WorkbasketInvalidStateException- if the Task is in one of the TaskState.END_STATES
-
setTaskRead
public Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedException
Description copied from interface:TaskService- Specified by:
setTaskReadin interfaceTaskService- Parameters:
taskId- the id of the Task to be updatedisRead- the new status of isRead- Returns:
- the updated Task
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
createTaskQuery
public TaskQuery createTaskQuery()
Description copied from interface:TaskServiceCreates an empty TaskQuery.- Specified by:
createTaskQueryin interfaceTaskService- Returns:
- a TaskQuery
-
createTaskCommentQuery
public TaskCommentQuery createTaskCommentQuery()
Description copied from interface:TaskServiceCreates an empty TaskCommentQuery.- Specified by:
createTaskCommentQueryin interfaceTaskService- Returns:
- a TaskCommentQuery
-
newTask
public Task newTask()
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted Task.Since a Task doesn't allow setting a workbasketSummary, please either provide an implementation of the TaskRoutingProvider or use the referenced methods to create a Task within a specific Workbasket.
- Specified by:
newTaskin interfaceTaskService- Returns:
- the instantiated Task
- See Also:
TaskService.newTask(String),TaskService.newTask(String, String)
-
newTask
public Task newTask(String workbasketId)
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted Task.- Specified by:
newTaskin interfaceTaskService- Parameters:
workbasketId- the id of the Workbasket to which the Task belongs- Returns:
- the instantiated Task
- See Also:
TaskService.newTask(),TaskService.newTask(String, String)
-
newTask
public Task newTask(String workbasketKey, String domain)
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted Task.- 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:
- the instantiated Task
- See Also:
TaskService.newTask(),TaskService.newTask(String)
-
newTaskComment
public TaskComment newTaskComment(String taskId)
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted TaskComment.- Specified by:
newTaskCommentin interfaceTaskService- Parameters:
taskId- the id of the Task to which the TaskComment belongs- Returns:
- the instantiated TaskComment
-
newAttachment
public Attachment newAttachment()
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted Attachment.- Specified by:
newAttachmentin interfaceTaskService- Returns:
- the instantiated Attachment
-
newObjectReference
public ObjectReference newObjectReference()
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted ObjectReference.- Specified by:
newObjectReferencein interfaceTaskService- Returns:
- the instantiated ObjectReference
- See Also:
TaskService.newObjectReference(String, String, String, String, String)
-
newObjectReference
public ObjectReference newObjectReference(String company, String system, String systemInstance, String type, String value)
Description copied from interface:TaskServiceInstantiates a non-persistent/non-inserted ObjectReference.- Specified by:
newObjectReferencein interfaceTaskService- Parameters:
company- the company of the new ObjectReferencesystem- the system of the new ObjectReferencesystemInstance- the systemInstance of the new ObjectReferencetype- the type of the new ObjectReferencevalue- the value of the new ObjectReference- Returns:
- the instantiated ObjectReference
- See Also:
TaskService.newObjectReference()
-
updateTask
public Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException, ObjectReferencePersistenceException, InvalidStateException, ClassificationNotFoundException
Description copied from interface:TaskServiceUpdate a Task.- Specified by:
updateTaskin interfaceTaskService- Parameters:
task- the Task to be updated- Returns:
- the updated Task
- Throws:
InvalidArgumentException- if the Task to be updated contains invalid properties like e.g. invalid secondaryObjectReferencesTaskNotFoundException- if the Task isn't found in the database by its idConcurrencyException- if the Task has been updated by another user in the meantime; that's the case if the given modified timestamp differs from the one in the databaseNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inAttachmentPersistenceException- if an Attachment with the same id was added to the Task multiple times without using Task.addAttachment(Attachment)ObjectReferencePersistenceException- if an ObjectReference with the same id was added to the Task multiple times without using TaskSummary.addSecondaryObjectReference(ObjectReference)InvalidStateException- if an attempt is made to change the owner of the Task that state isn't TaskState.READYClassificationNotFoundException- if the classificationSummary of the updated Task refers to aClassificationthat can't 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 isRead and sets isTransferred if setTransferFlag is true. Exceptions will be thrown if the caller got no WorkbasketPermission on the target or if the target Workbasket doesn't exist. Other Exceptions will be stored and returned in the end.
- Specified by:
transferTasksin interfaceTaskService- Parameters:
destinationWorkbasketId- id of the target WorkbaskettaskIds- List of source Tasks which will be movedsetTransferFlag- controls whether to set isTransferred or not- Returns:
- Bulkresult with ids and Error for each failed transactions
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target WorkbasketInvalidArgumentException- if the method parameters are empty or NULLWorkbasketNotFoundException- if the target Workbasket can't 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 isRead and sets isTransferred if setTransferFlag is true. Exceptions will be thrown if the caller got no WorkbasketPermission on the target Workbasket or if it doesn't exist. Other Exceptions will be stored and returned in the end.
- Specified by:
transferTasksin interfaceTaskService- Parameters:
destinationWorkbasketKey- target keydestinationWorkbasketDomain- target domaintaskIds- List of ids of source Tasks which will be movedsetTransferFlag- controls whether to set isTransferred or not- Returns:
- BulkResult with ids and Error for each failed transactions
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target WorkbasketInvalidArgumentException- if the method parameters are empty or NULLWorkbasketNotFoundException- if the target Workbasket can't be found
-
deleteTask
public void deleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskService- Specified by:
deleteTaskin interfaceTaskService- Parameters:
taskId- The id of the Task to delete- Throws:
TaskNotFoundException- If the given id doesn't refer to an existing TaskInvalidStateException- If the state of the referenced Task isn't one of the TaskState.END_STATESNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMIN
-
forceDeleteTask
public void forceDeleteTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskService- Specified by:
forceDeleteTaskin interfaceTaskService- Parameters:
taskId- The id of the Task to delete- Throws:
TaskNotFoundException- if the given id doesn't refer to an existing TaskInvalidStateException- if the state of the referenced Task isn't one of the TaskState.END_STATES and forceDelete is falseNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMIN
-
selectAndClaim
public Task selectAndClaim(TaskQuery taskQuery) throws NotAuthorizedException, InvalidOwnerException
Description copied from interface:TaskService- Specified by:
selectAndClaimin interfaceTaskService- Parameters:
taskQuery- the TaskQuery- Returns:
- the Task that got selected and claimed
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ 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 each id and Exception for each failed deletion
- Throws:
InvalidArgumentException- if the tasks parameter contains NULL valuesNotAuthorizedException- if the current user isn't member of TaskanaRole.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- ids of the Tasks which should be completed- Returns:
- the result of the operations with each id and Exception for each failed completion
- Throws:
InvalidArgumentException- If the taskIds parameter is NULL
-
forceCompleteTasks
public BulkOperationResults<String,TaskanaException> forceCompleteTasks(List<String> taskIds) throws InvalidArgumentException
Description copied from interface:TaskServiceCompletes each existing Task in the given List in every case, independent of the owner or state of the Task.- Specified by:
forceCompleteTasksin interfaceTaskService- Parameters:
taskIds- id of the Tasks which should be completed- Returns:
- the result of the operations with ids and Exception for each failed completion
- Throws:
InvalidArgumentException- If the taskIds parameter is NULL
-
updateTasks
public List<String> updateTasks(ObjectReference selectionCriteria, Map<TaskCustomField,String> customFieldsToUpdate) throws InvalidArgumentException
Description copied from interface:TaskService- Specified by:
updateTasksin interfaceTaskService- Parameters:
selectionCriteria- the primaryObjRef of the searched-for Tasks.customFieldsToUpdate- a Map that contains as key the identification of the TaskCustomField and as value the corresponding new value of that TaskCustomField- 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- See Also:
TaskService.updateTasks(List, Map)
-
updateTasks
public List<String> updateTasks(List<String> taskIds, Map<TaskCustomField,String> customFieldsToUpdate) throws InvalidArgumentException
Description copied from interface:TaskServiceUpdates specified TaskCustomFields for all given Tasks.- Specified by:
updateTasksin interfaceTaskService- Parameters:
taskIds- the taskIds that are used to select the TaskscustomFieldsToUpdate- a Map that contains as key the identification of the TaskCustomField and as value the corresponding new value of that TaskCustomField- Returns:
- a list of the ids of all modified Tasks
- Throws:
InvalidArgumentException- if the given customFieldsToUpdate are NULL or empty- See Also:
TaskService.updateTasks(ObjectReference, Map)
-
createTaskComment
public TaskComment createTaskComment(TaskComment taskComment) throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceInserts the specified TaskComment into the database.- Specified by:
createTaskCommentin interfaceTaskService- Parameters:
taskComment- the TaskComment to be created- Returns:
- the created TaskComment
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented Task.TaskNotFoundException- if the given taskId doesn't refer to an existing TaskInvalidArgumentException- if the id of the providedTaskCommentis neither NULL nor empty
-
updateTaskComment
public TaskComment updateTaskComment(TaskComment taskComment) throws NotAuthorizedException, ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceUpdates the specified TaskComment.- Specified by:
updateTaskCommentin interfaceTaskService- Parameters:
taskComment- the TaskComment to be updated in the database- Returns:
- the updated TaskComment
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented Task.ConcurrencyException- if an attempt is made to update the TaskComment and another user updated it already; that's the case if the given modified timestamp differs from the one in the databaseTaskCommentNotFoundException- if the id of the specified TaskComment doesn't refer to an existing TaskCommentTaskNotFoundException- if the taskId doesn't refer to an existing TaskInvalidArgumentException- if the id of the specified TaskComment is NULL or empty
-
deleteTaskComment
public void deleteTaskComment(String taskCommentId) throws NotAuthorizedException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceDeletes the TaskComment with the given id.- Specified by:
deleteTaskCommentin interfaceTaskService- Parameters:
taskCommentId- the id of the TaskComment to delete- Throws:
NotAuthorizedException- if the current user isn't TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN or the creator of the TaskComment; the user also needs WorkbasketPermission.READ for the Workbasket of the commented TaskTaskCommentNotFoundException- if the given taskCommentId doesn't refer to an existing TaskCommentTaskNotFoundException- if the taskId of the TaskComment doesn't refer to an existing TaskInvalidArgumentException- if the taskCommentId is NULL or empty
-
getTaskComment
public TaskComment getTaskComment(String taskCommentid) throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException, InvalidArgumentException
Description copied from interface:TaskServiceRetrieves the TaskComment with the given id.- Specified by:
getTaskCommentin interfaceTaskService- Parameters:
taskCommentid- the id of the TaskComment which should be retrieved- Returns:
- the TaskComment identified by taskCommentId
- Throws:
TaskCommentNotFoundException- if the given taskCommentId doesn't refer to an existing TaskCommentNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented TaskTaskNotFoundException- if the taskId of the TaskComment doesn't refer to an existing TaskInvalidArgumentException- if the given taskCommentId is NULL or empty
-
getTaskComments
public List<TaskComment> getTaskComments(String taskId) throws NotAuthorizedException, TaskNotFoundException
Description copied from interface:TaskService- Specified by:
getTaskCommentsin interfaceTaskService- Parameters:
taskId- the id of the Task for which all TaskComments should be retrieved- Returns:
- the List of TaskComments attached to the specified Task
- Throws:
NotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented TaskTaskNotFoundException- if the given taskId doesn't refer to an existing Task
-
setCallbackStateForTasks
public BulkOperationResults<String,TaskanaException> setCallbackStateForTasks(List<String> externalIds, CallbackState state)
Description copied from interface:TaskServiceSets the specified CallbackState on a List of Tasks.Note: this method is primarily intended to be used by the TaskanaAdapter
- Specified by:
setCallbackStateForTasksin interfaceTaskService- Parameters:
externalIds- the externalIds of the Tasks on which the CallbackState is setstate- the CallbackState that is to be set on the Tasks- Returns:
- the result of the operations with ids and Exception for each failed operation
-
setOwnerOfTasks
public BulkOperationResults<String,TaskanaException> setOwnerOfTasks(String owner, List<String> taskIds)
Description copied from interface:TaskService- 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 ids 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 Instant on a List of Tasks.Only Tasks in state TaskState.READY and TaskState.CLAIMED will be affected by this method. On each Task, the corresponding due Instant is set according to the shortest serviceLevel in the Classification of the Task and its Attachments.
- Specified by:
setPlannedPropertyOfTasksin interfaceTaskService- Parameters:
planned- the new planned Instant of the TasksargTaskIds- the ids of the Tasks on which the new planned Instant is to be set- Returns:
- the result of the operations with ids and Exception for each failed Task update
-
cancelTask
public Task cancelTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceCancels the Task with the given id.Cancellation means a Task is obsolete from a business perspective and doesn't 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 taskId wasn't foundInvalidStateException- if the Task isn't in TaskState.READY or TaskState.CLAIMEDNotAuthorizedException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
terminateTask
public Task terminateTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException
Description copied from interface:TaskServiceTerminates a Task. Termination is an administrative action to complete a Task.This is typically done by 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 taskId wasn't foundInvalidStateException- if the Task isn't in TaskState.READY or TaskState.CLAIMEDNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMIN or TaskanaRole.BUSINESS_ADMIN
-
findTasksIdsAffectedByClassificationChange
public List<String> findTasksIdsAffectedByClassificationChange(String classificationId)
-
-