Package app.controller.camp
Class CampEnquiryController
java.lang.Object
app.controller.camp.CampEnquiryController
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 Summary
Modifier and TypeMethodDescriptionstatic booleananswerEnquiry(Enquiry enquiry, User answeringUser, String answer) Answers an enquiry and, if the answering user is a student, awards them points.static booleancreateEnquiry(Enquiry enquiry) static booleandeleteEnquiry(Enquiry enquiry) Deletes an enquiry from the repository.static EnquiryListRetrieves all enquiries from the enquiry repository.static EnquiryListgetEnquiries(Camp camp) Retrieves all enquiries related to a specific camp.static EnquiryListgetEnquiries(Student user) Retrieves all enquiries made by a specific user.static EnquirygetEnquiry(String enquiryID) Retrieves an enquiry based on its unique ID.static booleanupdateEnquiry(Enquiry newEnquiry) Updates an existing enquiry in the repository.
-
Method Details
-
createEnquiry
-
getEnquiry
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
Retrieves all enquiries from the enquiry repository.- Returns:
- EnquiryList A list of all enquiries.
-
getEnquiries
Retrieves all enquiries related to a specific camp.- Parameters:
camp- TheCampfor which enquiries are to be retrieved.- Returns:
- EnquiryList A list of enquiries related to the specified camp.
-
getEnquiries
Retrieves all enquiries made by a specific user.- Parameters:
user- TheUserwho made the enquiries.- Returns:
- EnquiryList A list of enquiries made by the specified user.
-
updateEnquiry
Updates an existing enquiry in the repository.- Parameters:
newEnquiry- The updatedEnquiryobject.- Returns:
- boolean True if the update operation is successful.
-
deleteEnquiry
Deletes an enquiry from the repository.- Parameters:
enquiry- TheEnquiryto be deleted.- Returns:
- boolean True if the deletion is successful.
-
answerEnquiry
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.
-