Module eus.ehu.hotelreservation
Class BlFacadeImplementation
java.lang.Object
eus.ehu.hotelreservation.businessLogic.BlFacadeImplementation
- All Implemented Interfaces:
BlFacade
Singleton implementation of the business-logic facade.
Provides the application layer with high-level operations such as
searching available rooms, making reservations and joining the
waiting list. Internally delegates to DataAccess for
persistence and keeps track of the currently logged-in customer.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetAvailableRooms(String hotelName, LocalDate startDate, LocalDate endDate) Queries available room types for a given hotel and date range.Returns the list of all hotels registered in the system.static BlFacadeImplementationReturns the singleton instance of the business-logic facade.voidjoinWaitingList(String hotelName, String roomType, LocalDate startDate, LocalDate endDate) Registers the current customer on the waiting list for the given room type at the specified hotel and date range.voidreserveRoom(AvailableRoomModel room, LocalDate startDate, LocalDate endDate) Creates a reservation for the selected room type and charges 20% of the total price upfront as an advance payment.
-
Method Details
-
getInstance
Returns the singleton instance of the business-logic facade.- Returns:
- the unique
BlFacadeImplementationinstance
-
getHotels
-
getAvailableRooms
public List<AvailableRoomModel> getAvailableRooms(String hotelName, LocalDate startDate, LocalDate endDate) Description copied from interface:BlFacadeQueries available room types for a given hotel and date range.Only room types that have at least one available room for the entire stay (all days between
startDateandendDate) are returned. The total price is calculated day-by-day, respecting different rates on different dates (e.g. peak-season pricing).- Specified by:
getAvailableRoomsin interfaceBlFacade- Parameters:
hotelName- the name of the hotelstartDate- check-in date (inclusive)endDate- check-out date (exclusive)- Returns:
- list of available room types with daily and total prices
-
reserveRoom
Description copied from interface:BlFacadeCreates a reservation for the selected room type and charges 20% of the total price upfront as an advance payment.A concrete
Roomis assigned from the pool of available rooms of that type at the hotel.- Specified by:
reserveRoomin interfaceBlFacade- Parameters:
room- the room type model selected by the userstartDate- check-in dateendDate- check-out date
-
joinWaitingList
public void joinWaitingList(String hotelName, String roomType, LocalDate startDate, LocalDate endDate) Description copied from interface:BlFacadeRegisters the current customer on the waiting list for the given room type at the specified hotel and date range.This is typically used when no rooms of the desired type are available.
- Specified by:
joinWaitingListin interfaceBlFacade- Parameters:
hotelName- the hotel nameroomType- the desired room type (e.g. "simple", "doble", "suite")startDate- desired check-in dateendDate- desired check-out date
-