Class BookingController
java.lang.Object
com.ntu.fdae.group1.bto.controllers.booking.BookingController
Controller class responsible for managing booking operations in the BTO
Management System.
This controller acts as an intermediary between the UI layer and the booking service, handling booking-related operations such as creating new bookings and retrieving booking information for specific projects.
The BookingController implements the MVC architecture pattern by: 1. Receiving booking requests from the UI 2. Validating and processing these requests through the booking service 3. Returning the results back to the UI
-
Constructor Summary
ConstructorsConstructorDescriptionBookingController
(IBookingService bookingService) Constructs a new BookingController with the specified booking service. -
Method Summary
Modifier and TypeMethodDescriptioncreateBooking
(HDBOfficer officer, String applicantNric, FlatType flatType) Creates a new booking for an applicant by an HDB officer.getBookingsForProject
(String projectId) Retrieves all bookings associated with a specific project.
-
Constructor Details
-
BookingController
Constructs a new BookingController with the specified booking service.- Parameters:
bookingService
- The booking service to be used for booking operations
-
-
Method Details
-
createBooking
public Booking createBooking(HDBOfficer officer, String applicantNric, FlatType flatType) throws BookingException, InvalidInputException Creates a new booking for an applicant by an HDB officer.This method delegates the booking creation process to the booking service, which handles the validation and business logic for creating a booking.
- Parameters:
officer
- The HDB officer creating the bookingapplicantNric
- The NRIC of the applicant for whom the booking is being createdflatType
- The type of flat being booked- Returns:
- The newly created Booking object
- Throws:
BookingException
- If there is an issue with the booking processInvalidInputException
- If the provided input parameters are invalid
-
getBookingsForProject
Retrieves all bookings associated with a specific project.This method allows for listing all bookings that have been made for a particular HDB project, identified by its ID.
- Parameters:
projectId
- The unique identifier of the project- Returns:
- A list of Booking objects associated with the specified project
- Throws:
BookingException
- If there is an error retrieving the bookings
-