-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployeeMgr.java
58 lines (53 loc) · 1.54 KB
/
EmployeeMgr.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* A manager class that handles the Employee Entities: assigns employees and removes
* assigned employee from tables
*
* @author Rahul
*
*/
public class EmployeeMgr {
/**
* An ArrayList that contains unassigned employees, continuously updated
*/
private static EmployeeCollection Staff = new EmployeeCollection();
/**
* reads employees from a file to the Staff ArrayList
*
* @throws FileNotFoundException
* @throws IOException
* @throws ClassNotFoundException
*/
public static void readEmployees() throws ClassNotFoundException {
Staff.readEmployees();
}
/**
* Writes an employee into the file of saved employees
*
* @param employee that is to be written into file
* @throws FileNotFoundException
* @throws IOException
*/
public static void writeEmployee(Employee employee) throws FileNotFoundException, IOException {
Staff.writeEmployee(employee);
}
/**
* Assigns an employee to a table when an order is to be created, also removes
* it from the ArrayList
*
* @return employee that has been assigned to the table
*/
public static Employee assignEmployee() {
return Staff.assignEmployee();
}
/**
* Removes assigned employee from table after invoice has been generated, also
* adds the employee back to the ArrayList
*
* @param E employee that is to be unassigned from the table
*/
public static void unassignEmployee(Employee E) {
Staff.unassignEmployee(E);
}
}