use of de.symeda.sormas.api.location.LocationDto in project SORMAS-Project by hzi-braunschweig.
the class QuarantineOrderFacadeEjbTest method setup.
@Before
public void setup() throws URISyntaxException {
TestDataCreator.RDCF rdcf = creator.createRDCF("Region", "District", "Community", "Facility", "PointOfEntry");
UserDto userDto = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
loginWith(userDto);
quarantineOrderFacadeEjb = getQuarantineOrderFacade();
reset();
LocationDto locationDto = new LocationDto();
locationDto.setStreet("Nauwieserstraße");
locationDto.setHouseNumber("7");
locationDto.setCity("Saarbrücken");
locationDto.setPostalCode("66111");
PersonDto personDto = PersonDto.build();
personDto.setFirstName("Guy");
personDto.setLastName("Debord");
personDto.setSex(Sex.UNKNOWN);
personDto.setBirthdateYYYY(1931);
personDto.setBirthdateMM(12);
personDto.setBirthdateDD(28);
personDto.setAddress(locationDto);
personDto.setPhone("+49 681 1234");
getPersonFacade().savePerson(personDto);
caseDataDto = creator.createCase(userDto.toReference(), rdcf, (c) -> {
c.setDisease(Disease.CORONAVIRUS);
c.setPerson(personDto.toReference());
c.setQuarantineFrom(parseDate("10/09/2020"));
c.setQuarantineTo(parseDate("24/09/2020"));
c.setQuarantineOrderedOfficialDocumentDate(parseDate("09/09/2020"));
});
contactDto = creator.createContact(userDto.toReference(), personDto.toReference());
contactDto.setCaze(caseDataDto.toReference());
contactDto.setQuarantineFrom(parseDate("10/09/2020"));
contactDto.setQuarantineTo(parseDate("24/09/2020"));
contactDto.setQuarantineOrderedOfficialDocumentDate(parseDate("09/09/2020"));
getContactFacade().save(contactDto);
eventDto = creator.createEvent(userDto.toReference());
eventDto.setEventTitle("An event");
getEventFacade().save(eventDto);
eventParticipantDto = creator.createEventParticipant(eventDto.toReference(), personDto, "participated", userDto.toReference());
sampleDto = SampleDto.build(userDto.toReference(), caseDataDto.toReference());
sampleDto.setSampleDateTime(parseDate("11/09/2020"));
sampleDto.setSampleMaterial(SampleMaterial.NASAL_SWAB);
sampleDto.setPathogenTestResult(PathogenTestResultType.NEGATIVE);
sampleDto.setSamplePurpose(SamplePurpose.EXTERNAL);
sampleDto = getSampleFacade().saveSample(sampleDto);
pathogenTestDto = PathogenTestDto.build(sampleDto.toReference(), userDto.toReference());
pathogenTestDto.setTestDateTime(parseDate("12/09/2020"));
pathogenTestDto.setTestedDisease(Disease.CORONAVIRUS);
pathogenTestDto.setTestResult(PathogenTestResultType.POSITIVE);
pathogenTestDto.setTestResultVerified(false);
pathogenTestDto.setTestType(PathogenTestType.ANTIBODY_DETECTION);
pathogenTestDto = getPathogenTestFacade().savePathogenTest(pathogenTestDto);
travelEntryDto = TravelEntryDto.build(personDto.toReference());
travelEntryDto.setUuid("VQCJU2-DZPOBO-7FWMLV-G3F3SACI");
travelEntryDto.setReportDate(parseDate("09/01/2021"));
travelEntryDto.setReportingUser(userDto.toReference());
travelEntryDto.setDateOfArrival(new Date());
travelEntryDto.setPointOfEntry(rdcf.pointOfEntry);
// To survive validation:
travelEntryDto.setDisease(Disease.CORONAVIRUS);
travelEntryDto.setResponsibleRegion(rdcf.region);
travelEntryDto.setResponsibleDistrict(rdcf.district);
travelEntryDto = getTravelEntryFacade().save(travelEntryDto);
}
use of de.symeda.sormas.api.location.LocationDto in project SORMAS-Project by hzi-braunschweig.
the class EpiDataPseudonymizationTest method createCaseWEpiData.
private CaseDataDto createCaseWEpiData(UserDto user, TestDataCreator.RDCF rdcf) {
CaseDataDto caze = creator.createCase(user.toReference(), rdcf, c -> {
EpiDataDto epiData = c.getEpiData();
ExposureDto exposure = ExposureDto.build(ExposureType.ANIMAL_CONTACT);
exposure.setAnimalCondition(AnimalCondition.DEAD);
exposure.setDescription("Test description");
exposure.getLocation().setDetails("Test location details");
epiData.getExposures().add(exposure);
ExposureDto exposure2 = ExposureDto.build(ExposureType.ANIMAL_CONTACT);
exposure2.setTypeOfAnimal(TypeOfAnimal.OTHER);
exposure2.setTypeOfAnimalDetails("Test other animal details");
epiData.getExposures().add(exposure2);
ExposureDto exposure3 = ExposureDto.build(ExposureType.TRAVEL);
exposure3.setBodyOfWater(YesNoUnknown.YES);
exposure3.setWaterSource(WaterSource.OTHER);
exposure3.setWaterSourceDetails("Test water source details");
epiData.getExposures().add(exposure3);
ExposureDto exposure4 = ExposureDto.build(ExposureType.ANIMAL_CONTACT);
exposure4.setAnimalContactType(AnimalContactType.OTHER);
exposure4.setAnimalContactTypeDetails("Test animal contact type details");
epiData.getExposures().add(exposure4);
ExposureDto burial = ExposureDto.build(ExposureType.BURIAL);
burial.setDeceasedPersonName("John Smith");
burial.setDeceasedPersonRelation("Test burial relation");
LocationDto address = new LocationDto();
address.setRegion(rdcf.region);
address.setDistrict(rdcf.district);
address.setCommunity(rdcf.community);
address.setCity("Test City");
burial.setLocation(address);
epiData.getExposures().add(burial);
ExposureDto travel = ExposureDto.build(ExposureType.TRAVEL);
travel.getLocation().setDetails("Test travel destination");
epiData.getExposures().add(travel);
ExposureDto gathering = ExposureDto.build(ExposureType.GATHERING);
gathering.setLocation(address);
gathering.setDescription("Test gathering description");
epiData.getExposures().add(gathering);
});
return caze;
}
use of de.symeda.sormas.api.location.LocationDto in project SORMAS-Project by hzi-braunschweig.
the class EpiDataPseudonymizationTest method getEpiDataInJurisdiction.
@Test
public void getEpiDataInJurisdiction() {
CaseDataDto caseWEpiData = createCaseWEpiData(user2, rdcf2);
CaseDataDto savedCase = getCaseFacade().getCaseDataByUuid(caseWEpiData.getUuid());
EpiDataDto epiData = savedCase.getEpiData();
assertThat(epiData.getExposures().get(0).getDescription(), is("Test description"));
assertThat(epiData.getExposures().get(0).getLocation().getDetails(), is("Test location details"));
assertThat(epiData.getExposures().get(1).getTypeOfAnimalDetails(), is("Test other animal details"));
assertThat(epiData.getExposures().get(2).getWaterSourceDetails(), is("Test water source details"));
assertThat(epiData.getExposures().get(3).getAnimalContactTypeDetails(), is("Test animal contact type details"));
ExposureDto burial = epiData.getExposures().get(4);
assertThat(burial.getDeceasedPersonName(), is("John Smith"));
assertThat(burial.getDeceasedPersonRelation(), is("Test burial relation"));
LocationDto burialAddress = burial.getLocation();
assertThat(burialAddress.getCommunity(), is(rdcf2.community));
assertThat(burialAddress.getCity(), is("Test City"));
ExposureDto travel = epiData.getExposures().get(5);
assertThat(travel.getLocation().getDetails(), is("Test travel destination"));
ExposureDto gathering = epiData.getExposures().get(6);
assertThat(gathering.getDescription(), is("Test gathering description"));
LocationDto gatheringAddress = gathering.getLocation();
assertThat(gatheringAddress.getCommunity(), is(rdcf2.community));
assertThat(gatheringAddress.getCity(), is("Test City"));
}
use of de.symeda.sormas.api.location.LocationDto in project SORMAS-Project by hzi-braunschweig.
the class LocationsField method createEntry.
@Override
protected LocationDto createEntry() {
LocationDto location = LocationDto.build();
location.setCountry(FacadeProvider.getCountryFacade().getServerCountry());
return location;
}
use of de.symeda.sormas.api.location.LocationDto in project SORMAS-Project by hzi-braunschweig.
the class LocationsField method updateColumns.
@Override
protected void updateColumns() {
Table table = getTable();
table.addGeneratedColumn(STREET, (Table.ColumnGenerator) (source, itemId, columnId) -> {
LocationDto locationDto = (LocationDto) itemId;
if (!locationDto.isPseudonymized()) {
StringBuilder streetBuilder = new StringBuilder();
streetBuilder.append(locationDto.getStreet() != null ? locationDto.getStreet() + " " : "");
streetBuilder.append(locationDto.getHouseNumber() != null ? locationDto.getHouseNumber() : "");
return streetBuilder.toString();
} else {
return I18nProperties.getCaption(Captions.inaccessibleValue);
}
});
table.setVisibleColumns(EDIT_COLUMN_ID, LocationDto.ADDRESS_TYPE, STREET, LocationDto.CITY, LocationDto.POSTAL_CODE, LocationDto.DISTRICT, LocationDto.COMMUNITY);
table.setColumnExpandRatio(EDIT_COLUMN_ID, 0);
table.setColumnExpandRatio(LocationDto.ADDRESS_TYPE, 0);
table.setColumnExpandRatio(STREET, 0);
table.setColumnExpandRatio(LocationDto.CITY, 0);
table.setColumnExpandRatio(LocationDto.POSTAL_CODE, 0);
table.setColumnExpandRatio(LocationDto.DISTRICT, 0);
table.setColumnExpandRatio(LocationDto.COMMUNITY, 0);
for (Object columnId : table.getVisibleColumns()) {
if (columnId.equals(EDIT_COLUMN_ID)) {
table.setColumnHeader(columnId, " ");
} else {
table.setColumnHeader(columnId, I18nProperties.getPrefixCaption(LocationDto.I18N_PREFIX, (String) columnId));
}
}
}
Aggregations