Class Officer
java.lang.Object
entity.user.Applicant
entity.user.Officer
- All Implemented Interfaces:
User
Represents an Officer user in the housing application system.
An Officer is also an
Applicant, inheriting all applicant properties and behaviors,
but additionally has attributes related to their official duties. This includes a list
of projects they are assigned to work on and their registration status for various projects.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the list of project IDs the officer is assigned to or registered for.Gets the map containing the officer's registration status for different projects.Gets the registration status for a specific project ID from the status map.voidsetOfficerProject(List<String> officerProject) Sets the list of project IDs the officer is assigned to or registered for.voidsetRegistrationStatusByID(String ID, RegistrationStatus status) Sets or updates the registration status for a specific project ID in the status map.Methods inherited from class entity.user.Applicant
getAge, getApplicationStatus, getApplicationStatusByID, getAppliedFlat, getAppliedFlatByID, getHashedPassword, getMaritalStatus, getName, getProject, getUserID, setAge, setApplicationStatusByID, setAppliedFlatByID, setHashedPassoword, setMaritalStatus, setName, setProject, setUserID
-
Constructor Details
-
Officer
public Officer()Default constructor. Initializes a new Officer instance by calling the defaultApplicantconstructor and initializing the officer-specific fields (officerProjectlist andregistrationStatusmap) as empty collections. -
Officer
public Officer(String userID, String name, String hashedPassword, int age, MaritalStatus maritalStatus) Parameterized constructor to create an Officer with specified initial personal details. Calls the correspondingApplicantconstructor to initialize inherited fields. Initializes the officer-specific fields (officerProjectlist andregistrationStatusmap) as empty collections. Project assignments and statuses are typically managed separately.- Parameters:
userID- The unique user ID for the officer.name- The name of the officer.hashedPassword- The hashed password for the account.age- The age of the officer.maritalStatus- The marital status of the officer.
-
-
Method Details
-
getOfficerProject
Gets the list of project IDs the officer is assigned to or registered for. Returns an empty list if the officer is not assigned to any projects. Note: Returns the internal list reference. Consider returning a copy if immutability outside this class is desired.- Returns:
- The list of project ID strings.
-
setOfficerProject
-
getRegistrationStatus
Gets the map containing the officer's registration status for different projects. Returns an empty map if no statuses have been recorded.- Returns:
- A map where keys are project IDs and values are
RegistrationStatus.
-
getRegistrationStatusByID
Gets the registration status for a specific project ID from the status map.- Parameters:
ID- The ID of the project whose registration status is needed.- Returns:
- The
RegistrationStatusfor the given project ID, or null if not found.
-
setRegistrationStatusByID
Sets or updates the registration status for a specific project ID in the status map. Typically used when an officer applies to register or when a manager approves/rejects the registration.- Parameters:
ID- The ID of the project whose registration status is being set.status- TheRegistrationStatusto set for the project.
-