Class ItemTemplateRestController


  • @RestController
    @RequestMapping("/api/core/itemtemplates/{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}}")
    public class ItemTemplateRestController
    extends Object
    This RestController takes care of the modification and retrieval of Collection's Item templates Contrary to CollectionItemtemplateController, this class will receive the UUID of an Item template
    • Constructor Detail

      • ItemTemplateRestController

        public ItemTemplateRestController()
    • Method Detail

      • getTemplateItem

        @PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'READ\')")
        @RequestMapping(method=GET)
        public TemplateItemResource getTemplateItem​(javax.servlet.http.HttpServletRequest request,
                                                    @PathVariable
                                                    UUID uuid)
        This method gets a template Item based on its uuid Example:
         
         curl http://<dspace.server.url>/api/core/itemtemplates/cb760455-837a-4159-bd12-dcdfafcadc78
          -XGET \
          -H 'Authorization: Bearer eyJhbGciOiJI...'
         
         
        Parameters:
        request -
        uuid - A UUID of a template item
        Returns:
        The template item corresponding to the UUID above
      • patch

        @PreAuthorize("hasPermission(#uuid, \'ITEM\', \'WRITE\')")
        @RequestMapping(method=PATCH)
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch​(javax.servlet.http.HttpServletRequest request,
                                                                                                                 @PathVariable
                                                                                                                 UUID uuid,
                                                                                                                 @RequestBody(required=true)
                                                                                                                 com.fasterxml.jackson.databind.JsonNode jsonNode)
                                                                                                          throws SQLException,
                                                                                                                 org.dspace.authorize.AuthorizeException
        This method modifies installed template items Example:
         
         curl http://<dspace.server.url>/api/core/itemtemplates/cb760455-837a-4159-bd12-dcdfafcadc78
          -XPATCH -H 'Content-Type: Content-Type:application/json' \
          -H 'Authorization: Bearer eyJhbGciOiJI...' \
          --data '[
                {
                  "op": "add",
                  "path": "/metadata/dc.description",
                  "value": [ { "value": "Some other first description" } ]
                }
              ]'
         
         
        Parameters:
        request -
        uuid - The UUID of the template item to be modified
        jsonNode - The data as shown above
        Returns:
        The modified item
        Throws:
        SQLException
        org.dspace.authorize.AuthorizeException
      • deleteTemplateItem

        @PreAuthorize("hasPermission(#uuid, \'ITEM\', \'DELETE\')")
        @RequestMapping(method=DELETE)
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> deleteTemplateItem​(javax.servlet.http.HttpServletRequest request,
                                                                                                                              @PathVariable
                                                                                                                              UUID uuid)
                                                                                                                       throws SQLException,
                                                                                                                              org.dspace.authorize.AuthorizeException,
                                                                                                                              IOException
        This method deletes a template item from a collection. Example:
         
         curl http://<dspace.server.url>/api/core/itemtemplates/cb760455-837a-4159-bd12-dcdfafcadc78
          -XDELETE \
          -H 'Authorization: Bearer eyJhbGciOiJI...'
         
         
        Parameters:
        request -
        uuid -
        Returns:
        Status code 204 is returned if the deletion was successful
        Throws:
        SQLException
        org.dspace.authorize.AuthorizeException
        IOException