Interface ReservationRepository
- All Known Implementing Classes:
ReservationMongoRepository
,ReservationPostgresRepository
public interface ReservationRepository
Facade for repository layer for Reservation entities.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(Reservation reservation) Removes the unique specified reservation from the database, if it exists, otherwise it does nothing.findAll()
Retrieves all the reservations from the database in a list.findByClient
(UUID clientId) Retrieves all the reservations associated with the specified client's identifier from the database in a list.findByDate
(LocalDate date) Retrieves the unique reservation of the specified date from the database, if it exists.Retrieves the unique reservation with the specified identifier from the database, if it exists.save
(Reservation reservation) Insert a new reservation in the database or saves changes of an existing one.
-
Method Details
-
findAll
List<Reservation> findAll()Retrieves all the reservations from the database in a list.- Returns:
- the
List
ofReservation
s found in the repository.
-
findByClient
Retrieves all the reservations associated with the specified client's identifier from the database in a list.- Parameters:
clientId
- the identifier of the associated client.- Returns:
- the
List
ofReservation
s associated withclientId
found in the repository.
-
findById
Retrieves the unique reservation with the specified identifier from the database, if it exists.- Parameters:
id
- the identifier of the reservation to find.- Returns:
- an
Optional
contained theReservation
identified byid
, if it exists; anOptional
empty, otherwise.
-
findByDate
Retrieves the unique reservation of the specified date from the database, if it exists.- Parameters:
date
- the date of the reservation to find.- Returns:
- an
Optional
contained theReservation
ondate
, if it exists; anOptional
empty, otherwise.
-
save
Reservation save(Reservation reservation) throws IllegalArgumentException, UpdateFailureException, NotNullConstraintViolationException, UniquenessConstraintViolationException Insert a new reservation in the database or saves changes of an existing one.- Parameters:
reservation
- the reservation to save.- Returns:
- the
Reservation
saved. - Throws:
IllegalArgumentException
- ifreservation
is null.UpdateFailureException
- if the update fails.NotNullConstraintViolationException
- if a not-null constraint is violated.UniquenessConstraintViolationException
- if a uniqueness constraint is violated.
-
delete
Removes the unique specified reservation from the database, if it exists, otherwise it does nothing.- Parameters:
reservation
- the reservation to delete.- Throws:
IllegalArgumentException
- ifreservation
is null.
-