Interface DeviceRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<DeviceEntity,Long>, org.springframework.data.jpa.repository.JpaRepository<DeviceEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<DeviceEntity>, org.springframework.data.repository.ListCrudRepository<DeviceEntity,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<DeviceEntity,Long>, org.springframework.data.repository.PagingAndSortingRepository<DeviceEntity,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<DeviceEntity>, org.springframework.data.repository.Repository<DeviceEntity,Long>

@Repository public interface DeviceRepository extends org.springframework.data.jpa.repository.JpaRepository<DeviceEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<DeviceEntity>
Stores browser recognition and notices, with every account-facing lookup scoped by user ID.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T extends Object>
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    claimCodeAttempt(int userId, long id, String expectedHash, Instant expectedExpires, Instant now, boolean unblock, int maxAttempts)
    Claims one attempt only while the same code remains active and below its attempt limit.
    default long
    Deletes expired recognition records using the repository's bulk delete operation.
    org.springframework.data.domain.Page<DeviceEntity>
    findAllByUserId(int userId, org.springframework.data.domain.Pageable pageable)
     
     
    findByUserIdAndId(int userId, long id)
     
    findByUserIdAndIdIn(int userId, Set<Long> ids)
     
    findByUserIdAndTokenHash(int userId, String tokenHash)
     

    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.jpa.repository.JpaSpecificationExecutor

    count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, update

    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 org.springframework.data.repository.query.QueryByExampleExecutor

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

    • findByUserIdAndTokenHash

      Optional<DeviceEntity> findByUserIdAndTokenHash(int userId, String tokenHash)
    • findByUserIdAndId

      Optional<DeviceEntity> findByUserIdAndId(int userId, long id)
    • findByUserIdAndIdIn

      List<DeviceEntity> findByUserIdAndIdIn(int userId, Set<Long> ids)
    • findAllByUserId

      org.springframework.data.domain.Page<DeviceEntity> findAllByUserId(int userId, org.springframework.data.domain.Pageable pageable)
    • findByUserIdAndConfirmedAtIsNullAndReportedAtIsNullAndCreateDateAfterOrderByCreateDateDescIdAsc

      List<DeviceEntity> findByUserIdAndConfirmedAtIsNullAndReportedAtIsNullAndCreateDateAfterOrderByCreateDateDescIdAsc(int userId, Instant cutoff)
    • claimCodeAttempt

      @Transactional(transactionManager="webjet2022TransactionManager") @Modifying(clearAutomatically=true) @Query("UPDATE DeviceEntity d SET d.codeAttempts = d.codeAttempts + 1\nWHERE d.userId = :userId AND d.id = :id\n AND d.codeHash = :expectedHash AND d.codeExpires = :expectedExpires\n AND d.codeExpires > :now AND d.codeAttempts < :maxAttempts\n AND d.confirmedAt IS NULL\n AND ((:unblock = false AND d.reportedAt IS NULL)\n OR (:unblock = true AND d.reportedAt IS NOT NULL))\n") int claimCodeAttempt(@Param("userId") int userId, @Param("id") long id, @Param("expectedHash") String expectedHash, @Param("expectedExpires") Instant expectedExpires, @Param("now") Instant now, @Param("unblock") boolean unblock, @Param("maxAttempts") int maxAttempts)
      Claims one attempt only while the same code remains active and below its attempt limit.
      Returns:
      1 when the attempt was counted, otherwise 0
    • deleteExpired

      default long deleteExpired(Instant cutoff)
      Deletes expired recognition records using the repository's bulk delete operation.