Class Applicant

java.lang.Object
entity.user.Applicant
All Implemented Interfaces:
User
Direct Known Subclasses:
Officer

public class Applicant extends Object implements User
Represents an Applicant user in the housing application system. Implements the User interface. Stores personal details (ID, name, hashed password, age, marital status) and application-specific information, such as the single project currently applied to/booked, application statuses, and flat types applied for across potentially multiple projects (though typically associated with one active application at a time).
  • Constructor Details

    • Applicant

      public Applicant()
      Default constructor. Initializes a new Applicant instance with default values: empty strings, zero age, default marital status (SINGLE), and empty maps for application status and applied flat type.
    • Applicant

      public Applicant(String userID, String name, String hashedPassword, int age, MaritalStatus maritalStatus)
      Parameterized constructor to create an Applicant with specified initial details. Initializes application-related fields (project, applicationStatus, appliedFlat) as empty/null.
      Parameters:
      userID - The unique user ID for the applicant.
      name - The name of the applicant.
      hashedPassword - The hashed password for the account.
      age - The age of the applicant.
      maritalStatus - The marital status of the applicant.
  • Method Details

    • getUserID

      public String getUserID()
      Gets the applicant's user ID. Implements User.getUserID().
      Specified by:
      getUserID in interface User
      Returns:
      The user ID string.
    • setUserID

      public void setUserID(String userID)
      Sets the applicant's user ID.
      Specified by:
      setUserID in interface User
      Parameters:
      userID - The user ID string.
    • getName

      public String getName()
      Gets the applicant's name. Implements User.getName().
      Specified by:
      getName in interface User
      Returns:
      The name string.
    • setName

      public void setName(String name)
      Sets the applicant's name.
      Specified by:
      setName in interface User
      Parameters:
      name - The name string.
    • getHashedPassword

      public String getHashedPassword()
      Gets the applicant's hashed password. Implements User.getHashedPassword().
      Specified by:
      getHashedPassword in interface User
      Returns:
      The Base64 encoded hashed password string.
    • setHashedPassoword

      public void setHashedPassoword(String hashedPassword)
      Sets the applicant's hashed password. Note: Typo in original method name ("Passoword"). Kept here to match provided code. Consider renaming to setHashedPassword for consistency. Implements User.setHashedPassoword(String).
      Specified by:
      setHashedPassoword in interface User
      Parameters:
      hashedPassword - The Base64 encoded hashed password string.
    • getAge

      public int getAge()
      Gets the applicant's age.
      Specified by:
      getAge in interface User
      Returns:
      The age as an integer.
    • setAge

      public void setAge(int age)
      Sets the applicant's age.
      Specified by:
      setAge in interface User
      Parameters:
      age - The age as an integer.
    • getMaritalStatus

      public MaritalStatus getMaritalStatus()
      Gets the applicant's marital status.
      Specified by:
      getMaritalStatus in interface User
      Returns:
      The MaritalStatus enum value.
    • setMaritalStatus

      public void setMaritalStatus(MaritalStatus maritalStatus)
      Sets the applicant's marital status.
      Specified by:
      setMaritalStatus in interface User
      Parameters:
      maritalStatus - The MaritalStatus enum value.
    • getProject

      public String getProject()
      Gets the ID of the single project the applicant is currently actively associated with (e.g., the one they have applied to or booked). Returns null if the applicant is not currently associated with any active project application/booking.
      Returns:
      The project ID string, or null.
    • setProject

      public void setProject(String project)
      Sets the ID of the single project the applicant is currently actively associated with. Setting this typically happens upon successful application submission. Setting to null unlinks them.
      Parameters:
      project - The project ID string, or null to remove association.
    • getApplicationStatus

      public Map<String,ApplicationStatus> getApplicationStatus()
      Gets the map containing the application status for different projects. Useful for tracking history or status across multiple project interactions. Returns an empty map if no statuses have been recorded.
      Returns:
      A map where keys are project IDs and values are ApplicationStatus.
    • getApplicationStatusByID

      public ApplicationStatus getApplicationStatusByID(String projectID)
      Gets the application status for a specific project ID from the status map.
      Parameters:
      projectID - The ID of the project whose status is needed.
      Returns:
      The ApplicationStatus for the given project ID, or null if not found.
    • setApplicationStatusByID

      public void setApplicationStatusByID(String projectID, ApplicationStatus status)
      Sets or updates the application status for a specific project ID in the status map.
      Parameters:
      projectID - The ID of the project whose status is being set.
      status - The ApplicationStatus to set for the project.
    • getAppliedFlat

      public Map<String,FlatType> getAppliedFlat()
      Gets the map containing the flat type applied for in different projects. Returns an empty map if no flat types have been recorded.
      Returns:
      A map where keys are project IDs and values are FlatType.
    • getAppliedFlatByID

      public FlatType getAppliedFlatByID(String projectID)
      Gets the flat type applied for for a specific project ID from the map.
      Parameters:
      projectID - The ID of the project whose applied flat type is needed.
      Returns:
      The FlatType applied for in the given project, or null if not found or not applicable.
    • setAppliedFlatByID

      public void setAppliedFlatByID(String projectID, FlatType flat)
      Sets or updates the flat type applied for for a specific project ID in the map. This is typically set when an application is submitted. Can be set to null to clear the entry.
      Parameters:
      projectID - The ID of the project for which the flat type is being set.
      flat - The FlatType applied for, or null to remove the entry.