Package sc2002.repositories
Class StaffDB
java.lang.Object
sc2002.repositories.StaffDB
Represents the database for managing staff records, including adding, updating,
retrieving, and removing staff members.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a new staff member to the Staff and User databases.static intFinds if a staff member exists in the database.getStaff(StaffFilter selectedFilter) Retrieves a list of staff members filtered by the specified criteria.static voidremoveStaff(String staffID) Removes a staff member from both the Staff and User databases.static voidupdateStaff(String staffID, Staff updatedStaff) Updates an existing staff member's information in the database.
-
Constructor Details
-
StaffDB
public StaffDB()
-
-
Method Details
-
getStaff
Retrieves a list of staff members filtered by the specified criteria.- Parameters:
selectedFilter- The filter criteria to apply to the staff records.- Returns:
- A list of staff members that match the filter criteria.
- Throws:
IOException- If there is an issue reading the file.
-
addStaff
Adds a new staff member to the Staff and User databases.- Parameters:
newStaff- The staff member to add.- Throws:
IOException- If there is an issue writing to the file.
-
updateStaff
Updates an existing staff member's information in the database.- Parameters:
staffID- The ID of the staff member to update.updatedStaff- The updated staff details.- Throws:
IOException- If there is an issue updating the file.
-
removeStaff
Removes a staff member from both the Staff and User databases.- Parameters:
staffID- The ID of the staff member to remove.- Throws:
IOException- If there is an issue updating the file.
-
findStaff
Finds if a staff member exists in the database.- Parameters:
staffID- The ID of the staff member.- Returns:
- 1 if the staff member exists; otherwise, 0.
-