use of de.symeda.sormas.api.caze.CoreAndPersonDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjb method save.
@Override
@RolesAllowed({ UserRight._CASE_CREATE, UserRight._CASE_EDIT })
public CoreAndPersonDto<CaseDataDto> save(@Valid @NotNull CoreAndPersonDto<CaseDataDto> coreAndPersonDto) throws ValidationRuntimeException {
CaseDataDto caseDto = coreAndPersonDto.getCoreData();
CoreAndPersonDto savedCoreAndPersonDto = new CoreAndPersonDto();
if (coreAndPersonDto.getPerson() != null) {
PersonDto newlyCreatedPersonDto = personFacade.savePerson(coreAndPersonDto.getPerson());
caseDto.setPerson(newlyCreatedPersonDto.toReference());
savedCoreAndPersonDto.setPerson(newlyCreatedPersonDto);
}
CaseDataDto savedCaseData = save(caseDto, true, true, true, false);
savedCoreAndPersonDto.setCoreData(savedCaseData);
return savedCoreAndPersonDto;
}
use of de.symeda.sormas.api.caze.CoreAndPersonDto in project SORMAS-Project by hzi-braunschweig.
the class ContactFacadeEjb method save.
@RolesAllowed({ UserRight._CONTACT_CREATE, UserRight._CONTACT_EDIT })
public CoreAndPersonDto<ContactDto> save(@Valid @NotNull CoreAndPersonDto<ContactDto> coreAndPersonDto) throws ValidationRuntimeException {
ContactDto contactDto = coreAndPersonDto.getCoreData();
CoreAndPersonDto savedCoreAndPersonDto = new CoreAndPersonDto();
if (coreAndPersonDto.getPerson() != null) {
PersonDto newlyCreatedPersonDto = personFacade.savePerson(coreAndPersonDto.getPerson());
contactDto.setPerson(newlyCreatedPersonDto.toReference());
savedCoreAndPersonDto.setPerson(newlyCreatedPersonDto);
}
ContactDto savedContactData = save(contactDto, true, true, true, false);
savedCoreAndPersonDto.setCoreData(savedContactData);
return savedCoreAndPersonDto;
}
Aggregations