Class Staff
java.lang.Object
csce331.group13.project2.backend.Staff
Singleton class that manages the in-memory staff cache.
Provides methods to add and update employee records.
- Author:
- Varish Kongara, Austin Glander
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a new employee to the system.static StaffReturns the singleton instance of the Staff class.booleanupdateStaff(Employee employee) Updates an existing employee's information in the database.
-
Field Details
-
employees
-
-
Method Details
-
getInstance
Returns the singleton instance of the Staff class. Ensures only one instance is ever created.- Returns:
- The single Staff instance.
-
updateStaff
Updates an existing employee's information in the database.- Parameters:
employee- The Employee object with updated values.- Returns:
- true if the update was successful; false otherwise.
-
addStaff
Adds a new employee to the system. The employee is first inserted into the database, and if successful, the employee is added to the in-memory list.- Parameters:
employee- The new employee to add.- Returns:
- true if successfully added to both DB and memory; false otherwise.
-