Class WorkbasketController


  • @RestController
    @EnableHypermediaSupport(type=HAL)
    public class WorkbasketController
    extends Object
    Controller for all Workbasket related endpoints.
    • 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 request
        filterParameter - the filter parameters
        sortParameter - the sort parameters
        pagingParameter - 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.NotAuthorizedException
        This 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 found
        pro.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.WorkbasketInUseException
        This 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 empty
        pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException - if the requested Workbasket is not found
        pro.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.common.api.exceptions.InvalidArgumentException,
                                                                                                       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.common.api.exceptions.InvalidArgumentException - 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 ADMIN
        pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException - if the Workbasket exists already
        pro.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.WorkbasketNotFoundException,
                                                                                                       pro.taskana.common.api.exceptions.NotAuthorizedException,
                                                                                                       pro.taskana.common.api.exceptions.ConcurrencyException,
                                                                                                       pro.taskana.common.api.exceptions.InvalidArgumentException
        This 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.common.api.exceptions.InvalidArgumentException - 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 not
        pro.taskana.common.api.exceptions.NotAuthorizedException - if the current user is not authorized to update the Workbasket
        pro.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.WorkbasketNotFoundException
        This 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 ADMIN
        pro.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.WorkbasketAccessItemAlreadyExistException
        This 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 replaced
        workbasketAccessItemRepModels - 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 ADMIN
        pro.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.NotAuthorizedException
        This 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.NotAuthorizedException
        This endpoint replaces all Distribution Targets for a given Workbasket with the provided ones.
        Parameters:
        sourceWorkbasketId - the source Workbasket
        targetWorkbasketIds - 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.NotAuthorizedException
        This 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.