Interface TaskService
- All Known Implementing Classes:
TaskServiceImpl
-
Method Summary
Modifier and TypeMethodDescriptioncancelClaim(String taskId) Cancel the claim of an existing Task if it was claimed by the current user before.cancelClaim(String taskId, boolean keepOwner) Cancel the claim of an existing Task if it was claimed by the current user before.cancelTask(String taskId) Claim an existing Task for the current user.completeTask(String taskId) completeTasks(List<String> taskIds) Completes a List of Tasks.createTask(Task taskToCreate) Inserts a Task that doesn't exist in the database yet.createTaskComment(TaskComment taskComment) Inserts the specified TaskComment into the database.Creates an empty TaskCommentQuery.Creates an empty TaskQuery.voiddeleteTask(String taskId) voiddeleteTaskComment(String taskCommentId) Deletes the TaskComment with the given id.deleteTasks(List<String> tasks) Deletes a List of Tasks.forceCancelClaim(String taskId) Cancel the claim of an existing Task even if it was claimed by another user.forceCancelClaim(String taskId, boolean keepOwner) Cancel the claim of an existing Task even if it was claimed by another user.forceClaim(String taskId) Claim an existing Task for the current user even if it is already claimed by someone else.forceCompleteTask(String taskId) forceCompleteTasks(List<String> taskIds) voidforceDeleteTask(String taskId) forceRequestChanges(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.forceRequestReview(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.getTaskComment(String taskCommentId) Retrieves the TaskComment with the given id.getTaskComments(String taskId) Instantiates a non-persistent/non-inserted Attachment.Instantiates a non-persistent/non-inserted ObjectReference.Instantiates a non-persistent/non-inserted ObjectReference.newTask()Instantiates a non-persistent/non-inserted Task.Instantiates a non-persistent/non-inserted Task.Instantiates a non-persistent/non-inserted Task.newTaskComment(String taskId) Instantiates a non-persistent/non-inserted TaskComment.requestChanges(String taskId) Request changes for an existing Task that is in TaskState.IN_REVIEW.requestReview(String taskId) Request review for an existing Task that is in TaskState.CLAIMED.selectAndClaim(TaskQuery taskQuery) setCallbackStateForTasks(List<String> externalIds, CallbackState state) Sets the specified CallbackState on a List of Tasks.setOwnerOfTasks(String owner, List<String> taskIds) setPlannedPropertyOfTasks(Instant planned, List<String> taskIds) setTaskRead(String taskId, boolean isRead) terminateTask(String taskId) Terminates a Task.default TaskTransfers a Task to another Workbasket.default TaskTransfers a Task to another Workbasket.default BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds) transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, boolean setTransferFlag) Transfers a List of Tasks to another Workbasket.default BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds) transferTasks(String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag) Transfers a List of Tasks to another Workbasket.default BulkOperationResults<String,TaskanaException> transferTasksWithOwner(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, String owner) Transfers a List of Tasks to another Workbasket and sets the owner of the Tasks while always setting isTransferred to true.transferTasksWithOwner(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, String owner, boolean setTransferFlag) default BulkOperationResults<String,TaskanaException> transferTasksWithOwner(String destinationWorkbasketId, List<String> taskIds, String owner) Transfers a List of Tasks to another Workbasket and sets the owner of the Tasks to owner while always setting isTransferred to true.transferTasksWithOwner(String destinationWorkbasketId, List<String> taskIds, String owner, boolean setTransferFlag) default TasktransferWithOwner(String taskId, String destinationWorkbasketId, String owner) Transfers a Task to another Workbasket and sets the owner of the Task in the new Workbasket to owner while always setting isTransferred to true.transferWithOwner(String taskId, String destinationWorkbasketId, String owner, boolean setTransferFlag) default TasktransferWithOwner(String taskId, String workbasketKey, String domain, String owner) Transfers a Task to another Workbasket and sets the owner of the Task in new Workbasket to owner while always setting isTransferred .transferWithOwner(String taskId, String workbasketKey, String domain, String owner, boolean setTransferFlag) updateTask(Task task) Update a Task.updateTaskComment(TaskComment taskComment) Updates the specified TaskComment.updateTasks(List<String> taskIds, Map<TaskCustomField, String> customFieldsToUpdate) Updates specified TaskCustomFields for all given Tasks.updateTasks(ObjectReference selectionCriteria, Map<TaskCustomField, String> customFieldsToUpdate)
-
Method Details
-
newTask
Task newTask()Instantiates 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.
- Returns:
- the instantiated Task
- See Also:
-
newTask
Instantiates a non-persistent/non-inserted Task.- Parameters:
workbasketId- the id of the Workbasket to which the Task belongs- Returns:
- the instantiated Task
- See Also:
-
newTask
Instantiates a non-persistent/non-inserted Task.- 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:
-
createTask
Task createTask(Task taskToCreate) throws WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException, AttachmentPersistenceException, ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException Inserts 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
- Parameters:
taskToCreate- the transient Task to be inserted- Returns:
- the created and inserted Task
- Throws:
TaskAlreadyExistException- if the Task already existsNotAuthorizedOnWorkbasketException- 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 foundInvalidArgumentException- 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
- Parameters:
taskId- the id of the Task- Returns:
- the Task with the specified taskId
- 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
-
claim
Task claim(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Claim an existing Task for the current user.- Parameters:
taskId- the id of the Task to be claimed- Returns:
- the claimed Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundInvalidTaskStateException- if the state of the Task with taskId isn't TaskState.READYInvalidOwnerException- if the Task with taskId is claimed by some elseNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
forceClaim
Task forceClaim(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Claim an existing Task for the current user even if it is already claimed by someone else.- Parameters:
taskId- the id of the Task to be claimed- Returns:
- the claimed Task
- Throws:
TaskNotFoundException- if the Task with taskId was not foundInvalidTaskStateException- if the state of Task with taskId is in TaskState.END_STATESInvalidOwnerException- cannot be thrownNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
selectAndClaim
Optional<Task> selectAndClaim(TaskQuery taskQuery) throws InvalidOwnerException, NotAuthorizedOnWorkbasketException Selects and claims the first Task which is returned by the TaskQuery. It cannot be used together with the TaskQuery.lockResultsEquals(Integer) parameter of the query.- Parameters:
taskQuery- the TaskQuery- Returns:
- the Task that got selected and claimed
- Throws:
InvalidOwnerException- if the Task is claimed by someone elseNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
cancelClaim
Task cancelClaim(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Cancel the claim of an existing Task if it was claimed by the current user before.- 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_STATESInvalidOwnerException- if the Task is claimed by another userNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
cancelClaim
Task cancelClaim(String taskId, boolean keepOwner) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Cancel the claim of an existing Task if it was claimed by the current user before.- Parameters:
taskId- the id of the Task which should be unclaimedkeepOwner- If set to true, will keep the TaskSummary.getOwner() and TaskSummary.getOwnerLongName()- 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_STATESInvalidOwnerException- if the Task is claimed by another userNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
forceCancelClaim
Task forceCancelClaim(String taskId, boolean keepOwner) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Cancel the claim of an existing Task even if it was claimed by another user.- Parameters:
taskId- the id of the Task which should be unclaimedkeepOwner- If set to true, will keep the TaskSummary.getOwner() and TaskSummary.getOwnerLongName()- 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
-
forceCancelClaim
Task forceCancelClaim(String taskId) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Cancel the claim of an existing Task even if it was claimed by another user.- 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
Task requestReview(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException Request review for an existing Task that is in TaskState.CLAIMED.- 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
Task forceRequestReview(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException Request review for an existing Task even if the current user is not the owner or the Task is not in TaskState.CLAIMED yet.- 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
Task requestChanges(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException Request changes for an existing Task that is in TaskState.IN_REVIEW. The TaskState is changed to TaskState.READY after changes have been requested.- 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
Task forceRequestChanges(String taskId) throws InvalidTaskStateException, TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException 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. The TaskState is changed to TaskState.READY after changes have been requested.- 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
Task completeTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Complete a claimed Task as owner or TaskanaRole.ADMIN and update state and timestamps.If the Task is already completed, the Task is returned unchanged.
- Parameters:
taskId- the id of the Task which should be completed- Returns:
- the completed Task
- Throws:
InvalidTaskStateException- if the state of the Task with taskId is neither TaskState.CLAIMED nor TaskState.COMPLETEDTaskNotFoundException- 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 in
-
forceCompleteTask
Task forceCompleteTask(String taskId) throws TaskNotFoundException, InvalidOwnerException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Completes 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.
- Parameters:
taskId- the id of the Task which should be completed- Returns:
- the updated Task after completion
- Throws:
InvalidTaskStateException- if the state of the Task with taskId is with taskId is TaskState.TERMINATED or TaskState.CANCELLEDTaskNotFoundException- 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 in
-
completeTasks
BulkOperationResults<String,TaskanaException> completeTasks(List<String> taskIds) throws InvalidArgumentException Completes a List of Tasks.- 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
BulkOperationResults<String,TaskanaException> forceCompleteTasks(List<String> taskIds) throws InvalidArgumentException Completes each existing Task in the given List in every case, independent of the owner or state of the Task.- 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
-
cancelTask
Task cancelTask(String taskId) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Cancels the Task with the given id.Cancellation means a Task is obsolete from a business perspective and doesn't need to be completed anymore.
- Parameters:
taskId- the id of the Task to cancel- Returns:
- the updated Task
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundInvalidTaskStateException- if the Task isn't in TaskState.READY or TaskState.CLAIMEDNotAuthorizedOnWorkbasketException- if the current user has no WorkbasketPermission.READ for the Workbasket the Task is in
-
terminateTask
Task terminateTask(String taskId) throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Terminates a Task. Termination is an administrative action to complete a Task.This is typically done by administration to correct any technical issue.
- Parameters:
taskId- the id of the Task to terminate- Returns:
- the updated Task
- Throws:
TaskNotFoundException- if the Task with taskId wasn't foundInvalidTaskStateException- if the Task isn't in TaskState.READY or TaskState.CLAIMEDNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMIN or TaskanaRole.TASK_ADMINNotAuthorizedOnWorkbasketException- If the current user doesn't have the correct permission
-
transfer
default Task transfer(String taskId, String destinationWorkbasketId) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException - Parameters:
taskId- the id of the Task which should be transferreddestinationWorkbasketId- the id of the target Workbasket- Returns:
- the transferred Task
- Throws:
TaskNotFoundExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketExceptionInvalidTaskStateException- See Also:
-
transfer
Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Transfers a Task to another Workbasket.The transfer resets isRead and sets isTransferred if setTransferFlag is true.
- 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
default Task transfer(String taskId, String workbasketKey, String domain) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException - Parameters:
taskId- the id of the Task which should be transferredworkbasketKey- the key of the target Workbasketdomain- the domain of the target Workbasket- Returns:
- the transferred Task
- Throws:
TaskNotFoundExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketExceptionInvalidTaskStateException- See Also:
-
transfer
Task transfer(String taskId, String workbasketKey, String domain, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Transfers a Task to another Workbasket.The transfer resets isRead and sets isTransferred if setTransferFlag is true.
- 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
-
transferWithOwner
default Task transferWithOwner(String taskId, String destinationWorkbasketId, String owner) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Transfers a Task to another Workbasket and sets the owner of the Task in the new Workbasket to owner while always setting isTransferred to true.- Parameters:
taskId- the id of the Task which should be transferreddestinationWorkbasketId- the id of the target Workbasketowner- the owner of the Task after it has been transferred- Returns:
- the transferred Task
- Throws:
TaskNotFoundExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketExceptionInvalidTaskStateException- See Also:
-
transferWithOwner
Task transferWithOwner(String taskId, String destinationWorkbasketId, String owner, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Transfers a Task to another Workbasket and sets the owner of the Task.The transfer resets isRead and sets isTransferred if setTransferFlag is true.
- Parameters:
taskId- the id of the Task which should be transferreddestinationWorkbasketId- the id of the target Workbasketowner- the owner of the Task after it has been transferredsetTransferFlag- 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
-
transferWithOwner
default Task transferWithOwner(String taskId, String workbasketKey, String domain, String owner) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Transfers a Task to another Workbasket and sets the owner of the Task in new Workbasket to owner while always setting isTransferred .- Parameters:
taskId- the id of the Task which should be transferredworkbasketKey- the key of the target Workbasketdomain- the domain of the target Workbasketowner- the owner of the Task after it has been transferred- Returns:
- the transferred Task
- Throws:
TaskNotFoundExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketExceptionInvalidTaskStateException- See Also:
-
transferWithOwner
Task transferWithOwner(String taskId, String workbasketKey, String domain, String owner, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Transfers a Task to another Workbasket and sets the owner of the Task.The transfer resets isRead and sets isTransferred if setTransferFlag is true.
- Parameters:
taskId- the id of the Task which should be transferredworkbasketKey- the key of the target Workbasketdomain- the domain of the target Workbasketowner- the owner of the Task after it has been transferredsetTransferFlag- 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
-
transferTasks
default BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException - Parameters:
destinationWorkbasketId- id of the target WorkbaskettaskIds- List of source Tasks which will be moved- Returns:
- Bulkresult with ids and Error for each failed transactions
- Throws:
InvalidArgumentExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketException- See Also:
-
transferTasks
BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Transfers 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.
- 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:
NotAuthorizedOnWorkbasketException- 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
default BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException - Parameters:
destinationWorkbasketKey- target keydestinationWorkbasketDomain- target domaintaskIds- List of source Tasks which will be moved- Returns:
- Bulkresult with ids and Error for each failed transactions
- Throws:
InvalidArgumentExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketException- See Also:
-
transferTasks
BulkOperationResults<String,TaskanaException> transferTasks(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Transfers 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.
- 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:
NotAuthorizedOnWorkbasketException- 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
-
transferTasksWithOwner
default BulkOperationResults<String,TaskanaException> transferTasksWithOwner(String destinationWorkbasketId, List<String> taskIds, String owner) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Transfers a List of Tasks to another Workbasket and sets the owner of the Tasks to owner while always setting isTransferred to true.- Parameters:
destinationWorkbasketId- id of the target WorkbaskettaskIds- List of source Tasks which will be movedowner- the owner of the Tasks after they have been transferred- Throws:
InvalidArgumentExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketException- See Also:
-
transferTasksWithOwner
BulkOperationResults<String,TaskanaException> transferTasksWithOwner(String destinationWorkbasketId, List<String> taskIds, String owner, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Transfers a List of Tasks to another Workbasket and sets the owner of the Tasks.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.
- Parameters:
destinationWorkbasketId- id of the target WorkbaskettaskIds- List of source Tasks which will be movedowner- the owner of the Tasks after they have been transferredsetTransferFlag- controls whether to set isTransferred or not- Returns:
- Bulkresult with ids and Error for each failed transactions
- Throws:
NotAuthorizedOnWorkbasketException- 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
-
transferTasksWithOwner
default BulkOperationResults<String,TaskanaException> transferTasksWithOwner(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, String owner) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Transfers a List of Tasks to another Workbasket and sets the owner of the Tasks while always setting isTransferred to true.- Parameters:
destinationWorkbasketKey- target keydestinationWorkbasketDomain- target domaintaskIds- List of source Tasks which will be movedowner- the new owner of the transferred tasks- Returns:
- Bulkresult with ids and Error for each failed transactions
- Throws:
InvalidArgumentExceptionWorkbasketNotFoundExceptionNotAuthorizedOnWorkbasketException- See Also:
-
transferTasksWithOwner
BulkOperationResults<String,TaskanaException> transferTasksWithOwner(String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds, String owner, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Transfers a List of Tasks to another Workbasket and sets the owner of the Tasks.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.
- Parameters:
destinationWorkbasketKey- target keydestinationWorkbasketDomain- target domaintaskIds- List of ids of source Tasks which will be movedowner- the new owner of the transferred taskssetTransferFlag- controls whether to set isTransferred or not- Returns:
- BulkResult with ids and Error for each failed transactions
- Throws:
NotAuthorizedOnWorkbasketException- 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
-
updateTask
Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, ClassificationNotFoundException, AttachmentPersistenceException, ObjectReferencePersistenceException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException Update a Task.- 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 databaseClassificationNotFoundException- 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 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)InvalidTaskStateException- if an attempt is made to change the owner of the Task that state isn't TaskState.READY
-
updateTasks
List<String> updateTasks(ObjectReference selectionCriteria, Map<TaskCustomField, String> customFieldsToUpdate) throws InvalidArgumentExceptionUpdates specified TaskCustomFields of Tasks associated with the given primaryObjRef. Tasks in Workbaskets without EDITTASKS permission will be ignored and not updated.- 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:
-
updateTasks
List<String> updateTasks(List<String> taskIds, Map<TaskCustomField, String> customFieldsToUpdate) throws InvalidArgumentExceptionUpdates specified TaskCustomFields for all given Tasks.- 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:
-
setTaskRead
Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException - 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
-
setCallbackStateForTasks
BulkOperationResults<String,TaskanaException> setCallbackStateForTasks(List<String> externalIds, CallbackState state) Sets the specified CallbackState on a List of Tasks.Note: this method is primarily intended to be used by the TaskanaAdapter
- 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
-
setPlannedPropertyOfTasks
BulkOperationResults<String,TaskanaException> setPlannedPropertyOfTasks(Instant planned, List<String> taskIds) Sets 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.
-
deleteTask
void deleteTask(String taskId) throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException, InvalidCallbackStateException - Parameters:
taskId- The id of the Task to delete- Throws:
NotAuthorizedOnWorkbasketException- If the current user doesn't have correct permissionTaskNotFoundException- If the given id doesn't refer to an existing TaskInvalidTaskStateException- If the state of the referenced Task isn't one of the TaskState.END_STATESNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMINInvalidCallbackStateException- the Callback State of the Task is CallbackState.CALLBACK_PROCESSING_REQUIRED
-
forceDeleteTask
void forceDeleteTask(String taskId) throws TaskNotFoundException, NotAuthorizedException, NotAuthorizedOnWorkbasketException, InvalidTaskStateException, InvalidCallbackStateException - Parameters:
taskId- The id of the Task to delete- Throws:
TaskNotFoundException- if the given id doesn't refer to an existing TaskInvalidTaskStateException- if the state of the referenced Task isn't TaskState.TERMINATED or TaskState.CANCELLEDNotAuthorizedOnWorkbasketException- If the current user doesn't have correct permissionsNotAuthorizedException- if the current user isn't member of TaskanaRole.ADMINInvalidCallbackStateException- the Callback State of the Task is CallbackState.CALLBACK_PROCESSING_REQUIRED
-
deleteTasks
BulkOperationResults<String,TaskanaException> deleteTasks(List<String> tasks) throws InvalidArgumentException, NotAuthorizedException Deletes a List of Tasks.- Parameters:
tasks- 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
-
newTaskComment
Instantiates a non-persistent/non-inserted TaskComment.- Parameters:
taskId- the id of the Task to which the TaskComment belongs- Returns:
- the instantiated TaskComment
-
createTaskComment
TaskComment createTaskComment(TaskComment taskComment) throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException Inserts the specified TaskComment into the database.- Parameters:
taskComment- the TaskComment to be created- Returns:
- the created TaskComment
- Throws:
NotAuthorizedOnWorkbasketException- 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
-
getTaskComment
TaskComment getTaskComment(String taskCommentId) throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnWorkbasketException Retrieves the TaskComment with the given id.- 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 TaskCommentNotAuthorizedOnWorkbasketException- 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
List<TaskComment> getTaskComments(String taskId) throws TaskNotFoundException, NotAuthorizedOnWorkbasketException - 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:
NotAuthorizedOnWorkbasketException- 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
-
updateTaskComment
TaskComment updateTaskComment(TaskComment taskComment) throws ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException Updates the specified TaskComment.- Parameters:
taskComment- the TaskComment to be updated in the database- Returns:
- the updated TaskComment
- Throws:
NotAuthorizedOnWorkbasketException- 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 emptyNotAuthorizedOnTaskCommentException- If the current user doesn't have correct permissions
-
deleteTaskComment
void deleteTaskComment(String taskCommentId) throws TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException, NotAuthorizedOnTaskCommentException, NotAuthorizedOnWorkbasketException Deletes the TaskComment with the given id.- Parameters:
taskCommentId- the id of the TaskComment to delete- Throws:
InvalidArgumentException- if the taskCommentId is NULL or emptyTaskCommentNotFoundException- 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 the commented Task is inNotAuthorizedOnTaskCommentException- if the current user is not the creator of the TaskComment.
-
newAttachment
Attachment newAttachment()Instantiates a non-persistent/non-inserted Attachment.- Returns:
- the instantiated Attachment
-
newObjectReference
ObjectReference newObjectReference()Instantiates a non-persistent/non-inserted ObjectReference.- Returns:
- the instantiated ObjectReference
- See Also:
-
newObjectReference
ObjectReference newObjectReference(String company, String system, String systemInstance, String type, String value) Instantiates a non-persistent/non-inserted ObjectReference.- 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:
-
createTaskQuery
TaskQuery createTaskQuery()Creates an empty TaskQuery.- Returns:
- a TaskQuery
-
createTaskCommentQuery
TaskCommentQuery createTaskCommentQuery()Creates an empty TaskCommentQuery.- Returns:
- a TaskCommentQuery
-