Class CollectionItemTemplateController


  • @RestController
    @RequestMapping("/api/core/collections/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}/itemtemplate")
    public class CollectionItemTemplateController
    extends Object
    This RestController takes care of the creation and retrieval of Collection's Item templates This class will receive the UUID of a Collection and it'll perform actions on its nested objects
    • Constructor Detail

      • CollectionItemTemplateController

        public CollectionItemTemplateController()
    • Method Detail

      • createTemplateItem

        @PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'WRITE\')")
        @RequestMapping(method=POST)
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> createTemplateItem​(javax.servlet.http.HttpServletRequest request,
                                                                                                                              @PathVariable
                                                                                                                              UUID uuid,
                                                                                                                              @RequestBody(required=false)
                                                                                                                              com.fasterxml.jackson.databind.JsonNode itemBody)
                                                                                                                       throws SQLException,
                                                                                                                              AuthorizeException
        This method will create an Item and add it as a template to a Collection. Example:
         
         curl http://<dspace.server.url>/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/itemtemplate
          -XPOST -H 'Content-Type: Content-Type:application/json' \
          -H 'Authorization: Bearer eyJhbGciOiJI...' \
          --data '{
                "metadata": {
                  "dc.type": [
                    {
                      "value": "Journal Article",
                      "language": "en",
                      "authority": null,
                      "confidence": -1
                    }
                  ]
                },
                "inArchive": false,
                "discoverable": false,
                "withdrawn": false,
                "type": "item"
              }'
         
         
        Parameters:
        request - The request as described above
        uuid - The UUID of the Collection for which the template item should be made
        itemBody - The new item
        Returns:
        The created template
        Throws:
        SQLException
        AuthorizeException
      • getTemplateItem

        @PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'READ\')")
        @RequestMapping(method=GET)
        public TemplateItemResource getTemplateItem​(javax.servlet.http.HttpServletRequest request,
                                                    @PathVariable
                                                    UUID uuid)
                                             throws SQLException
        This method gets the template Item based on the owning Collection
         
         curl http://<dspace.server.url>/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/itemtemplate
          -XGET \
          -H 'Authorization: Bearer eyJhbGciOiJI...'
         
         
        Parameters:
        request -
        uuid - The UUID of the Collection from which you want the template item
        Returns:
        The template item from the Collection in the request
        Throws:
        SQLException