Package pro.taskana.workbasket.rest
Class WorkbasketController
- java.lang.Object
-
- pro.taskana.workbasket.rest.WorkbasketController
-
@RestController @EnableHypermediaSupport(type=HAL) public class WorkbasketController extends Object
Controller for allWorkbasketrelated endpoints.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkbasketController.WorkbasketQuerySortBystatic classWorkbasketController.WorkbasketQuerySortParameter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<WorkbasketRepresentationModel>createWorkbasket(WorkbasketRepresentationModel workbasketRepresentationModel)This endpoint creates a persistent Workbasket.org.springframework.http.ResponseEntity<WorkbasketRepresentationModel>deleteWorkbasket(String workbasketId)This endpoint deletes an existing Workbasket.org.springframework.http.ResponseEntity<DistributionTargetsCollectionRepresentationModel>getDistributionTargets(String workbasketId)This endpoint retrieves all Distribution Targets for a requested Workbasket.org.springframework.http.ResponseEntity<WorkbasketRepresentationModel>getWorkbasket(String workbasketId)This endpoint retrieves a single Workbasket.org.springframework.http.ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel>getWorkbasketAccessItems(String workbasketId)This endpoint retrieves all Workbasket Access Items for a given Workbasket.org.springframework.http.ResponseEntity<WorkbasketSummaryPagedRepresentationModel>getWorkbaskets(javax.servlet.http.HttpServletRequest request, WorkbasketQueryFilterParameter filterParameter, WorkbasketController.WorkbasketQuerySortParameter sortParameter, QueryPagingParameter<pro.taskana.workbasket.api.models.WorkbasketSummary,pro.taskana.workbasket.api.WorkbasketQuery> pagingParameter)This endpoint retrieves a list of existing Workbaskets.org.springframework.http.ResponseEntity<Void>removeDistributionTargetForWorkbasketId(String targetWorkbasketId)This endpoint removes all Distribution Target references for a provided Workbasket.org.springframework.http.ResponseEntity<DistributionTargetsCollectionRepresentationModel>setDistributionTargetsForWorkbasketId(String sourceWorkbasketId, List<String> targetWorkbasketIds)This endpoint replaces all Distribution Targets for a given Workbasket with the provided ones.org.springframework.http.ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel>setWorkbasketAccessItems(String workbasketId, WorkbasketAccessItemCollectionRepresentationModel workbasketAccessItemRepModels)This endpoint replaces all Workbasket Access Items for a given Workbasket with the provided ones.org.springframework.http.ResponseEntity<WorkbasketRepresentationModel>updateWorkbasket(String workbasketId, WorkbasketRepresentationModel workbasketRepresentationModel)This endpoint updates a given Workbasket.
-
-
-
Method Detail
-
getWorkbaskets
@GetMapping(path="/api/v1/workbaskets") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<WorkbasketSummaryPagedRepresentationModel> getWorkbaskets(javax.servlet.http.HttpServletRequest request, WorkbasketQueryFilterParameter filterParameter, WorkbasketController.WorkbasketQuerySortParameter sortParameter, QueryPagingParameter<pro.taskana.workbasket.api.models.WorkbasketSummary,pro.taskana.workbasket.api.WorkbasketQuery> pagingParameter)This endpoint retrieves a list of existing Workbaskets. Filters can be applied.- Parameters:
request- the HTTP requestfilterParameter- the filter parameterssortParameter- the sort parameterspagingParameter- the paging parameters- Returns:
- the Workbaskets with the given filter, sort and paging options.
-
getWorkbasket
@GetMapping(path="/api/v1/workbaskets/{workbasketId}", produces="application/hal+json") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<WorkbasketRepresentationModel> getWorkbasket(@PathVariable("workbasketId") String workbasketId) throws pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedExceptionThis endpoint retrieves a single Workbasket.- Parameters:
workbasketId- the Id of the requested Workbasket- Returns:
- the requested Workbasket
- Throws:
pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if the requested Workbasket is not foundpro.taskana.common.api.exceptions.NotAuthorizedException- if the current user has no permissions to access the requested Workbasket
-
deleteWorkbasket
@DeleteMapping(path="/api/v1/workbaskets/{workbasketId}") @Transactional(rollbackFor=java.lang.Exception.class, noRollbackFor=pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException.class) public org.springframework.http.ResponseEntity<WorkbasketRepresentationModel> deleteWorkbasket(@PathVariable("workbasketId") String workbasketId) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.workbasket.api.exceptions.WorkbasketInUseExceptionThis endpoint deletes an existing Workbasket.Returned HTTP Status codes:
- 204 NO_CONTENT - Workbasket has been deleted successfully
- 202 ACCEPTED - Workbasket still contains completed Tasks. It has been marked for deletion and will be deleted automatically as soon as all completed Tasks are deleted.
- 423 LOCKED - Workbasket contains non-completed Tasks and cannot be deleted.
- Parameters:
workbasketId- the Id of the Workbasket which should be deleted- Returns:
- the deleted Workbasket
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not authorized to delete this Workbasket.pro.taskana.common.api.exceptions.InvalidArgumentException- if the requested Workbasket Id is null or emptypro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if the requested Workbasket is not foundpro.taskana.workbasket.api.exceptions.WorkbasketInUseException- if the Workbasket contains tasks.
-
createWorkbasket
@PostMapping(path="/api/v1/workbaskets") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<WorkbasketRepresentationModel> createWorkbasket(@RequestBody WorkbasketRepresentationModel workbasketRepresentationModel) throws pro.taskana.workbasket.api.exceptions.InvalidWorkbasketException, pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException, pro.taskana.common.api.exceptions.DomainNotFoundException
This endpoint creates a persistent Workbasket.- Parameters:
workbasketRepresentationModel- the Workbasket which should be created.- Returns:
- the created Workbasket
- Throws:
pro.taskana.workbasket.api.exceptions.InvalidWorkbasketException- if some required properties of the Workbasket are not set.pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINpro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException- if the Workbasket exists alreadypro.taskana.common.api.exceptions.DomainNotFoundException- if the domain does not exist in the configuration.
-
updateWorkbasket
@PutMapping(path="/api/v1/workbaskets/{workbasketId}") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<WorkbasketRepresentationModel> updateWorkbasket(@PathVariable("workbasketId") String workbasketId, @RequestBody WorkbasketRepresentationModel workbasketRepresentationModel) throws pro.taskana.workbasket.api.exceptions.InvalidWorkbasketException, pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.common.api.exceptions.ConcurrencyExceptionThis endpoint updates a given Workbasket.- Parameters:
workbasketId- the Id of the Workbasket which should be updated.workbasketRepresentationModel- the new Workbasket for the requested id.- Returns:
- the updated Workbasket
- Throws:
pro.taskana.workbasket.api.exceptions.InvalidWorkbasketException- if the requested Id and the Id within the new Workbasket do not match.pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if the requested workbasket does notpro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not authorized to update the Workbasketpro.taskana.common.api.exceptions.ConcurrencyException- if an attempt is made to update the Workbasket and another user updated it already
-
getWorkbasketAccessItems
@GetMapping(path="/api/v1/workbaskets/{workbasketId}/workbasketAccessItems", produces="application/hal+json") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel> getWorkbasketAccessItems(@PathVariable("workbasketId") String workbasketId) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundExceptionThis endpoint retrieves all Workbasket Access Items for a given Workbasket.- Parameters:
workbasketId- the Id of the requested Workbasket.- Returns:
- the access items for the requested Workbasket.
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINpro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if the requested Workbasket does not exist.
-
setWorkbasketAccessItems
@PutMapping(path="/api/v1/workbaskets/{workbasketId}/workbasketAccessItems") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel> setWorkbasketAccessItems(@PathVariable("workbasketId") String workbasketId, @RequestBody WorkbasketAccessItemCollectionRepresentationModel workbasketAccessItemRepModels) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistExceptionThis endpoint replaces all Workbasket Access Items for a given Workbasket with the provided ones.- Parameters:
workbasketId- the Id of the Workbasket whose Workbasket Access Items will be replacedworkbasketAccessItemRepModels- the new Workbasket Access Items.- Returns:
- the new Workbasket Access Items for the requested Workbasket
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINpro.taskana.common.api.exceptions.InvalidArgumentException- if the new Workbasket Access Items are not provided.pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- TODO: this is never thrown.pro.taskana.workbasket.api.exceptions.WorkbasketAccessItemAlreadyExistException- if a duplicate Workbasket Access Item exists in the provided list.
-
getDistributionTargets
@GetMapping(path="/api/v1/workbaskets/{workbasketId}/distribution-targets", produces="application/hal+json") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<DistributionTargetsCollectionRepresentationModel> getDistributionTargets(@PathVariable("workbasketId") String workbasketId) throws pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedExceptionThis endpoint retrieves all Distribution Targets for a requested Workbasket.- Parameters:
workbasketId- the Id of the Workbasket whose Distribution Targets will be retrieved- Returns:
- the Distribution Targets for the requested Workbasket
- Throws:
pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if the requested Workbasket does not exist.pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user has no read permission for the specified Workbasket
-
setDistributionTargetsForWorkbasketId
@PutMapping(path="/api/v1/workbaskets/{workbasketId}/distribution-targets") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<DistributionTargetsCollectionRepresentationModel> setDistributionTargetsForWorkbasketId(@PathVariable("workbasketId") String sourceWorkbasketId, @RequestBody List<String> targetWorkbasketIds) throws pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedExceptionThis endpoint replaces all Distribution Targets for a given Workbasket with the provided ones.- Parameters:
sourceWorkbasketId- the source WorkbaskettargetWorkbasketIds- the destination Workbaskets.- Returns:
- the new Distribution Targets for the requested Workbasket.
- Throws:
pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if any Workbasket was not found (either source or target)pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user doesn't have READ permission for the source Workbasket
-
removeDistributionTargetForWorkbasketId
@DeleteMapping(path="/api/v1/workbaskets/{workbasketId}/distribution-targets") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<Void> removeDistributionTargetForWorkbasketId(@PathVariable("workbasketId") String targetWorkbasketId) throws pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedExceptionThis endpoint removes all Distribution Target references for a provided Workbasket.- Parameters:
targetWorkbasketId- the Id of the requested Workbasket.- Returns:
- no content
- Throws:
pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException- if the requested Workbasket does not exist.pro.taskana.common.api.exceptions.NotAuthorizedException- if the requested user ist not ADMIN or BUSINESS_ADMIN.
-
-