use of de.symeda.sormas.api.vaccination.VaccinationDto in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationDtoHelper method fillInnerFromAdo.
@Override
protected void fillInnerFromAdo(ImmunizationDto target, Immunization source) {
target.setDisease(source.getDisease());
target.setDiseaseDetails(source.getDiseaseDetails());
if (source.getPerson() != null) {
Person person = DatabaseHelper.getPersonDao().queryForId(source.getPerson().getId());
target.setPerson(PersonDtoHelper.toReferenceDto(person));
}
target.setReportDate(source.getReportDate());
if (source.getReportingUser() != null) {
User user = DatabaseHelper.getUserDao().queryForId(source.getReportingUser().getId());
target.setReportingUser(UserDtoHelper.toReferenceDto(user));
}
target.setArchived(source.isArchived());
target.setImmunizationStatus(source.getImmunizationStatus());
target.setMeansOfImmunization(source.getMeansOfImmunization());
target.setMeansOfImmunizationDetails(source.getMeansOfImmunizationDetails());
target.setImmunizationManagementStatus(source.getImmunizationManagementStatus());
target.setExternalId(source.getExternalId());
if (source.getResponsibleRegion() != null) {
Region region = DatabaseHelper.getRegionDao().queryForId(source.getResponsibleRegion().getId());
target.setResponsibleRegion(RegionDtoHelper.toReferenceDto(region));
}
if (source.getResponsibleDistrict() != null) {
District district = DatabaseHelper.getDistrictDao().queryForId(source.getResponsibleDistrict().getId());
target.setResponsibleDistrict(DistrictDtoHelper.toReferenceDto(district));
}
if (source.getResponsibleCommunity() != null) {
Community community = DatabaseHelper.getCommunityDao().queryForId(source.getResponsibleCommunity().getId());
target.setResponsibleCommunity(CommunityDtoHelper.toReferenceDto(community));
}
if (source.getCountry() != null) {
Country country = DatabaseHelper.getCountryDao().queryForId(source.getCountry().getId());
target.setCountry(CountryDtoHelper.toReferenceDto(country));
}
target.setFacilityType(source.getFacilityType());
if (source.getHealthFacility() != null) {
Facility facility = DatabaseHelper.getFacilityDao().queryForId(source.getHealthFacility().getId());
target.setHealthFacility(FacilityDtoHelper.toReferenceDto(facility));
} else {
target.setHealthFacility(null);
}
target.setHealthFacilityDetails(source.getHealthFacilityDetails());
target.setStartDate(source.getStartDate());
target.setEndDate(source.getEndDate());
target.setValidFrom(source.getValidFrom());
target.setValidUntil(source.getValidUntil());
target.setNumberOfDoses(source.getNumberOfDoses());
target.setPreviousInfection(source.getPreviousInfection());
target.setLastInfectionDate(source.getLastInfectionDate());
target.setAdditionalDetails(source.getAdditionalDetails());
target.setPositiveTestResultDate(source.getPositiveTestResultDate());
target.setRecoveryDate(source.getRecoveryDate());
if (source.getRelatedCase() != null) {
Case caze = DatabaseHelper.getCaseDao().queryForId(source.getRelatedCase().getId());
target.setRelatedCase(CaseDtoHelper.toReferenceDto(caze));
}
List<VaccinationDto> vaccinationDtos = new ArrayList<>();
DatabaseHelper.getImmunizationDao().initVaccinations(source);
if (!source.getVaccinations().isEmpty()) {
for (Vaccination vaccination : source.getVaccinations()) {
VaccinationDto vaccinationDto = vaccinationDtoHelper.adoToDto(vaccination);
vaccinationDtos.add(vaccinationDto);
}
}
target.setVaccinations(vaccinationDtos);
if (source.getSormasToSormasOriginInfo() != null) {
target.setSormasToSormasOriginInfo(sormasToSormasOriginInfoDtoHelper.adoToDto(source.getSormasToSormasOriginInfo()));
}
target.setPseudonymized(source.isPseudonymized());
}
Aggregations