public class WorkbasketServiceImpl extends Object implements WorkbasketService
| Constructor and Description |
|---|
WorkbasketServiceImpl(InternalTaskanaEngine taskanaEngine,
WorkbasketMapper workbasketMapper,
DistributionTargetMapper distributionTargetMapper,
WorkbasketAccessMapper workbasketAccessMapper) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDistributionTarget(String sourceWorkbasketId,
String targetWorkbasketId)
Add a distribution target to a workbasket.
|
void |
checkAuthorization(String workbasketKey,
String domain,
WorkbasketPermission... requestedPermissions)
This method checks the authorization for the actual User.
|
void |
checkAuthorization(String workbasketId,
WorkbasketPermission... requestedPermissions)
This method checks the authorization for the actual User.
|
Workbasket |
createWorkbasket(Workbasket newWorkbasket)
Create a new Workbasket.
|
WorkbasketAccessItem |
createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
Create and persist a new
WorkbasketAccessItem with a WorkbasketId, an accessId and
permissions. |
WorkbasketAccessItemQuery |
createWorkbasketAccessItemQuery()
This method provides a query builder for querying the database.
|
WorkbasketQuery |
createWorkbasketQuery()
This method provides a query builder for querying the database.
|
boolean |
deleteWorkbasket(String workbasketId)
Deletes the workbasket by the given ID of it.
|
void |
deleteWorkbasketAccessItem(String accessItemId)
Deletes a specific
WorkbasketAccessItem. |
void |
deleteWorkbasketAccessItemsForAccessId(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. |
Workbasket |
getWorkbasket(String workbasketId)
Get Workbasket for a given id.
|
Workbasket |
getWorkbasket(String workbasketKey,
String domain)
Get Workbasket for a given key.
|
List<WorkbasketAccessItem> |
getWorkbasketAccessItems(String workbasketId)
Get all
s for a Workbasket. |
Workbasket |
newWorkbasket(String key,
String domain)
Returns a new workbasket which is not persisted.
|
WorkbasketAccessItem |
newWorkbasketAccessItem(String workbasketId,
String accessId)
Returns a new WorkbasketAccessItem which is not persisted.
|
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.
|
Workbasket |
updateWorkbasket(Workbasket workbasketToUpdate)
Update a Workbasket.
|
WorkbasketAccessItem |
updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
This method updates a
WorkbasketAccessItem. |
public WorkbasketServiceImpl(InternalTaskanaEngine taskanaEngine, WorkbasketMapper workbasketMapper, DistributionTargetMapper distributionTargetMapper, WorkbasketAccessMapper workbasketAccessMapper)
public Workbasket getWorkbasket(String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedException
WorkbasketServicegetWorkbasket in interface WorkbasketServiceworkbasketId - the Id of the Workbasket requestedWorkbasketNotFoundException - If the Workbasket with workbasketId is not foundNotAuthorizedException - If the current user or group does not have the permissions for
interactions.public Workbasket getWorkbasket(String workbasketKey, String domain) throws WorkbasketNotFoundException, NotAuthorizedException
WorkbasketServicegetWorkbasket in interface WorkbasketServiceworkbasketKey - the Key of the Workbasket requesteddomain - the domain of the workbasketWorkbasketNotFoundException - If the Workbasket with workbasketId is not foundNotAuthorizedException - If the current user or group does not have the permissions for
interactions.public Workbasket createWorkbasket(Workbasket newWorkbasket) throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException
WorkbasketServicecreateWorkbasket in interface WorkbasketServicenewWorkbasket - The Workbasket to createInvalidWorkbasketException - 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.public Workbasket updateWorkbasket(Workbasket workbasketToUpdate) throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException
WorkbasketServiceupdateWorkbasket in interface WorkbasketServiceworkbasketToUpdate - The Workbasket to updateNotAuthorizedException - if the current user is not authorized to update the work basketWorkbasketNotFoundException - if the workbasket cannot be found.ConcurrencyException - if an attempt is made to update the workbasket and another user
updated it alreadypublic WorkbasketAccessItem newWorkbasketAccessItem(String workbasketId, String accessId)
WorkbasketServicenewWorkbasketAccessItem in interface WorkbasketServiceworkbasketId - the workbasket id used to identify the referenced workbasketaccessId - the group id or user id for which access is controlledpublic WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException, WorkbasketAccessItemAlreadyExistException
WorkbasketServiceWorkbasketAccessItem with a WorkbasketId, an accessId and
permissions.createWorkbasketAccessItem in interface WorkbasketServiceworkbasketAccessItem - the new workbasketAccessItemInvalidArgumentException - when 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 workbasketpublic WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws InvalidArgumentException, NotAuthorizedException
WorkbasketServiceWorkbasketAccessItem.updateWorkbasketAccessItem in interface WorkbasketServiceworkbasketAccessItem - the WorkbasketAccessItemInvalidArgumentException - if accessid or workbasketId is changed in the
workbasketAccessItemNotAuthorizedException - if the current user is not member of role BUSINESS_ADMIN or
ADMINpublic void deleteWorkbasketAccessItem(String accessItemId) throws NotAuthorizedException
WorkbasketServiceWorkbasketAccessItem.deleteWorkbasketAccessItem in interface WorkbasketServiceaccessItemId - the id of the WorbasketAccessItem to be deletedNotAuthorizedException - if the current user is not member of role BUSINESS_ADMIN or
ADMINpublic void checkAuthorization(String workbasketId, WorkbasketPermission... requestedPermissions) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServicecheckAuthorization in interface WorkbasketServiceworkbasketId - the id of the workbasket we want to accessrequestedPermissions - the needed WorkbasketPermission If more than one permission is
specified, the current user needs all of them.NotAuthorizedException - if the current user has not the requested authorization for the
specified workbasketWorkbasketNotFoundException - if the workbasket cannot be found for the given ID.public void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... requestedPermissions) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServicecheckAuthorization in interface WorkbasketServiceworkbasketKey - the key of the workbasket we want to accessdomain - the domain of the workbasket we want to accessrequestedPermissions - the needed WorkbasketPermission. If more than one permission is
specified, the current user needs all of them.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.public List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId) throws NotAuthorizedException
WorkbasketServices for a Workbasket.getWorkbasketAccessItems in interface WorkbasketServiceworkbasketId - the id of the WorkbasketNotAuthorizedException - if the current user is not member of role BUSINESS_ADMIN or
ADMINpublic void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems) throws InvalidArgumentException, NotAuthorizedException, WorkbasketAccessItemAlreadyExistException
WorkbasketServicePreconditions for each WorkbasketAccessItem in wbAccessItems:
WorkbasketAccessItem.getWorkbasketId() is not null
WorkbasketAccessItem.getWorkbasketId() is equal to workbasketId
WorkbasketAccessItem.getAccessId() is unique
setWorkbasketAccessItems in interface WorkbasketServiceworkbasketId - ID of the access-target workbasket.wbAccessItems - List of WorkbasketAccessItems which does replace all current stored ones.InvalidArgumentException - will be thrown when the parameter wbAccessItems is
NULL or member doesn't match the preconditionsNotAuthorizedException - if the current user is not member of role BUSINESS_ADMIN or
ADMINWorkbasketAccessItemAlreadyExistException - if wbAccessItems contains multiple
accessItems with the same accessId.public WorkbasketQuery createWorkbasketQuery()
WorkbasketServicecreateWorkbasketQuery in interface WorkbasketServiceWorkbasketQuerypublic WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException
WorkbasketServicecreateWorkbasketAccessItemQuery in interface WorkbasketServiceWorkbasketAccessItemQueryNotAuthorizedException - if the current user is not member of role BUSINESS_ADMIN or
ADMINpublic Workbasket newWorkbasket(String key, String domain)
WorkbasketServicenewWorkbasket in interface WorkbasketServicekey - the workbasket key used to identify the workbasketdomain - the domain of the new workbasketpublic List<WorkbasketPermission> getPermissionsForWorkbasket(String workbasketId)
WorkbasketServicegetPermissionsForWorkbasket in interface WorkbasketServiceworkbasketId - the id of the referenced workbasketList with all WorkbasketPermissions of the caller on the requested
workbasket.public List<WorkbasketSummary> getDistributionTargets(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServicegetDistributionTargets in interface WorkbasketServiceworkbasketId - the id of the referenced workbasketNotAuthorizedException - if the current user has no read permission for the specified
workbasketWorkbasketNotFoundException - if the workbasket doesn't existpublic List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServicegetDistributionTargets in interface WorkbasketServiceworkbasketKey - the key of the referenced workbasketdomain - the domain of the referenced workbasketNotAuthorizedException - if the current user has no read permission for the specified
workbasketWorkbasketNotFoundException - if the workbasket doesn't existpublic void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds) throws WorkbasketNotFoundException, NotAuthorizedException
WorkbasketServicesetDistributionTargets in interface WorkbasketServicesourceWorkbasketId - the id of the source workbasket for which the distribution targets
are to be settargetWorkbasketIds - a list of the ids of the target workbasketsWorkbasketNotFoundException - if either the source workbasket or any of the target
workbaskets don't existNotAuthorizedException - if the current used doesn't have READ permission for the source
workbasketpublic void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServiceaddDistributionTarget in interface WorkbasketServicesourceWorkbasketId - the id of the source workbaskettargetWorkbasketId - the id of the target workbasketNotAuthorizedException - if the current user doesn't have READ permission for the source
workbasketWorkbasketNotFoundException - if either the source workbasket or the target workbasket
doesn't existpublic void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws NotAuthorizedException
WorkbasketServiceremoveDistributionTarget in interface WorkbasketServicesourceWorkbasketId - The id of the source workbaskettargetWorkbasketId - The id of the target workbasketNotAuthorizedException - If the current user doesn't have READ permission for the source
workbasketpublic boolean deleteWorkbasket(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException
WorkbasketServicedeleteWorkbasket in interface WorkbasketServiceworkbasketId - Id of the workbasket which should be deleted.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 EMPTYpublic BulkOperationResults<String,TaskanaException> deleteWorkbaskets(List<String> workbasketsIds) throws NotAuthorizedException, InvalidArgumentException
WorkbasketServicedeleteWorkbaskets in interface WorkbasketServiceworkbasketsIds - the ids of the workbaskets to delete.NotAuthorizedException - if the current user got no permission for this interaction.InvalidArgumentException - if the WorkbasketIds parameter list is NULL or emptypublic List<WorkbasketSummary> getDistributionSources(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServicegetDistributionSources in interface WorkbasketServiceworkbasketId - the id of the referenced workbasketNotAuthorizedException - if the current user has no read permission for the specified
workbasketWorkbasketNotFoundException - if the workbasket doesn't existpublic List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain) throws NotAuthorizedException, WorkbasketNotFoundException
WorkbasketServicegetDistributionSources in interface WorkbasketServiceworkbasketKey - the key of the referenced workbasketdomain - the domain of the referenced workbasketNotAuthorizedException - if the current user has no read permission for the specified
workbasketWorkbasketNotFoundException - if the workbasket doesn't existpublic void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException
WorkbasketServicedeleteWorkbasketAccessItemsForAccessId in interface WorkbasketServiceaccessId - of a taskana-user.NotAuthorizedException - if the current user is not member of role BUSINESS_ADMIN or
ADMINCopyright © 2020. All rights reserved.