Class RestResourceController

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean

    @RestController
    @RequestMapping("/api/{apiCategory}/{model}")
    public class RestResourceController
    extends Object
    implements org.springframework.beans.factory.InitializingBean
    This is the main entry point of the new REST API. Its responsibility is to provide a consistent behaviors for all the exposed resources in terms of returned HTTP codes, endpoint URLs, HTTP verbs to methods translation, etc. It delegates to the repository the business logic
    Author:
    Andrea Bollini (andrea.bollini at 4science.it)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> action​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id)
      Called in POST, with a x-www-form-urlencoded, execute an action on a resource Note that the regular expression in the request mapping accept a number as identifier;
      void afterPropertiesSet()  
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id)  
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid)  
      <T extends RestAddressableModel>
      org.springframework.hateoas.RepresentationModel
      executeSearchMethods​(String apiCategory, String model, String searchMethodName, javax.servlet.http.HttpServletResponse response, org.springframework.data.domain.Pageable pageable, org.springframework.data.domain.Sort sort, org.springframework.data.web.PagedResourcesAssembler assembler, org.springframework.util.MultiValueMap<String,​Object> parameters)  
      <T extends RestAddressableModel>
      org.springframework.hateoas.PagedModel<DSpaceResource<T>>
      findAll​(String apiCategory, String model, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler, javax.servlet.http.HttpServletResponse response, org.springframework.util.MultiValueMap<String,​Object> parameters)
      Find all
      HALResource<RestAddressableModel> findOne​(String apiCategory, String model, Integer id)
      Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a number as identifier; Please see findOne(String, String, String) for findOne with string as identifier and see findOne(String, String, UUID) for uuid as identifier
      HALResource<RestAddressableModel> findOne​(String apiCategory, String model, String id)
      Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier; http:///api/{apiCategory}/{model}/{id} Example:
      HALResource<RestAddressableModel> findOne​(String apiCategory, String model, UUID uuid)
      Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a UUID as identifier; Please see findOne(String, String, Integer) for findOne with number as identifier and see findOne(String, String, String) for string as identifier
      org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String apiCategory, String model, Integer id, String rel, String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)  
      org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String apiCategory, String model, Integer id, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
      Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a number;
      org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String apiCategory, String model, String id, String rel, String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
      Called in GET, try to retrieve the requested linked resource.
      org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String apiCategory, String model, String id, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
      Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier;
      org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String apiCategory, String model, UUID uuid, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler)
      Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a UUID as identifier;
      org.springframework.hateoas.RepresentationModel listSearchMethods​(String apiCategory, String model)  
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, com.fasterxml.jackson.databind.JsonNode jsonNode)
      PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a number as identifier;
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID id, com.fasterxml.jackson.databind.JsonNode jsonNode)
      PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a UUID as identifier;
      <ID extends Serializable>
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
      patchInternal​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, ID id, com.fasterxml.jackson.databind.JsonNode jsonNode)
      Internal patch method
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> post​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent)
      Execute a POST request; curl -X POST -H "Content-Type:application/json" http:///api/{apiCategory}/{model} Example:
      <ID extends Serializable>
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
      postJsonInternal​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent)
      Internal method to execute POST with application/json MediaType;
      <ID extends Serializable>
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
      postUriListInternal​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model)
      Internal method to execute POST with text/uri-list MediaType;
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postWithUriListContentType​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model)
      Execute a POST request; curl -X POST -H "Content-Type:text/uri-list" http:///api/{apiCategory}/{model} Example:
      DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id)
      Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:text/uri-list" http:///api/{apiCategory}/{model}/{id} Example:
      DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, com.fasterxml.jackson.databind.JsonNode jsonNode)
      Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:application/json" http:///api/{apiCategory}/{model}/{id} Example:
      DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, String id, com.fasterxml.jackson.databind.JsonNode jsonNode)
      Execute a PUT request for an entity with id of type String and containing 32 hexadecimal digits.
      DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, com.fasterxml.jackson.databind.JsonNode jsonNode)
      Execute a PUT request for an entity with id of type UUID; curl -X PUT http:///api/{apiCategory}/{model}/{uuid} Example:
      <ID extends Serializable>
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
      upload​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, org.springframework.web.multipart.MultipartFile uploadfile)
      Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a number as identifier;
      <T extends RestAddressableModel>
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
      upload​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, List<org.springframework.web.multipart.MultipartFile> uploadfile)
      Upload a file against the collection resource endpoint.
      <ID extends Serializable>
      org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>
      upload​(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, org.springframework.web.multipart.MultipartFile uploadfile)
      Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a UUID as identifier;
    • Constructor Detail

      • RestResourceController

        public RestResourceController()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • findOne

        @RequestMapping(method=GET,
                        value="/{id:\\d+}")
        public HALResource<RestAddressableModel> findOne​(@PathVariable
                                                         String apiCategory,
                                                         @PathVariable
                                                         String model,
                                                         @PathVariable
                                                         Integer id)
        Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a number as identifier; Please see findOne(String, String, String) for findOne with string as identifier and see findOne(String, String, UUID) for uuid as identifier
        Parameters:
        apiCategory - category from request
        model - model from request
        id - Identifier from request
        Returns:
        single DSpaceResource
      • findOne

        @RequestMapping(method=GET,
                        value="/{id:^(?!^\\d+$)(?!^[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}$)[\\w+\\-\\.:]+$+}")
        public HALResource<RestAddressableModel> findOne​(@PathVariable
                                                         String apiCategory,
                                                         @PathVariable
                                                         String model,
                                                         @PathVariable
                                                         String id)
        Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier; http:///api/{apiCategory}/{model}/{id} Example:
         
            http://<dspace.server.url>/api/config/submissionsections/collection
         
         
        Please see findOne(String, String, Integer) for findOne with number as identifier and see findOne(String, String, UUID) for uuid as identifier
        Parameters:
        apiCategory - category from request
        model - model from request
        id - Identifier from request
        Returns:
        single DSpaceResource
      • findOne

        @RequestMapping(method=GET,
                        value="/{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 HALResource<RestAddressableModel> findOne​(@PathVariable
                                                         String apiCategory,
                                                         @PathVariable
                                                         String model,
                                                         @PathVariable
                                                         UUID uuid)
        Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a UUID as identifier; Please see findOne(String, String, Integer) for findOne with number as identifier and see findOne(String, String, String) for string as identifier
        Parameters:
        apiCategory - category from request
        model - model from request
        uuid - Identifier from request
        Returns:
        single DSpaceResource
      • findRel

        @RequestMapping(method=GET,
                        value="/{id:\\d+}/{rel}")
        public org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response,
                                                                       @PathVariable
                                                                       String apiCategory,
                                                                       @PathVariable
                                                                       String model,
                                                                       @PathVariable
                                                                       Integer id,
                                                                       @PathVariable
                                                                       String rel,
                                                                       org.springframework.data.domain.Pageable page,
                                                                       org.springframework.data.web.PagedResourcesAssembler assembler)
        Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a number;
        Parameters:
        request - current HTTPServletRequest
        apiCategory - category from request
        model - model from request
        id - identifier from request
        rel - relation from request
        page - pagination information
        assembler - PagedResourcesAssembler
        Returns:
        single RepresentationModel
      • findRel

        @RequestMapping(method=GET,
                        value="/{id:^(?!^\\d+$)(?!^[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}$)[\\w+\\-\\.:]+$+}/{rel}")
        public org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response,
                                                                       @PathVariable
                                                                       String apiCategory,
                                                                       @PathVariable
                                                                       String model,
                                                                       @PathVariable
                                                                       String id,
                                                                       @PathVariable
                                                                       String rel,
                                                                       org.springframework.data.domain.Pageable page,
                                                                       org.springframework.data.web.PagedResourcesAssembler assembler)
        Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier;
        Parameters:
        request - current HTTPServletRequest
        response - HTTPServletResponse
        apiCategory - category from request
        model - model from request
        id - identifier from request
        rel - relation from request
        page - pagination information
        assembler - PagedResourcesAssembler
        Returns:
        single RepresentationModel
      • findRel

        @RequestMapping(method=GET,
                        value="/{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}}/{rel}")
        public org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response,
                                                                       @PathVariable
                                                                       String apiCategory,
                                                                       @PathVariable
                                                                       String model,
                                                                       @PathVariable
                                                                       UUID uuid,
                                                                       @PathVariable
                                                                       String rel,
                                                                       org.springframework.data.domain.Pageable page,
                                                                       org.springframework.data.web.PagedResourcesAssembler assembler)
        Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a UUID as identifier;
        Parameters:
        request -
        apiCategory -
        model -
        uuid -
        rel -
        page -
        assembler -
        Returns:
      • findRel

        @RequestMapping(method=GET,
                        value="/{id:^(?!^\\d+$)(?!^[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}$)[\\w+\\-\\.:]+$+}/{rel}/{relid}")
        public org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response,
                                                                       @PathVariable
                                                                       String apiCategory,
                                                                       @PathVariable
                                                                       String model,
                                                                       @PathVariable
                                                                       String id,
                                                                       @PathVariable
                                                                       String rel,
                                                                       @PathVariable
                                                                       String relid,
                                                                       org.springframework.data.domain.Pageable page,
                                                                       org.springframework.data.web.PagedResourcesAssembler assembler)
                                                                throws Throwable
        Called in GET, try to retrieve the requested linked resource. Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier; http:///api/{apiCategory}/{model}/{id}/{rel}/{relid} Example:
         
              http://<dspace.server.url>/api/integration/authorities/SRJournalTitle/entryValues/1479-9995
         
         
        Example:
         
              http://<dspace.server.url>/api/integration/authorities/srsc/entries/VR110111
         
         
        Parameters:
        request -
        apiCategory -
        model -
        id -
        rel -
        relid -
        page -
        assembler -
        Returns:
        Throws:
        Throwable
      • findRel

        @RequestMapping(method=GET,
                        value="/{id:\\d+}/{rel}/{relid}")
        public org.springframework.hateoas.RepresentationModel findRel​(javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response,
                                                                       @PathVariable
                                                                       String apiCategory,
                                                                       @PathVariable
                                                                       String model,
                                                                       @PathVariable
                                                                       Integer id,
                                                                       @PathVariable
                                                                       String rel,
                                                                       @PathVariable
                                                                       String relid,
                                                                       org.springframework.data.domain.Pageable page,
                                                                       org.springframework.data.web.PagedResourcesAssembler assembler)
                                                                throws Throwable
        Throws:
        Throwable
      • post

        @RequestMapping(method=POST,
                        consumes={"application/json","application/hal+json"})
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> post​(javax.servlet.http.HttpServletRequest request,
                                                                                                                @PathVariable
                                                                                                                String apiCategory,
                                                                                                                @PathVariable
                                                                                                                String model,
                                                                                                                @RequestParam(required=false)
                                                                                                                String parent)
                                                                                                         throws org.springframework.web.HttpRequestMethodNotSupportedException
        Execute a POST request; curl -X POST -H "Content-Type:application/json" http:///api/{apiCategory}/{model} Example:
         
              curl -X POST -H "Content-Type:application/json" http://<dspace.server.url>/api/submission/workspaceitems
         
         
        Parameters:
        request - The relevant request
        apiCategory - The apiCategory to be used
        model - The model to be used
        parent - Optional parent identifier
        Returns:
        The relevant ResponseEntity for this request
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrong
      • postWithUriListContentType

        @RequestMapping(method=POST,
                        consumes="text/uri-list")
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postWithUriListContentType​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                      @PathVariable
                                                                                                                                      String apiCategory,
                                                                                                                                      @PathVariable
                                                                                                                                      String model)
                                                                                                                               throws org.springframework.web.HttpRequestMethodNotSupportedException
        Execute a POST request; curl -X POST -H "Content-Type:text/uri-list" http:///api/{apiCategory}/{model} Example:
         
              curl -X POST -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/submission/workspaceitems
         
         
        Parameters:
        request - The relevant request
        apiCategory - The apiCategory to be used
        model - The model to be used
        Returns:
        The relevant ResponseEntity for this request
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrong
      • postJsonInternal

        public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postJsonInternal​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                                      String apiCategory,
                                                                                                                                                      String model,
                                                                                                                                                      String parent)
                                                                                                                                               throws org.springframework.web.HttpRequestMethodNotSupportedException
        Internal method to execute POST with application/json MediaType;
        Parameters:
        request - The relevant request
        apiCategory - The apiCategory to be used
        model - The model to be used
        parent - The parent object id (optional)
        Returns:
        The relevant ResponseEntity for this request
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrong
      • postUriListInternal

        public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postUriListInternal​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                                         String apiCategory,
                                                                                                                                                         String model)
                                                                                                                                                  throws org.springframework.web.HttpRequestMethodNotSupportedException
        Internal method to execute POST with text/uri-list MediaType;
        Parameters:
        request - The relevant request
        apiCategory - The apiCategory to be used
        model - The model to be used
        Returns:
        The relevant ResponseEntity for this request
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException - If something goes wrong
      • action

        @RequestMapping(method=POST,
                        value="/{id:\\d+}",
                        headers="content-type=application/x-www-form-urlencoded")
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> action​(javax.servlet.http.HttpServletRequest request,
                                                                                                                  @PathVariable
                                                                                                                  String apiCategory,
                                                                                                                  @PathVariable
                                                                                                                  String model,
                                                                                                                  @PathVariable
                                                                                                                  Integer id)
                                                                                                           throws org.springframework.web.HttpRequestMethodNotSupportedException,
                                                                                                                  SQLException,
                                                                                                                  IOException
        Called in POST, with a x-www-form-urlencoded, execute an action on a resource Note that the regular expression in the request mapping accept a number as identifier;
        Parameters:
        request -
        apiCategory -
        model -
        id -
        Returns:
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
        IOException
        SQLException
      • upload

        @RequestMapping(method=POST,
                        value="/{id:\\d+}",
                        headers="content-type=multipart/form-data")
        public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                            @PathVariable
                                                                                                                                            String apiCategory,
                                                                                                                                            @PathVariable
                                                                                                                                            String model,
                                                                                                                                            @PathVariable
                                                                                                                                            Integer id,
                                                                                                                                            @RequestParam("file")
                                                                                                                                            org.springframework.web.multipart.MultipartFile uploadfile)
                                                                                                                                     throws org.springframework.web.HttpRequestMethodNotSupportedException
        Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a number as identifier;
        Parameters:
        request - the http request
        apiCategory - the api category
        model - the rest model that identify the REST resource collection
        id - the id of the specific rest resource
        uploadfile - the file to upload
        Returns:
        the created resource
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • upload

        @RequestMapping(method=POST,
                        value="/{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}}",
                        headers="content-type=multipart/form-data")
        public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                            @PathVariable
                                                                                                                                            String apiCategory,
                                                                                                                                            @PathVariable
                                                                                                                                            String model,
                                                                                                                                            @PathVariable
                                                                                                                                            UUID uuid,
                                                                                                                                            @RequestParam("file")
                                                                                                                                            org.springframework.web.multipart.MultipartFile uploadfile)
                                                                                                                                     throws org.springframework.web.HttpRequestMethodNotSupportedException
        Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a UUID as identifier;
        Parameters:
        request - the http request
        apiCategory - the api category
        model - the rest model that identify the REST resource collection
        uuid - the uuid of the specific rest resource
        uploadfile - the file to upload
        Returns:
        the created resource
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • upload

        @RequestMapping(method=POST,
                        headers="content-type=multipart/form-data")
        public <T extends RestAddressableModel> org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                                   @PathVariable
                                                                                                                                                   String apiCategory,
                                                                                                                                                   @PathVariable
                                                                                                                                                   String model,
                                                                                                                                                   @RequestParam("file")
                                                                                                                                                   List<org.springframework.web.multipart.MultipartFile> uploadfile)
                                                                                                                                            throws SQLException,
                                                                                                                                                   FileNotFoundException,
                                                                                                                                                   IOException,
                                                                                                                                                   AuthorizeException
        Upload a file against the collection resource endpoint. This is typically used for bulk creation of resources such for instance multiple workspaceitems from a CSV or bibliographic file
        Parameters:
        request - the http request
        apiCategory - the api category
        model - the rest model that identify the REST resource collection
        uploadfile - the bulk file
        Returns:
        the list of generated resources
        Throws:
        SQLException
        FileNotFoundException
        IOException
        AuthorizeException
      • patch

        @RequestMapping(method=PATCH,
                        value="/{id:\\d+}")
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch​(javax.servlet.http.HttpServletRequest request,
                                                                                                                 @PathVariable
                                                                                                                 String apiCategory,
                                                                                                                 @PathVariable
                                                                                                                 String model,
                                                                                                                 @PathVariable
                                                                                                                 Integer id,
                                                                                                                 @RequestBody(required=true)
                                                                                                                 com.fasterxml.jackson.databind.JsonNode jsonNode)
        PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a number as identifier;
        Parameters:
        request -
        apiCategory -
        model -
        id -
        jsonNode -
        Returns:
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • patch

        @RequestMapping(method=PATCH,
                        value="/{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 org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch​(javax.servlet.http.HttpServletRequest request,
                                                                                                                 @PathVariable
                                                                                                                 String apiCategory,
                                                                                                                 @PathVariable
                                                                                                                 String model,
                                                                                                                 @PathVariable(name="uuid")
                                                                                                                 UUID id,
                                                                                                                 @RequestBody(required=true)
                                                                                                                 com.fasterxml.jackson.databind.JsonNode jsonNode)
        PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a UUID as identifier;
        Parameters:
        request -
        apiCategory -
        model -
        id -
        jsonNode -
        Returns:
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • patchInternal

        public <ID extends Serializable> org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patchInternal​(javax.servlet.http.HttpServletRequest request,
                                                                                                                                                   String apiCategory,
                                                                                                                                                   String model,
                                                                                                                                                   ID id,
                                                                                                                                                   com.fasterxml.jackson.databind.JsonNode jsonNode)
        Internal patch method
        Parameters:
        request -
        apiCategory -
        model -
        id -
        jsonNode -
        Returns:
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • findAll

        @RequestMapping(method=GET)
        public <T extends RestAddressableModel> org.springframework.hateoas.PagedModel<DSpaceResource<T>> findAll​(@PathVariable
                                                                                                                  String apiCategory,
                                                                                                                  @PathVariable
                                                                                                                  String model,
                                                                                                                  org.springframework.data.domain.Pageable page,
                                                                                                                  org.springframework.data.web.PagedResourcesAssembler assembler,
                                                                                                                  javax.servlet.http.HttpServletResponse response,
                                                                                                                  @RequestParam
                                                                                                                  org.springframework.util.MultiValueMap<String,​Object> parameters)
        Find all
        Parameters:
        apiCategory -
        model -
        page -
        assembler -
        Returns:
      • listSearchMethods

        @RequestMapping(method=GET,
                        value="/search")
        public org.springframework.hateoas.RepresentationModel listSearchMethods​(@PathVariable
                                                                                 String apiCategory,
                                                                                 @PathVariable
                                                                                 String model)
      • delete

        @RequestMapping(method=DELETE,
                        value="/{id:\\d+}")
        public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete​(javax.servlet.http.HttpServletRequest request,
                                                                                                                  @PathVariable
                                                                                                                  String apiCategory,
                                                                                                                  @PathVariable
                                                                                                                  String model,
                                                                                                                  @PathVariable
                                                                                                                  Integer id)
                                                                                                           throws org.springframework.web.HttpRequestMethodNotSupportedException
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • delete

        @RequestMapping(method=DELETE,
                        value="/{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 org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete​(javax.servlet.http.HttpServletRequest request,
                                                                                                                  @PathVariable
                                                                                                                  String apiCategory,
                                                                                                                  @PathVariable
                                                                                                                  String model,
                                                                                                                  @PathVariable
                                                                                                                  UUID uuid)
                                                                                                           throws org.springframework.web.HttpRequestMethodNotSupportedException
        Throws:
        org.springframework.web.HttpRequestMethodNotSupportedException
      • put

        @RequestMapping(method=PUT,
                        value="/{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 DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request,
                                                        @PathVariable
                                                        String apiCategory,
                                                        @PathVariable
                                                        String model,
                                                        @PathVariable
                                                        UUID uuid,
                                                        @RequestBody
                                                        com.fasterxml.jackson.databind.JsonNode jsonNode)
        Execute a PUT request for an entity with id of type UUID; curl -X PUT http:///api/{apiCategory}/{model}/{uuid} Example:
         
              curl -X PUT http://<dspace.server.url>/api/core/collection/8b632938-77c2-487c-81f0-e804f63e68e6
         
         
        Parameters:
        request - the http request
        apiCategory - the API category e.g. "core"
        model - the DSpace model e.g. "collection"
        uuid - the ID of the target REST object
        jsonNode - the part of the request body representing the updated rest object
        Returns:
        the relevant REST resource
      • put

        @RequestMapping(method=PUT,
                        value="/{id:\\d+}",
                        consumes={"application/json","application/hal+json"})
        public DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request,
                                                        @PathVariable
                                                        String apiCategory,
                                                        @PathVariable
                                                        String model,
                                                        @PathVariable
                                                        Integer id,
                                                        @RequestBody(required=true)
                                                        com.fasterxml.jackson.databind.JsonNode jsonNode)
        Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:application/json" http:///api/{apiCategory}/{model}/{id} Example:
         
              curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/core/metadatafield/1
         
         
        Parameters:
        request - the http request
        apiCategory - the API category e.g. "api"
        model - the DSpace model e.g. "collection"
        id - the ID of the target REST object
        jsonNode - the part of the request body representing the updated rest object
        Returns:
        the relevant REST resource
      • put

        @RequestMapping(method=PUT,
                        value="/{id:\\d+}",
                        consumes="text/uri-list")
        public DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request,
                                                        @PathVariable
                                                        String apiCategory,
                                                        @PathVariable
                                                        String model,
                                                        @PathVariable
                                                        Integer id)
                                                 throws IOException
        Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:text/uri-list" http:///api/{apiCategory}/{model}/{id} Example:
         
              curl -X PUT -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/core/metadatafield/1
         
         
        Parameters:
        request - the http request
        apiCategory - the API category e.g. "api"
        model - the DSpace model e.g. "collection"
        id - the ID of the target REST object
        Returns:
        the relevant REST resource
        Throws:
        IOException
      • put

        @RequestMapping(method=PUT,
                        value="/{id:[0-9a-fA-F]{32}}",
                        consumes={"application/json","application/hal+json"})
        public DSpaceResource<RestAddressableModel> put​(javax.servlet.http.HttpServletRequest request,
                                                        @PathVariable
                                                        String apiCategory,
                                                        @PathVariable
                                                        String model,
                                                        @PathVariable
                                                        String id,
                                                        @RequestBody(required=true)
                                                        com.fasterxml.jackson.databind.JsonNode jsonNode)
        Execute a PUT request for an entity with id of type String and containing 32 hexadecimal digits.

        curl -X PUT -H "Content-Type:application/json" http:///api/{apiCategory}/{model}/{id}

        Example:

         
              curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/core/metadatafield/d41d8cd98f00b204e9800998ecf8427e
         
         
        Parameters:
        request - the http request
        apiCategory - the API category e.g. "api"
        model - the DSpace model e.g. "collection"
        id - the ID of the target REST object
        jsonNode - the part of the request body representing the updated rest object
        Returns:
        the relevant REST resource