use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class WorkdaysCalendarsBeanTest method testGetWorkdaysCalendarsByDepartments_whenNotNull.
@Test
public void testGetWorkdaysCalendarsByDepartments_whenNotNull() throws NoSuchFieldException {
Map<String, WorkdaysCalendar> calendarMap = new HashMap<>();
calendarMap.put("Dept1", new WorkdaysCalendar("aa"));
calendarMap.put("Dept2", new WorkdaysCalendar("bb"));
setField(bean, "workdaysCalendarsByDepartments", calendarMap);
Map<String, WorkdaysCalendar> actual = bean.getWorkdaysCalendarsByDepartments();
assertEquals(calendarMap, actual);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class WorkdaysCalendarsBeanTest method testSaveCalendarsByDepartments.
@Test
public void testSaveCalendarsByDepartments() throws NoSuchFieldException {
List<String> departments = Arrays.asList("Dept1", "Dept2");
Map<String, WorkdaysCalendar> calendarMap = new HashMap<>();
WorkdaysCalendar calendar = new WorkdaysCalendar("Cal1");
calendarMap.put("Dept1", calendar);
calendarMap.put("Dept2", null);
setField(bean, "departments", departments);
setField(bean, "workdaysCalendarsByDepartments", calendarMap);
departmentService.setCalendarToDepartment("Dept1", calendar);
departmentService.setCalendarToDepartment("Dept2", null);
replay(departmentService);
bean.save();
verify(departmentService);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class EmployeesBeanTest method testFilterByCalendar_valueNull_filterNotNull_filterEmpty.
@Test
public void testFilterByCalendar_valueNull_filterNotNull_filterEmpty() throws NoSuchFieldException {
WorkdaysCalendar calendar = new WorkdaysCalendar("calendar1");
setField(calendar, "id", 1L);
boolean actual = bean.filterByCalendar(null, Collections.emptyList(), null);
assertTrue(actual);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class DepartmentService method setCalendarToDepartment.
@RolesAllowed({ EXEC_ROLE, OFFICE_MANAGER })
public void setCalendarToDepartment(String department, WorkdaysCalendar newCalendar) {
WorkdaysCalendar currentCalendar = workdaysCalendarRepository.findByDepartment(department);
changeDepartmentCalendar(department, newCalendar, currentCalendar);
changeEmployeesCalendar(department, newCalendar, currentCalendar);
}
use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.
the class KeycloakAdapter method createEmployee.
Employee createEmployee(UserInfo userInfo) {
Employee employee = new Employee(userInfo.getUsername(), userInfo.getFirstName(), userInfo.getLastName(), userInfo.getEmail(), userInfo.getDepartment());
WorkdaysCalendar calendar = workdaysCalendarRepository.findDefaultCalendar(employee.getDepartment());
employee.setCalendar(calendar);
return employee;
}
Aggregations