Skip to content
217317751JiayeChen edited this page Apr 1, 2024 · 2 revisions

Model Class

Singleton class representing the model in the MVC architecture.

Fields:

  • model: Static instance of the Model class.
  • viewFactory: Instance of the ViewFactory class for managing views.
  • ClaimsDatabaseDriver: Instance of the ClaimsDatabaseDriver class for database operations.
  • loginAccountType: AccountType representing the current login account type.
  • customer: Instance of the Customer class representing customer data.
  • customerLoginSuccessFlag: Flag indicating whether customer login was successful.
  • customerList: ObservableList of Customer objects.
  • advisor: Instance of the Advisor class representing advisor data.
  • AdvisorLoginSuccessFlag: Flag indicating whether advisor login was successful.
  • admin: Instance of the Admin class representing admin data.
  • AdminLoginSuccessFlag: Flag indicating whether admin login was successful.

Methods:

getInstance(): Static method to get the instance of the Model class.

getViewFactory(): Returns the ViewFactory instance.

getClaimsDatabaseDriver(): Returns the ClaimsDatabaseDriver instance.

getLoginAccountType(): Returns the current login account type.

setLoginAccountType(AccountType loginAccountType): Sets the current login account type.

getCustomerLoginSuccessFlag(): Returns the flag indicating whether customer login was successful.

setCustomerLoginSuccessFlag(boolean flag): Sets the flag indicating whether customer login was successful.

getCustomer(): Returns the Customer instance.

evaluateClientCred(String username, String password): Evaluates customer credentials and sets customer data if login is successful.

getCustomersByAdvisor(int ID): Retrieves a list of customers associated with the specified advisor ID.

getClaimsByClient(int ID): Retrieves a list of claims associated with the specified client ID.

getClaimsByAdvisor(int ID): Retrieves a list of claims associated with the specified advisor ID.

getCustomerList(): Returns the list of customers.

getAdvisorLoginSuccessFlag(): Returns the flag indicating whether advisor login was successful.

setAdvisorLoginSuccessFlag(boolean flag): Sets the flag indicating whether advisor login was successful.

getAdvisor(): Returns the Advisor instance.

evaluateAdvisorCred(String username, String password): Evaluates advisor credentials and sets advisor data if login is successful.

getAdminLoginSuccessFlag(): Returns the flag indicating whether admin login was successful.

setAdminLoginSuccessFlag(boolean flag): Sets the flag indicating whether admin login was successful.

getAdmin(): Returns the Admin instance.

evaluateAdminCred(String username, String password): Evaluates admin credentials and sets admin data if login is successful.

Usage Notes:

This class serves as the model in the MVC architecture, managing data and business logic. It provides methods for handling customer, advisor, and admin login, retrieving data from the database, and maintaining login state flags.```

Clone this wiki locally