Class ItemController


  • @RestController
    @Api(description="The Item controller",
         name="Item controller")
    public class ItemController
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ItemController()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addDigitalObject​(UUID uuid, UUID digitalObjectUuid)  
      boolean addWork​(UUID uuid, UUID workUuid)  
      long count()  
      de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.work.Item> findAll​(int pageNumber, int pageSize, List<de.digitalcollections.model.api.paging.Order> sortBy, String language, String initial)  
      org.springframework.http.ResponseEntity<de.digitalcollections.model.api.identifiable.entity.work.Item> get​(UUID uuid, Locale pLocale)  
      org.springframework.http.ResponseEntity<de.digitalcollections.model.api.identifiable.entity.work.Item> getByIdentifier​(String namespace, String id)  
      Set<de.digitalcollections.model.api.identifiable.entity.DigitalObject> getDigitalObjects​(UUID uuid)  
      Set<de.digitalcollections.model.api.identifiable.entity.work.Work> getWorks​(UUID uuid)  
      de.digitalcollections.model.api.identifiable.entity.work.Item save​(de.digitalcollections.model.api.identifiable.entity.work.Item item, org.springframework.validation.BindingResult errors)  
      de.digitalcollections.model.api.identifiable.entity.work.Item update​(UUID uuid, de.digitalcollections.model.api.identifiable.entity.work.Item item, org.springframework.validation.BindingResult errors)  
    • Constructor Detail

      • ItemController

        public ItemController()
    • Method Detail

      • count

        @ApiMethod(description="count all items")
        @GetMapping(value={"/latest/items/count","/v2/items/count"},
                    produces="application/json")
        @ApiResponseObject
        public long count()
      • findAll

        @ApiMethod(description="get all items")
        @GetMapping(value={"/latest/items","/v2/items"},
                    produces="application/json")
        @ApiResponseObject
        public de.digitalcollections.model.api.paging.PageResponse<de.digitalcollections.model.api.identifiable.entity.work.Item> findAll​(@RequestParam(name="pageNumber",required=false,defaultValue="0")
                                                                                                                                          int pageNumber,
                                                                                                                                          @RequestParam(name="pageSize",required=false,defaultValue="5")
                                                                                                                                          int pageSize,
                                                                                                                                          @RequestParam(name="sortBy",required=false)
                                                                                                                                          List<de.digitalcollections.model.api.paging.Order> sortBy,
                                                                                                                                          @RequestParam(name="language",required=false,defaultValue="de")
                                                                                                                                          String language,
                                                                                                                                          @RequestParam(name="initial",required=false)
                                                                                                                                          String initial)
      • get

        @ApiMethod(description="get an item as JSON or XML, depending on extension or <tt>format</tt> request parameter or accept header")
        @GetMapping(value={"/latest/items/{uuid}","/v2/items/{uuid}"},
                    produces={"application/json","application/xml"})
        @ApiResponseObject
        public org.springframework.http.ResponseEntity<de.digitalcollections.model.api.identifiable.entity.work.Item> get​(@ApiPathParam(name="uuid",description="UUID of the item, 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
      • getByIdentifier

        @ApiMethod(description="get an item as JSON or XML, depending on extension or <tt>format</tt> request parameter or accept header")
        @GetMapping(value={"/latest/items/identifier","/v2/items/identifier"},
                    produces={"application/json","application/xml"})
        @ApiResponseObject
        public org.springframework.http.ResponseEntity<de.digitalcollections.model.api.identifiable.entity.work.Item> getByIdentifier​(@RequestParam(name="namespace",required=true)
                                                                                                                                      String namespace,
                                                                                                                                      @RequestParam(name="id",required=true)
                                                                                                                                      String id)
                                                                                                                               throws IdentifiableServiceException
        Throws:
        IdentifiableServiceException
      • save

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

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

        @ApiMethod(description="Get digital objects of this item")
        @GetMapping(value={"/latest/items/{uuid}/digitalobjects","/v2/items/{uuid}/digitalobjects"},
                    produces="application/json")
        @ApiResponseObject
        public Set<de.digitalcollections.model.api.identifiable.entity.DigitalObject> getDigitalObjects​(@ApiPathParam(name="uuid",description="UUID of the item") @PathVariable
                                                                                                        UUID uuid)
      • getWorks

        @ApiMethod(description="Get works embodied in an item")
        @GetMapping(value={"/latest/items/{uuid}/works","/v2/items/{uuid}/works"},
                    produces="application/json")
        @ApiResponseObject
        public Set<de.digitalcollections.model.api.identifiable.entity.work.Work> getWorks​(@ApiPathParam(name="uuid",description="UUID of the item") @PathVariable
                                                                                           UUID uuid)
      • addWork

        @ApiMethod(description="Add work to an item")
        @PostMapping(value={"/latest/items/{uuid}/works/{workUuid}","/v2/items/{uuid}/works/{workUuid}"},
                     produces="application/json")
        @ApiResponseObject
        public boolean addWork​(@ApiPathParam(name="uuid",description="UUID of the item") @PathVariable
                               UUID uuid,
                               @ApiPathParam(name="workUuid",description="UUID of the work") @PathVariable
                               UUID workUuid)
      • addDigitalObject

        @ApiMethod(description="Add digital object to an item")
        @PostMapping(value={"/latest/items/{uuid}/digitalobjects/{digitalObjectUuid}","/v2/items/{uuid}/digitalobjects/{digitalObjectUuid}"},
                     produces="application/json")
        @ApiResponseObject
        public boolean addDigitalObject​(@ApiPathParam(name="uuid",description="UUID of the item") @PathVariable
                                        UUID uuid,
                                        @ApiPathParam(name="digitalObjectUuid",description="UUID of the digital object") @PathVariable
                                        UUID digitalObjectUuid)