Class OfficerRequestController

java.lang.Object
controller.OfficerRequestController

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

    • OfficerRequestController

      public OfficerRequestController()
  • Method Details

    • setOfficerID

      public static void setOfficerID(String ID)
      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

      public static void registerProject(String projectID)
      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 new OfficerRegistration request in the RequestList.
      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 in FilterController to 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

      public static void viewEnquiries(String projectID)
      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

      public static void answerEnquiry(String requestID, String text)
      Records an answer provided by the officer for a specific enquiry. Updates the Enquiry object with the answer text and sets its status to DONE. Note: This method assumes the requestID corresponds to a valid Enquiry and performs no validation checks itself (checks might be done in the calling boundary class).
      Parameters:
      requestID - The ID of the Enquiry request to answer.
      text - The text of the answer provided by the officer.