CaseFacadeEjb implements CaseFacade { @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public List<CaseExportDto> getExportList( CaseCriteria caseCriteria, CaseExportType exportType, int first, int max, ExportConfigurationDto exportConfiguration, Language userLanguage) { Boolean previousCaseManagementDataCriteria = caseCriteria.getMustHaveCaseManagementData(); if (CaseExportType.CASE_MANAGEMENT == exportType) { caseCriteria.setMustHaveCaseManagementData(Boolean.TRUE); } CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<CaseExportDto> cq = cb.createQuery(CaseExportDto.class); Root<Case> caseRoot = cq.from(Case.class); CaseJoins<Case> joins = new CaseJoins<>(caseRoot); Subquery<Long> eventCountSq = cq.subquery(Long.class); Root<EventParticipant> eventCountRoot = eventCountSq.from(EventParticipant.class); Join<EventParticipant, Event> event = eventCountRoot.join(EventParticipant.EVENT, JoinType.INNER); Join<EventParticipant, Case> resultingCase = eventCountRoot.join(EventParticipant.RESULTING_CASE, JoinType.INNER); eventCountSq.where( cb.and( cb.equal(resultingCase.get(Case.ID), caseRoot.get(Case.ID)), cb.isFalse(event.get(Event.DELETED)), cb.isFalse(event.get(Event.ARCHIVED)), cb.isFalse(eventCountRoot.get(EventParticipant.DELETED)))); eventCountSq.select(cb.countDistinct(event.get(Event.ID))); cq.multiselect(caseRoot.get(Case.ID), joins.getPerson().get(Person.ID), joins.getPersonAddress().get(Location.ID), joins.getEpiData().get(EpiData.ID), joins.getSymptoms().get(Symptoms.ID), joins.getHospitalization().get(Hospitalization.ID), joins.getDistrict().get(District.ID), joins.getHealthConditions().get(HealthConditions.ID), caseRoot.get(Case.UUID), caseRoot.get(Case.EPID_NUMBER), caseRoot.get(Case.DISEASE), caseRoot.get(Case.DISEASE_DETAILS), joins.getPerson().get(Person.FIRST_NAME), joins.getPerson().get(Person.LAST_NAME), joins.getPerson().get(Person.SEX), caseRoot.get(Case.PREGNANT), joins.getPerson().get(Person.APPROXIMATE_AGE), joins.getPerson().get(Person.APPROXIMATE_AGE_TYPE), joins.getPerson().get(Person.BIRTHDATE_DD), joins.getPerson().get(Person.BIRTHDATE_MM), joins.getPerson().get(Person.BIRTHDATE_YYYY), caseRoot.get(Case.REPORT_DATE), joins.getReportingUser().get(User.UUID), joins.getRegion().get(Region.UUID), joins.getRegion().get(Region.NAME), joins.getDistrict().get(District.UUID), joins.getDistrict().get(District.NAME), joins.getCommunity().get(Community.UUID), joins.getCommunity().get(Community.NAME), joins.getFacility().get(Facility.NAME), joins.getFacility().get(Facility.UUID), caseRoot.get(Case.HEALTH_FACILITY_DETAILS), joins.getPointOfEntry().get(PointOfEntry.NAME), joins.getPointOfEntry().get(PointOfEntry.UUID), caseRoot.get(Case.POINT_OF_ENTRY_DETAILS), caseRoot.get(Case.CASE_CLASSIFICATION), caseRoot.get(Case.INVESTIGATION_STATUS), caseRoot.get(Case.OUTCOME), caseRoot.get(Case.FOLLOW_UP_STATUS), caseRoot.get(Case.FOLLOW_UP_UNTIL), caseRoot.get(Case.QUARANTINE), caseRoot.get(Case.QUARANTINE_TYPE_DETAILS), caseRoot.get(Case.QUARANTINE_FROM), caseRoot.get(Case.QUARANTINE_TO), caseRoot.get(Case.QUARANTINE_ORDERED_VERBALLY), caseRoot.get(Case.QUARANTINE_ORDERED_OFFICIAL_DOCUMENT), caseRoot.get(Case.QUARANTINE_ORDERED_VERBALLY_DATE), caseRoot.get(Case.QUARANTINE_ORDERED_OFFICIAL_DOCUMENT_DATE), caseRoot.get(Case.QUARANTINE_EXTENDED), caseRoot.get(Case.QUARANTINE_REDUCED), caseRoot.get(Case.QUARANTINE_OFFICIAL_ORDER_SENT), caseRoot.get(Case.QUARANTINE_OFFICIAL_ORDER_SENT_DATE), joins.getHospitalization().get(Hospitalization.ADMITTED_TO_HEALTH_FACILITY), joins.getHospitalization().get(Hospitalization.ADMISSION_DATE), joins.getHospitalization().get(Hospitalization.DISCHARGE_DATE), joins.getHospitalization().get(Hospitalization.LEFT_AGAINST_ADVICE), joins.getPerson().get(Person.PRESENT_CONDITION), joins.getPerson().get(Person.DEATH_DATE), joins.getPerson().get(Person.BURIAL_DATE), joins.getPerson().get(Person.BURIAL_CONDUCTOR), joins.getPerson().get(Person.BURIAL_PLACE_DESCRIPTION), joins.getPersonAddressRegion().get(Region.NAME), joins.getPersonAddressDistrict().get(District.NAME), joins.getPersonAddressCommunity().get(Community.NAME), joins.getPersonAddress().get(Location.CITY), joins.getPersonAddress().get(Location.STREET), joins.getPersonAddress().get(Location.HOUSE_NUMBER), joins.getPersonAddress().get(Location.ADDITIONAL_INFORMATION), joins.getPersonAddress().get(Location.POSTAL_CODE), joins.getPersonAddressFacility().get(Facility.NAME), joins.getPersonAddressFacility().get(Facility.UUID), joins.getPersonAddress().get(Location.FACILITY_DETAILS), joins.getPerson().get(Person.PHONE), joins.getPerson().get(Person.PHONE_OWNER), joins.getPerson().get(Person.EDUCATION_TYPE), joins.getPerson().get(Person.EDUCATION_DETAILS), joins.getPerson().get(Person.OCCUPATION_TYPE), joins.getPerson().get(Person.OCCUPATION_DETAILS), joins.getEpiData().get(EpiData.TRAVELED), joins.getEpiData().get(EpiData.BURIAL_ATTENDED), joins.getEpiData().get(EpiData.DIRECT_CONTACT_CONFIRMED_CASE), joins.getEpiData().get(EpiData.DIRECT_CONTACT_PROBABLE_CASE), joins.getEpiData().get(EpiData.RODENTS), caseRoot.get(Case.VACCINATION), caseRoot.get(Case.VACCINATION_DOSES), caseRoot.get(Case.VACCINATION_DATE), caseRoot.get(Case.VACCINATION_INFO_SOURCE), caseRoot.get(Case.POSTPARTUM), caseRoot.get(Case.TRIMESTER), eventCountSq ); cq.distinct(true); Predicate filter = caseService.createUserFilter(cb, cq, caseRoot); if (caseCriteria != null) { Predicate criteriaFilter = caseService.createCriteriaFilter(caseCriteria, cb, cq, caseRoot, joins); filter = AbstractAdoService.and(cb, filter, criteriaFilter); } if (filter != null) { cq.where(filter); } cq.orderBy(cb.desc(caseRoot.get(Case.REPORT_DATE)), cb.desc(caseRoot.get(Case.ID))); List<CaseExportDto> resultList = em.createQuery(cq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).setFirstResult(first).setMaxResults(max).getResultList(); List<Long> resultCaseIds = resultList.stream().map(CaseExportDto::getId).collect(Collectors.toList()); if (!resultList.isEmpty()) { Map<Long, Symptoms> symptoms = null; if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseDataDto.SYMPTOMS)) { List<Symptoms> symptomsList = null; CriteriaQuery<Symptoms> symptomsCq = cb.createQuery(Symptoms.class); Root<Symptoms> symptomsRoot = symptomsCq.from(Symptoms.class); Expression<String> symptomsIdsExpr = symptomsRoot.get(Symptoms.ID); symptomsCq.where(symptomsIdsExpr.in(resultList.stream().map(CaseExportDto::getSymptomsId).collect(Collectors.toList()))); symptomsList = em.createQuery(symptomsCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList(); symptoms = symptomsList.stream().collect(Collectors.toMap(Symptoms::getId, Function.identity())); } Map<Long, Location> personAddresses = null; if (exportConfiguration == null || exportConfiguration.getProperties().contains(PersonDto.ADDRESS) || exportConfiguration.getProperties().contains(CaseExportDto.ADDRESS_GPS_COORDINATES)) { List<Location> personAddressesList = null; CriteriaQuery<Location> personAddressesCq = cb.createQuery(Location.class); Root<Location> personAddressesRoot = personAddressesCq.from(Location.class); Expression<String> personAddressesIdsExpr = personAddressesRoot.get(Location.ID); personAddressesCq .where(personAddressesIdsExpr.in(resultList.stream().map(CaseExportDto::getPersonAddressId).collect(Collectors.toList()))); personAddressesList = em.createQuery(personAddressesCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList(); personAddresses = personAddressesList.stream().collect(Collectors.toMap(Location::getId, Function.identity())); } Map<Long, Integer> prescriptionCounts = null; Map<Long, Integer> treatmentCounts = null; Map<Long, Integer> clinicalVisitCounts = null; Map<Long, HealthConditions> healthConditions = null; if (exportType == null || exportType == CaseExportType.CASE_MANAGEMENT) { if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.NUMBER_OF_PRESCRIPTIONS)) { prescriptionCounts = prescriptionService.getPrescriptionCountByCases(resultCaseIds) .stream() .collect(Collectors.toMap(e -> (Long) e[0], e -> ((Long) e[1]).intValue())); } if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.NUMBER_OF_TREATMENTS)) { treatmentCounts = treatmentService.getTreatmentCountByCases(resultCaseIds) .stream() .collect(Collectors.toMap(e -> (Long) e[0], e -> ((Long) e[1]).intValue())); } if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.NUMBER_OF_CLINICAL_VISITS)) { clinicalVisitCounts = clinicalVisitService.getClinicalVisitCountByCases(resultCaseIds) .stream() .collect(Collectors.toMap(e -> (Long) e[0], e -> ((Long) e[1]).intValue())); } if (exportConfiguration == null || exportConfiguration.getProperties().contains(ClinicalCourseDto.HEALTH_CONDITIONS)) { List<HealthConditions> healthConditionsList = null; CriteriaQuery<HealthConditions> healthConditionsCq = cb.createQuery(HealthConditions.class); Root<HealthConditions> healthConditionsRoot = healthConditionsCq.from(HealthConditions.class); Expression<String> healthConditionsIdsExpr = healthConditionsRoot.get(HealthConditions.ID); healthConditionsCq.where( healthConditionsIdsExpr.in(resultList.stream().map(CaseExportDto::getHealthConditionsId).collect(Collectors.toList()))); healthConditionsList = em.createQuery(healthConditionsCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList(); healthConditions = healthConditionsList.stream().collect(Collectors.toMap(HealthConditions::getId, Function.identity())); } } Map<Long, PreviousHospitalization> firstPreviousHospitalizations = null; if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.INITIAL_DETECTION_PLACE)) { List<PreviousHospitalization> prevHospsList = null; CriteriaQuery<PreviousHospitalization> prevHospsCq = cb.createQuery(PreviousHospitalization.class); Root<PreviousHospitalization> prevHospsRoot = prevHospsCq.from(PreviousHospitalization.class); Join<PreviousHospitalization, Hospitalization> prevHospsHospitalizationJoin = prevHospsRoot.join(PreviousHospitalization.HOSPITALIZATION, JoinType.LEFT); Expression<String> hospitalizationIdsExpr = prevHospsHospitalizationJoin.get(Hospitalization.ID); prevHospsCq .where(hospitalizationIdsExpr.in(resultList.stream().map(CaseExportDto::getHospitalizationId).collect(Collectors.toList()))); prevHospsCq.orderBy(cb.asc(prevHospsRoot.get(PreviousHospitalization.ADMISSION_DATE))); prevHospsList = em.createQuery(prevHospsCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList(); firstPreviousHospitalizations = prevHospsList.stream().collect(Collectors.toMap(p -> p.getHospitalization().getId(), Function.identity(), (id1, id2) -> { return id1; })); } Map<Long, CaseClassification> sourceCaseClassifications = null; if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.MAX_SOURCE_CASE_CLASSIFICATION)) { sourceCaseClassifications = contactService.getSourceCaseClassifications(resultCaseIds) .stream() .collect(Collectors.toMap(e -> (Long) e[0], e -> (CaseClassification) e[1])); } List<Long> caseIdsWithOutbreak = null; if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.ASSOCIATED_WITH_OUTBREAK)) { caseIdsWithOutbreak = outbreakService.getCaseIdsWithOutbreak(resultCaseIds); } Map<Long, List<EpiDataTravel>> travels = null; if ((exportType == null || exportType == CaseExportType.CASE_SURVEILLANCE) && (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.TRAVEL_HISTORY))) { List<EpiDataTravel> travelsList = null; CriteriaQuery<EpiDataTravel> travelsCq = cb.createQuery(EpiDataTravel.class); Root<EpiDataTravel> travelsRoot = travelsCq.from(EpiDataTravel.class); Join<EpiDataTravel, EpiData> travelsEpiDataJoin = travelsRoot.join(EpiDataTravel.EPI_DATA, JoinType.LEFT); Expression<String> epiDataIdsExpr = travelsEpiDataJoin.get(EpiData.ID); travelsCq.where(epiDataIdsExpr.in(resultList.stream().map(CaseExportDto::getEpiDataId).collect(Collectors.toList()))); travelsCq.orderBy(cb.asc(travelsEpiDataJoin.get(EpiData.ID))); travelsList = em.createQuery(travelsCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList(); travels = travelsList.stream().collect(Collectors.groupingBy(t -> t.getEpiData().getId())); } Map<Long, List<Sample>> samples = null; if ((exportType == null || exportType == CaseExportType.CASE_SURVEILLANCE) && (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.SAMPLE_INFORMATION))) { List<Sample> samplesList = null; CriteriaQuery<Sample> samplesCq = cb.createQuery(Sample.class); Root<Sample> samplesRoot = samplesCq.from(Sample.class); Join<Sample, Case> samplesCaseJoin = samplesRoot.join(Sample.ASSOCIATED_CASE, JoinType.LEFT); Expression<String> caseIdsExpr = samplesCaseJoin.get(Case.ID); samplesCq.where(caseIdsExpr.in(resultList.stream().map(CaseExportDto::getId).collect(Collectors.toList()))); samplesList = em.createQuery(samplesCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList(); samples = samplesList.stream().collect(Collectors.groupingBy(s -> s.getAssociatedCase().getId())); } List<VisitSummaryExportDetails> visitSummaries = null; if (featureConfigurationFacade.isFeatureEnabled(FeatureType.CASE_FOLLOWUP) && (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.NUMBER_OF_VISITS) || exportConfiguration.getProperties().contains(CaseExportDto.LAST_COOPERATIVE_VISIT_DATE) || exportConfiguration.getProperties().contains(CaseExportDto.LAST_COOPERATIVE_VISIT_SYMPTOMATIC) || exportConfiguration.getProperties().contains(CaseExportDto.LAST_COOPERATIVE_VISIT_SYMPTOMS))) { CriteriaQuery<VisitSummaryExportDetails> visitsCq = cb.createQuery(VisitSummaryExportDetails.class); Root<Case> visitsCqRoot = visitsCq.from(Case.class); Join<Case, Visit> visitsJoin = visitsCqRoot.join(Case.VISITS, JoinType.LEFT); Join<Visit, Symptoms> visitSymptomsJoin = visitsJoin.join(Visit.SYMPTOMS, JoinType.LEFT); List<Long> exportCaseIds = resultList.stream().map(e -> e.getId()).collect(Collectors.toList()); visitsCq.where( CaseService.and(cb, visitsCqRoot.get(AbstractDomainObject.ID).in(exportCaseIds), cb.isNotEmpty(visitsCqRoot.get(Case.VISITS)))); visitsCq.multiselect( visitsCqRoot.get(AbstractDomainObject.ID), visitsJoin.get(Visit.VISIT_DATE_TIME), visitsJoin.get(Visit.VISIT_STATUS), visitSymptomsJoin); visitSummaries = em.createQuery(visitsCq).getResultList(); } List<EventSummaryDetails> eventSummaries = null; if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.LATEST_EVENT_ID) || exportConfiguration.getProperties().contains(CaseExportDto.LATEST_EVENT_STATUS) || exportConfiguration.getProperties().contains(CaseExportDto.LATEST_EVENT_TITLE)) { eventSummaries = eventService.getEventSummaryDetailsByCases(resultCaseIds); } Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue)); for (CaseExportDto exportDto : resultList) { final boolean inJurisdiction = caseJurisdictionChecker.isInJurisdictionOrOwned(exportDto.getJurisdiction()); if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.COUNTRY)) { exportDto.setCountry(configFacade.getEpidPrefix()); } if (symptoms != null) { Optional.ofNullable(symptoms.get(exportDto.getSymptomsId())) .ifPresent(symptom -> exportDto.setSymptoms(SymptomsFacadeEjb.toDto(symptom))); } if (personAddresses != null || exportConfiguration.getProperties().contains(CaseExportDto.ADDRESS_GPS_COORDINATES)) { Optional.ofNullable(personAddresses.get(exportDto.getPersonAddressId())) .ifPresent(personAddress -> exportDto.setAddressGpsCoordinates(personAddress.buildGpsCoordinatesCaption())); } if (prescriptionCounts != null) { Optional.ofNullable(prescriptionCounts.get(exportDto.getId())) .ifPresent(prescriptionCount -> exportDto.setNumberOfPrescriptions(prescriptionCount)); } if (treatmentCounts != null) { Optional.ofNullable(treatmentCounts.get(exportDto.getId())) .ifPresent(treatmentCount -> exportDto.setNumberOfTreatments(treatmentCount)); } if (clinicalVisitCounts != null) { Optional.ofNullable(clinicalVisitCounts.get(exportDto.getId())) .ifPresent(clinicalVisitCount -> exportDto.setNumberOfClinicalVisits(clinicalVisitCount)); } if (healthConditions != null) { Optional.ofNullable(healthConditions.get(exportDto.getHealthConditionsId())) .ifPresent(healthCondition -> exportDto.setHealthConditions(ClinicalCourseFacadeEjb.toHealthConditionsDto(healthCondition))); } if (firstPreviousHospitalizations != null) { Optional.ofNullable(firstPreviousHospitalizations.get(exportDto.getHospitalizationId())) .ifPresent( firstPreviousHospitalization -> exportDto.setInitialDetectionPlace( FacilityHelper.buildFacilityString( firstPreviousHospitalization.getHealthFacility().getUuid(), firstPreviousHospitalization.getHealthFacility().getName(), firstPreviousHospitalization.getHealthFacilityDetails()))); if (StringUtils.isEmpty(exportDto.getInitialDetectionPlace())) { if (!StringUtils.isEmpty(exportDto.getHealthFacility())) { exportDto.setInitialDetectionPlace(exportDto.getHealthFacility()); } else { exportDto.setInitialDetectionPlace(exportDto.getPointOfEntry()); } } } if (sourceCaseClassifications != null) { Optional.ofNullable(sourceCaseClassifications.get(exportDto.getId())) .ifPresent(sourceCaseClassification -> exportDto.setMaxSourceCaseClassification(sourceCaseClassification)); } if (caseIdsWithOutbreak != null) { exportDto.setAssociatedWithOutbreak(caseIdsWithOutbreak.contains(exportDto.getId())); } if (travels != null) { Optional.ofNullable(travels.get(exportDto.getEpiDataId())).ifPresent(caseTravels -> { StringBuilder travelHistoryBuilder = new StringBuilder(); caseTravels.forEach(travel -> { travelHistoryBuilder.append( EpiDataTravelHelper.buildTravelString( travel.getTravelType(), travel.getTravelDestination(), travel.getTravelDateFrom(), travel.getTravelDateTo(), userLanguage)) .append(", "); }); if (travelHistoryBuilder.length() > 0) { travelHistoryBuilder.delete(travelHistoryBuilder.lastIndexOf(", "), travelHistoryBuilder.length() - 1); } if (travelHistoryBuilder.length() == 0 && exportDto.getTraveled() != null) { travelHistoryBuilder.append(exportDto.getTraveled()); } exportDto.setTravelHistory(travelHistoryBuilder.toString()); }); } if (samples != null) { Optional.ofNullable(samples.get(exportDto.getId())).ifPresent(caseSamples -> { int count = 0; for (Sample sample : caseSamples) { EmbeddedSampleExportDto sampleDto = new EmbeddedSampleExportDto( sample.getSampleDateTime(), sample.getLab() != null ? FacilityHelper.buildFacilityString(sample.getLab().getUuid(), sample.getLab().getName(), sample.getLabDetails()) : null, sample.getPathogenTestResult()); switch (++count) { case 1: exportDto.setSample1(sampleDto); break; case 2: exportDto.setSample2(sampleDto); break; case 3: exportDto.setSample3(sampleDto); default: exportDto.addOtherSample(sampleDto); break; } } }); } if (visitSummaries != null) { List<VisitSummaryExportDetails> visits = visitSummaries.stream().filter(v -> v.getContactId() == exportDto.getId()).collect(Collectors.toList()); VisitSummaryExportDetails lastCooperativeVisit = visits.stream() .filter(v -> v.getVisitStatus() == VisitStatus.COOPERATIVE) .max(Comparator.comparing(VisitSummaryExportDetails::getVisitDateTime)) .orElse(null); exportDto.setNumberOfVisits(visits.size()); if (lastCooperativeVisit != null) { exportDto.setLastCooperativeVisitDate(lastCooperativeVisit.getVisitDateTime()); SymptomsDto visitSymptoms = SymptomsFacadeEjb.toDto(lastCooperativeVisit.getSymptoms()); pseudonymizer.pseudonymizeDto(SymptomsDto.class, visitSymptoms, inJurisdiction, null); exportDto.setLastCooperativeVisitSymptoms(SymptomsHelper.buildSymptomsHumanString(visitSymptoms, true, userLanguage)); exportDto.setLastCooperativeVisitSymptomatic(visitSymptoms.getSymptomatic() ? YesNoUnknown.YES : YesNoUnknown.NO); } } if (eventSummaries != null && exportDto.getEventCount() != 0) { eventSummaries.stream() .filter(v -> v.getCaseId() == exportDto.getId()) .sorted(Comparator.comparing(EventSummaryDetails::getEventDate).reversed()) .findFirst() .ifPresent(eventSummary -> { exportDto.setLatestEventId(eventSummary.getEventUuid()); exportDto.setLatestEventStatus(eventSummary.getEventStatus()); exportDto.setLatestEventTitle(eventSummary.getEventTitle()); }); } pseudonymizer.pseudonymizeDto(CaseExportDto.class, exportDto, inJurisdiction, (c) -> { pseudonymizer.pseudonymizeDto(BirthDateDto.class, c.getBirthdate(), inJurisdiction, null); pseudonymizer.pseudonymizeDto(EmbeddedSampleExportDto.class, c.getSample1(), inJurisdiction, null); pseudonymizer.pseudonymizeDto(EmbeddedSampleExportDto.class, c.getSample2(), inJurisdiction, null); pseudonymizer.pseudonymizeDto(EmbeddedSampleExportDto.class, c.getSample3(), inJurisdiction, null); pseudonymizer.pseudonymizeDtoCollection(EmbeddedSampleExportDto.class, c.getOtherSamples(), s -> inJurisdiction, null); pseudonymizer.pseudonymizeDto(BurialInfoDto.class, c.getBurialInfo(), inJurisdiction, null); pseudonymizer.pseudonymizeDto(SymptomsDto.class, c.getSymptoms(), inJurisdiction, null); }); } } caseCriteria.setMustHaveCaseManagementData(previousCaseManagementDataCriteria); return resultList; }  @Override List<CaseDataDto> getAllActiveCasesAfter(Date date); @Override List<CaseDataDto> getAllActiveCasesAfter(Date date, boolean includeExtendedChangeDateFilters); @Override List<CaseDataDto> getByUuids(List<String> uuids); @Override String getUuidByUuidEpidNumberOrExternalId(String searchTerm); @Override long count(CaseCriteria caseCriteria); @Override List<CaseIndexDto> getIndexList(CaseCriteria caseCriteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override List<CaseIndexDetailedDto> getIndexDetailedList(CaseCriteria caseCriteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) List<CaseExportDto> getExportList(
		CaseCriteria caseCriteria,
		CaseExportType exportType,
		int first,
		int max,
		ExportConfigurationDto exportConfiguration,
		Language userLanguage); @Override List<String> getAllActiveUuids(); @Override List<DashboardCaseDto> getCasesForDashboard(CaseCriteria caseCriteria); List<DashboardQuarantineDataDto> getQuarantineDataForDashBoard(
		RegionReferenceDto regionRef,
		DistrictReferenceDto districtRef,
		Disease disease,
		Date from,
		Date to); long countCasesConvertedFromContacts(CaseCriteria caseCriteria); @Override List<MapCaseDto> getCasesForMap(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to); @Override List<CaseDataDto> getAllCasesOfPerson(String personUuid); @Override Map<CaseClassification, Long> getCaseCountPerClassification(
		CaseCriteria caseCriteria,
		boolean excludeSharedCases,
		boolean excludeCasesFromContacts); @Override Map<PresentCondition, Long> getCaseCountPerPersonCondition(
		CaseCriteria caseCriteria,
		boolean excludeSharedCases,
		boolean excludeCasesFromContacts); @Override Map<Disease, Long> getCaseCountByDisease(CaseCriteria caseCriteria, boolean excludeSharedCases, boolean excludeCasesFromContacts); @Override List<CaseReferenceDto> getRandomCaseReferences(CaseCriteria criteria, int count); Map<Disease, District> getLastReportedDistrictByDisease(
		CaseCriteria caseCriteria,
		boolean excludeSharedCases,
		boolean excludeCasesFromContacts); @Override List<CaseIndexDto> getSimilarCases(CaseSimilarityCriteria criteria); @Override List<CaseIndexDto[]> getCasesForDuplicateMerging(CaseCriteria criteria, boolean ignoreRegion); void updateCompleteness(String caseUuid); @Override String getLastReportedDistrictName(CaseCriteria caseCriteria, boolean excludeSharedCases, boolean excludeCasesFromContacts); @Override CaseDataDto getCaseDataByUuid(String uuid); @Override CaseReferenceDto getReferenceByUuid(String uuid); @Override CaseDataDto saveCase(CaseDataDto dto); CaseDataDto saveCase(CaseDataDto dto, boolean handleChanges); @Override void setSampleAssociations(ContactReferenceDto sourceContact, CaseReferenceDto cazeRef); @Override void setSampleAssociations(EventParticipantReferenceDto sourceEventParticipant, CaseReferenceDto cazeRef); @Override void setSampleAssociationsUnrelatedDisease(EventParticipantReferenceDto sourceEventParticipant, CaseReferenceDto cazeRef); @Override void validate(CaseDataDto caze); @Override void archiveOrDearchiveCase(String caseUuid, boolean archive); void onCaseChanged(CaseDataDto existingCase, Case newCase); void setResponsibleSurveillanceOfficer(Case caze); void reassignTasks(Case caze); @Override String generateEpidNumber(CaseReferenceDto caze); String generateEpidNumber(Case caze); @Override void deleteCase(String caseUuid); @Override void deleteCaseAsDuplicate(String caseUuid, String duplicateOfCaseUuid); @Override List<String> getArchivedUuidsSince(Date since); @Override List<String> getDeletedUuidsSince(Date since); Case fillOrBuildEntity(@NotNull CaseDataDto source, Case target); CaseDataDto convertToDto(Case source, Pseudonymizer pseudonymizer); CaseReferenceDto convertToReferenceDto(Case source); static CaseReferenceDto toReferenceDto(Case entity); static CaseDataDto toDto(Case source); void updateInvestigationByStatus(CaseDataDto existingCase, Case caze); void updateInvestigationByTask(Case caze); @Override boolean doesEpidNumberExist(String epidNumber, String caseUuid, Disease caseDisease); @Override List<Pair<DistrictDto, BigDecimal>> getCaseMeasurePerDistrict(Date fromDate, Date toDate, Disease disease, CaseMeasure caseMeasure); @Override Date getOldestCaseOnsetDate(); @Override Date getOldestCaseReportDate(); @Override boolean isArchived(String caseUuid); @Override boolean isDeleted(String caseUuid); @Override void mergeCase(String leadUuid, String otherUuid); @Override CaseDataDto cloneCase(CaseDataDto existingCaseDto); @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) void archiveAllArchivableCases(int daysAfterCaseGetsArchived); @Override void updateArchived(List<String> caseUuids, boolean archived); @Override boolean exists(String uuid); @Override boolean hasPositiveLabResult(String caseUuid); @Override List<CaseFollowUpDto> getCaseFollowUpList(
		CaseCriteria caseCriteria,
		Date referenceDate,
		int interval,
		Integer first,
		Integer max,
		List<SortProperty> sortProperties); Boolean isCaseEditAllowed(String caseUuid);  }
@Test public void testGetExportList() { RDCFEntities rdcf = creator.createRDCFEntities("Region", "District", "Community", "Facility"); UserDto user = creator .createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR); PersonDto cazePerson = creator.createPerson("Case", "Person"); CaseDataDto caze = creator.createCase( user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf); cazePerson.getAddress().setCity("City"); getPersonFacade().savePerson(cazePerson); EpiDataTravelDto travel = EpiDataTravelDto.build(); travel.setTravelDestination("Ghana"); travel.setTravelDateFrom(new Date()); travel.setTravelDateTo(new Date()); caze.getEpiData().getTravels().add(travel); caze.getSymptoms().setAbdominalPain(SymptomState.YES); caze = getCaseFacade().saveCase(caze); creator.createSample(caze.toReference(), new Date(), new Date(), user.toReference(), SampleMaterial.BLOOD, rdcf.facility); creator.createPathogenTest(caze, PathogenTestType.ANTIGEN_DETECTION, PathogenTestResultType.POSITIVE); creator.createPrescription(caze); List<CaseExportDto> results = getCaseFacade().getExportList(new CaseCriteria(), CaseExportType.CASE_MANAGEMENT, 0, 100, null, Language.EN); assertEquals(1, results.size()); CaseExportDto exportDto = results.get(0); assertNotNull(exportDto.getSymptoms()); }