Class CollectionController


  • @RestController
    @Api(description="The collection controller",
         name="Collection controller")
    public class CollectionController
    extends Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity addDigitalObject​(UUID collectionUuid, UUID digitalObjectUuid)  
      org.springframework.http.ResponseEntity addDigitalObjects​(UUID collectionUuid, List<de.digitalcollections.model.api.identifiable.entity.DigitalObject> digitalObjects)  
      org.springframework.http.ResponseEntity addSubcollection​(UUID uuid, UUID subcollectionUuid)  
      org.springframework.http.ResponseEntity addSubcollections​(UUID uuid, List<de.digitalcollections.model.api.identifiable.entity.Collection> subcollections)  
      long count()  
      de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> findAll​(int pageNumber, int pageSize, String sortField, de.digitalcollections.model.api.paging.enums.Direction sortDirection, de.digitalcollections.model.api.paging.enums.NullHandling nullHandling, de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationStart, de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationEnd)  
      de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> findAllTop​(int pageNumber, int pageSize, String sortField, de.digitalcollections.model.api.paging.enums.Direction sortDirection, de.digitalcollections.model.api.paging.enums.NullHandling nullHandling)  
      de.digitalcollections.model.api.identifiable.entity.Collection findByIdentifier​(String namespace, String id)  
      org.springframework.http.ResponseEntity<de.digitalcollections.model.api.identifiable.entity.Collection> findByUuid​(UUID uuid, Locale pLocale)  
      de.digitalcollections.model.api.paging.SearchPageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> findCollections​(int pageNumber, int pageSize, String sortField, de.digitalcollections.model.api.paging.enums.Direction sortDirection, de.digitalcollections.model.api.paging.enums.NullHandling nullHandling, String searchTerm)  
      org.springframework.http.ResponseEntity<de.digitalcollections.model.api.view.BreadcrumbNavigation> getBreadcrumb​(UUID uuid, Locale pLocale)  
      de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.DigitalObject> getDigitalObjects​(UUID collectionUuid, int pageNumber, int pageSize)  
      de.digitalcollections.model.api.identifiable.entity.Collection getParent​(UUID uuid)  
      List<de.digitalcollections.model.api.identifiable.entity.Collection> getParents​(UUID collectionUuid)  
      de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> getSubcollections​(UUID collectionUuid, int pageNumber, int pageSize, de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationStart, de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationEnd)  
      org.springframework.http.ResponseEntity removeDigitalObject​(UUID collectionUuid, UUID digitalObjectUuid)  
      org.springframework.http.ResponseEntity removeSubcollection​(UUID uuid, UUID subcollectionUuid)  
      de.digitalcollections.model.api.identifiable.entity.Collection save​(de.digitalcollections.model.api.identifiable.entity.Collection collection, org.springframework.validation.BindingResult errors)  
      org.springframework.http.ResponseEntity saveDigitalObjects​(UUID collectionUuid, List<de.digitalcollections.model.api.identifiable.entity.DigitalObject> digitalObjects)  
      de.digitalcollections.model.api.identifiable.entity.Collection saveWithParentCollection​(UUID parentUuid, de.digitalcollections.model.api.identifiable.entity.Collection collection)  
      de.digitalcollections.model.api.identifiable.entity.Collection update​(UUID uuid, de.digitalcollections.model.api.identifiable.entity.Collection collection, org.springframework.validation.BindingResult errors)  
    • Constructor Detail

      • CollectionController

        @Autowired
        public CollectionController​(CollectionService collectionService)
    • Method Detail

      • findAll

        @ApiMethod(description="Get all collections")
        @GetMapping(value={"/latest/collections","/v2/collections"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> findAll​(@RequestParam(name="pageNumber",required=false,defaultValue="0")
                                                                                                                                           int pageNumber,
                                                                                                                                           @RequestParam(name="pageSize",required=false,defaultValue="25")
                                                                                                                                           int pageSize,
                                                                                                                                           @RequestParam(name="sortField",required=false,defaultValue="lastModified")
                                                                                                                                           String sortField,
                                                                                                                                           @RequestParam(name="sortDirection",required=false,defaultValue="DESC")
                                                                                                                                           de.digitalcollections.model.api.paging.enums.Direction sortDirection,
                                                                                                                                           @RequestParam(name="nullHandling",required=false,defaultValue="NATIVE")
                                                                                                                                           de.digitalcollections.model.api.paging.enums.NullHandling nullHandling,
                                                                                                                                           @RequestParam(name="publicationStart",required=false)
                                                                                                                                           de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationStart,
                                                                                                                                           @RequestParam(name="publicationEnd",required=false)
                                                                                                                                           de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationEnd)
      • findAllTop

        @ApiMethod(description="Get all top collections")
        @GetMapping(value={"/latest/collections/top","/v2/collections/top"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> findAllTop​(@RequestParam(name="pageNumber",required=false,defaultValue="0")
                                                                                                                                              int pageNumber,
                                                                                                                                              @RequestParam(name="pageSize",required=false,defaultValue="5")
                                                                                                                                              int pageSize,
                                                                                                                                              @RequestParam(name="sortField",required=false,defaultValue="uuid")
                                                                                                                                              String sortField,
                                                                                                                                              @RequestParam(name="sortDirection",required=false,defaultValue="ASC")
                                                                                                                                              de.digitalcollections.model.api.paging.enums.Direction sortDirection,
                                                                                                                                              @RequestParam(name="nullHandling",required=false,defaultValue="NATIVE")
                                                                                                                                              de.digitalcollections.model.api.paging.enums.NullHandling nullHandling)
      • findByIdentifier

        @ApiMethod(description="Get collection by namespace and id")
        @GetMapping(value={"/latest/collections/identifier/{namespace}:{id}","/v2/collections/identifier/{namespace}:{id}"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.identifiable.entity.Collection findByIdentifier​(@PathVariable
                                                                                               String namespace,
                                                                                               @PathVariable
                                                                                               String id)
                                                                                        throws IdentifiableServiceException
        Throws:
        IdentifiableServiceException
      • findByUuid

        @ApiMethod(description="Get an collection as JSON or XML, depending on extension or <tt>format</tt> request parameter or accept header")
        @GetMapping(value={"/latest/collections/{uuid}","/v2/collections/{uuid}"},
                    produces={"application/json","application/xml"})
        @ApiResponseObject
        public org.springframework.http.ResponseEntity<de.digitalcollections.model.api.identifiable.entity.Collection> findByUuid​(@ApiPathParam(description="UUID of the collection, e.g. <tt>599a120c-2dd5-11e8-b467-0ed5f89f718b</tt>") @PathVariable("uuid")
                                                                                                                                  UUID uuid,
                                                                                                                                  @ApiQueryParam(name="pLocale",description="Desired locale, e.g. <tt>de_DE</tt>. If unset, contents in all languages will be returned") @RequestParam(name="pLocale",required=false)
                                                                                                                                  Locale pLocale)
                                                                                                                           throws IdentifiableServiceException
        Throws:
        IdentifiableServiceException
      • findCollections

        @ApiMethod(description="Find limited amount of collections containing searchTerm in label or description")
        @GetMapping(value={"/latest/collections/search","/v3/collections/search"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.paging.SearchPageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> findCollections​(@RequestParam(name="pageNumber",required=false,defaultValue="0")
                                                                                                                                                         int pageNumber,
                                                                                                                                                         @RequestParam(name="pageSize",required=false,defaultValue="5")
                                                                                                                                                         int pageSize,
                                                                                                                                                         @RequestParam(name="sortField",required=false,defaultValue="uuid")
                                                                                                                                                         String sortField,
                                                                                                                                                         @RequestParam(name="sortDirection",required=false,defaultValue="ASC")
                                                                                                                                                         de.digitalcollections.model.api.paging.enums.Direction sortDirection,
                                                                                                                                                         @RequestParam(name="nullHandling",required=false,defaultValue="NATIVE")
                                                                                                                                                         de.digitalcollections.model.api.paging.enums.NullHandling nullHandling,
                                                                                                                                                         @RequestParam(name="searchTerm",required=false)
                                                                                                                                                         String searchTerm)
      • save

        @ApiMethod(description="Save a newly created collection")
        @PostMapping(value={"/latest/collections","/v2/collections"},
                     produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.identifiable.entity.Collection save​(@RequestBody
                                                                                   de.digitalcollections.model.api.identifiable.entity.Collection collection,
                                                                                   org.springframework.validation.BindingResult errors)
                                                                            throws IdentifiableServiceException
        Throws:
        IdentifiableServiceException
      • saveWithParentCollection

        @ApiMethod(description="Save a newly created collection with parent collection")
        @PostMapping(value={"/latest/collections/{parentUuid}/collection","/v2/collections/{parentUuid}/collection"},
                     produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.identifiable.entity.Collection saveWithParentCollection​(@ApiPathParam(name="parentUuid",description="The uuid of the parent collection") @PathVariable
                                                                                                       UUID parentUuid,
                                                                                                       @RequestBody
                                                                                                       de.digitalcollections.model.api.identifiable.entity.Collection collection)
                                                                                                throws IdentifiableServiceException
        Throws:
        IdentifiableServiceException
      • update

        @ApiMethod(description="Update an collection")
        @PutMapping(value={"/latest/collections/{uuid}","/v2/collections/{uuid}"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.identifiable.entity.Collection update​(@PathVariable
                                                                                     UUID uuid,
                                                                                     @RequestBody
                                                                                     de.digitalcollections.model.api.identifiable.entity.Collection collection,
                                                                                     org.springframework.validation.BindingResult errors)
                                                                              throws IdentifiableServiceException
        Throws:
        IdentifiableServiceException
      • count

        @ApiMethod(description="Get count of collections")
        @GetMapping(value={"/latest/collections/count","/v2/collections/count"},
                    produces="application/json")
        @ApiResponseObject
        public long count()
      • getParent

        @ApiMethod(description="Get the first created parent of a collection")
        @GetMapping(value={"/latest/collections/{uuid}/parent","/v3/collections/{uuid}/parent"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.identifiable.entity.Collection getParent​(@PathVariable
                                                                                        UUID uuid)
      • getBreadcrumb

        @ApiMethod(description="Get the breadcrumb for a collection")
        @GetMapping(value={"/latest/collections/{uuid}/breadcrumb","/v3/collections/{uuid}/breadcrumb"},
                    produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity<de.digitalcollections.model.api.view.BreadcrumbNavigation> getBreadcrumb​(@ApiPathParam(description="UUID of the collection, e.g. <tt>6119d8e9-9c92-4091-8dcb-bc4053385406</tt>") @PathVariable("uuid")
                                                                                                                                UUID uuid,
                                                                                                                                @ApiQueryParam(name="pLocale",description="Desired locale, e.g. <tt>de_DE</tt>. If unset, contents in all languages will be returned") @RequestParam(name="pLocale",required=false)
                                                                                                                                Locale pLocale)
      • addDigitalObject

        @ApiMethod(description="Add an existing digital object to an existing collection")
        @PostMapping(value={"/latest/collections/{uuid}/digitalobjects/{digitalObjectUuid}","/v3/collections/{uuid}/digitalobjects/{digitalObjectUuid}"},
                     produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity addDigitalObject​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                        UUID collectionUuid,
                                                                        @ApiPathParam(description="UUID of the digital object") @PathVariable("digitalObjectUuid")
                                                                        UUID digitalObjectUuid)
      • addDigitalObjects

        @ApiMethod(description="Add existing digital objects to an existing collection")
        @PostMapping(value={"/latest/collections/{uuid}/digitalobjects","/v3/collections/{uuid}/digitalobjects"},
                     produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity addDigitalObjects​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                         UUID collectionUuid,
                                                                         @ApiPathParam(description="List of the digital objects") @RequestBody
                                                                         List<de.digitalcollections.model.api.identifiable.entity.DigitalObject> digitalObjects)
      • getDigitalObjects

        @ApiMethod(description="Get paged digital objects of a collection")
        @GetMapping(value={"/latest/collections/{uuid}/digitalobjects","/v3/collections/{uuid}/digitalobjects"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.DigitalObject> getDigitalObjects​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                                                                                                        UUID collectionUuid,
                                                                                                                                                        @RequestParam(name="pageNumber",required=false,defaultValue="0")
                                                                                                                                                        int pageNumber,
                                                                                                                                                        @RequestParam(name="pageSize",required=false,defaultValue="25")
                                                                                                                                                        int pageSize)
      • getParents

        @ApiMethod(description="Get parent collections")
        @GetMapping(value={"/latest/collections/{uuid}/parents","/v3/collections/{uuid}/parents"},
                    produces="application/json")
        @ApiResponseObject
        public List<de.digitalcollections.model.api.identifiable.entity.Collection> getParents​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                                               UUID collectionUuid)
      • removeDigitalObject

        @ApiMethod(description="Remove an existing digital object from an existing collection")
        @DeleteMapping(value={"/latest/collections/{uuid}/digitalobjects/{digitalObjectUuid}","/v3/collections/{uuid}/digitalobjects/{digitalObjectUuid}"},
                       produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity removeDigitalObject​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                           UUID collectionUuid,
                                                                           @ApiPathParam(description="UUID of the digital object") @PathVariable("digitalObjectUuid")
                                                                           UUID digitalObjectUuid)
      • saveDigitalObjects

        @ApiMethod(description="Save existing digital objects into an existing collection")
        @PutMapping(value={"/latest/collections/{uuid}/digitalobjects","/v3/collections/{uuid}/digitalobjects"},
                    produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity saveDigitalObjects​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                          UUID collectionUuid,
                                                                          @ApiPathParam(description="List of the digital objects") @RequestBody
                                                                          List<de.digitalcollections.model.api.identifiable.entity.DigitalObject> digitalObjects)
      • addSubcollection

        @ApiMethod(description="Add an existing collection to an existing collection")
        @PostMapping(value={"/latest/collections/{uuid}/subcollections/{subcollectionUuid}","/v3/collections/{uuid}/subcollections/{subcollectionUuid}"},
                     produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity addSubcollection​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                        UUID uuid,
                                                                        @ApiPathParam(description="UUID of the subcollection") @PathVariable("subcollectionUuid")
                                                                        UUID subcollectionUuid)
      • addSubcollections

        @ApiMethod(description="Add existing collections to an existing collection")
        @PostMapping(value={"/latest/collections/{uuid}/subcollections","/v3/collections/{uuid}/subcollections"},
                     produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity addSubcollections​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                         UUID uuid,
                                                                         @ApiPathParam(description="List of the subcollections") @RequestBody
                                                                         List<de.digitalcollections.model.api.identifiable.entity.Collection> subcollections)
      • getSubcollections

        @ApiMethod(description="Get paged subcollections of a collection")
        @GetMapping(value={"/latest/collections/{uuid}/subcollections","/v3/collections/{uuid}/subcollections"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.Collection> getSubcollections​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                                                                                                     UUID collectionUuid,
                                                                                                                                                     @RequestParam(name="pageNumber",required=false,defaultValue="0")
                                                                                                                                                     int pageNumber,
                                                                                                                                                     @RequestParam(name="pageSize",required=false,defaultValue="25")
                                                                                                                                                     int pageSize,
                                                                                                                                                     @RequestParam(name="publicationStart",required=false)
                                                                                                                                                     de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationStart,
                                                                                                                                                     @RequestParam(name="publicationEnd",required=false)
                                                                                                                                                     de.digitalcollections.model.api.filter.FilterCriterion<LocalDate> publicationEnd)
      • removeSubcollection

        @ApiMethod(description="Remove an existing collection from an existing collection")
        @DeleteMapping(value={"/latest/collections/{uuid}/subcollections/{subcollectionUuid}","/v3/collections/{uuid}/subcollections/{subcollectionUuid}"},
                       produces="application/json")
        @ApiResponseObject
        public org.springframework.http.ResponseEntity removeSubcollection​(@ApiPathParam(description="UUID of the collection") @PathVariable("uuid")
                                                                           UUID uuid,
                                                                           @ApiPathParam(description="UUID of the subcollection") @PathVariable("subcollectionUuid")
                                                                           UUID subcollectionUuid)