public static DepartmentResponse convertNameInfo(Department department) { DepartmentResponse result = new DepartmentResponse(); result.setId(department.getId()); result.setName(department.getName()); result.setDescription(department.getDescription()); return result; }
public static DepartmentResponse convert(Department department) { DepartmentResponse result = new DepartmentResponse(); result.setId(department.getId()); result.setName(department.getName()); result.setDescription(department.getDescription()); if (department.getDirector() != null) { result.setDirector(EmployeeResponseConverter.convertNameInfo(department.getDirector())); } for (Employee employee : department.getEmployees()) { result.addEmployee(EmployeeResponseConverter.convertNameInfo(employee)); } return result; }