use of com.bigcrowd.noticeBoard.entities.Person in project Notice-Board by FulvioFPimentel.
the class PersonService method savePerson.
@Transactional
public PersonAllDTO savePerson(PersonSaveDTO dto) {
Person person = new Person();
person.setName(dto.getName());
person.setCellPhone(dto.getCellPhone());
person.setPassword(passwordEncoder.encode(dto.getPassword()));
Role role = roleRepository.getById(3L);
person.getRoles().add(role);
person = personRepository.saveAndFlush(person);
return new PersonAllDTO(person, person.getRoles());
}
use of com.bigcrowd.noticeBoard.entities.Person in project Notice-Board by FulvioFPimentel.
the class PersonService method updatePerson.
public PersonSaveDTO updatePerson(Long id, PersonSaveDTO dto) {
Person person = personRepository.getById(id);
person.setName(dto.getName());
person.setCellPhone(dto.getCellPhone());
person.setPassword(passwordEncoder.encode(dto.getPassword()));
person = personRepository.saveAndFlush(person);
return new PersonSaveDTO(person);
}
use of com.bigcrowd.noticeBoard.entities.Person in project Notice-Board by FulvioFPimentel.
the class PersonService method findById.
@Transactional(readOnly = true)
public PersonDesignationsDTO findById(Long id) {
Optional<Person> obj = personRepository.findById(id);
Person person = obj.get();
List<Designation> designations = designationRepository.findAllByPerson(person);
return new PersonDesignationsDTO(person, designations);
}
use of com.bigcrowd.noticeBoard.entities.Person in project Notice-Board by FulvioFPimentel.
the class SupportService method update.
@Transactional
public SupportSaveDTO update(Long id, SupportSaveDTO dto) {
Support support = supportRepository.getById(id);
support.setMeeting(support.getMeeting());
for (DesignationSaveDTO desig : dto.getDesignations()) {
Designation designation = designationRepository.getById(desig.getId());
Assignment assignment = assignmentRepository.getById(desig.getAssignment().getId());
Person person = personRepository.getById(desig.getPerson().getId());
designation.setAssignment(assignment);
designation.setPerson(person);
designation = designationRepository.saveAndFlush(designation);
support.getDesignations().add(designation);
}
support = supportRepository.saveAndFlush(support);
return new SupportSaveDTO(support, support.getDesignations());
}
use of com.bigcrowd.noticeBoard.entities.Person 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