Class ApplicationController
java.lang.Object
com.ntu.fdae.group1.bto.controllers.project.ApplicationController
Controller for application-related operations
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationController
(IApplicationService applicationService) Constructs a new ApplicationController -
Method Summary
Modifier and TypeMethodDescriptiongetApplicationsByStatus
(HDBStaff staff, ApplicationStatus status) Retrieves applications with a specific status.getMyApplication
(User user) Gets the application for a specific applicantgetProjectApplications
(HDBStaff staff, String projectId) Retrieves all applications for a specific project.boolean
requestWithdrawal
(User user) Requests withdrawal of an applicationboolean
reviewApplication
(HDBManager manager, String applicationId, boolean approve) Reviews an applicationboolean
reviewWithdrawal
(HDBManager manager, String applicationId, boolean approve) Reviews a withdrawal requestsubmitApplication
(User user, String projectId, FlatType preferredFlatType) Submits a new application
-
Constructor Details
-
ApplicationController
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 applicationprojectId
- ID of the project to apply forpreferredFlatType
- The preferred flat type- Returns:
- The created application
- Throws:
ApplicationException
- if submission fails
-
requestWithdrawal
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 applicationapplicationId
- ID of the application to reviewapprove
- 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 withdrawalapplicationId
- ID of the application to withdrawapprove
- true to approve, false to reject withdrawal- Returns:
- true if review was successful, false otherwise
- Throws:
ApplicationException
- if review fails
-
getMyApplication
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 requestprojectId
- 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 requeststatus
- 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
-