/** Определяет есть ли активные Project Manager у сотрудника */ @Transactional(readOnly = true) public Boolean hasActiveManagerEmployee(Employee employee) { List<ProjectManager> empProjectManagers = projectManagerDAO.findByEmployee(employee); for (ProjectManager manager : empProjectManagers) { if (manager.isActive()) return true; } return false; }
public void deactivateEmployeesRights(List<Employee> employees) { for (Employee employee : employees) { List<ProjectManager> empProjectManagers = projectManagerDAO.findByEmployee(employee); if (empProjectManagers != null) { for (ProjectManager manager : empProjectManagers) { manager.setActive(false); projectManagerDAO.save(manager); } } } }