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 Department convert(DepartmentResponse department) { Department result = new Department(); result.setId(department.getId()); result.setName(department.getName()); result.setDescription(department.getDescription()); if (department.getDirector() != null) { result.setDirector(EmployeeResponseConverter.convert(department.getDirector())); } for (EmployeeResponse employeeResponse : department.getEmployees()) { result.addEmployee(EmployeeResponseConverter.convert(employeeResponse)); } return result; }