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)TaskforceRequestChanges(String taskId)Request changes for an existing Task even if the current user is not the owner or the Task is not in TaskState.IN_REVIEW yet.TaskforceRequestReview(String taskId)Request review for an existing Task even if the current user is not the owner or the Task is not in TaskState.CLAIMED yet.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)TaskrequestChanges(String taskId)Request changes for an existing Task that is in TaskState.IN_REVIEW.TaskrequestReview(String taskId)Request review for an existing Task that is in TaskState.CLAIMED.Optional<Task>selectAndClaim(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, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 foundInvalidOwnerException- if the Task with taskId is claimed by some elseNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if the state of the Task with taskId isn't TaskState.READY
-
forceClaim
public Task forceClaim(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 foundInvalidOwnerException- cannot be thrownNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if the state of Task with taskId is in TaskState.END_STATES
-
cancelClaim
public Task cancelClaim(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 foundInvalidOwnerException- if the Task is claimed by another userNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if the Task is already in one of the TaskState.END_STATES
-
forceCancelClaim
public Task forceCancelClaim(String taskId) throws TaskNotFoundException, InvalidTaskStateException, NotAuthorizedOnWorkbasketException
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 foundInvalidTaskStateException- if the Task is already in one of the TaskState.END_STATESNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
requestReview
public Task requestReview(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException
Description copied from interface:TaskServiceRequest review for an existing Task that is in TaskState.CLAIMED.- Specified by:
requestReviewin interfaceTaskService- Parameters:
taskId- the id of the specified Task- Returns:
- the Task after a review has been requested
- Throws:
InvalidTaskStateException- if the state of the Task with taskId is not in TaskState.CLAIMEDTaskNotFoundException- if the Task with taskId wasn't foundInvalidOwnerException- if the Task is claimed by another userNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
forceRequestReview
public Task forceRequestReview(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException
Description copied from interface:TaskServiceRequest review for an existing Task even if the current user is not the owner or the Task is not in TaskState.CLAIMED yet.- Specified by:
forceRequestReviewin interfaceTaskService- Parameters:
taskId- the id of the specified Task- Returns:
- the Task after a review has been requested
- Throws:
InvalidTaskStateException- if the state of the Task with taskId is one of the TaskState.END_STATESTaskNotFoundException- if the Task with taskId wasn't foundInvalidOwnerException- cannot be thrownNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
requestChanges
public Task requestChanges(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException
Description copied from interface:TaskServiceRequest changes for an existing Task that is in TaskState.IN_REVIEW. The TaskState is changed to TaskState.READY after changes have been requested.- Specified by:
requestChangesin interfaceTaskService- Parameters:
taskId- the id of the specified Task- Returns:
- the Task after changes have been requested
- Throws:
InvalidTaskStateException- if the state of the Task with taskId is not in TaskState.IN_REVIEWTaskNotFoundException- if the Task with taskId wasn't foundInvalidOwnerException- if the Task is claimed by another userNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
forceRequestChanges
public Task forceRequestChanges(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException
Description copied from interface:TaskServiceRequest changes for an existing Task even if the current user is not the owner or the Task is not in TaskState.IN_REVIEW yet. The TaskState is changed to TaskState.READY after changes have been requested.- Specified by:
forceRequestChangesin interfaceTaskService- Parameters:
taskId- the id of the specified Task- Returns:
- the Task after changes have been requested
- Throws:
InvalidTaskStateException- if the state of the Task with taskId is one of the TaskState.END_STATESTaskNotFoundException- if the Task with taskId wasn't foundInvalidOwnerException- cannot be thrownNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
completeTask
public Task completeTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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.ADMINNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if the state of the Task with taskId is neither TaskState.CLAIMED nor TaskState.COMPLETED
-
forceCompleteTask
public Task forceCompleteTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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.ADMINNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if the state of the Task with taskId is with taskId is TaskState.TERMINATED or TaskState.CANCELLED
-
createTask
public Task createTask(Task taskToCreate) throws WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException, ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException
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:
WorkbasketNotFoundException- 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)NotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.APPEND for the Workbasket the Task is in
-
getTask
public Task getTask(String id) throws NotAuthorizedOnWorkbasketException, 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:
NotAuthorizedOnWorkbasketException- 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, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 foundNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target WorkbasketInvalidTaskStateException- 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, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 foundNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target WorkbasketInvalidTaskStateException- if the Task is in one of the TaskState.END_STATES
-
setTaskRead
public Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException
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 foundNotAuthorizedOnWorkbasketException- 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, AttachmentPersistenceException, ObjectReferencePersistenceException, ClassificationNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 databaseAttachmentPersistenceException- 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)ClassificationNotFoundException- if the classificationSummary of the updated Task refers to aClassificationthat can't be foundNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if an attempt is made to change the owner of the Task that state isn't TaskState.READY
-
transferTasks
public BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException
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:
InvalidArgumentException- if the method parameters are empty or NULLWorkbasketNotFoundException- if the target Workbasket can't be foundNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target Workbasket
-
transferTasks
public BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException
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:
InvalidArgumentException- if the method parameters are empty or NULLWorkbasketNotFoundException- if the target Workbasket can't be foundNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the source Workbasket or no WorkbasketPermission.TRANSFER for the target Workbasket
-
deleteTask
public void deleteTask(String taskId) throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException, InvalidCallbackStateException
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 TaskNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMINNotAuthorizedOnWorkbasketException- If the current user doesn't have correct permissionInvalidTaskStateException- If the state of the referenced Task isn't one of the TaskState.END_STATESInvalidCallbackStateException- the Callback State of the Task is CallbackState.CALLBACK_PROCESSING_REQUIRED
-
forceDeleteTask
public void forceDeleteTask(String taskId) throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException, InvalidCallbackStateException
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 TaskNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMINNotAuthorizedOnWorkbasketException- If the current user doesn't have correct permissionsInvalidTaskStateException- if the state of the referenced Task isn't TaskState.TERMINATED or TaskState.CANCELLEDInvalidCallbackStateException- the Callback State of the Task is CallbackState.CALLBACK_PROCESSING_REQUIRED
-
selectAndClaim
public Optional<Task> selectAndClaim(TaskQuery taskQuery) throws NotAuthorizedOnWorkbasketException
Description copied from interface:TaskService- Specified by:
selectAndClaimin interfaceTaskService- Parameters:
taskQuery- the TaskQuery- Returns:
- the Task that got selected and claimed
- Throws:
NotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
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:TaskServiceUpdates specified TaskCustomFields of Tasks associated with the given primaryObjRef. Tasks in Workbaskets without EDITTASKS permission will be ignored and not updated.- 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 TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException
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:
TaskNotFoundException- if the given taskId doesn't refer to an existing TaskInvalidArgumentException- if the id of the providedTaskCommentis neither NULL nor emptyNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented Task.
-
updateTaskComment
public TaskComment updateTaskComment(TaskComment taskComment) throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException
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:
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 emptyNotAuthorizedOnTaskCommentException- If the current user doesn't have correct permissionsNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented Task.
-
deleteTaskComment
public void deleteTaskComment(String taskCommentId) throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException
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:
TaskCommentNotFoundException- 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 emptyNotAuthorizedOnTaskCommentException- if the current user is not the creator of the TaskComment.NotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the commented Task is in
-
getTaskComment
public TaskComment getTaskComment(String taskCommentid) throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException
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 TaskCommentTaskNotFoundException- if the taskId of the TaskComment doesn't refer to an existing TaskInvalidArgumentException- if the given taskCommentId is NULL or emptyNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented Task
-
getTaskComments
public List<TaskComment> getTaskComments(String taskId) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException
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:
TaskNotFoundException- if the given taskId doesn't refer to an existing TaskNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket of the commented 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, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 foundNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is inInvalidTaskStateException- if the Task isn't in TaskState.READY or TaskState.CLAIMED
-
terminateTask
public Task terminateTask(String taskId) throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException
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 terminate- Returns:
- the updated Task
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMIN or TaskanaRole.TASK_ADMINNotAuthorizedOnWorkbasketException- If the current user doesn't have the correct permissionInvalidTaskStateException- if the Task isn't in TaskState.READY or TaskState.CLAIMED
-
findTasksIdsAffectedByClassificationChange
public List<String> findTasksIdsAffectedByClassificationChange(String classificationId)
-
-