Package sc2002.FCS1.grp2
Class Enquiry
Object
CSVDecodable
Enquiry
- All Implemented Interfaces:
CSVEncodable
Each enquiry acts as a question and answer session, between applicants and officers or managers of a project.
- Author:
- Vincent Neo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate UUIDA unique identifier to identify each enquiry.private BTOProjectThe BTO Project which the enquiry is intended to be about.private StringPlaceholder object as intermediary for CSV parsing This is because the CSV cells only represents projects as their names.private MessageA question intended for an authorised HDB manager or officer to respond to.private MessageA response from an authorised HDB manager or officer to answer the question. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisplay()Display this enquiry on the console, formatted.encode()Override this to provide a line/row of CSV content.booleangetId()Retrieve the unique identifier of this object.Retrieve the project associated to this enquiry.Retrieve the question message that has been added in by the applicant that has submitted this enquiry.Retrieve the response object provided by an authorised officer or manager, if any.booleanCheck if this enquiry has been responded by an authorised personnel or not.booleanisUserInvolved(User user) Checks if the provided user is involved in this enquiry, as an enquirer.voidlinkProject(ArrayList<BTOProject> projects) Only call if projectName is provided by CSV parsing and not null.voidLink connected users to this object.voidsetResponse(Message response) Use this to provide a response to the enquiry question.Override this to provide which file type the encodable class should be represented as.
-
Field Details
-
id
A unique identifier to identify each enquiry. -
question
A question intended for an authorised HDB manager or officer to respond to. -
response
A response from an authorised HDB manager or officer to answer the question. It is expected for this to benullif unanswered. -
projectName
Placeholder object as intermediary for CSV parsing This is because the CSV cells only represents projects as their names. We need to further process to link actualBTOProjectobject to this class. Set to null when not in use. -
project
The BTO Project which the enquiry is intended to be about. Each enquiry question is supposed to be related to a BTO project. This enables the enquiry to be handled by a suitable personnel, such as the officer in charge of the project.
-
-
Constructor Details
-
Enquiry
Construct an enquiry by theCSVParser. -
Enquiry
Construct a new enquiry from anApplicantrole.- Parameters:
question- The question for an officer or manager to reply to.project- The related project, for context of the question.
-
-
Method Details
-
linkProject
Only call if projectName is provided by CSV parsing and not null.- Parameters:
projects- All projects of system, used for matching and linking.
-
linkUsers
Link connected users to this object.- Parameters:
users- All users supported in the system. This method will pick whichever user necessary.
-
isUserInvolved
Checks if the provided user is involved in this enquiry, as an enquirer.- Parameters:
user- The user to be checked.- Returns:
- true, if user provided is found to be involved in this enquiry.
-
getId
Retrieve the unique identifier of this object.- Returns:
- a UUID that uniquely represents this object.
-
getResponse
Retrieve the response object provided by an authorised officer or manager, if any.- Returns:
- A message representing a response from an authorised personnel.
-
setResponse
Use this to provide a response to the enquiry question.- Parameters:
response- The response to be provided.
-
getProject
Retrieve the project associated to this enquiry.- Returns:
- project information.
-
getQuestion
Retrieve the question message that has been added in by the applicant that has submitted this enquiry.- Returns:
- the question message.
-
hasResponded
public boolean hasResponded()Check if this enquiry has been responded by an authorised personnel or not.- Returns:
- false, if no responses.
-
encode
Description copied from interface:CSVEncodableOverride this to provide a line/row of CSV content. This will be called one by one in theCSVEncoder, to be written in file.- Specified by:
encodein interfaceCSVEncodable- Returns:
- A CSV row, in
Stringtext.
-
sourceFileType
Description copied from interface:CSVEncodableOverride this to provide which file type the encodable class should be represented as. This ensures that the right data is written in the right file, depending on the class type.- Specified by:
sourceFileTypein interfaceCSVEncodable- Returns:
- a CSVFileType, such as
CSVFileType.MANAGER_LIST.
-
display
public void display()Display this enquiry on the console, formatted. -
equals
-