Class Message

All Implemented Interfaces:
CSVEncodable

public class Message extends CSVDecodable implements CSVEncodable
This class represents a message of an enquiry, by a user of our application, typically an applicant. It contains essential metadata such as the submitter's identity, date and time, as well as the message's content.
Author:
Vincent Neo
  • Field Details

    • user

      private User user
      User involved in this message.
    • content

      private String content
      Contents of this message.
    • timestamp

      private LocalDateTime timestamp
      The time of which this message was constructed or last updated.
    • nric

      private String nric
      Temporary value for CSV parsing and further linking.
  • Constructor Details

    • Message

      Message(List<CSVCell> cells)
      Constructor for CSVParser
      Parameters:
      cells - CSV cells.
    • Message

      Message(User user, String content)
      Construct a message for a user.
      Parameters:
      user - User that wrote this message.
      content - Content of this message.
  • Method Details

    • getUser

      public User getUser()
      Get the user.
      Returns:
      the user.
    • getContent

      public String getContent()
      Get the content.
      Returns:
      the message contents.
    • getTimestamp

      public LocalDateTime getTimestamp()
      Get the timestamp whereby message was submitted.
      Returns:
      the timestamp.
    • updateContent

      public void updateContent(String newContent)
      Call this to update/edit the message.
      Parameters:
      newContent - the updated message.
    • linkUser

      public void linkUser(List<User> users)
      Use this to link User objects to this Message.
      Parameters:
      users - All users.
    • encode

      public String encode()
      Description copied from interface: CSVEncodable
      Override this to provide a line/row of CSV content. This will be called one by one in the CSVEncoder, to be written in file.
      Specified by:
      encode in interface CSVEncodable
      Returns:
      A CSV row, in String text.
    • sourceFileType

      public CSVFileTypes sourceFileType()
      Description copied from interface: CSVEncodable
      Override 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:
      sourceFileType in interface CSVEncodable
      Returns:
      a CSVFileType, such as CSVFileType.MANAGER_LIST.