Interface RoomRepository

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

@Table(name="rooms") public interface RoomRepository extends org.springframework.data.jpa.repository.JpaRepository<Room,Long>
Fetches/saves Rooms from/to the database table rooms.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(@NonNull Room room)
    Permanently removes the given Room from the database.
    boolean
    existsByNumber(@NonNull String number)
    Checks whether a Room with the given Room.number is present in the database.
    @NonNull org.springframework.data.domain.Page<Room>
    findAll(@NonNull org.springframework.data.domain.Pageable pageable)
    A subset of all Rooms in the database table according to the given Pageable.
    Fetches all room numbers present on any Rooms in the database.
    @NonNull org.springframework.data.domain.Page<Room>
    findAtLeastPartiallyAccessibleRooms(@NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that have Accessibility.FULL or Accessibility.PARTIAL as the Room.accessibility.
    @NonNull org.springframework.data.domain.Page<Room>
    findAtLeastPartiallyAccessibleRoomsByFloor(int floor, @NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor and have Accessibility.FULL or Accessibility.PARTIAL as the Room.accessibility.
    @NonNull org.springframework.data.domain.Page<Room>
    findByFloor(int floor, @NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor.
    @NonNull org.springframework.data.domain.Page<Room>
    findFullyAccessibleRooms(@NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that have Accessibility.FULL as the Room.accessibility.
    @NonNull org.springframework.data.domain.Page<Room>
    findFullyAccessibleRoomsByFloor(int floor, @NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor and have Accessibility.FULL as the Room.accessibility.
    @NonNull org.springframework.data.domain.Page<Room>
    findInaccessibleRooms(@NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that have Accessibility.NONE as the Room.accessibility (or null).
    @NonNull org.springframework.data.domain.Page<Room>
    findInaccessibleRoomsByFloor(int floor, @NonNull org.springframework.data.domain.Pageable pageable)
    A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor and have Accessibility.NONE as the Room.accessibility.
    @NonNull Optional<Room>
    findRoomByNumber(@NonNull String number)
    Fetches the Room with the specified Room.number from the database table.
    @NonNull Optional<Long>
    findRoomIdByNumber(@NonNull String number)
    Fetches the Room.id of the Room with the given Room.number from the database.

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

    count, 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.query.QueryByExampleExecutor

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

    • findAll

      @NonNull @NonNull org.springframework.data.domain.Page<Room> findAll(@NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset of all Rooms in the database table according to the given Pageable.
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<Room,Long>
      Parameters:
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      All Rooms, but only the specified subset.
    • findByFloor

      @NonNull @NonNull org.springframework.data.domain.Page<Room> findByFloor(int floor, @NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor.
      Parameters:
      floor - The floor whose Rooms are looked for.
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findFullyAccessibleRooms

      @Query("select r from Room r where r.accessibility = 'FULL'") @NonNull @NonNull org.springframework.data.domain.Page<Room> findFullyAccessibleRooms(@NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that have Accessibility.FULL as the Room.accessibility.
      Parameters:
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findFullyAccessibleRoomsByFloor

      @Query("select r from Room r where r.floor = :floor and r.accessibility = 'FULL'") @NonNull @NonNull org.springframework.data.domain.Page<Room> findFullyAccessibleRoomsByFloor(int floor, @NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor and have Accessibility.FULL as the Room.accessibility.
      Parameters:
      floor - The floor whose Rooms are looked for.
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findAtLeastPartiallyAccessibleRooms

      @Query("select r from Room r where r.accessibility = 'FULL' or r.accessibility = 'PARTIAL'") @NonNull @NonNull org.springframework.data.domain.Page<Room> findAtLeastPartiallyAccessibleRooms(@NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that have Accessibility.FULL or Accessibility.PARTIAL as the Room.accessibility.
      Parameters:
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findAtLeastPartiallyAccessibleRoomsByFloor

      @Query("select r from Room r where r.floor = :floor and (r.accessibility = 'FULL' or r.accessibility = 'PARTIAL')") @NonNull @NonNull org.springframework.data.domain.Page<Room> findAtLeastPartiallyAccessibleRoomsByFloor(int floor, @NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor and have Accessibility.FULL or Accessibility.PARTIAL as the Room.accessibility.
      Parameters:
      floor - The floor whose Rooms are looked for.
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findInaccessibleRooms

      @Query("select r from Room r where r.accessibility is null or r.accessibility = 'NONE'") @NonNull @NonNull org.springframework.data.domain.Page<Room> findInaccessibleRooms(@NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that have Accessibility.NONE as the Room.accessibility (or null).
      Parameters:
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findInaccessibleRoomsByFloor

      @Query("select r from Room r where r.floor = :floor and (r.accessibility is null or r.accessibility = 'NONE')") @NonNull @NonNull org.springframework.data.domain.Page<Room> findInaccessibleRoomsByFloor(int floor, @NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset – according to the given Pageable – of those Rooms in the database table that are located on the specified floor and have Accessibility.NONE as the Room.accessibility.
      Parameters:
      floor - The floor whose Rooms are looked for.
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      The Rooms on the given floor, but only the specified subset.
    • findRoomByNumber

      @NonNull @NonNull Optional<Room> findRoomByNumber(@NonNull @NonNull String number)
      Fetches the Room with the specified Room.number from the database table.
      Parameters:
      number - The number of the room that is being looked for.
      Returns:
      The Room matching the given number, if it exists.
    • findAllRoomNumbers

      @Query("select r.number from Room r") @NonNull @NonNull LinkedHashSet<String> findAllRoomNumbers()
      Fetches all room numbers present on any Rooms in the database.
      Returns:
      All room numbers in the database.
    • delete

      void delete(@NonNull @NonNull Room room)
      Permanently removes the given Room from the database.
      Specified by:
      delete in interface org.springframework.data.repository.CrudRepository<Room,Long>
      Parameters:
      room - The Room that shall no longer be available for booking.
    • existsByNumber

      boolean existsByNumber(@NonNull @NonNull String number)
      Checks whether a Room with the given Room.number is present in the database.
      Parameters:
      number - The Room number to check.
      Returns:
      True if a Room with the number exists, false otherwise.
    • findRoomIdByNumber

      @Query("select r.id from Room r where r.number = :number") @NonNull @NonNull Optional<Long> findRoomIdByNumber(@NonNull @NonNull String number)
      Fetches the Room.id of the Room with the given Room.number from the database.
      Parameters:
      number - The number of the Room whose ID shall be returned.
      Returns:
      The ID of the Room with the given number.