Class OfficerRequestController
java.lang.Object
controller.OfficerRequestController
Controller responsible for handling request-related operations specific to Officers.
This includes registering for projects, viewing registration status and assigned projects,
viewing enquiries for assigned projects, and answering those enquiries.
It operates using the context of the currently logged-in officer's ID.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidanswerEnquiry(String requestID, String text) Records an answer provided by the officer for a specific enquiry.static voidregisterProject(String projectID) Submits a registration request for the current officer to join a specific project.static voidsetOfficerID(String ID) Sets the officer ID for the current session context.static voidDisplays all enquiries associated with all projects the current officer is registered for.static voidviewEnquiries(String projectID) Displays enquiries associated with a specific project ID, but only if the current officer is registered for that project.static voidDisplays a list of projects the current officer is successfully registered for.static voidDisplays the history of project registration requests submitted by the current officer.
-
Constructor Details
-
OfficerRequestController
public OfficerRequestController()
-
-
Method Details
-
setOfficerID
Sets the officer ID for the current session context. Subsequent officer-specific operations in this controller will use this ID.- Parameters:
ID- The user ID of the currently logged-in officer.
-
registerProject
Submits a registration request for the current officer to join a specific project. Performs checks: - Project exists and is visible. - Officer is not already an applicant for the project. - The project's dates do not overlap with any project the officer is already registered for. If checks pass, updates the officer's status for this project to PENDING and creates a newOfficerRegistrationrequest in theRequestList.- Parameters:
projectID- The ID of the project the officer wants to register for.
-
viewRegisteredProject
public static void viewRegisteredProject()Displays a list of projects the current officer is successfully registered for. Applies filters set inFilterControllerto the list before display. -
viewRegistrationStatus
public static void viewRegistrationStatus()Displays the history of project registration requests submitted by the current officer. Shows the status of each request (e.g., PENDING, APPROVED, REJECTED). -
viewEnquiries
public static void viewEnquiries()Displays all enquiries associated with all projects the current officer is registered for. -
viewEnquiries
Displays enquiries associated with a specific project ID, but only if the current officer is registered for that project.- Parameters:
projectID- The ID of the project for which to view enquiries.
-
answerEnquiry
Records an answer provided by the officer for a specific enquiry. Updates theEnquiryobject with the answer text and sets its status to DONE. Note: This method assumes therequestIDcorresponds to a valid Enquiry and performs no validation checks itself (checks might be done in the calling boundary class).- Parameters:
requestID- The ID of theEnquiryrequest to answer.text- The text of the answer provided by the officer.
-