use of de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseDto in project SORMAS-Project by hzi-braunschweig.
the class CaseShareDataBuilder method doBuildShareData.
@Override
protected SormasToSormasCaseDto doBuildShareData(Case caze, ShareRequestInfo requestInfo) {
Pseudonymizer pseudonymizer = dataBuilderHelper.createPseudonymizer(requestInfo.isPseudonymizedPersonalData(), requestInfo.isPseudonymizedSensitiveData());
PersonDto personDto = dataBuilderHelper.getPersonDto(caze.getPerson(), pseudonymizer, requestInfo.isPseudonymizedPersonalData(), requestInfo.isPseudonymizedSensitiveData());
CaseDataDto cazeDto = getCazeDto(caze, pseudonymizer);
dataBuilderHelper.clearIgnoredProperties(cazeDto);
return new SormasToSormasCaseDto(personDto, cazeDto);
}
use of de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseDto in project SORMAS-Project by hzi-braunschweig.
the class SormasToSormasCaseFacadeEjbTest method testSaveSharedCaseWithContacts.
@Test
public void testSaveSharedCaseWithContacts() throws SormasToSormasException, SormasToSormasValidationException {
PersonDto person = createPersonDto(rdcf);
CaseDataDto caze = createRemoteCaseDto(rdcf, person);
ContactDto contact = createRemoteContactDto(rdcf, caze);
PersonDto contactPerson = createPersonDto(rdcf);
contact.setPerson(contactPerson.toReference());
SormasToSormasDto shareData = new SormasToSormasDto();
shareData.setOriginInfo(createSormasToSormasOriginInfo(DEFAULT_SERVER_ID, false));
shareData.setCases(Collections.singletonList(new SormasToSormasCaseDto(person, caze)));
shareData.setContacts(Collections.singletonList(new SormasToSormasContactDto(contactPerson, contact)));
SormasToSormasEncryptedDataDto encryptedData = encryptShareData(shareData);
getSormasToSormasCaseFacade().saveSharedEntities(encryptedData);
CaseDataDto savedCase = getCaseFacade().getCaseDataByUuid(caze.getUuid());
ContactDto savedContact = getContactFacade().getByUuid(contact.getUuid());
assertThat(savedContact, is(notNullValue()));
assertThat(savedContact.getRegion(), is(rdcf.region));
assertThat(savedContact.getDistrict(), is(rdcf.district));
assertThat(savedContact.getCommunity(), is(rdcf.community));
assertThat(savedCase.getSormasToSormasOriginInfo().getUuid(), is(savedContact.getSormasToSormasOriginInfo().getUuid()));
}
use of de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseDto in project SORMAS-Project by hzi-braunschweig.
the class SormasToSormasCaseFacadeEjbTest method testSaveSharedPointOfEntryCaseWithInfrastructureExternalId.
@Test
public void testSaveSharedPointOfEntryCaseWithInfrastructureExternalId() throws SormasToSormasException, SormasToSormasValidationException {
PersonDto person = createPersonDto(rdcf);
CaseDataDto caze = CaseDataDto.build(person.toReference(), Disease.CORONAVIRUS);
caze.setCaseOrigin(CaseOrigin.POINT_OF_ENTRY);
caze.setResponsibleRegion(rdcf.region);
caze.setResponsibleDistrict(rdcf.district);
caze.setResponsibleCommunity(rdcf.community);
caze.setPointOfEntry(rdcf.pointOfEntry);
PortHealthInfoDto portHealthInfo = PortHealthInfoDto.build();
portHealthInfo.setAirlineName("Test Airline");
caze.setPortHealthInfo(portHealthInfo);
SormasToSormasDto shareData = new SormasToSormasDto();
shareData.setOriginInfo(createSormasToSormasOriginInfo(DEFAULT_SERVER_ID, false));
shareData.setCases(Collections.singletonList(new SormasToSormasCaseDto(person, caze)));
SormasToSormasEncryptedDataDto encryptedData = encryptShareData(shareData);
getSormasToSormasCaseFacade().saveSharedEntities(encryptedData);
CaseDataDto savedCase = getCaseFacade().getCaseDataByUuid(caze.getUuid());
assertThat(savedCase.getResponsibleRegion(), is(rdcf.region));
assertThat(savedCase.getResponsibleDistrict(), is(rdcf.district));
assertThat(savedCase.getResponsibleCommunity(), is(rdcf.community));
assertThat(savedCase.getPointOfEntry(), is(rdcf.pointOfEntry));
assertThat(savedCase.getPortHealthInfo().getAirlineName(), is("Test Airline"));
}
use of de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseDto in project SORMAS-Project by hzi-braunschweig.
the class SormasToSormasCaseFacadeEjbTest method testSaveSharedCaseWithInfrastructureExternalId.
@Test
public void testSaveSharedCaseWithInfrastructureExternalId() throws SormasToSormasException, SormasToSormasValidationException {
PersonDto person = createPersonDto(rdcf);
person.setFirstName("James");
person.setLastName("Smith");
CaseDataDto caze = createRemoteCaseDto(rdcf, person);
caze.getHospitalization().setAdmittedToHealthFacility(YesNoUnknown.YES);
caze.getSymptoms().setAgitation(SymptomState.YES);
ExposureDto exposure = ExposureDto.build(ExposureType.ANIMAL_CONTACT);
exposure.setAnimalContactType(AnimalContactType.TOUCH);
caze.getEpiData().getExposures().add(exposure);
caze.getHealthConditions().setAsplenia(YesNoUnknown.YES);
caze.getMaternalHistory().setChildrenNumber(2);
SormasToSormasDto shareData = new SormasToSormasDto();
shareData.setOriginInfo(createSormasToSormasOriginInfo(DEFAULT_SERVER_ID, false));
shareData.setCases(Collections.singletonList(new SormasToSormasCaseDto(person, caze)));
SormasToSormasEncryptedDataDto encryptedData = encryptShareData(shareData);
getSormasToSormasCaseFacade().saveSharedEntities(encryptedData);
CaseDataDto savedCase = getCaseFacade().getCaseDataByUuid(caze.getUuid());
assertThat(savedCase, is(notNullValue()));
assertThat(savedCase.getResponsibleRegion(), is(rdcf.region));
assertThat(savedCase.getResponsibleDistrict(), is(rdcf.district));
assertThat(savedCase.getResponsibleCommunity(), is(rdcf.community));
assertThat(savedCase.getHealthFacility(), is(rdcf.facility));
assertThat(savedCase.getHospitalization().getAdmittedToHealthFacility(), is(YesNoUnknown.YES));
assertThat(savedCase.getSymptoms().getAgitation(), is(SymptomState.YES));
assertThat(savedCase.getEpiData().getExposures().get(0).getAnimalContactType(), is(AnimalContactType.TOUCH));
assertThat(savedCase.getHealthConditions().getAsplenia(), is(YesNoUnknown.YES));
assertThat(savedCase.getMaternalHistory().getChildrenNumber(), is(2));
assertThat(savedCase.getSormasToSormasOriginInfo().getOrganizationId(), is(DEFAULT_SERVER_ID));
assertThat(savedCase.getSormasToSormasOriginInfo().getSenderName(), is("John doe"));
PersonDto savedPerson = getPersonFacade().getPersonByUuid(savedCase.getPerson().getUuid());
assertThat(savedPerson, is(notNullValue()));
assertThat(savedPerson.getAddress().getRegion(), is(rdcf.region));
assertThat(savedPerson.getAddress().getDistrict(), is(rdcf.district));
assertThat(savedPerson.getAddress().getCommunity(), is(rdcf.community));
assertThat(savedPerson.getFirstName(), is("James"));
assertThat(savedPerson.getLastName(), is("Smith"));
}
use of de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseDto in project SORMAS-Project by hzi-braunschweig.
the class SormasToSormasCaseFacadeEjbTest method testSaveSharedCaseWithSamples.
@Test
public void testSaveSharedCaseWithSamples() throws SormasToSormasException, SormasToSormasValidationException {
PersonDto person = createPersonDto(rdcf);
CaseDataDto caze = createRemoteCaseDto(rdcf, person);
SormasToSormasSampleDto sample = createRemoteSampleDtoWithTests(rdcf, caze.toReference(), null);
SormasToSormasDto shareData = new SormasToSormasDto();
shareData.setOriginInfo(createSormasToSormasOriginInfo(DEFAULT_SERVER_ID, false));
shareData.setCases(Collections.singletonList(new SormasToSormasCaseDto(person, caze)));
shareData.setSamples(Collections.singletonList(sample));
SormasToSormasEncryptedDataDto encryptedData = encryptShareData(shareData);
getSormasToSormasCaseFacade().saveSharedEntities(encryptedData);
CaseDataDto savedCase = getCaseFacade().getCaseDataByUuid(caze.getUuid());
SampleDto savedSample = getSampleFacade().getSampleByUuid(sample.getEntity().getUuid());
assertThat(savedSample, is(notNullValue()));
assertThat(savedSample.getLab(), is(rdcf.facility));
assertThat(getPathogenTestFacade().getAllBySample(savedSample.toReference()), hasSize(1));
assertThat(getAdditionalTestFacade().getAllBySample(savedSample.getUuid()), hasSize(1));
assertThat(savedCase.getSormasToSormasOriginInfo().getUuid(), is(savedSample.getSormasToSormasOriginInfo().getUuid()));
}
Aggregations