Class Project

java.lang.Object
entity.project.Project

public class Project extends Object
Represents a housing project entity. Contains details such as project identification, name, associated neighbourhoods, available units and prices for different flat types, application timeline (open/close dates), associated manager, available officer slots, assigned officers, applicants who have booked units, and the project's visibility status.
  • Constructor Details

    • Project

      public Project()
      Default constructor. Initializes a new Project instance with default values: empty strings, empty lists/maps, current date for open/close dates, zero available officers, and false visibility.
    • Project

      public Project(String projectID, String name, List<String> neighbourhood, Map<FlatType,Integer> availableUnit, Map<FlatType,Integer> price, LocalDate openDate, LocalDate closeDate, String managerID, int availableOfficer, boolean visibility)
      Parameterized constructor to create a Project with specified initial values. Note: The lists for officer IDs and applicant IDs are initialized as empty by this constructor; they are expected to be populated later.
      Parameters:
      projectID - The unique ID for the project.
      name - The name of the project.
      neighbourhood - The list of nearby neighbourhoods.
      availableUnit - The map of available units per flat type.
      price - The map of prices per flat type.
      openDate - The application open date.
      closeDate - The application close date.
      managerID - The ID of the managing user.
      availableOfficer - The initial number of available officer slots.
      visibility - The initial visibility status.
  • Method Details

    • getProjectID

      public String getProjectID()
      Gets the unique project ID.
      Returns:
      The project ID string.
    • setProjectID

      public void setProjectID(String projectID)
      Sets the unique project ID.
      Parameters:
      projectID - The project ID string.
    • getName

      public String getName()
      Gets the name of the project.
      Returns:
      The project name string.
    • setName

      public void setName(String name)
      Sets the name of the project.
      Parameters:
      name - The project name string.
    • getNeighborhood

      public List<String> getNeighborhood()
      Gets the list of nearby neighbourhood names.
      Returns:
      The list of neighbourhood strings. Returns an empty list if none are set.
    • setNeighborhood

      public void setNeighborhood(List<String> neighborhood)
      Sets the list of nearby neighbourhood names.
      Parameters:
      neighborhood - The list of neighbourhood strings.
    • getAvailableUnit

      public Map<FlatType,Integer> getAvailableUnit()
      Gets the map of available units per flat type.
      Returns:
      The map where keys are FlatType and values are Integer counts. Returns an empty map if none are set.
    • setAvailableUnit

      public void setAvailableUnit(Map<FlatType,Integer> availableUnit)
      Sets the map of available units per flat type.
      Parameters:
      availableUnit - The map where keys are FlatType and values are Integer counts.
    • setAvailableUnit

      public void setAvailableUnit(FlatType flat, Integer availableUnit)
      Sets the number of available units for a specific flat type. Adds or updates the entry in the available units map.
      Parameters:
      flat - The FlatType to update.
      availableUnit - The number of available units for the specified flat type.
    • getPrice

      public Map<FlatType,Integer> getPrice()
      Gets the map of prices per flat type.
      Returns:
      The map where keys are FlatType and values are Integer prices. Returns an empty map if none are set.
    • setPrice

      public void setPrice(Map<FlatType,Integer> price)
      Sets the map of prices per flat type.
      Parameters:
      price - The map where keys are FlatType and values are Integer prices.
    • getOpenDate

      public LocalDate getOpenDate()
      Gets the application open date.
      Returns:
      The open date as a LocalDate.
    • setOpenDate

      public void setOpenDate(LocalDate openDate)
      Sets the application open date.
      Parameters:
      openDate - The open date as a LocalDate.
    • getCloseDate

      public LocalDate getCloseDate()
      Gets the application close date.
      Returns:
      The close date as a LocalDate.
    • setCloseDate

      public void setCloseDate(LocalDate closeDate)
      Sets the application close date.
      Parameters:
      closeDate - The close date as a LocalDate.
    • getManagerID

      public String getManagerID()
      Gets the user ID of the manager responsible for this project.
      Returns:
      The manager's user ID string.
    • setManagerID

      public void setManagerID(String managerID)
      Sets the user ID of the manager responsible for this project.
      Parameters:
      managerID - The manager's user ID string.
    • getAvailableOfficer

      public int getAvailableOfficer()
      Gets the number of available officer slots for this project.
      Returns:
      The count of available officer slots.
    • setAvailableOfficer

      public void setAvailableOfficer(int availableOfficer)
      Sets the number of available officer slots for this project.
      Parameters:
      availableOfficer - The count of available officer slots.
    • getOfficerID

      public List<String> getOfficerID()
      Gets the list of user IDs of officers assigned to this project.
      Returns:
      The list of officer user ID strings. Returns an empty list if none are set.
    • setOfficerID

      public void setOfficerID(List<String> officerID)
      Sets the list of user IDs of officers assigned to this project.
      Parameters:
      officerID - The list of officer user ID strings.
    • getApplicantID

      public List<String> getApplicantID()
      Gets the list of user IDs of applicants who have successfully booked a flat in this project.
      Returns:
      The list of applicant user ID strings. Returns an empty list if none are set.
    • setApplicantID

      public void setApplicantID(List<String> applicantID)
      Sets the list of user IDs of applicants who have successfully booked a flat in this project.
      Parameters:
      applicantID - The list of applicant user ID strings.
    • addApplicantID

      public void addApplicantID(String applicantID)
      Adds a single applicant ID to the list of applicants who have booked a flat. Typically called when an officer successfully books a flat for an applicant.
      Parameters:
      applicantID - The user ID of the applicant to add.
    • getVisibility

      public boolean getVisibility()
      Gets the visibility status of the project.
      Returns:
      true if the project is visible, false otherwise.
    • setVisibility

      public void setVisibility(boolean visibility)
      Sets the visibility status of the project.
      Parameters:
      visibility - true to make the project visible, false otherwise.
    • setAll

      public void setAll(Project project)
      Copies all attribute values from another Project object into this object. This is a shallow copy for primitive types and references (lists/maps point to the same objects as the source). Consider implementing deep copy if independent copies of lists/maps are needed.
      Parameters:
      project - The source Project object from which to copy attributes.