Class ApplicationController

java.lang.Object
com.ntu.fdae.group1.bto.controllers.project.ApplicationController

public class ApplicationController extends Object
Controller for application-related operations
  • Constructor Details

    • ApplicationController

      public ApplicationController(IApplicationService applicationService)
      Constructs a new ApplicationController
      Parameters:
      applicationService - The application service to use
  • Method Details

    • submitApplication

      public Application submitApplication(User user, String projectId, FlatType preferredFlatType) throws ApplicationException
      Submits a new application
      Parameters:
      user - The applicant submitting the application
      projectId - ID of the project to apply for
      preferredFlatType - The preferred flat type
      Returns:
      The created application
      Throws:
      ApplicationException - if submission fails
    • requestWithdrawal

      public boolean requestWithdrawal(User user) throws ApplicationException
      Requests withdrawal of an application
      Parameters:
      user - The applicant requesting withdrawal
      Returns:
      true if request was successful, false otherwise
      Throws:
      ApplicationException - if withdrawal request fails
    • reviewApplication

      public boolean reviewApplication(HDBManager manager, String applicationId, boolean approve) throws ApplicationException
      Reviews an application
      Parameters:
      manager - The manager reviewing the application
      applicationId - ID of the application to review
      approve - true to approve, false to reject
      Returns:
      true if review was successful, false otherwise
      Throws:
      ApplicationException - if review fails
    • reviewWithdrawal

      public boolean reviewWithdrawal(HDBManager manager, String applicationId, boolean approve) throws ApplicationException
      Reviews a withdrawal request
      Parameters:
      manager - The manager reviewing the withdrawal
      applicationId - ID of the application to withdraw
      approve - true to approve, false to reject withdrawal
      Returns:
      true if review was successful, false otherwise
      Throws:
      ApplicationException - if review fails
    • getMyApplication

      public Application getMyApplication(User user)
      Gets the application for a specific applicant
      Parameters:
      user - The applicant
      Returns:
      The application, or null if not found
    • getProjectApplications

      public List<Application> getProjectApplications(HDBStaff staff, String projectId) throws ApplicationException
      Retrieves all applications for a specific project.

      This method allows HDB staff to view all applications submitted for a particular project, which is useful for project management and status tracking.

      Parameters:
      staff - The HDB staff member making the request
      projectId - The ID of the project to retrieve applications for
      Returns:
      A list of applications for the specified project
      Throws:
      ApplicationException - If the staff member doesn't have appropriate access rights or if there's an error retrieving the applications
    • getApplicationsByStatus

      public List<Application> getApplicationsByStatus(HDBStaff staff, ApplicationStatus status) throws ApplicationException
      Retrieves applications with a specific status.

      This method allows HDB staff to filter applications by status, which is useful for processing applications at various stages of the approval process.

      Parameters:
      staff - The HDB staff member making the request
      status - The status to filter applications by
      Returns:
      A list of applications with the specified status
      Throws:
      ApplicationException - If the staff member doesn't have appropriate access rights or if there's an error retrieving the applications