use of com.bigcrowd.noticeBoard.entities.Designation in project Notice-Board by FulvioFPimentel.
the class SupportService method saveSupport.
@Transactional
public SupportDTO saveSupport(SupportSaveDTO dto) {
Meeting meeting = meetingRepository.getById(dto.getMeetingId());
Support support = new Support();
support.setMeeting(meeting);
for (DesignationSaveDTO desg : dto.getDesignations()) {
Assignment Assignment = assignmentRepository.getById(desg.getAssignment().getId());
Person person = personRepository.getById(desg.getPerson().getId());
Designation designation = new Designation();
designation.setAssignment(Assignment);
designation.setPerson(person);
designation = designationRepository.saveAndFlush(designation);
support.getDesignations().add(designation);
}
support = supportRepository.saveAndFlush(support);
return new SupportDTO(support, support.getDesignations());
}
Aggregations