Class Application

Object
CSVDecodable
Application
All Implemented Interfaces:
CSVEncodable

public class Application extends CSVDecodable implements CSVEncodable
This class represents a BTO application.
  • Field Details

    • project

      private BTOProject project
      The project which this application is applied to.
    • flatType

      private FlatType flatType
      The flat type that is applied.
    • status

      private ApplicationStatus status
      The status of this application.
    • withdrawalStatus

      private WithdrawalStatus withdrawalStatus
      Whether if this application shall be invalidated due to withdrawal.
    • applicant

      private Applicant applicant
      The applicant
    • lastUpdated

      private LocalDateTime lastUpdated
      The last updated date and time
    • projectName

      private String projectName
      Temporary value for CSV parse and link
    • applicantNRIC

      private String applicantNRIC
      Temporary value for CSV parse and link
  • Constructor Details

    • Application

      public Application(BTOProject project, FlatType flatType, Applicant applicant)
      Construct a BTO application.
      Parameters:
      project - The project which this application is applying to.
      flatType - The flat type/size applied for.
      applicant - The applicant
    • Application

      public Application(List<CSVCell> cells)
      For CSVParser to parse a CSV row representing this class.
      Parameters:
      cells - cells of a CSV row, of application type.
  • Method Details

    • linkApplicant

      void linkApplicant(List<Applicant> applicants)
      Call this to link relevant applicant objects to this object, post CSV parse.
      Parameters:
      applicants - Pool of all applicants
    • linkProject

      void linkProject(List<BTOProject> projects)
      Call this to link relevant project to this object, post CSV parse.
      Parameters:
      projects - Pool of all projects
    • withdraw

      public void withdraw() throws Exception
      Withdraw this application. Should only be called by applicant.
      Throws:
      Exception - access control.
    • setStatus

      public void setStatus(ApplicationStatus status)
      Update status and update last updated time.
      Parameters:
      status - application status
    • getStatus

      public ApplicationStatus getStatus()
      Get the application's status.
      Returns:
      the status.
    • getWithdrawalStatus

      public WithdrawalStatus getWithdrawalStatus()
      Get the withdrawal status.
      Returns:
      the status.
    • setWithdrawalStatus

      public void setWithdrawalStatus(WithdrawalStatus withdrawalStatus)
      Set the withdrawal status.
      Parameters:
      withdrawalStatus - the new status.
    • getFlatType

      public FlatType getFlatType()
      Get flat type
      Returns:
      the flat type
    • getApplicant

      public Applicant getApplicant()
      Get the applicant of this application
      Returns:
      the applicant
    • getProject

      public BTOProject getProject()
      The project that's being applied for.
      Returns:
      the project.
    • getLastUpdatedDate

      public LocalDateTime getLastUpdatedDate()
      The last update date and time.
      Returns:
      date and time object.
    • getReceipt

      public String getReceipt() throws Exception
      The receipt for a successfully booked application.
      Returns:
      The receipt.
      Throws:
      Exception - Non-booked applications does not have receipts.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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.