Search in sources :

Example 6 with Assignment

use of com.bigcrowd.noticeBoard.entities.Assignment 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());
}
Also used : Assignment(com.bigcrowd.noticeBoard.entities.Assignment) Designation(com.bigcrowd.noticeBoard.entities.Designation) DesignationSaveDTO(com.bigcrowd.noticeBoard.dto.savesDTO.DesignationSaveDTO) Support(com.bigcrowd.noticeBoard.entities.Support) Meeting(com.bigcrowd.noticeBoard.entities.Meeting) SupportDTO(com.bigcrowd.noticeBoard.dto.SupportDTO) Person(com.bigcrowd.noticeBoard.entities.Person) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Assignment (com.bigcrowd.noticeBoard.entities.Assignment)6 Transactional (org.springframework.transaction.annotation.Transactional)6 DesignationSaveDTO (com.bigcrowd.noticeBoard.dto.savesDTO.DesignationSaveDTO)4 Designation (com.bigcrowd.noticeBoard.entities.Designation)4 Person (com.bigcrowd.noticeBoard.entities.Person)4 Meeting (com.bigcrowd.noticeBoard.entities.Meeting)3 AssignmentInfoDTO (com.bigcrowd.noticeBoard.dto.AssignmentInfoDTO)2 CanticleSaveDTO (com.bigcrowd.noticeBoard.dto.savesDTO.CanticleSaveDTO)2 MeetingSaveDTO (com.bigcrowd.noticeBoard.dto.savesDTO.MeetingSaveDTO)2 PrayerSaveDTO (com.bigcrowd.noticeBoard.dto.savesDTO.PrayerSaveDTO)2 SessionSaveDTO (com.bigcrowd.noticeBoard.dto.savesDTO.SessionSaveDTO)2 SubSessionSaveDTO (com.bigcrowd.noticeBoard.dto.savesDTO.SubSessionSaveDTO)2 Canticle (com.bigcrowd.noticeBoard.entities.Canticle)2 Prayer (com.bigcrowd.noticeBoard.entities.Prayer)2 Presidency (com.bigcrowd.noticeBoard.entities.Presidency)2 Segmentation (com.bigcrowd.noticeBoard.entities.Segmentation)2 Session (com.bigcrowd.noticeBoard.entities.Session)2 SubSession (com.bigcrowd.noticeBoard.entities.SubSession)2 Support (com.bigcrowd.noticeBoard.entities.Support)2 SupportDTO (com.bigcrowd.noticeBoard.dto.SupportDTO)1