Search in sources :

Example 1 with CoreAndPersonDto

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;
}
Also used : CoreAndPersonDto(de.symeda.sormas.api.caze.CoreAndPersonDto) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) PersonDto(de.symeda.sormas.api.person.PersonDto) CoreAndPersonDto(de.symeda.sormas.api.caze.CoreAndPersonDto) CasePersonDto(de.symeda.sormas.api.caze.CasePersonDto) RolesAllowed(javax.annotation.security.RolesAllowed)

Example 2 with CoreAndPersonDto

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;
}
Also used : CoreAndPersonDto(de.symeda.sormas.api.caze.CoreAndPersonDto) PersonDto(de.symeda.sormas.api.person.PersonDto) CoreAndPersonDto(de.symeda.sormas.api.caze.CoreAndPersonDto) DashboardContactDto(de.symeda.sormas.api.dashboard.DashboardContactDto) SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) MapContactDto(de.symeda.sormas.api.contact.MapContactDto) ContactDto(de.symeda.sormas.api.contact.ContactDto) RolesAllowed(javax.annotation.security.RolesAllowed)

Aggregations

CoreAndPersonDto (de.symeda.sormas.api.caze.CoreAndPersonDto)2 PersonDto (de.symeda.sormas.api.person.PersonDto)2 RolesAllowed (javax.annotation.security.RolesAllowed)2 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)1 CasePersonDto (de.symeda.sormas.api.caze.CasePersonDto)1 ContactDto (de.symeda.sormas.api.contact.ContactDto)1 MapContactDto (de.symeda.sormas.api.contact.MapContactDto)1 SimilarContactDto (de.symeda.sormas.api.contact.SimilarContactDto)1 DashboardContactDto (de.symeda.sormas.api.dashboard.DashboardContactDto)1