Interface EsPermissionRequestRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<DatadisPermissionRequest,String>, org.springframework.data.jpa.repository.JpaRepository<DatadisPermissionRequest,String>, org.springframework.data.repository.ListCrudRepository<DatadisPermissionRequest,String>, org.springframework.data.repository.ListPagingAndSortingRepository<DatadisPermissionRequest,String>, org.springframework.data.repository.PagingAndSortingRepository<DatadisPermissionRequest,String>, PermissionRequestRepository<EsPermissionRequest>, org.springframework.data.repository.query.QueryByExampleExecutor<DatadisPermissionRequest>, org.springframework.data.repository.Repository<DatadisPermissionRequest,String>, StalePermissionRequestRepository<DatadisPermissionRequest>, StatusPermissionRequestRepository<EsPermissionRequest>

@Repository public interface EsPermissionRequestRepository extends org.springframework.data.jpa.repository.JpaRepository<DatadisPermissionRequest,String>, StatusPermissionRequestRepository<EsPermissionRequest>, StalePermissionRequestRepository<DatadisPermissionRequest>, PermissionRequestRepository<EsPermissionRequest>
  • Method Summary

    Modifier and Type
    Method
    Description
     
    findStalePermissionRequests(int timeoutDuration)
    Finds all permission request that are older than the stalenessDuration and have either the status VALIDATED or SENT_TO_PERMISSION_ADMINISTRATOR.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface energy.eddie.api.agnostic.process.model.persistence.PermissionRequestRepository

    findByPermissionId, getByPermissionId, save

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByStatus

      Specified by:
      findByStatus in interface StatusPermissionRequestRepository<EsPermissionRequest>
    • findStalePermissionRequests

      @Query(value="SELECT permission_id, connection_id, nif, metering_point_id, permission_start, permission_end, data_need_id, granularity, allowed_granularity, distributor_code, point_type, latest_meter_reading, status, error_message, production_support, created FROM es_datadis.datadis_permission_request WHERE status = \'SENT_TO_PERMISSION_ADMINISTRATOR\' AND created <= NOW() - :hours * INTERVAL \'1 hour\'", nativeQuery=true) List<DatadisPermissionRequest> findStalePermissionRequests(@Param("hours") int timeoutDuration)
      Description copied from interface: StalePermissionRequestRepository
      Finds all permission request that are older than the stalenessDuration and have either the status VALIDATED or SENT_TO_PERMISSION_ADMINISTRATOR.
      Specified by:
      findStalePermissionRequests in interface StalePermissionRequestRepository<DatadisPermissionRequest>
      Parameters:
      timeoutDuration - the max amount of hours the permission request has to be created ago to not be considered stale.
      Returns:
      all permission request created now - stalenessDuration hours ago, with above specified status.