Class CampEnquiryController

java.lang.Object
app.controller.camp.CampEnquiryController

public class CampEnquiryController extends Object
The CampEnquiryController class manages the operations related to enquiries within a camp context. It provides functionalities to create, retrieve, update, and delete enquiries, along with specific methods to handle enquiries by camp or user. It also includes a feature to answer an enquiry and award points to students for their participation.

Methods include:

  • Creating new enquiries.
  • Retrieving enquiries by ID, camp, or user.
  • Updating existing enquiries.
  • Deleting enquiries.
  • Answering enquiries with an optional reward system for student users.

This app.controller interacts with the RepositoryCollection to perform data operations, ensuring a separation of concerns between the data layer and business logic.

See Also:
  • Method Details

    • createEnquiry

      public static boolean createEnquiry(Enquiry enquiry)
    • getEnquiry

      public static Enquiry getEnquiry(String enquiryID)
      Retrieves an enquiry based on its unique ID. If no enquiry is found with the given ID, this method returns null.
      Parameters:
      enquiryID - The unique identifier of the enquiry.
      Returns:
      Enquiry The enquiry matching the given ID, or null if none found.
    • getEnquiries

      public static EnquiryList getEnquiries()
      Retrieves all enquiries from the enquiry repository.
      Returns:
      EnquiryList A list of all enquiries.
    • getEnquiries

      public static EnquiryList getEnquiries(Camp camp)
      Retrieves all enquiries related to a specific camp.
      Parameters:
      camp - The Camp for which enquiries are to be retrieved.
      Returns:
      EnquiryList A list of enquiries related to the specified camp.
    • getEnquiries

      public static EnquiryList getEnquiries(Student user)
      Retrieves all enquiries made by a specific user.
      Parameters:
      user - The User who made the enquiries.
      Returns:
      EnquiryList A list of enquiries made by the specified user.
    • updateEnquiry

      public static boolean updateEnquiry(Enquiry newEnquiry)
      Updates an existing enquiry in the repository.
      Parameters:
      newEnquiry - The updated Enquiry object.
      Returns:
      boolean True if the update operation is successful.
    • deleteEnquiry

      public static boolean deleteEnquiry(Enquiry enquiry)
      Deletes an enquiry from the repository.
      Parameters:
      enquiry - The Enquiry to be deleted.
      Returns:
      boolean True if the deletion is successful.
    • answerEnquiry

      public static boolean answerEnquiry(Enquiry enquiry, User answeringUser, String answer)
      Answers an enquiry and, if the answering user is a student, awards them points. The method updates the enquiry with the provided answer and user information.
      Parameters:
      enquiry - The Enquiry to be answered.
      answeringUser - The User who is answering the enquiry.
      answer - The answer to the enquiry.
      Returns:
      boolean True if the update operation after answering is successful.