Class MetadataFieldRestRepository

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.data.repository.CrudRepository<MetadataFieldRest,Integer>, org.springframework.data.repository.PagingAndSortingRepository<MetadataFieldRest,Integer>, org.springframework.data.repository.Repository<MetadataFieldRest,Integer>

@Component("core.metadatafield") public class MetadataFieldRestRepository extends DSpaceRestRepository<MetadataFieldRest,Integer>
This is the repository responsible to manage MetadataField Rest object
Author:
Andrea Bollini (andrea.bollini at 4science.it)
  • Constructor Details

    • MetadataFieldRestRepository

      public MetadataFieldRestRepository()
  • Method Details

    • findOne

      @PreAuthorize("permitAll()") public MetadataFieldRest findOne(Context context, Integer id)
      Description copied from class: DSpaceRestRepository
      Method to implement to support retrieval of a specific REST object instance
      Specified by:
      findOne in class DSpaceRestRepository<MetadataFieldRest,Integer>
      Parameters:
      context - the dspace context
      id - the rest object id
      Returns:
      the REST object identified by its ID
    • findAll

      public org.springframework.data.domain.Page<MetadataFieldRest> findAll(Context context, org.springframework.data.domain.Pageable pageable)
      Description copied from class: DSpaceRestRepository
      Method to implement to support scroll of entity instances from the collection resource endpoint
      Specified by:
      findAll in class DSpaceRestRepository<MetadataFieldRest,Integer>
      Parameters:
      context - the dspace context
      pageable - object embedding the requested pagination info
      Returns:
    • findBySchema

      public org.springframework.data.domain.Page<MetadataFieldRest> findBySchema(String schemaName, org.springframework.data.domain.Pageable pageable)
    • findByFieldName

      public org.springframework.data.domain.Page<MetadataFieldRest> findByFieldName(String schemaName, String elementName, String qualifierName, String query, String exactName, org.springframework.data.domain.Pageable pageable) throws SQLException
      Endpoint for the search in the MetadataField objects by various different params representing the field name. Query being a partial
      Parameters:
      schemaName - an exact match of the prefix of the metadata schema (e.g. "dc", "dcterms", "eperson")
      elementName - an exact match of the field's element (e.g. "contributor", "title")
      qualifierName - an exact match of the field's qualifier (e.g. "author", "alternative")
      query - part of the fully qualified field, should start with the start of the schema, element or qualifier (e.g. "dc.ti", "contributor", "auth", "contributor.ot")
      exactName - exactName, The exact fully qualified field, should use the syntax schema.element .qualifier or schema.element if no qualifier exists (e.g. "dc.title", "dc.contributor .author"). It will only return one value if there's an exact match
      pageable - the pagination options
      Returns:
      List of MetadataFieldRest objects representing all MetadataField objects that match the given params
      Throws:
      SQLException
    • getDomainClass

      public Class<MetadataFieldRest> getDomainClass()
      Description copied from class: DSpaceRestRepository
      The REST model supported by the repository
      Specified by:
      getDomainClass in class DSpaceRestRepository<MetadataFieldRest,Integer>
    • createAndReturn

      @PreAuthorize("hasAuthority(\'ADMIN\')") protected MetadataFieldRest createAndReturn(Context context) throws AuthorizeException, SQLException
      Description copied from class: DSpaceRestRepository
      Method to implement to support the creation of a new instance. Usually require to retrieve the http request from the thread bound attribute
      Overrides:
      createAndReturn in class DSpaceRestRepository<MetadataFieldRest,Integer>
      Parameters:
      context - the dspace context
      Returns:
      the created REST object
      Throws:
      AuthorizeException
      SQLException
    • delete

      @PreAuthorize("hasAuthority(\'ADMIN\')") protected void delete(Context context, Integer id) throws AuthorizeException
      Description copied from class: DSpaceRestRepository
      Method to implement to support delete of a single object instance
      Overrides:
      delete in class DSpaceRestRepository<MetadataFieldRest,Integer>
      Parameters:
      context - the dspace context
      id - the id of the rest object to delete
      Throws:
      AuthorizeException
    • put

      @PreAuthorize("hasAuthority(\'ADMIN\')") protected MetadataFieldRest put(Context context, javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, com.fasterxml.jackson.databind.JsonNode jsonNode) throws SQLException, AuthorizeException
      Description copied from class: DSpaceRestRepository
      Implement this method in the subclass to support updating a REST object.
      Overrides:
      put in class DSpaceRestRepository<MetadataFieldRest,Integer>
      Parameters:
      context - the dspace context
      apiCategory - the API category e.g. "api"
      model - the DSpace model e.g. "metadatafield"
      id - the ID of the target REST object
      jsonNode - the part of the request body representing the updated rest object
      Returns:
      the updated REST object
      Throws:
      SQLException - when the database returns an error
      AuthorizeException - if the context user is not authorized to perform this operation