Package pro.taskana.workbasket.api
Interface WorkbasketService
-
- All Known Implementing Classes:
WorkbasketServiceImpl
public interface WorkbasketServiceThis service manages Workbaskets.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)Add a distribution target to a workbasket.voidcheckAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission)This method checks the authorization for the actual User.voidcheckAuthorization(String workbasketId, WorkbasketPermission... permission)This method checks the authorization for the actual User.WorkbasketcreateWorkbasket(Workbasket workbasket)Creates a new Workbasket.WorkbasketAccessItemcreateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)Create and insert a newWorkbasketAccessItemwith a WorkbasketId, an accessId and permissions.WorkbasketAccessItemQuerycreateWorkbasketAccessItemQuery()This method provides a query builder for querying the database.WorkbasketQuerycreateWorkbasketQuery()This method provides a query builder for querying the database.booleandeleteWorkbasket(String workbasketId)Deletes the workbasket by the given ID of it.voiddeleteWorkbasketAccessItem(String id)Deletes a specificWorkbasketAccessItem.voiddeleteWorkbasketAccessItemsForAccessId(String accessId)Deletes all WorkbasketAccessItems using the given AccessId of a user.BulkOperationResults<String,TaskanaException>deleteWorkbaskets(List<String> workbasketsIds)Deletes a list of workbaskets.List<WorkbasketSummary>getDistributionSources(String workbasketId)Returns the distribution sources for a given workbasket.List<WorkbasketSummary>getDistributionSources(String workbasketKey, String domain)Returns the distribution sources for a given workbasket.List<WorkbasketSummary>getDistributionTargets(String workbasketId)Returns the distribution targets for a given workbasket.List<WorkbasketSummary>getDistributionTargets(String workbasketKey, String domain)Returns the distribution targets for a given workbasket.List<WorkbasketPermission>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 permissions 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.WorkbasketgetWorkbasket(String workbasketId)Get Workbasket for a given id.WorkbasketgetWorkbasket(String workbasketKey, String domain)Get Workbasket for a given key.List<WorkbasketAccessItem>getWorkbasketAccessItems(String workbasketId)Get allsfor a Workbasket.WorkbasketnewWorkbasket(String key, String domain)Returns a new workbasket which is not inserted.WorkbasketAccessItemnewWorkbasketAccessItem(String workbasketId, String accessId)Returns a new WorkbasketAccessItem which is not inserted.voidremoveDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)Remove a distribution target from a workbasket.voidsetDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds)Set the distribution targets for a workbasket.voidsetWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems)Setting up the new WorkbasketAccessItems for a Workbasket.WorkbasketupdateWorkbasket(Workbasket workbasket)Update a Workbasket.WorkbasketAccessItemupdateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)This method updates aWorkbasketAccessItem.
-
-
-
Method Detail
-
getWorkbasket
Workbasket getWorkbasket(String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedException
Get Workbasket for a given id.- Parameters:
workbasketId- the Id of the Workbasket requested- Returns:
- the requested Workbasket
- Throws:
WorkbasketNotFoundException- If the Workbasket with workbasketId is not foundNotAuthorizedException- If the current user or group does not have the permissions for interactions.
-
getWorkbasket
Workbasket getWorkbasket(String workbasketKey, String domain) throws WorkbasketNotFoundException, NotAuthorizedException
Get Workbasket for a given key.- 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 foundNotAuthorizedException- If the current user or group does not have the permissions for interactions.
-
createWorkbasket
Workbasket createWorkbasket(Workbasket workbasket) throws InvalidArgumentException, NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException
Creates a new Workbasket.
The default values are:- id - generated by IdGenerator
- Parameters:
workbasket- The Workbasket to create- Returns:
- the created and inserted Workbasket
- Throws:
InvalidArgumentException- If a required property of the Workbasket is not set.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINWorkbasketAlreadyExistException- if the Workbasket exists alreadyDomainNotFoundException- if the domain does not exist in the configuration.
-
updateWorkbasket
Workbasket updateWorkbasket(Workbasket workbasket) throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException
Update a Workbasket.- Parameters:
workbasket- The Workbasket to update- Returns:
- the updated Workbasket
- Throws:
InvalidArgumentException- if workbasket name or type is invalidNotAuthorizedException- if the current user is not authorized to update the WorkbasketWorkbasketNotFoundException- if the Workbasket cannot be found.ConcurrencyException- if an attempt is made to update the Workbasket and another user updated it already
-
newWorkbasketAccessItem
WorkbasketAccessItem newWorkbasketAccessItem(String workbasketId, String accessId)
Returns a new WorkbasketAccessItem which is not inserted.- Parameters:
workbasketId- the workbasket 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 InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException, WorkbasketAccessItemAlreadyExistException
Create and insert a newWorkbasketAccessItemwith a WorkbasketId, an accessId and permissions.- Parameters:
workbasketAccessItem- the new workbasketAccessItem- Returns:
- the created WorkbasketAccessItem
- Throws:
InvalidArgumentException- if the preconditions dont match the required ones.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINWorkbasketNotFoundException- if the workbasketAccessItem refers to a not existing workbasket *WorkbasketAccessItemAlreadyExistException- if there exists already a WorkbasketAccessItem for the same access id and workbasket
-
updateWorkbasketAccessItem
WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws InvalidArgumentException, NotAuthorizedException
This method updates aWorkbasketAccessItem.- Parameters:
workbasketAccessItem- theWorkbasketAccessItem- Returns:
- the updated entity
- Throws:
InvalidArgumentException- if accessid or workbasketId is changed in the workbasketAccessItemNotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMIN
-
deleteWorkbasketAccessItem
void deleteWorkbasketAccessItem(String id) throws NotAuthorizedException
Deletes a specificWorkbasketAccessItem.- Parameters:
id- the id of the WorbasketAccessItem to be deleted- Throws:
NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMIN
-
checkAuthorization
void checkAuthorization(String workbasketId, WorkbasketPermission... permission) throws NotAuthorizedException, WorkbasketNotFoundException
This method checks the authorization for the actual User.- Parameters:
workbasketId- the id of the workbasket we want to accesspermission- the neededWorkbasketPermissionIf more than one permission is specified, the current user needs all of them.- Throws:
NotAuthorizedException- 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 NotAuthorizedException, WorkbasketNotFoundException
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 neededWorkbasketPermission. If more than one permission is specified, the current user needs all of them.- Throws:
NotAuthorizedException- if the current user has not the requested permission for the specified workbasketWorkbasketNotFoundException- if no workbasket can be found for the given key+domain values.
-
getWorkbasketAccessItems
List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId) throws NotAuthorizedException
Get allsfor a Workbasket.- Parameters:
workbasketId- the id of the Workbasket- Returns:
- List of WorkbasketAccessItems for the Workbasket
- Throws:
NotAuthorizedException- if the current user is not member of role TaskanaRole.BUSINESS_ADMIN or TaskanaRole.ADMIN
-
setWorkbasketAccessItems
void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems) throws InvalidArgumentException, NotAuthorizedException, WorkbasketAccessItemAlreadyExistException, WorkbasketNotFoundException
Setting up the new WorkbasketAccessItems for a Workbasket. Already stored values will be completely replaced by the current ones.Preconditions for each
WorkbasketAccessItemthenwbAccessItems:WorkbasketAccessItem.getWorkbasketId()is not nullWorkbasketAccessItem.getWorkbasketId()is equal toworkbasketIdWorkbasketAccessItem.getAccessId()is unique
- Parameters:
workbasketId- ID of the access-target workbasket.wbAccessItems- List of WorkbasketAccessItems which does replace all current stored ones.- Throws:
InvalidArgumentException- will be thrown when the parameterwbAccessItemsis NULL or member doesn't match the preconditionsNotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINWorkbasketAccessItemAlreadyExistException- ifwbAccessItemscontains multiple accessItems with the same accessId.WorkbasketNotFoundException- if the Workbasket cannot be found for the given id.
-
createWorkbasketQuery
WorkbasketQuery createWorkbasketQuery()
This method provides a query builder for querying the database.- Returns:
- a
WorkbasketQuery
-
createWorkbasketAccessItemQuery
WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException
This method provides a query builder for querying the database.- Returns:
- a
WorkbasketAccessItemQuery - Throws:
NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMIN
-
newWorkbasket
Workbasket newWorkbasket(String key, String domain)
Returns a new workbasket which is not inserted.- Parameters:
key- the workbasket key used to identify the workbasketdomain- the domain of the new workbasket- Returns:
- new Workbasket
-
getPermissionsForWorkbasket
List<WorkbasketPermission> 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 permissions 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
Listwith allWorkbasketPermissions of the caller on the requested workbasket.
-
getDistributionTargets
List<WorkbasketSummary> getDistributionTargets(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException
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:
NotAuthorizedException- 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 NotAuthorizedException, WorkbasketNotFoundException
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:
NotAuthorizedException- if the current user has no read permission for the specified workbasketWorkbasketNotFoundException- if the workbasket doesn't exist
-
setDistributionTargets
void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds) throws NotAuthorizedException, WorkbasketNotFoundException
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:
NotAuthorizedException- if the current used doesn't have READ permission for the source workbasketWorkbasketNotFoundException- if either the source workbasket or any of the target workbaskets don't exist
-
addDistributionTarget
void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws NotAuthorizedException, WorkbasketNotFoundException
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:
NotAuthorizedException- if the current user doesn't have READ permission for the source workbasketWorkbasketNotFoundException- if either the source workbasket or the target workbasket doesn't exist
-
removeDistributionTarget
void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws NotAuthorizedException
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:
NotAuthorizedException- If the current user doesn't have READ permission for the source workbasket
-
deleteWorkbasket
boolean deleteWorkbasket(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException
Deletes the workbasket by the given ID of it.- 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:
NotAuthorizedException- if the current user got no permissions for this interaction.WorkbasketNotFoundException- if the workbasket does not exist.WorkbasketInUseException- if the workbasket does contain task-content.InvalidArgumentException- if the workbasketId is NULL or EMPTY
-
deleteWorkbaskets
BulkOperationResults<String,TaskanaException> deleteWorkbaskets(List<String> workbasketsIds) throws NotAuthorizedException, InvalidArgumentException
Deletes a list of workbaskets.- Parameters:
workbasketsIds- the ids of the workbaskets to delete.- Returns:
- the result of the operations with Id and Exception for each failed workbasket deletion.
- Throws:
InvalidArgumentException- if the WorkbasketIds parameter list is NULL or emptyNotAuthorizedException- if the current user got no permission for this interaction.
-
getDistributionSources
List<WorkbasketSummary> getDistributionSources(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException
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:
NotAuthorizedException- 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 NotAuthorizedException, WorkbasketNotFoundException
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:
NotAuthorizedException- if the current user has no read permission for the specified workbasketWorkbasketNotFoundException- if the workbasket doesn't exist
-
deleteWorkbasketAccessItemsForAccessId
void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException
Deletes all WorkbasketAccessItems using the given AccessId of a user.- Parameters:
accessId- of a taskana-user.- Throws:
NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMIN
-
-