Package io.kadai.workbasket.api
Interface WorkbasketService
- All Known Implementing Classes:
WorkbasketServiceImpl
public interface WorkbasketService
This service manages Workbaskets.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDistributionTarget
(String sourceWorkbasketId, String targetWorkbasketId) Add a distribution target to a Workbasket.void
checkAuthorization
(String workbasketId, WorkbasketPermission... permission) This method checks the authorization for the actual User.void
checkAuthorization
(String workbasketKey, String domain, WorkbasketPermission... permission) This method checks the authorization for the actual User.createWorkbasket
(Workbasket workbasket) Creates a new Workbasket.createWorkbasketAccessItem
(WorkbasketAccessItem workbasketAccessItem) This method provides a query builder for querying the database.This method provides a query builder for querying the database.boolean
deleteWorkbasket
(String workbasketId) Deletes the Workbasket by the given id.void
Deletes a specific WorkbasketAccessItem.void
deleteWorkbasketAccessItemsForAccessId
(String accessId) Deletes all WorkbasketAccessItems using the given WorkbasketAccessItem.getAccessId().io.kadai.common.api.BulkOperationResults<String,
io.kadai.common.api.exceptions.KadaiException> deleteWorkbaskets
(List<String> workbasketsIds) Deletes the list of Workbaskets specified via ids.getDistributionSources
(String workbasketId) Returns the distribution sources for a given Workbasket.getDistributionSources
(String workbasketKey, String domain) Returns the distribution sources for a given Workbasket.getDistributionTargets
(String workbasketId) Returns the distribution targets for a given Workbasket.getDistributionTargets
(String workbasketKey, String domain) Returns the distribution targets for a given Workbasket.getPermissionsForWorkbasket
(String workbasketId) Returns a set with all permissions of the current user at this Workbasket.
If the workbasketId is invalid, an empty List of WorkbasketPermissions is returned since there is no distinction made between the situation that the Workbasket is not found and the caller has no permissions on the Workbasket.getWorkbasket
(String workbasketId) Get the Workbasket specified by the given id.getWorkbasket
(String workbasketKey, String domain) getWorkbasketAccessItems
(String workbasketId) Get all WorkbasketAccessItems for a Workbasket.newWorkbasket
(String key, String domain) Returns a new Workbasket which is not inserted.newWorkbasketAccessItem
(String workbasketId, String accessId) Returns a new WorkbasketAccessItem which is not inserted.void
removeDistributionTarget
(String sourceWorkbasketId, String targetWorkbasketId) Remove a distribution target from a Workbasket.void
setDistributionTargets
(String sourceWorkbasketId, List<String> targetWorkbasketIds) Set the distribution targets for a Workbasket.void
setWorkbasketAccessItems
(String workbasketId, List<WorkbasketAccessItem> wbAccessItems) Setting up the new WorkbasketAccessItems for a Workbasket.updateWorkbasket
(Workbasket workbasket) Update the given Workbasket.updateWorkbasketAccessItem
(WorkbasketAccessItem workbasketAccessItem) This method updates a WorkbasketAccessItem.
-
Method Details
-
newWorkbasket
Returns a new Workbasket which is not inserted.- Parameters:
key
- the key used to identify the Workbasketdomain
- the domain of the new Workbasket- Returns:
- new Workbasket
-
createWorkbasket
Workbasket createWorkbasket(Workbasket workbasket) throws io.kadai.common.api.exceptions.InvalidArgumentException, WorkbasketAlreadyExistException, io.kadai.common.api.exceptions.DomainNotFoundException, io.kadai.common.api.exceptions.NotAuthorizedException - Parameters:
workbasket
- The Workbasket to create- Returns:
- the created and inserted Workbasket
- Throws:
io.kadai.common.api.exceptions.InvalidArgumentException
- If a required property of the Workbasket is not set.io.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of role admin or business-adminWorkbasketAlreadyExistException
- if the Workbasket exists alreadyio.kadai.common.api.exceptions.DomainNotFoundException
- if the domain does not exist in the configuration.
-
getWorkbasket
Workbasket getWorkbasket(String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Get the Workbasket specified by the given id.- Parameters:
workbasketId
- the id of the Workbasket requested- Returns:
- the requested Workbasket
- Throws:
WorkbasketNotFoundException
- If the Workbasket with workbasketId is not foundNotAuthorizedOnWorkbasketException
- if the current user has no WorkbasketPermission.READ for the requested Workbasket
-
getWorkbasket
Workbasket getWorkbasket(String workbasketKey, String domain) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException - Parameters:
workbasketKey
- the key of the Workbasket requesteddomain
- the domain of the Workbasket- Returns:
- the requested Workbasket
- Throws:
WorkbasketNotFoundException
- If the Workbasket with workbasketId is not foundNotAuthorizedOnWorkbasketException
- if the current user has no WorkbasketPermission.READ for the requested Workbasket
-
updateWorkbasket
Workbasket updateWorkbasket(Workbasket workbasket) throws io.kadai.common.api.exceptions.InvalidArgumentException, WorkbasketNotFoundException, io.kadai.common.api.exceptions.ConcurrencyException, io.kadai.common.api.exceptions.NotAuthorizedException, NotAuthorizedOnWorkbasketException Update the given Workbasket.- Parameters:
workbasket
- The Workbasket to update- Returns:
- the updated Workbasket
- Throws:
io.kadai.common.api.exceptions.InvalidArgumentException
- if name or type of the Workbasket is invalidNotAuthorizedOnWorkbasketException
- This is never thrownio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMINWorkbasketNotFoundException
- if the Workbasket cannot be found.io.kadai.common.api.exceptions.ConcurrencyException
- if an attempt is made to update the Workbasket and another user updated it already; that's the case if the given modified timestamp differs from the one in the database
-
deleteWorkbasket
boolean deleteWorkbasket(String workbasketId) throws WorkbasketNotFoundException, WorkbasketInUseException, io.kadai.common.api.exceptions.InvalidArgumentException, io.kadai.common.api.exceptions.NotAuthorizedException, NotAuthorizedOnWorkbasketException Deletes the Workbasket by the given id.- Parameters:
workbasketId
- id of the Workbasket which should be deleted.- Returns:
- true if the Workbasket was deleted successfully; false if the Workbasket is marked for deletion
- Throws:
NotAuthorizedOnWorkbasketException
- This is never thrownio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMINWorkbasketNotFoundException
- if the Workbasket does not existWorkbasketInUseException
- if the Workbasket does contain task-contentio.kadai.common.api.exceptions.InvalidArgumentException
- if the workbasketId is NULL or EMPTY
-
deleteWorkbaskets
io.kadai.common.api.BulkOperationResults<String,io.kadai.common.api.exceptions.KadaiException> deleteWorkbaskets(List<String> workbasketsIds) throws io.kadai.common.api.exceptions.InvalidArgumentException, io.kadai.common.api.exceptions.NotAuthorizedException Deletes the list of Workbaskets specified via ids.- Parameters:
workbasketsIds
- the ids of the Workbaskets to delete.- Returns:
- the result of the operations and an Exception for each failed workbasket deletion
- Throws:
io.kadai.common.api.exceptions.InvalidArgumentException
- if the WorkbasketIds parameter List is NULL or emptyio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMIN
-
setDistributionTargets
void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds) throws WorkbasketNotFoundException, io.kadai.common.api.exceptions.NotAuthorizedException, NotAuthorizedOnWorkbasketException Set the distribution targets for a Workbasket.- Parameters:
sourceWorkbasketId
- the id of the source Workbasket for which the distribution targets are to be settargetWorkbasketIds
- a list of the ids of the target Workbaskets- Throws:
NotAuthorizedOnWorkbasketException
- This is never thrownio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMINWorkbasketNotFoundException
- if either the source Workbasket or any of the target Workbaskets don't exist
-
getDistributionTargets
List<WorkbasketSummary> getDistributionTargets(String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Returns the distribution targets for a given Workbasket.- Parameters:
workbasketId
- the id of the referenced Workbasket- Returns:
- the distribution targets of the specified Workbasket
- Throws:
NotAuthorizedOnWorkbasketException
- if the current user has no READ permission for the specified WorkbasketWorkbasketNotFoundException
- if the Workbasket doesn't exist
-
getDistributionTargets
List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Returns the distribution targets for a given Workbasket.- Parameters:
workbasketKey
- the key of the referenced Workbasketdomain
- the domain of the referenced Workbasket- Returns:
- the distribution targets of the specified Workbasket
- Throws:
NotAuthorizedOnWorkbasketException
- if the current user has no READ permission for the specified WorkbasketWorkbasketNotFoundException
- if the Workbasket doesn't exist
-
getDistributionSources
List<WorkbasketSummary> getDistributionSources(String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Returns the distribution sources for a given Workbasket.- Parameters:
workbasketId
- the id of the referenced Workbasket- Returns:
- the workbaskets that are distribution sources of the specified Workbasket.
- Throws:
NotAuthorizedOnWorkbasketException
- if the current user has no READ permission for the specified WorkbasketWorkbasketNotFoundException
- if the Workbasket doesn't exist
-
getDistributionSources
List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException Returns the distribution sources for a given Workbasket.- Parameters:
workbasketKey
- the key of the referenced Workbasketdomain
- the domain of the referenced Workbasket- Returns:
- the workbaskets that are distribution sources of the specified Workbasket.
- Throws:
NotAuthorizedOnWorkbasketException
- if the current user has no READ permission for the specified WorkbasketWorkbasketNotFoundException
- if the Workbasket doesn't exist
-
addDistributionTarget
void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws WorkbasketNotFoundException, io.kadai.common.api.exceptions.NotAuthorizedException, NotAuthorizedOnWorkbasketException Add a distribution target to a Workbasket. If the specified distribution target exists already, the method silently returns without doing anything.- Parameters:
sourceWorkbasketId
- the id of the source WorkbaskettargetWorkbasketId
- the id of the target Workbasket- Throws:
NotAuthorizedOnWorkbasketException
- if the current user doesn't have READ permission for the source Workbasketsio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMINWorkbasketNotFoundException
- if either the source Workbasket or the target Workbasket doesn't exist
-
removeDistributionTarget
void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws io.kadai.common.api.exceptions.NotAuthorizedException, NotAuthorizedOnWorkbasketException Remove a distribution target from a Workbasket. If the specified distribution target doesn't exist, the method silently returns without doing anything.- Parameters:
sourceWorkbasketId
- The id of the source WorkbaskettargetWorkbasketId
- The id of the target Workbasket- Throws:
NotAuthorizedOnWorkbasketException
- If the current user doesn't have READ permission for the source Workbasketio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMIN
-
newWorkbasketAccessItem
Returns a new WorkbasketAccessItem which is not inserted.- Parameters:
workbasketId
- the id used to identify the referenced WorkbasketaccessId
- the group id or user id for which access is controlled- Returns:
- new WorkbasketAccessItem
-
createWorkbasketAccessItem
WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws io.kadai.common.api.exceptions.InvalidArgumentException, WorkbasketNotFoundException, WorkbasketAccessItemAlreadyExistException, io.kadai.common.api.exceptions.NotAuthorizedException - Parameters:
workbasketAccessItem
- the new WorkbasketAccessItem- Returns:
- the created WorkbasketAccessItem
- Throws:
io.kadai.common.api.exceptions.InvalidArgumentException
- if the preconditions don't match the required ones.io.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of role admin or business-adminWorkbasketNotFoundException
- if the WorkbasketAccessItem refers to a not existing workbasketWorkbasketAccessItemAlreadyExistException
- if there exists already a WorkbasketAccessItem for the same accessId and Workbasket
-
setWorkbasketAccessItems
void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems) throws io.kadai.common.api.exceptions.InvalidArgumentException, WorkbasketAccessItemAlreadyExistException, WorkbasketNotFoundException, io.kadai.common.api.exceptions.NotAuthorizedException, NotAuthorizedOnWorkbasketException Setting up the new WorkbasketAccessItems for a Workbasket. Already stored values will be completely replaced by the current ones.Preconditions for each WorkbasketAccessItem then
wbAccessItems
:- WorkbasketAccessItem.getWorkbasketId() is not null
- WorkbasketAccessItem.getWorkbasketId() is equal to
workbasketId
- WorkbasketAccessItem.getAccessId() is unique
- Parameters:
workbasketId
- id of the access-target Workbasket.wbAccessItems
- List of WorkbasketAccessItems which does replace all current stored ones.- Throws:
io.kadai.common.api.exceptions.InvalidArgumentException
- will be thrown when the parameterwbAccessItems
is NULL or member doesn't match the preconditionsio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMINNotAuthorizedOnWorkbasketException
- This is never thrownWorkbasketAccessItemAlreadyExistException
- ifwbAccessItems
contains multiple WorkbasketAccessItem with the same accessId.WorkbasketNotFoundException
- if the Workbasket cannot be found for the given id.
-
getWorkbasketAccessItems
List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId) throws io.kadai.common.api.exceptions.NotAuthorizedException Get all WorkbasketAccessItems for a Workbasket.- Parameters:
workbasketId
- the id of the Workbasket- Returns:
- List of WorkbasketAccessItems for the Workbasket
- Throws:
io.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of role KadaiRole.BUSINESS_ADMIN or KadaiRole.ADMIN
-
updateWorkbasketAccessItem
WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws io.kadai.common.api.exceptions.InvalidArgumentException, io.kadai.common.api.exceptions.NotAuthorizedException This method updates a WorkbasketAccessItem.- Parameters:
workbasketAccessItem
- the WorkbasketAccessItem- Returns:
- the updated entity
- Throws:
io.kadai.common.api.exceptions.InvalidArgumentException
- if accessId or workbasketId is changed in the WorkbasketAccessItemio.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of role admin or business-admin
-
deleteWorkbasketAccessItem
void deleteWorkbasketAccessItem(String id) throws io.kadai.common.api.exceptions.NotAuthorizedException Deletes a specific WorkbasketAccessItem.- Parameters:
id
- the id of the WorkbasketAccessItem to be deleted- Throws:
io.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of role admin or business-admin
-
deleteWorkbasketAccessItemsForAccessId
void deleteWorkbasketAccessItemsForAccessId(String accessId) throws io.kadai.common.api.exceptions.NotAuthorizedException Deletes all WorkbasketAccessItems using the given WorkbasketAccessItem.getAccessId(). -
createWorkbasketQuery
WorkbasketQuery createWorkbasketQuery()This method provides a query builder for querying the database.- Returns:
- a WorkbasketQuery
-
createWorkbasketAccessItemQuery
WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws io.kadai.common.api.exceptions.NotAuthorizedExceptionThis method provides a query builder for querying the database.- Returns:
- a WorkbasketAccessItemQuery
- Throws:
io.kadai.common.api.exceptions.NotAuthorizedException
- if the current user is not member of role admin or business-admin
-
getPermissionsForWorkbasket
Returns a set with all permissions of the current user at this Workbasket.
If the workbasketId is invalid, an empty List of WorkbasketPermissions is returned since there is no distinction made between the situation that the Workbasket is not found and the caller has no permissions on the Workbasket.- Parameters:
workbasketId
- the id of the referenced Workbasket- Returns:
- a
List
with allWorkbasketPermission
s of the caller on the requested Workbasket.
-
checkAuthorization
void checkAuthorization(String workbasketId, WorkbasketPermission... permission) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException This method checks the authorization for the actual User.- Parameters:
workbasketId
- the id of the Workbasket we want to accesspermission
- the needed WorkbasketPermission; if more than one permission is specified, the current user needs all of them- Throws:
NotAuthorizedOnWorkbasketException
- if the current user has not the requested authorization for the specified WorkbasketWorkbasketNotFoundException
- if the Workbasket cannot be found for the given id.
-
checkAuthorization
void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission) throws WorkbasketNotFoundException, NotAuthorizedOnWorkbasketException This method checks the authorization for the actual User.- Parameters:
workbasketKey
- the key of the Workbasket we want to accessdomain
- the domain of the Workbasket we want to accesspermission
- the needed WorkbasketPermission; if more than one permission is specified, the current user needs all of them.- Throws:
NotAuthorizedOnWorkbasketException
- if the current user has not the requested permission for the specified WorkbasketWorkbasketNotFoundException
- if no Workbasket can be found for the given key and domain values.
-