Interface ReservationRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Reservation, Long>, org.springframework.data.jpa.repository.JpaRepository<Reservation, Long>, org.springframework.data.repository.ListCrudRepository<Reservation, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Reservation, Long>, org.springframework.data.repository.PagingAndSortingRepository<Reservation, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Reservation>, org.springframework.data.repository.Repository<Reservation, Long>
reservations.-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAllById(@NonNull Iterable<@NonNull ? extends Long> ids) voiddeleteById(@NonNull Long id) booleanexistsByApplicantAndId(@NonNull Actor applicant, @NonNull Long id) booleanexistsById(@NonNull Long id) @NonNull org.springframework.data.domain.Page<Reservation> findAll(@NonNull org.springframework.data.domain.Pageable pageable) A subset of all Reservations in the database table according to the givenPageable.@NonNull org.springframework.data.domain.Page<Reservation> findCurrentReservationsByApplicant(@NonNull Actor applicant, @NonNull LocalDateTime now, @NonNull org.springframework.data.domain.Pageable pageable) Fetches all Reservations from the database placed by the givenActorwhere theReservation.endDateis in the future.@NonNull Optional<Reservation> findReservationByRoomForDate(@NonNull Long roomId, @NonNull LocalDateTime date) Fetches theReservation– for the givenRoom– that starts before and ends after the givenLocalDateTimefrom the database.@NonNull LinkedHashSet<Reservation> findReservationsAfterDateForApplicant(@NonNull Long applicantId, @NonNull LocalDateTime date) Fetches all Reservations from the database placed for theReservation.applicantwith the givenActor.idand starting or ending after the given date.@NonNull Set<Reservation> findReservationsBetweenDates(@NonNull LocalDateTime startDate, @NonNull LocalDateTime endDate) Fetches all Reservations from the database that@NonNull Set<Reservation> findReservationsBetweenDatesForApplicant(@NonNull Long applicantId, @NonNull LocalDateTime startDate, @NonNull LocalDateTime endDate) Fetches all Reservations from the database placed for theReservation.applicantwith the givenActor.idand@NonNull LinkedHashSet<Reservation> findReservationsBetweenDatesForRoom(@NonNull Long roomId, @NonNull LocalDateTime startDate, @NonNull LocalDateTime endDate) @NonNull LinkedHashSet<Reservation> findReservationsByApplicant(@NonNull Actor applicant) Fetches all Reservations from the database placed by the givenActor.@NonNull org.springframework.data.domain.Page<Reservation> findReservationsByApplicantUserName(@NonNull String userName, @NonNull org.springframework.data.domain.Pageable pageable) @NonNull LinkedHashSet<Reservation> findReservationsByRoomId(@NonNull Long roomId) @NonNull LinkedHashSet<SeatReservation> findSeatReservationsBetweenDatesForRoom(@NonNull Long roomId, @NonNull LocalDateTime startDate, @NonNull LocalDateTime endDate) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findAll
@NonNull @NonNull org.springframework.data.domain.Page<Reservation> findAll(@NonNull @NonNull org.springframework.data.domain.Pageable pageable) A subset of all Reservations in the database table according to the givenPageable.- Specified by:
findAllin interfaceorg.springframework.data.repository.PagingAndSortingRepository<Reservation, Long>- Parameters:
pageable- The pagination information specifying which page of Reservations shall be returned.- Returns:
- All Reservations, but only the specified subset.
-
findReservationsByRoomId
@NonNull @NonNull LinkedHashSet<Reservation> findReservationsByRoomId(@NonNull @Param("roomId") @NonNull Long roomId) - Parameters:
roomId- The ID of the Room whose Reservations shall be looked for.- Returns:
- All Reservations for the specified Room.
-
findReservationsByApplicant
@NonNull @NonNull LinkedHashSet<Reservation> findReservationsByApplicant(@NonNull @NonNull Actor applicant) Fetches all Reservations from the database placed by the givenActor.- Parameters:
applicant- The user whose Reservations shall be looked for.- Returns:
- All Reservations of the specified user.
-
findCurrentReservationsByApplicant
@Query("select r from Reservation r where r.endDate > :now") @NonNull @NonNull org.springframework.data.domain.Page<Reservation> findCurrentReservationsByApplicant(@NonNull @NonNull Actor applicant, @NonNull @NonNull LocalDateTime now, @NonNull @NonNull org.springframework.data.domain.Pageable pageable) Fetches all Reservations from the database placed by the givenActorwhere theReservation.endDateis in the future.- Parameters:
applicant- The user whose Reservations shall be looked for.now- The current time.pageable- The pagination information specifying which page of Reservations shall be returned.- Returns:
- All Reservations of the specified user.
-
findReservationsByApplicantUserName
@NonNull @NonNull org.springframework.data.domain.Page<Reservation> findReservationsByApplicantUserName(@NonNull @NonNull String userName, @NonNull @NonNull org.springframework.data.domain.Pageable pageable) - Parameters:
userName- The user whose Reservations shall be looked for.pageable- The pagination information specifying which page of Reservations shall be returned.- Returns:
- All Reservations of the specified user.
-
findReservationByRoomForDate
@Query("select r from Reservation r where r.room.id = :roomId and r.startDate < :date and r.endDate > :date") @NonNull @NonNull Optional<Reservation> findReservationByRoomForDate(@NonNull @Param("roomId") @NonNull Long roomId, @NonNull @Param("date") @NonNull LocalDateTime date) Fetches theReservation– for the givenRoom– that starts before and ends after the givenLocalDateTimefrom the database. (There can only be one Reservation at a time for each Room.) -
findReservationsBetweenDates
@Query("select r from Reservation r where (r.startDate between :startDate and :endDate) or (r.endDate between :startDate and :endDate) or (r.startDate < :startDate and r.endDate > :endDate)") @NonNull @NonNull Set<Reservation> findReservationsBetweenDates(@NonNull @Param("startDate") @NonNull LocalDateTime startDate, @NonNull @Param("endDate") @NonNull LocalDateTime endDate) Fetches all Reservations from the database that
- Parameters:
startDate- The Reservations looked for start or end after this date.endDate- The Reservations looked for start or end before this date.- Returns:
- All Reservations between the two dates.
-
findReservationsBetweenDatesForRoom
@Query("select r from Reservation r where r.room.id = :roomId and ((r.startDate between :startDate and :endDate) or (r.endDate between :startDate and :endDate) or (r.startDate < :startDate and r.endDate > :endDate)) order by r.startDate asc") @NonNull @NonNull LinkedHashSet<Reservation> findReservationsBetweenDatesForRoom(@NonNull @Param("roomId") @NonNull Long roomId, @NonNull @Param("startDate") @NonNull LocalDateTime startDate, @NonNull @Param("endDate") @NonNull LocalDateTime endDate) Fetches all Reservations from the database placed for the
Roomwith the givenRoom.idand- starting or ending between the two given dates or
- starting before the given start-date and ending after the given end-date.
To be clear: Only those Reservations are returned that simultaneously match the Room ID and the specified date interval.
- Parameters:
roomId- The ID of the Room whose Reservations shall be looked for.startDate- The Reservations looked for start or end after this date.endDate- The Reservations looked for start or end before this date.- Returns:
- The Reservations between the two dates for the given Room. Will be sorted by the
Reservation.startDate, ascending.
-
findSeatReservationsBetweenDatesForRoom
@Query("select r from SeatReservation r where r.room.id = :roomId and ((r.startDate between :startDate and :endDate) or (r.endDate between :startDate and :endDate) or (r.startDate < :startDate and r.endDate > :endDate)) order by r.startDate asc") @NonNull @NonNull LinkedHashSet<SeatReservation> findSeatReservationsBetweenDatesForRoom(@NonNull @Param("roomId") @NonNull Long roomId, @NonNull @Param("startDate") @NonNull LocalDateTime startDate, @NonNull @Param("endDate") @NonNull LocalDateTime endDate) Fetches all SeatReservations from the database placed for the
Roomwith the givenRoom.idand- starting or ending between the two given dates or
- starting before the given start-date and ending after the given end-date.
To be clear: Only those SeatReservation are returned that simultaneously match the Room ID and the specified date interval.
- Parameters:
roomId- The ID of the Room whose SeatReservations shall be looked for.startDate- The SeatReservations looked for start or end after this date.endDate- The SeatReservations looked for start or end before this date.- Returns:
- The SeatReservations between the two dates for the given Room. Will be sorted by the
Reservation.startDate, ascending.
-
findReservationsBetweenDatesForApplicant
@Query("select r from Reservation r where r.applicant.id = :applicantId and ((r.startDate between :startDate and :endDate) or (r.endDate between :startDate and :endDate) or (r.startDate < :startDate and r.endDate > :endDate))") @NonNull @NonNull Set<Reservation> findReservationsBetweenDatesForApplicant(@NonNull @Param("applicantId") @NonNull Long applicantId, @NonNull @Param("startDate") @NonNull LocalDateTime startDate, @NonNull @Param("endDate") @NonNull LocalDateTime endDate) Fetches all Reservations from the database placed for the
Reservation.applicantwith the givenActor.idandTo be clear: Only those Reservations are returned that simultaneously match the
ActorID and the specified date interval.- Parameters:
applicantId- The ID of the applicant whose Reservations shall be looked for.startDate- The Reservations looked for start or end after this date.endDate- The Reservations looked for start or end before this date.- Returns:
- The Reservations between the two dates for the given applicant.
-
findReservationsAfterDateForApplicant
@Query("select r from Reservation r where r.applicant.id = :applicantId and (r.startDate > :date or r.endDate > :date)") @NonNull @NonNull LinkedHashSet<Reservation> findReservationsAfterDateForApplicant(@NonNull @Param("applicantId") @NonNull Long applicantId, @NonNull @Param("date") @NonNull LocalDateTime date) Fetches all Reservations from the database placed for the
Reservation.applicantwith the givenActor.idand starting or ending after the given date.To be clear: Only those Reservations are returned that simultaneously match the
ActorID and the specified lower (exclusive) date-boundary.- Parameters:
applicantId- The ID of the applicant whose Reservations shall be looked for.date- The Reservations looked for start or end after this date (greater than).- Returns:
- The Reservations between the two dates for the given applicant.
-
existsById
- Specified by:
existsByIdin interfaceorg.springframework.data.repository.CrudRepository<Reservation, Long>
-
existsByApplicantAndId
- Parameters:
applicant- The Actor whose Reservation is looked for.id- The identifier of the Reservation looked for.- Returns:
- True if the Actor has a Reservation with the ID, false otherwise.
-
deleteById
- Specified by:
deleteByIdin interfaceorg.springframework.data.repository.CrudRepository<Reservation, Long>
-
deleteAllById
- Specified by:
deleteAllByIdin interfaceorg.springframework.data.repository.CrudRepository<Reservation, Long>
-