private SchoolDto createSchool(final EducationHistory log) { School school = log.getSchool(); if (school != null) { return new SchoolDto(school.getId()).withName(school.getName()); } else { return null; } }
public EducationHistory toLog(EducationDto dto) { EducationHistory log = new EducationHistory(); log.setVersion(dto.getVersion()); log.setId(dto.getId()); log.setCourse(dto.getCourse()); log.setEducationStatus(dto.getEducationalStatus()); log.setStartDate(dto.getDate()); log.setStudentId(dto.getStudentId()); log.setSecondaryLevel1(dto.getSecondaryEducationStatus1()); log.setSecondaryLevel2(dto.getSecondaryEducationStatus2()); log.setYear(dto.getYear()); log.setComments(dto.getComments()); log.setPredictedEndDate(dto.getPredictedEndDate()); return log; }
public EducationDto toDto(EducationHistory log) { EducationDto dto = new EducationDto() .withId(log.getId()) .withVersion(log.getVersion()) .withCourse(log.getCourse()) .withSecondaryStatus1(log.getSecondaryLevel1()) .withSecondaryStatus2(log.getSecondaryLevel2()) .withStudentId(log.getStudentId()) .withInstitution(createSchool(log)) .withEducationalStatus(log.getEducationStatus()) .withYear(log.getYear()) .withEducationDate(log.getStartDate()) .withComments(log.getComments()) .withPredictedEndDate(log.getPredictedEndDate()); return dto; }