Class BookingController

java.lang.Object
com.ntu.fdae.group1.bto.controllers.booking.BookingController

public class BookingController extends Object
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 Details

    • BookingController

      public BookingController(IBookingService bookingService)
      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 booking
      applicantNric - The NRIC of the applicant for whom the booking is being created
      flatType - The type of flat being booked
      Returns:
      The newly created Booking object
      Throws:
      BookingException - If there is an issue with the booking process
      InvalidInputException - If the provided input parameters are invalid
    • getBookingsForProject

      public List<Booking> getBookingsForProject(String projectId) throws BookingException
      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