|
14 | 14 | */ |
15 | 15 | public interface DataRepository { |
16 | 16 |
|
17 | | - // companies |
| 17 | + // Companies |
18 | 18 |
|
| 19 | + /** |
| 20 | + * @param pid Primary key of the company record to be found |
| 21 | + * @return Should return full record of the Company record identified by pid |
| 22 | + */ |
19 | 23 | Company findCompany(Integer pid); |
20 | 24 |
|
| 25 | + /** |
| 26 | + * @param pid Primary key of the company record to be found |
| 27 | + * @return Should return full record of the Company record identified by pid. A static (non-prepared) statement should be used for that. |
| 28 | + */ |
21 | 29 | Company findCompanyUsingSimpleStaticStatement(Integer pid); |
22 | 30 |
|
23 | | - // departments |
24 | 31 |
|
| 32 | + |
| 33 | + // Departments |
| 34 | + |
| 35 | + /** |
| 36 | + * @param pid Primary key of the Department record to be found |
| 37 | + * @return Should return full record of the Department record identified by pid |
| 38 | + */ |
25 | 39 | Department findDepartment(Integer pid); |
26 | 40 |
|
| 41 | + /** |
| 42 | + * Should return full records of all Departments assigned to the Company (passed in as parameter). |
| 43 | + * @param company Full Company record |
| 44 | + * @return List of Departments |
| 45 | + */ |
27 | 46 | List<Department> findDepartmentsOfCompany(Company company); |
28 | 47 |
|
| 48 | + /** |
| 49 | + * Should immediately delete Departments passed in as parameter from database. Should do it in most efficient way (preferably as batch operation). |
| 50 | + * We expect that the deletions were already performed in database upon return from this method. |
| 51 | + * |
| 52 | + * @param departmentsToDelete Full records of Departments to be deleted |
| 53 | + */ |
29 | 54 | void deleteDepartments(List<Department> departmentsToDelete); |
30 | 55 |
|
| 56 | + /** |
| 57 | + * Should immediately update Department records passed in as parameter. Should do it in most efficient way (preferably as batch operation). |
| 58 | + * We expect that the updates were already performed in database upon return from this method (meaning all required SQL statements were already |
| 59 | + * executed and are not deferred to a later time). |
| 60 | + * |
| 61 | + * @param departmentsToUpdate Full records of Departments to be updated. Update all fields of Department, identified by Department.getPid() |
| 62 | + */ |
31 | 63 | void updateDepartments(List<Department> departmentsToUpdate); |
32 | 64 |
|
| 65 | + /** |
| 66 | + * Should immediately insert Department records passed in as parameter. Should do it in most efficient way (preferably as batch operation). |
| 67 | + * We expect that the inserts were already performed in database upon return from this method (meaning all required SQL statements were already |
| 68 | + * executed and are not deferred to a later time). |
| 69 | + * |
| 70 | + * @param departmentsToInsert Full records of Departments to be inserted. Records should have getPid()==null |
| 71 | + */ |
33 | 72 | void insertDepartments(List<Department> departmentsToInsert); |
34 | 73 |
|
35 | | - // projects |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + // Projects |
36 | 78 |
|
37 | 79 | /** |
38 | 80 | * Insert project and return PID of newly created item |
| 81 | + * |
39 | 82 | * @param project Project to be inserted |
40 | 83 | * @return PID of new record in database |
41 | 84 | */ |
42 | 85 | Integer insertProject(Project project); |
43 | 86 |
|
44 | 87 | /** |
45 | | - * Insert projects and return all PIDs of newly created records. |
| 88 | + * Should immediately insert Project records passed in as parameter. Should do it in most efficient way (preferably as batch operation). |
| 89 | + * We expect that the inserts were already performed in database upon return from this method (meaning all required SQL statements were already |
| 90 | + * executed and are not deferred to a later time). |
| 91 | + * |
46 | 92 | * @param projects New projects to insert |
47 | 93 | * @return List of PIDs of newly created records. |
48 | 94 | */ |
49 | 95 | List<Integer> insertProjects(List<Project> projects); |
50 | 96 |
|
| 97 | + /** |
| 98 | + * Execute following query: get all projects, where the total cost of the project per month is greater than parameter totalCostBoundary. In the same result set |
| 99 | + * get all companies participating on such project along with cost of the project for the company. |
| 100 | + */ |
51 | 101 | List<ProjectsWithCostsGreaterThanOutput> getProjectsWithCostsGreaterThan(int totalCostBoundary); |
52 | 102 |
|
53 | | - // employees |
54 | 103 |
|
| 104 | + |
| 105 | + // Employees |
| 106 | + |
| 107 | + /** |
| 108 | + * @param pid Primary key of the employee record to be found |
| 109 | + * @return Should return full record of the Employee record identified by pid |
| 110 | + */ |
55 | 111 | Employee findEmployee(Integer pid); |
56 | 112 |
|
| 113 | + |
| 114 | + /** |
| 115 | + * Execute following query and return all Employee records satisfying following condition: salary of the employee |
| 116 | + * is greater than parameter minSalary |
| 117 | + */ |
57 | 118 | List<Employee> employeesWithSalaryGreaterThan(Integer minSalary); |
58 | 119 |
|
| 120 | + |
| 121 | + /** |
| 122 | + * Should immediately update Employee record passed in as parameter. Should do it in most efficient way. |
| 123 | + * We expect that the update was already performed in database upon return from this method (meaning SQL statement was already |
| 124 | + * executed and is not deferred to a later time). |
| 125 | + * |
| 126 | + * @param employeeToUpdate Full records of Employee to be updated. Update all fields of Employee, identified by Employee.getPid() |
| 127 | + */ |
59 | 128 | void updateEmployee(Employee employeeToUpdate); |
60 | 129 |
|
| 130 | + |
| 131 | + /** |
| 132 | + * Register new employee and create company and department if required - use stored procedure register_employee (see register_employee.sql) |
| 133 | + * to perform the operation. |
| 134 | + * |
| 135 | + * @return Newly created PIDs of records (output of the stored procedure) |
| 136 | + */ |
61 | 137 | RegisterEmployeeOutput callRegisterEmployee(String name, String surname, String email, BigDecimal salary, |
62 | 138 | String departmentName, String companyName); |
63 | 139 |
|
| 140 | + /** |
| 141 | + * @return Return count of records in Project table |
| 142 | + */ |
64 | 143 | Integer getProjectsCount(); |
65 | 144 | } |
0 commit comments