Interface IEnquiryService
- All Known Implementing Classes:
EnquiryService
This service interface provides methods for the complete lifecycle management of enquiries, including creation, editing, deletion, and replying. It also offers various methods for retrieving enquiries based on different criteria.
The service acts as part of the business logic layer in the application architecture, positioned between controllers and repositories, implementing all enquiry-related business rules and validation.
-
Method Summary
Modifier and TypeMethodDescriptioncreateEnquiry
(User user, String projectId, String content) Creates a new enquiry in the system.boolean
deleteEnquiry
(String enquiryId, User user) Deletes an existing enquiry from the system.boolean
editEnquiry
(String enquiryId, String newContent, User user) Edits an existing enquiry's content.findEnquiryById
(String enquiryId) Finds an enquiry by its unique identifier.boolean
replyToEnquiry
(String enquiryId, String replyContent, HDBStaff staff) Adds an official reply to an existing enquiry.Retrieves all enquiries in the system.viewMyEnquiries
(User user) Retrieves all enquiries submitted by a specific user.viewProjectEnquiries
(String projectId) Retrieves enquiries associated with a specific project.
-
Method Details
-
createEnquiry
Creates a new enquiry in the system.Records the enquiry with metadata including the creator, creation time, and association with a project (if applicable).
- Parameters:
user
- The user creating the enquiryprojectId
- ID of the related project, or null for general enquiriescontent
- The enquiry content- Returns:
- The created enquiry with its assigned ID and metadata
-
editEnquiry
Edits an existing enquiry's content.The implementation should verify that the user is authorized to edit the enquiry and that the enquiry has not been replied to yet.
- Parameters:
enquiryId
- ID of the enquiry to editnewContent
- New content for the enquiryuser
- The user editing the enquiry- Returns:
- true if edit was successful, false otherwise
-
deleteEnquiry
Deletes an existing enquiry from the system.The implementation should verify that the user is authorized to delete the enquiry and that the enquiry has not been replied to yet.
- Parameters:
enquiryId
- ID of the enquiry to deleteuser
- The user deleting the enquiry- Returns:
- true if deletion was successful, false otherwise
-
replyToEnquiry
Adds an official reply to an existing enquiry.The reply is recorded with the staff member who provided it and the timestamp. Once replied to, an enquiry should be marked as such and should not be editable or deletable by the original submitter.
- Parameters:
enquiryId
- ID of the enquiry to reply toreplyContent
- The content of the replystaff
- The HDB staff member providing the reply- Returns:
- true if reply was successfully added, false otherwise
-
viewMyEnquiries
Retrieves all enquiries submitted by a specific user.- Parameters:
user
- The user whose enquiries to retrieve- Returns:
- List of enquiries submitted by the user
-
viewAllEnquiries
Retrieves all enquiries in the system.- Returns:
- List of all enquiries
-
viewProjectEnquiries
Retrieves enquiries associated with a specific project.- Parameters:
projectId
- ID of the project- Returns:
- List of enquiries for the specified project
-
findEnquiryById
Finds an enquiry by its unique identifier.- Parameters:
enquiryId
- ID of the enquiry to find- Returns:
- The enquiry if found, or null if no enquiry exists with the given ID
-