Class SystemWideAlertRestRepository

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

@Component("system.systemwidealert") public class SystemWideAlertRestRepository extends DSpaceRestRepository<SystemWideAlertRest,Integer>
The repository for the SystemWideAlert workload
  • Constructor Details

    • SystemWideAlertRestRepository

      public SystemWideAlertRestRepository()
  • Method Details

    • createAndReturn

      @PreAuthorize("hasAuthority(\'ADMIN\')") protected SystemWideAlertRest createAndReturn(Context context) throws SQLException, AuthorizeException
      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<SystemWideAlertRest,Integer>
      Parameters:
      context - the dspace context
      Returns:
      the created REST object
      Throws:
      SQLException
      AuthorizeException
    • findOne

      @PreAuthorize("permitAll()") public SystemWideAlertRest findOne(Context context, Integer id)
      This method will retrieve the system-wide alert for the provided ID However, only admins will be able to retrieve the inactive alerts. Non-admin users will only be able to retrieve active alerts. This is necessary also to be able to return the results through the search endpoint, since the PreAuthorization will be checked when converting the results to a list. Therefore, closing this endpoint fully off will prevent results from being displayed in the search endpoint
      Specified by:
      findOne in class DSpaceRestRepository<SystemWideAlertRest,Integer>
      Parameters:
      context - the dspace context
      id - the rest object id
      Returns:
      retrieve the system-wide alert for the provided ID
    • findAll

      @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.data.domain.Page<SystemWideAlertRest> 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<SystemWideAlertRest,Integer>
      Parameters:
      context - the dspace context
      pageable - object embedding the requested pagination info
      Returns:
    • put

      @PreAuthorize("hasAuthority(\'ADMIN\')") protected SystemWideAlertRest 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<SystemWideAlertRest,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
    • findAllActive

      @PreAuthorize("permitAll()") public org.springframework.data.domain.Page<SystemWideAlertRest> findAllActive(org.springframework.data.domain.Pageable pageable)
      Search method to retrieve all active system-wide alerts
      Parameters:
      pageable - The page object
      Returns:
      all active system-wide alerts for the provided page
    • getDomainClass

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