Class Applicant
java.lang.Object
entity.user.Applicant
- All Implemented Interfaces:
User
- Direct Known Subclasses:
Officer
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetAge()Gets the applicant's age.Gets the map containing the application status for different projects.getApplicationStatusByID(String projectID) Gets the application status for a specific project ID from the status map.Gets the map containing the flat type applied for in different projects.getAppliedFlatByID(String projectID) Gets the flat type applied for for a specific project ID from the map.Gets the applicant's hashed password.Gets the applicant's marital status.getName()Gets the applicant's name.Gets the ID of the single project the applicant is currently actively associated with (e.g., the one they have applied to or booked).Gets the applicant's user ID.voidsetAge(int age) Sets the applicant's age.voidsetApplicationStatusByID(String projectID, ApplicationStatus status) Sets or updates the application status for a specific project ID in the status map.voidsetAppliedFlatByID(String projectID, FlatType flat) Sets or updates the flat type applied for for a specific project ID in the map.voidsetHashedPassoword(String hashedPassword) Sets the applicant's hashed password.voidsetMaritalStatus(MaritalStatus maritalStatus) Sets the applicant's marital status.voidSets the applicant's name.voidsetProject(String project) Sets the ID of the single project the applicant is currently actively associated with.voidSets the applicant's user ID.
-
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
Gets the applicant's user ID. ImplementsUser.getUserID(). -
setUserID
-
getName
Gets the applicant's name. ImplementsUser.getName(). -
setName
-
getHashedPassword
Gets the applicant's hashed password. ImplementsUser.getHashedPassword().- Specified by:
getHashedPasswordin interfaceUser- Returns:
- The Base64 encoded hashed password string.
-
setHashedPassoword
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. ImplementsUser.setHashedPassoword(String).- Specified by:
setHashedPassowordin interfaceUser- Parameters:
hashedPassword- The Base64 encoded hashed password string.
-
getAge
-
setAge
-
getMaritalStatus
Gets the applicant's marital status.- Specified by:
getMaritalStatusin interfaceUser- Returns:
- The
MaritalStatusenum value.
-
setMaritalStatus
Sets the applicant's marital status.- Specified by:
setMaritalStatusin interfaceUser- Parameters:
maritalStatus- TheMaritalStatusenum value.
-
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
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
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
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
ApplicationStatusfor the given project ID, or null if not found.
-
setApplicationStatusByID
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- TheApplicationStatusto set for the project.
-
getAppliedFlat
-
getAppliedFlatByID
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
FlatTypeapplied for in the given project, or null if not found or not applicable.
-
setAppliedFlatByID
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- TheFlatTypeapplied for, or null to remove the entry.
-