use of de.symeda.sormas.backend.activityascase.ActivityAsCase in project SORMAS-Project by hzi-braunschweig.
the class EpiDataFacadeEjb method fromActivityAsCaseDto.
public ActivityAsCase fromActivityAsCaseDto(ActivityAsCaseDto source, boolean checkChangeDate) {
if (source == null) {
return null;
}
ActivityAsCase target = DtoHelper.fillOrBuildEntity(source, activityAsCaseService.getByUuid(source.getUuid()), ActivityAsCase::new, checkChangeDate);
target.setReportingUser(userService.getByReferenceDto(source.getReportingUser()));
target.setStartDate(source.getStartDate());
target.setEndDate(source.getEndDate());
target.setDescription(source.getDescription());
target.setActivityAsCaseType(source.getActivityAsCaseType());
target.setActivityAsCaseTypeDetails(source.getActivityAsCaseTypeDetails());
target.setLocation(locationFacade.fromDto(source.getLocation(), checkChangeDate));
target.setRole(source.getRole());
target.setTypeOfPlace(source.getTypeOfPlace());
target.setTypeOfPlaceDetails(source.getTypeOfPlaceDetails());
target.setMeansOfTransport(source.getMeansOfTransport());
target.setMeansOfTransportDetails(source.getMeansOfTransportDetails());
target.setConnectionNumber(source.getConnectionNumber());
target.setSeatNumber(source.getSeatNumber());
target.setWorkEnvironment(source.getWorkEnvironment());
target.setGatheringType(source.getGatheringType());
target.setGatheringDetails(source.getGatheringDetails());
target.setHabitationType(source.getHabitationType());
target.setHabitationDetails(source.getHabitationDetails());
return target;
}
use of de.symeda.sormas.backend.activityascase.ActivityAsCase in project SORMAS-Project by hzi-braunschweig.
the class EpiDataFacadeEjb method fromDto.
public EpiData fromDto(EpiDataDto source, boolean checkChangeDate) {
if (source == null) {
return null;
}
EpiData target = DtoHelper.fillOrBuildEntity(source, service.getByUuid(source.getUuid()), EpiData::new, checkChangeDate);
target.setExposureDetailsKnown(source.getExposureDetailsKnown());
target.setActivityAsCaseDetailsKnown(source.getActivityAsCaseDetailsKnown());
target.setContactWithSourceCaseKnown(source.getContactWithSourceCaseKnown());
target.setHighTransmissionRiskArea(source.getHighTransmissionRiskArea());
target.setLargeOutbreaksArea(source.getLargeOutbreaksArea());
target.setAreaInfectedAnimals(source.getAreaInfectedAnimals());
List<Exposure> exposures = new ArrayList<>();
for (ExposureDto exposureDto : source.getExposures()) {
Exposure exposure = fromExposureDto(exposureDto, checkChangeDate);
exposure.setEpiData(target);
exposures.add(exposure);
}
if (!DataHelper.equal(target.getExposures(), exposures)) {
target.setChangeDateOfEmbeddedLists(new Date());
}
target.getExposures().clear();
target.getExposures().addAll(exposures);
List<ActivityAsCase> activitiesAsCase = new ArrayList<>();
for (ActivityAsCaseDto activityAsCaseDto : source.getActivitiesAsCase()) {
ActivityAsCase activityAsCase = fromActivityAsCaseDto(activityAsCaseDto, checkChangeDate);
activityAsCase.setEpiData(target);
activitiesAsCase.add(activityAsCase);
}
if (!DataHelper.equal(target.getActivitiesAsCase(), activitiesAsCase)) {
target.setChangeDateOfEmbeddedLists(new Date());
}
target.getActivitiesAsCase().clear();
target.getActivitiesAsCase().addAll(activitiesAsCase);
return target;
}
use of de.symeda.sormas.backend.activityascase.ActivityAsCase in project SORMAS-Project by hzi-braunschweig.
the class EpiDataFacadeEjb method toDto.
public static EpiDataDto toDto(EpiData epiData) {
if (epiData == null) {
return null;
}
EpiDataDto target = new EpiDataDto();
EpiData source = epiData;
DtoHelper.fillDto(target, source);
target.setExposureDetailsKnown(source.getExposureDetailsKnown());
target.setActivityAsCaseDetailsKnown(source.getActivityAsCaseDetailsKnown());
target.setContactWithSourceCaseKnown(source.getContactWithSourceCaseKnown());
target.setHighTransmissionRiskArea(source.getHighTransmissionRiskArea());
target.setLargeOutbreaksArea(source.getLargeOutbreaksArea());
target.setAreaInfectedAnimals(source.getAreaInfectedAnimals());
List<ExposureDto> exposureDtos = new ArrayList<>();
for (Exposure exposure : source.getExposures()) {
ExposureDto exposureDto = toExposureDto(exposure);
exposureDtos.add(exposureDto);
}
target.setExposures(exposureDtos);
List<ActivityAsCaseDto> activityAsCaseDtos = new ArrayList<>();
for (ActivityAsCase activityAsCase : source.getActivitiesAsCase()) {
ActivityAsCaseDto activityAsCaseDto = toActivityAsCaseDto(activityAsCase);
activityAsCaseDtos.add(activityAsCaseDto);
}
target.setActivitiesAsCase(activityAsCaseDtos);
return target;
}
Aggregations