From 5388763b4064e769ec9a502d9c3bffa87e8040e5 Mon Sep 17 00:00:00 2001
From: Yakup Ensar Evli <54323073+ensarevlideveloper@users.noreply.github.com>
Date: Sat, 21 May 2022 16:11:38 +0200
Subject: [PATCH] TSK-1883: Reorder methods in WorkbasketService
New ordering follows CRUD principles for better readability.
Introduction of regions for group of methods.
---
.../workbasket/api/WorkbasketService.java | 537 ++++++++++--------
1 file changed, 290 insertions(+), 247 deletions(-)
diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java
index ec8a4614f..ec8544361 100644
--- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java
+++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java
@@ -20,6 +20,46 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary;
/** This service manages Workbaskets. */
public interface WorkbasketService {
+ // region Workbasket
+
+ // CREATE
+
+ /**
+ * Returns a new {@linkplain Workbasket} which is not inserted.
+ *
+ * @param key the {@linkplain Workbasket#getKey() key} used to identify the {@linkplain
+ * Workbasket}
+ * @param domain the {@linkplain Workbasket#getDomain() domain} of the new {@linkplain Workbasket}
+ * @return new {@linkplain Workbasket}
+ */
+ Workbasket newWorkbasket(String key, String domain);
+
+ /**
+ * Creates a new {@linkplain Workbasket}.
+ * The default values are:
+ *
+ *
+ * - id - generated by {@linkplain pro.taskana.common.internal.util.IdGenerator
+ * IdGenerator}
+ *
+ *
+ * @param workbasket The {@linkplain Workbasket} to create
+ * @return the created and inserted {@linkplain Workbasket}
+ * @throws InvalidArgumentException If a required property of the {@linkplain Workbasket} is not
+ * set.
+ * @throws NotAuthorizedException if the current user is not member of role {@linkplain
+ * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
+ * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
+ * @throws WorkbasketAlreadyExistException if the {@linkplain Workbasket} exists already
+ * @throws DomainNotFoundException if the {@linkplain Workbasket#getDomain() domain} does not
+ * exist in the configuration.
+ */
+ Workbasket createWorkbasket(Workbasket workbasket)
+ throws InvalidArgumentException, NotAuthorizedException, WorkbasketAlreadyExistException,
+ DomainNotFoundException;
+
+ // READ
+
/**
* Get the {@linkplain Workbasket} specified by the given {@linkplain WorkbasketSummary#getId()
* id}.
@@ -52,29 +92,7 @@ public interface WorkbasketService {
Workbasket getWorkbasket(String workbasketKey, String domain)
throws WorkbasketNotFoundException, NotAuthorizedException;
- /**
- * Creates a new {@linkplain Workbasket}.
- * The default values are:
- *
- *
- * - id - generated by {@linkplain pro.taskana.common.internal.util.IdGenerator
- * IdGenerator}
- *
- *
- * @param workbasket The {@linkplain Workbasket} to create
- * @return the created and inserted {@linkplain Workbasket}
- * @throws InvalidArgumentException If a required property of the {@linkplain Workbasket} is not
- * set.
- * @throws NotAuthorizedException if the current user is not member of role {@linkplain
- * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
- * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
- * @throws WorkbasketAlreadyExistException if the {@linkplain Workbasket} exists already
- * @throws DomainNotFoundException if the {@linkplain Workbasket#getDomain() domain} does not
- * exist in the configuration.
- */
- Workbasket createWorkbasket(Workbasket workbasket)
- throws InvalidArgumentException, NotAuthorizedException, WorkbasketAlreadyExistException,
- DomainNotFoundException;
+ // UPDATE
/**
* Update the given {@linkplain Workbasket}.
@@ -94,6 +112,156 @@ public interface WorkbasketService {
throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException,
ConcurrencyException;
+ // DELETE
+
+ /**
+ * Deletes the {@linkplain Workbasket} by the given {@linkplain Workbasket#getId() id}.
+ *
+ * @param workbasketId {@linkplain Workbasket#getId() id} of the {@linkplain Workbasket} which
+ * should be deleted.
+ * @return true if the {@linkplain Workbasket} was deleted successfully; false if the {@linkplain
+ * Workbasket} is marked for deletion
+ * @throws NotAuthorizedException if the current user got no {@linkplain WorkbasketPermission}s
+ * for this interaction
+ * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} does not exist
+ * @throws WorkbasketInUseException if the {@linkplain Workbasket} does contain task-content
+ * @throws InvalidArgumentException if the workbasketId is NULL or EMPTY
+ */
+ boolean deleteWorkbasket(String workbasketId)
+ throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException,
+ InvalidArgumentException;
+
+ /**
+ * Deletes the list of {@linkplain Workbasket}s specified via {@linkplain Workbasket#getId() ids}.
+ *
+ * @param workbasketsIds the {@linkplain Workbasket#getId() ids} of the {@linkplain Workbasket}s
+ * to delete.
+ * @return the result of the operations and an Exception for each failed workbasket deletion
+ * @throws InvalidArgumentException if the WorkbasketIds parameter List is NULL or empty
+ * @throws NotAuthorizedException if the current user got no {@linkplain WorkbasketPermission} for
+ * this interaction
+ */
+ BulkOperationResults deleteWorkbaskets(List workbasketsIds)
+ throws NotAuthorizedException, InvalidArgumentException;
+
+ // endregion
+
+ // region DistributionTarget
+
+ // CREATE
+
+ /**
+ * Set the distribution targets for a {@linkplain Workbasket}.
+ *
+ * @param sourceWorkbasketId the {@linkplain Workbasket#getId() id} of the source {@linkplain
+ * Workbasket} for which the distribution targets are to be set
+ * @param targetWorkbasketIds a list of the ids of the target {@linkplain Workbasket}s
+ * @throws NotAuthorizedException if the current used doesn't have {@linkplain
+ * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}
+ * @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or any of the
+ * target {@linkplain Workbasket}s don't exist
+ */
+ void setDistributionTargets(String sourceWorkbasketId, List targetWorkbasketIds)
+ throws NotAuthorizedException, WorkbasketNotFoundException;
+
+ // READ
+
+ /**
+ * Returns the distribution targets for a given {@linkplain Workbasket}.
+ *
+ * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
+ * Workbasket}
+ * @return the distribution targets of the specified {@linkplain Workbasket}
+ * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
+ * READ permission} for the specified {@linkplain Workbasket}
+ * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
+ */
+ List getDistributionTargets(String workbasketId)
+ throws NotAuthorizedException, WorkbasketNotFoundException;
+
+ /**
+ * Returns the distribution targets for a given {@linkplain Workbasket}.
+ *
+ * @param workbasketKey the {@linkplain Workbasket#getKey() key} of the referenced {@linkplain
+ * Workbasket}
+ * @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain
+ * Workbasket}
+ * @return the distribution targets of the specified {@linkplain Workbasket}
+ * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
+ * READ permission} for the specified {@linkplain Workbasket}
+ * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
+ */
+ List getDistributionTargets(String workbasketKey, String domain)
+ throws NotAuthorizedException, WorkbasketNotFoundException;
+
+ /**
+ * Returns the distribution sources for a given {@linkplain Workbasket}.
+ *
+ * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
+ * Workbasket}
+ * @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}.
+ * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
+ * READ permission} for the specified {@linkplain Workbasket}
+ * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
+ */
+ List getDistributionSources(String workbasketId)
+ throws NotAuthorizedException, WorkbasketNotFoundException;
+
+ /**
+ * Returns the distribution sources for a given {@linkplain Workbasket}.
+ *
+ * @param workbasketKey the {@linkplain Workbasket#getKey() key} of the referenced {@linkplain
+ * Workbasket}
+ * @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain
+ * Workbasket}
+ * @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}.
+ * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
+ * READ permission} for the specified {@linkplain Workbasket}
+ * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
+ */
+ List getDistributionSources(String workbasketKey, String domain)
+ throws NotAuthorizedException, WorkbasketNotFoundException;
+
+ // UPDATE
+
+ /**
+ * Add a distribution target to a {@linkplain Workbasket}. If the specified distribution target
+ * exists already, the method silently returns without doing anything.
+ *
+ * @param sourceWorkbasketId the {@linkplain Workbasket#getId() id} of the source {@linkplain
+ * Workbasket}
+ * @param targetWorkbasketId the {@linkplain Workbasket#getId() id} of the target {@linkplain
+ * Workbasket}
+ * @throws NotAuthorizedException if the current user doesn't have {@linkplain
+ * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}s
+ * @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or the target
+ * {@linkplain Workbasket} doesn't exist
+ */
+ void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
+ throws NotAuthorizedException, WorkbasketNotFoundException;
+
+ // DELETE
+
+ /**
+ * Remove a distribution target from a {@linkplain Workbasket}. If the specified distribution
+ * target doesn't exist, the method silently returns without doing anything.
+ *
+ * @param sourceWorkbasketId The {@linkplain Workbasket#getId() id} of the source {@linkplain
+ * Workbasket}
+ * @param targetWorkbasketId The {@linkplain Workbasket#getId() id} of the target {@linkplain
+ * Workbasket}
+ * @throws NotAuthorizedException If the current user doesn't have {@linkplain
+ * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}
+ */
+ void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
+ throws NotAuthorizedException;
+
+ // endregion
+
+ // region WorkbasketAccessItem
+
+ // CREATE
+
/**
* Returns a new {@linkplain WorkbasketAccessItem} which is not inserted.
*
@@ -126,6 +294,53 @@ public interface WorkbasketService {
throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException,
WorkbasketAccessItemAlreadyExistException;
+ /**
+ * Setting up the new {@linkplain WorkbasketAccessItem}s for a {@linkplain Workbasket}. Already
+ * stored values will be completely replaced by the current ones.
+ *
+ * Preconditions for each {@linkplain WorkbasketAccessItem} then {@code wbAccessItems}:
+ *
+ *
+ * - {@linkplain WorkbasketAccessItem#getWorkbasketId()} is not null
+ *
- {@linkplain WorkbasketAccessItem#getWorkbasketId()} is equal to {@code workbasketId}
+ *
- {@linkplain WorkbasketAccessItem#getAccessId()} is unique
+ *
+ *
+ * @param workbasketId {@linkplain Workbasket#getId() id} of the access-target {@linkplain
+ * Workbasket}.
+ * @param wbAccessItems List of {@linkplain WorkbasketAccessItem}s which does replace all current
+ * stored ones.
+ * @throws InvalidArgumentException will be thrown when the parameter {@code wbAccessItems} is
+ * NULL or member doesn't match the preconditions
+ * @throws NotAuthorizedException if the current user is not member of role {@linkplain
+ * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
+ * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
+ * @throws WorkbasketAccessItemAlreadyExistException if {@code wbAccessItems} contains multiple
+ * {@linkplain WorkbasketAccessItem} with the same {@linkplain
+ * WorkbasketAccessItem#getAccessId() accessId}.
+ * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} cannot be found for the
+ * given {@linkplain Workbasket#getId() id}.
+ */
+ void setWorkbasketAccessItems(String workbasketId, List wbAccessItems)
+ throws InvalidArgumentException, NotAuthorizedException,
+ WorkbasketAccessItemAlreadyExistException, WorkbasketNotFoundException;
+
+ // READ
+
+ /**
+ * Get all {@linkplain WorkbasketAccessItem}s for a {@linkplain Workbasket}.
+ *
+ * @param workbasketId the {@linkplain Workbasket#getId() id} of the {@linkplain Workbasket}
+ * @return List of {@linkplain WorkbasketAccessItem}s for the {@linkplain Workbasket}
+ * @throws NotAuthorizedException if the current user is not member of role {@linkplain
+ * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN} or {@linkplain
+ * pro.taskana.common.api.TaskanaRole#ADMIN}
+ */
+ List getWorkbasketAccessItems(String workbasketId)
+ throws NotAuthorizedException;
+
+ // UPDATE
+
/**
* This method updates a {@linkplain WorkbasketAccessItem}.
*
@@ -141,6 +356,8 @@ public interface WorkbasketService {
WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
throws InvalidArgumentException, NotAuthorizedException;
+ // DELETE
+
/**
* Deletes a specific {@linkplain WorkbasketAccessItem}.
*
@@ -152,6 +369,55 @@ public interface WorkbasketService {
*/
void deleteWorkbasketAccessItem(String id) throws NotAuthorizedException;
+ /**
+ * Deletes all {@linkplain WorkbasketAccessItem}s using the given {@linkplain
+ * WorkbasketAccessItem#getAccessId()}.
+ *
+ * @param accessId {@linkplain User#getId() id} of a taskana-{@linkplain User}.
+ * @throws NotAuthorizedException if the current user is not member of role {@linkplain
+ * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
+ * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
+ */
+ void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException;
+
+ // endregion
+
+ // region Query
+ /**
+ * This method provides a query builder for querying the database.
+ *
+ * @return a {@linkplain WorkbasketQuery}
+ */
+ WorkbasketQuery createWorkbasketQuery();
+
+ /**
+ * This method provides a query builder for querying the database.
+ *
+ * @return a {@linkplain WorkbasketAccessItemQuery}
+ * @throws NotAuthorizedException if the current user is not member of role {@linkplain
+ * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
+ * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
+ */
+ WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException;
+ // endregion
+
+ // region Permission and Authorization
+
+ /**
+ * Returns a set with all {@linkplain WorkbasketPermission permissions} of the current user at
+ * this {@linkplain Workbasket}.
+ * If the workbasketId is invalid, an empty List of {@linkplain WorkbasketPermission}s is returned
+ * since there is no distinction made between the situation that the {@linkplain Workbasket} is
+ * not found and the caller has no {@linkplain WorkbasketPermission permissions} on the
+ * {@linkplain Workbasket}.
+ *
+ * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
+ * Workbasket}
+ * @return a {@link List} with all {@link WorkbasketPermission}s of the caller on the requested
+ * {@linkplain Workbasket}.
+ */
+ List getPermissionsForWorkbasket(String workbasketId);
+
/**
* This method checks the authorization for the actual User.
*
@@ -184,229 +450,6 @@ public interface WorkbasketService {
void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission)
throws NotAuthorizedException, WorkbasketNotFoundException;
- /**
- * Get all {@linkplain WorkbasketAccessItem}s for a {@linkplain Workbasket}.
- *
- * @param workbasketId the {@linkplain Workbasket#getId() id} of the {@linkplain Workbasket}
- * @return List of {@linkplain WorkbasketAccessItem}s for the {@linkplain Workbasket}
- * @throws NotAuthorizedException if the current user is not member of role {@linkplain
- * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN} or {@linkplain
- * pro.taskana.common.api.TaskanaRole#ADMIN}
- */
- List getWorkbasketAccessItems(String workbasketId)
- throws NotAuthorizedException;
+ // endregion
- /**
- * Setting up the new {@linkplain WorkbasketAccessItem}s for a {@linkplain Workbasket}. Already
- * stored values will be completely replaced by the current ones.
- *
- * Preconditions for each {@linkplain WorkbasketAccessItem} then {@code wbAccessItems}:
- *
- *
- * - {@linkplain WorkbasketAccessItem#getWorkbasketId()} is not null
- *
- {@linkplain WorkbasketAccessItem#getWorkbasketId()} is equal to {@code workbasketId}
- *
- {@linkplain WorkbasketAccessItem#getAccessId()} is unique
- *
- *
- * @param workbasketId {@linkplain Workbasket#getId() id} of the access-target {@linkplain
- * Workbasket}.
- * @param wbAccessItems List of {@linkplain WorkbasketAccessItem}s which does replace all current
- * stored ones.
- * @throws InvalidArgumentException will be thrown when the parameter {@code wbAccessItems} is
- * NULL or member doesn't match the preconditions
- * @throws NotAuthorizedException if the current user is not member of role {@linkplain
- * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
- * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
- * @throws WorkbasketAccessItemAlreadyExistException if {@code wbAccessItems} contains multiple
- * {@linkplain WorkbasketAccessItem} with the same {@linkplain
- * WorkbasketAccessItem#getAccessId() accessId}.
- * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} cannot be found for the
- * given {@linkplain Workbasket#getId() id}.
- */
- void setWorkbasketAccessItems(String workbasketId, List wbAccessItems)
- throws InvalidArgumentException, NotAuthorizedException,
- WorkbasketAccessItemAlreadyExistException, WorkbasketNotFoundException;
-
- /**
- * This method provides a query builder for querying the database.
- *
- * @return a {@linkplain WorkbasketQuery}
- */
- WorkbasketQuery createWorkbasketQuery();
-
- /**
- * This method provides a query builder for querying the database.
- *
- * @return a {@linkplain WorkbasketAccessItemQuery}
- * @throws NotAuthorizedException if the current user is not member of role {@linkplain
- * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
- * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
- */
- WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException;
-
- /**
- * Returns a new {@linkplain Workbasket} which is not inserted.
- *
- * @param key the {@linkplain Workbasket#getKey() key} used to identify the {@linkplain
- * Workbasket}
- * @param domain the {@linkplain Workbasket#getDomain() domain} of the new {@linkplain Workbasket}
- * @return new {@linkplain Workbasket}
- */
- Workbasket newWorkbasket(String key, String domain);
-
- /**
- * Returns a set with all {@linkplain WorkbasketPermission permissions} of the current user at
- * this {@linkplain Workbasket}.
- * If the workbasketId is invalid, an empty List of {@linkplain WorkbasketPermission}s is returned
- * since there is no distinction made between the situation that the {@linkplain Workbasket} is
- * not found and the caller has no {@linkplain WorkbasketPermission permissions} on the
- * {@linkplain Workbasket}.
- *
- * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
- * Workbasket}
- * @return a {@link List} with all {@link WorkbasketPermission}s of the caller on the requested
- * {@linkplain Workbasket}.
- */
- List getPermissionsForWorkbasket(String workbasketId);
-
- /**
- * Returns the distribution targets for a given {@linkplain Workbasket}.
- *
- * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
- * Workbasket}
- * @return the distribution targets of the specified {@linkplain Workbasket}
- * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
- * READ permission} for the specified {@linkplain Workbasket}
- * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
- */
- List getDistributionTargets(String workbasketId)
- throws NotAuthorizedException, WorkbasketNotFoundException;
-
- /**
- * Returns the distribution targets for a given {@linkplain Workbasket}.
- *
- * @param workbasketKey the {@linkplain Workbasket#getKey() key} of the referenced {@linkplain
- * Workbasket}
- * @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain
- * Workbasket}
- * @return the distribution targets of the specified {@linkplain Workbasket}
- * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
- * READ permission} for the specified {@linkplain Workbasket}
- * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
- */
- List getDistributionTargets(String workbasketKey, String domain)
- throws NotAuthorizedException, WorkbasketNotFoundException;
-
- /**
- * Set the distribution targets for a {@linkplain Workbasket}.
- *
- * @param sourceWorkbasketId the {@linkplain Workbasket#getId() id} of the source {@linkplain
- * Workbasket} for which the distribution targets are to be set
- * @param targetWorkbasketIds a list of the ids of the target {@linkplain Workbasket}s
- * @throws NotAuthorizedException if the current used doesn't have {@linkplain
- * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}
- * @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or any of the
- * target {@linkplain Workbasket}s don't exist
- */
- void setDistributionTargets(String sourceWorkbasketId, List targetWorkbasketIds)
- throws NotAuthorizedException, WorkbasketNotFoundException;
-
- /**
- * Add a distribution target to a {@linkplain Workbasket}. If the specified distribution target
- * exists already, the method silently returns without doing anything.
- *
- * @param sourceWorkbasketId the {@linkplain Workbasket#getId() id} of the source {@linkplain
- * Workbasket}
- * @param targetWorkbasketId the {@linkplain Workbasket#getId() id} of the target {@linkplain
- * Workbasket}
- * @throws NotAuthorizedException if the current user doesn't have {@linkplain
- * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}s
- * @throws WorkbasketNotFoundException if either the source {@linkplain Workbasket} or the target
- * {@linkplain Workbasket} doesn't exist
- */
- void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
- throws NotAuthorizedException, WorkbasketNotFoundException;
-
- /**
- * Remove a distribution target from a {@linkplain Workbasket}. If the specified distribution
- * target doesn't exist, the method silently returns without doing anything.
- *
- * @param sourceWorkbasketId The {@linkplain Workbasket#getId() id} of the source {@linkplain
- * Workbasket}
- * @param targetWorkbasketId The {@linkplain Workbasket#getId() id} of the target {@linkplain
- * Workbasket}
- * @throws NotAuthorizedException If the current user doesn't have {@linkplain
- * WorkbasketPermission#READ READ permission} for the source {@linkplain Workbasket}
- */
- void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
- throws NotAuthorizedException;
-
- /**
- * Deletes the {@linkplain Workbasket} by the given {@linkplain Workbasket#getId() id}.
- *
- * @param workbasketId {@linkplain Workbasket#getId() id} of the {@linkplain Workbasket} which
- * should be deleted.
- * @return true if the {@linkplain Workbasket} was deleted successfully; false if the {@linkplain
- * Workbasket} is marked for deletion
- * @throws NotAuthorizedException if the current user got no {@linkplain WorkbasketPermission}s
- * for this interaction
- * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} does not exist
- * @throws WorkbasketInUseException if the {@linkplain Workbasket} does contain task-content
- * @throws InvalidArgumentException if the workbasketId is NULL or EMPTY
- */
- boolean deleteWorkbasket(String workbasketId)
- throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException,
- InvalidArgumentException;
-
- /**
- * Deletes the list of {@linkplain Workbasket}s specified via {@linkplain Workbasket#getId() ids}.
- *
- * @param workbasketsIds the {@linkplain Workbasket#getId() ids} of the {@linkplain Workbasket}s
- * to delete.
- * @return the result of the operations and an Exception for each failed workbasket deletion
- * @throws InvalidArgumentException if the WorkbasketIds parameter List is NULL or empty
- * @throws NotAuthorizedException if the current user got no {@linkplain WorkbasketPermission} for
- * this interaction
- */
- BulkOperationResults deleteWorkbaskets(List workbasketsIds)
- throws NotAuthorizedException, InvalidArgumentException;
-
- /**
- * Returns the distribution sources for a given {@linkplain Workbasket}.
- *
- * @param workbasketId the {@linkplain Workbasket#getId() id} of the referenced {@linkplain
- * Workbasket}
- * @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}.
- * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
- * READ permission} for the specified {@linkplain Workbasket}
- * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
- */
- List getDistributionSources(String workbasketId)
- throws NotAuthorizedException, WorkbasketNotFoundException;
-
- /**
- * Returns the distribution sources for a given {@linkplain Workbasket}.
- *
- * @param workbasketKey the {@linkplain Workbasket#getKey() key} of the referenced {@linkplain
- * Workbasket}
- * @param domain the {@linkplain Workbasket#getDomain() domain} of the referenced {@linkplain
- * Workbasket}
- * @return the workbaskets that are distribution sources of the specified {@linkplain Workbasket}.
- * @throws NotAuthorizedException if the current user has no {@linkplain WorkbasketPermission#READ
- * READ permission} for the specified {@linkplain Workbasket}
- * @throws WorkbasketNotFoundException if the {@linkplain Workbasket} doesn't exist
- */
- List getDistributionSources(String workbasketKey, String domain)
- throws NotAuthorizedException, WorkbasketNotFoundException;
-
- /**
- * Deletes all {@linkplain WorkbasketAccessItem}s using the given {@linkplain
- * WorkbasketAccessItem#getAccessId()}.
- *
- * @param accessId {@linkplain User#getId() id} of a taskana-{@linkplain User}.
- * @throws NotAuthorizedException if the current user is not member of role {@linkplain
- * pro.taskana.common.api.TaskanaRole#ADMIN admin} or {@linkplain
- * pro.taskana.common.api.TaskanaRole#BUSINESS_ADMIN business-admin}
- */
- void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException;
}