From 93119f371458d76865a3169d4e1e0fee46533921 Mon Sep 17 00:00:00 2001 From: Stefan Kock Date: Thu, 21 Jul 2022 10:56:44 +0200 Subject: [PATCH 1/6] [GITFLOW]updating poms for 1.73.3 branch with snapshot versions --- sormas-api/pom.xml | 2 +- sormas-app/pom.xml | 2 +- sormas-backend/pom.xml | 2 +- sormas-base/dependencies/serverlibs.pom | 2 +- sormas-base/pom.xml | 2 +- sormas-cargoserver/pom.xml | 2 +- sormas-ear/pom.xml | 2 +- sormas-keycloak-service-provider/pom.xml | 2 +- sormas-rest/pom.xml | 2 +- sormas-ui/pom.xml | 2 +- sormas-widgetset/pom.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sormas-api/pom.xml b/sormas-api/pom.xml index 4f4acaaf4d5..73e09f2184e 100644 --- a/sormas-api/pom.xml +++ b/sormas-api/pom.xml @@ -2,7 +2,7 @@ de.symeda.sormas sormas-base - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-app/pom.xml b/sormas-app/pom.xml index f5552a1794a..47c0d53a8a8 100644 --- a/sormas-app/pom.xml +++ b/sormas-app/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-backend/pom.xml b/sormas-backend/pom.xml index d58a5dd3a85..876e00ad480 100644 --- a/sormas-backend/pom.xml +++ b/sormas-backend/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-base/dependencies/serverlibs.pom b/sormas-base/dependencies/serverlibs.pom index 4b683411423..8a13dd2961e 100644 --- a/sormas-base/dependencies/serverlibs.pom +++ b/sormas-base/dependencies/serverlibs.pom @@ -8,7 +8,7 @@ sormas-base de.symeda.sormas - 1.73.2 + 1.73.3-SNAPSHOT ../ diff --git a/sormas-base/pom.xml b/sormas-base/pom.xml index 825eb0115ae..4516e6b25cf 100644 --- a/sormas-base/pom.xml +++ b/sormas-base/pom.xml @@ -5,7 +5,7 @@ de.symeda.sormas sormas-base pom - 1.73.2 + 1.73.3-SNAPSHOT 1.8 diff --git a/sormas-cargoserver/pom.xml b/sormas-cargoserver/pom.xml index d7654c04bb1..95f20503a62 100644 --- a/sormas-cargoserver/pom.xml +++ b/sormas-cargoserver/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base diff --git a/sormas-ear/pom.xml b/sormas-ear/pom.xml index b5b868f3cf0..84ef32df396 100644 --- a/sormas-ear/pom.xml +++ b/sormas-ear/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base diff --git a/sormas-keycloak-service-provider/pom.xml b/sormas-keycloak-service-provider/pom.xml index 48490950fd2..629247b3b5a 100644 --- a/sormas-keycloak-service-provider/pom.xml +++ b/sormas-keycloak-service-provider/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-rest/pom.xml b/sormas-rest/pom.xml index 110655b743a..64dc339d8f8 100644 --- a/sormas-rest/pom.xml +++ b/sormas-rest/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base diff --git a/sormas-ui/pom.xml b/sormas-ui/pom.xml index 7081b224b6f..6bb15ffc187 100644 --- a/sormas-ui/pom.xml +++ b/sormas-ui/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-widgetset/pom.xml b/sormas-widgetset/pom.xml index d9fe7574b5c..9b642b4d6e5 100644 --- a/sormas-widgetset/pom.xml +++ b/sormas-widgetset/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.2 + 1.73.3-SNAPSHOT ../sormas-base 4.0.0 From 4d9d0add0a015b8f0415ae5a9917d17267960399 Mon Sep 17 00:00:00 2001 From: syntakker Date: Fri, 22 Jul 2022 08:29:09 +0200 Subject: [PATCH 2/6] refactoring export of cases, contacts and event participants (backport of #9193) #9908 --- .../api/event/EventParticipantExportDto.java | 8 +- .../sormas/backend/caze/CaseFacadeEjb.java | 36 ++++----- .../backend/contact/ContactFacadeEjb.java | 16 +--- .../event/EventParticipantFacadeEjb.java | 18 ++--- .../vaccination/VaccinationService.java | 74 +++++++++++++++---- 5 files changed, 88 insertions(+), 64 deletions(-) diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/event/EventParticipantExportDto.java b/sormas-api/src/main/java/de/symeda/sormas/api/event/EventParticipantExportDto.java index 77257bedd8d..9ee12138dea 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/event/EventParticipantExportDto.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/event/EventParticipantExportDto.java @@ -82,6 +82,7 @@ public class EventParticipantExportDto implements Serializable { private long personAddressId; private String eventUuid; + private Date eventReportDateTime; private final EventStatus eventStatus; private final EventInvestigationStatus eventInvestigationStatus; @@ -177,7 +178,7 @@ public class EventParticipantExportDto implements Serializable { private long contactCount; //@formatter:off - public EventParticipantExportDto(long id, long personId, String personUuid, String eventParticipantUuid, String nationalHealthId, long personAddressId, boolean isInJurisdiction, String eventUuid, + public EventParticipantExportDto(long id, long personId, String personUuid, String eventParticipantUuid, String nationalHealthId, long personAddressId, boolean isInJurisdiction, String eventUuid, Date eventReportDateTime, EventStatus eventStatus, EventInvestigationStatus eventInvestigationStatus, Disease eventDisease, TypeOfPlace typeOfPlace, Date eventStartDate, Date eventEndDate, String eventTitle, String eventDesc, String eventRegion, String eventDistrict, String eventCommunity, String eventCity, String eventStreet, String eventHouseNumber, @@ -197,6 +198,7 @@ public EventParticipantExportDto(long id, long personId, String personUuid, Stri this.nationalHealthId = nationalHealthId; this.personAddressId = personAddressId; this.eventUuid = eventUuid; + this.eventReportDateTime = eventReportDateTime; this.eventStatus = eventStatus; this.eventInvestigationStatus = eventInvestigationStatus; @@ -978,4 +980,8 @@ public void setVaccineUniiCode(String vaccineUniiCode) { public void setVaccineAtcCode(String vaccineAtcCode) { this.vaccineAtcCode = vaccineAtcCode; } + + public Date getEventReportDateTime() { + return eventReportDateTime; + } } diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java index 871c4f61da8..8c954edbcb4 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java @@ -885,16 +885,13 @@ public List getExportList( List resultCaseIds = resultList.stream().map(CaseExportDto::getId).collect(Collectors.toList()); if (!resultList.isEmpty()) { - Map symptoms = null; - if (ExportHelper.shouldExportFields(exportConfiguration, CaseDataDto.SYMPTOMS)) { - List symptomsList = null; - CriteriaQuery symptomsCq = cb.createQuery(Symptoms.class); - Root symptomsRoot = symptomsCq.from(Symptoms.class); - Expression 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())); - } + List symptomsList = null; + CriteriaQuery symptomsCq = cb.createQuery(Symptoms.class); + Root symptomsRoot = symptomsCq.from(Symptoms.class); + Expression 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(); + Map symptoms = symptomsList.stream().collect(Collectors.toMap(Symptoms::getId, Function.identity())); Map healthConditions = null; if (exportType == null || exportType == CaseExportType.CASE_MANAGEMENT) { @@ -1048,7 +1045,7 @@ public List getExportList( if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.COUNTRY)) { exportDto.setCountry(configFacade.getEpidPrefix()); } - if (symptoms != null) { + if (ExportHelper.shouldExportFields(exportConfiguration, CaseDataDto.SYMPTOMS)) { Optional.ofNullable(symptoms.get(exportDto.getSymptomsId())) .ifPresent(symptom -> exportDto.setSymptoms(SymptomsFacadeEjb.toDto(symptom))); } @@ -1135,10 +1132,12 @@ public List getExportList( filteredImmunizations.sort(Comparator.comparing(i -> ImmunizationEntityHelper.getDateForComparison(i, false))); Immunization mostRecentImmunization = filteredImmunizations.get(filteredImmunizations.size() - 1); Integer numberOfDoses = mostRecentImmunization.getNumberOfDoses(); + Date onsetDate = Optional.ofNullable(symptoms.get(exportDto.getSymptomsId())).map(Symptoms::getOnsetDate).orElse(null); - List relevantSortedVaccinations = getRelevantSortedVaccinations( - exportDto.getUuid(), - filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList())); + List relevantSortedVaccinations = vaccinationService.getRelevantSortedVaccinations( + filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()), + onsetDate, + exportDto.getReportDate()); Vaccination firstVaccination = null; Vaccination lastVaccination = null; @@ -1281,15 +1280,6 @@ private Map getCaseUsersForExport(List resul return caseUsers; } - private List getRelevantSortedVaccinations(String caseUuid, List vaccinations) { - Case caze = caseService.getByUuid(caseUuid); - - return vaccinations.stream() - .filter(v -> vaccinationService.isVaccinationRelevant(caze, v)) - .sorted(Comparator.comparing(ImmunizationEntityHelper::getVaccinationDateForComparison)) - .collect(Collectors.toList()); - } - private String getNumberOfDosesFromVaccinations(Vaccination vaccination) { return vaccination != null ? vaccination.getVaccineDose() : ""; } diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java index b86f72532bd..89cd3250fdb 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java @@ -847,9 +847,10 @@ public List getExportList( Immunization mostRecentImmunization = filteredImmunizations.get(filteredImmunizations.size() - 1); Integer numberOfDoses = mostRecentImmunization.getNumberOfDoses(); - List relevantSortedVaccinations = getRelevantSortedVaccinations( - exportContact.getUuid(), - filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList())); + List relevantSortedVaccinations = vaccinationService.getRelevantSortedVaccinations( + filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()), + exportContact.getLastContactDate(), + exportContact.getReportDate()); Vaccination firstVaccination = null; Vaccination lastVaccination = null; @@ -2259,15 +2260,6 @@ private User getRandomDistrictContactResponsible(District district) { return userService.getRandomDistrictUser(district, UserRight.CONTACT_RESPONSIBLE); } - private List getRelevantSortedVaccinations(String caseUuid, List vaccinations) { - Contact contact = contactService.getByUuid(caseUuid); - - return vaccinations.stream() - .filter(v -> vaccinationService.isVaccinationRelevant(contact, v)) - .sorted(Comparator.comparing(ImmunizationEntityHelper::getVaccinationDateForComparison)) - .collect(Collectors.toList()); - } - private String getNumberOfDosesFromVaccinations(Vaccination vaccination) { return vaccination != null ? vaccination.getVaccineDose() : ""; } diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantFacadeEjb.java index 513226500a4..7dadc35347a 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantFacadeEjb.java @@ -277,15 +277,6 @@ private void archiveAllArchivableEventParticipants(int daysAfterEventParticipant } } - private List getRelevantSortedVaccinations(String eventUuid, List vaccinations) { - Event event = eventService.getByUuid(eventUuid); - - return vaccinations.stream() - .filter(v -> vaccinationService.isVaccinationRelevant(event, v)) - .sorted(Comparator.comparing(ImmunizationEntityHelper::getVaccinationDateForComparison)) - .collect(Collectors.toList()); - } - private String getNumberOfDosesFromVaccinations(Vaccination vaccination) { return vaccination != null ? vaccination.getVaccineDose() : ""; } @@ -657,6 +648,7 @@ public List getExportList( JurisdictionHelper.booleanSelector(cb, service.inJurisdictionOrOwned(eventParticipantQueryContext)), event.get(Event.UUID), + event.get(Event.REPORT_DATE_TIME), event.get(Event.EVENT_STATUS), event.get(Event.EVENT_INVESTIGATION_STATUS), @@ -804,9 +796,11 @@ public List getExportList( Immunization mostRecentImmunization = filteredImmunizations.get(filteredImmunizations.size() - 1); Integer numberOfDoses = mostRecentImmunization.getNumberOfDoses(); - List relevantSortedVaccinations = getRelevantSortedVaccinations( - exportDto.getEventUuid(), - filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList())); + List relevantSortedVaccinations = vaccinationService.getRelevantSortedVaccinations( + filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()), + exportDto.getEventStartDate(), + exportDto.getEventEndDate(), + exportDto.getEventReportDateTime()); Vaccination firstVaccination = null; Vaccination lastVaccination = null; diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/vaccination/VaccinationService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/vaccination/VaccinationService.java index 1fce00baa51..efd992abf36 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/vaccination/VaccinationService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/vaccination/VaccinationService.java @@ -16,6 +16,8 @@ package de.symeda.sormas.backend.vaccination; import java.util.ArrayList; +import java.util.Comparator; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,6 +47,7 @@ import de.symeda.sormas.backend.common.CriteriaBuilderHelper; import de.symeda.sormas.backend.contact.Contact; import de.symeda.sormas.backend.event.Event; +import de.symeda.sormas.backend.immunization.ImmunizationEntityHelper; import de.symeda.sormas.backend.immunization.entity.Immunization; import de.symeda.sormas.backend.person.Person; @@ -52,6 +55,8 @@ @LocalBean public class VaccinationService extends BaseAdoService { + public static final int REPORT_DATE_RELEVANT_DAYS = 14; + public VaccinationService() { super(Vaccination.class); } @@ -118,28 +123,65 @@ public List getVaccinationsByCriteria( } public boolean isVaccinationRelevant(Case caze, Vaccination vaccination) { - return vaccination.getVaccinationDate() != null - && (caze.getSymptoms().getOnsetDate() != null - ? DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(caze.getSymptoms().getOnsetDate()) - : DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(caze.getReportDate())); + return isVaccinationRelevant(vaccination, caze.getSymptoms().getOnsetDate(), caze.getReportDate()); } public boolean isVaccinationRelevant(Contact contact, Vaccination vaccination) { - return vaccination.getVaccinationDate() != null - && (contact.getLastContactDate() != null - ? DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(contact.getLastContactDate()) - : DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(contact.getReportDateTime())); + return isVaccinationRelevant(vaccination, contact.getLastContactDate(), contact.getReportDateTime()); + } + /** + * HEADS UP! When this method gets changed, most probably the database logic in + * {@link de.symeda.sormas.backend.event.EventParticipantService#updateVaccinationStatuses(Long, Disease, Date)} + * will also need an update. + * + * @param event + * to decide whether the vaccination is relevant for + * @param vaccination + * to be decided about + * @return true when the vaccination is relevant, false otherwise + */ public boolean isVaccinationRelevant(Event event, Vaccination vaccination) { - if (vaccination.getVaccinationDate() == null) { - return false; - } - if (event.getStartDate() != null) { - return DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(event.getStartDate()); + return isVaccinationRelevant(vaccination, event.getStartDate(), event.getEndDate(), event.getReportDateTime()); + } + + /* + * HEADS UP! If you make changes here, you most probably also need to update the database queries in + * ContactService.updateVaccinationStatuses(...) and + * EventParticipantService.updateVaccinationStatuses(...). + */ + private boolean isVaccinationRelevant(Vaccination vaccination, Date... relevanceFilterDates) { + + Date relevantVaccineDate = getRelevantVaccineDate(vaccination); + for (Date comparisonDate : relevanceFilterDates) { + if (comparisonDate != null) { + return DateHelper.getEndOfDay(relevantVaccineDate).before(comparisonDate); + } } - return event.getEndDate() != null - ? DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(event.getEndDate()) - : DateHelper.getEndOfDay(vaccination.getVaccinationDate()).before(event.getReportDateTime()); + return false; + } + + public List getRelevantSortedVaccinations(List vaccinations, Date... relevanceFilterDates) { + + return vaccinations.stream() + .filter(v -> isVaccinationRelevant(v, relevanceFilterDates)) + .sorted(Comparator.comparing(ImmunizationEntityHelper::getVaccinationDateForComparison)) + .collect(Collectors.toList()); + } + + /** + * * Obtains the date used for calculating the relevance of a vaccination for a case/contact/event participant. + * * There is a 14-day buffer when the report date needs to be used. + * * There is an identical method for VaccinationDtos below! + * + * @param vaccination + * to obtain the relevant date from + * @return relevant date + */ + public Date getRelevantVaccineDate(Vaccination vaccination) { + return vaccination.getVaccinationDate() != null + ? vaccination.getVaccinationDate() + : DateHelper.subtractDays(vaccination.getReportDate(), REPORT_DATE_RELEVANT_DAYS); } } From ab25e2f44ed2853585fc851fdd5d22a930f5377b Mon Sep 17 00:00:00 2001 From: Levente Gal <62599627+leventegal-she@users.noreply.github.com> Date: Fri, 22 Jul 2022 12:56:47 +0300 Subject: [PATCH 3/6] #9817 [DEMIS2SORMAS] Converting contacts while processing physician reports can disable source cases in epiData (#9917) --- .../symeda/sormas/ui/caze/CaseController.java | 18 ++++++++++++++---- .../sormas/ui/epidata/CaseEpiDataView.java | 4 ---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseController.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseController.java index 6c3df105c06..99c0268dd0c 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseController.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseController.java @@ -68,6 +68,7 @@ import de.symeda.sormas.api.common.DeletionDetails; import de.symeda.sormas.api.common.DeletionReason; import de.symeda.sormas.api.contact.ContactClassification; +import de.symeda.sormas.api.contact.ContactCriteria; import de.symeda.sormas.api.contact.ContactDto; import de.symeda.sormas.api.contact.ContactSimilarityCriteria; import de.symeda.sormas.api.contact.ContactStatus; @@ -412,10 +413,11 @@ private void showConvertToCaseSelection( convertToCaseSelectComponent.addCommitListener(() -> { List selectedContacts = convertToCaseSelectionField.getSelectedContacts(); if (!selectedContacts.isEmpty()) { - caze.getEpiData().setContactWithSourceCaseKnown(YesNoUnknown.YES); + CaseDataDto refreshedCaze = FacadeProvider.getCaseFacade().getCaseDataByUuid(caze.getUuid()); + refreshedCaze.getEpiData().setContactWithSourceCaseKnown(YesNoUnknown.YES); + saveCase(refreshedCaze); } - CaseDataDto refreshedCaze = FacadeProvider.getCaseFacade().getCaseDataByUuid(caze.getUuid()); - saveCase(refreshedCaze); + setResultingCase(caze, selectedContacts, convertToCaseSelectionField.getSelectedEventParticipants()); SormasUI.refreshView(); }); @@ -1354,9 +1356,10 @@ public CommitDiscardWrapperComponent getEpiDataComponent(final Stri EpiDataForm epiDataForm = new EpiDataForm(caze.getDisease(), CaseDataDto.class, caze.isPseudonymized(), sourceContactsToggleCallback); epiDataForm.setValue(caze.getEpiData()); + UserProvider currentUserProvider = UserProvider.getCurrent(); final CommitDiscardWrapperComponent editView = new CommitDiscardWrapperComponent( epiDataForm, - UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT), + currentUserProvider.hasUserRight(UserRight.CASE_EDIT), epiDataForm.getFieldGroup()); editView.addCommitListener(() -> { @@ -1365,6 +1368,13 @@ public CommitDiscardWrapperComponent getEpiDataComponent(final Stri saveCase(cazeDto); }); + if (currentUserProvider.hasUserRight(UserRight.CONTACT_VIEW)) { + long sourceContactCount = FacadeProvider.getContactFacade().count(new ContactCriteria().resultingCase(caze.toReference())); + if (sourceContactCount > 0) { + epiDataForm.disableContactWithSourceCaseKnownField(); + } + } + return editView; } diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/CaseEpiDataView.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/CaseEpiDataView.java index 8fb35a4a196..4210c296028 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/CaseEpiDataView.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/CaseEpiDataView.java @@ -109,10 +109,6 @@ protected void initView(String params) { sourceContactsLayout.addComponent(contactCreationDisclaimer); } - if (!sourceContactList.isEmpty()) { - epiDataComponent.getWrappedComponent().disableContactWithSourceCaseKnownField(); - } - epiDataComponent.getWrappedComponent().setGetSourceContactsCallback(sourceContactList::getEntries); } layout.addComponent(sourceContactsLayout, LOC_SOURCE_CONTACTS); From 055bad5acecf070a66c9472a825e3982f477b4de Mon Sep 17 00:00:00 2001 From: Levente Gal <62599627+leventegal-she@users.noreply.github.com> Date: Fri, 22 Jul 2022 14:05:57 +0300 Subject: [PATCH 4/6] #9858 fix editing vaccination while processing phisicians report (#9916) --- .../PhysiciansReportCaseEditComponent.java | 10 ++++++++-- .../PhysiciansReportCaseImmunizationsComponent.java | 13 ++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java index c22080c4a58..8004d0d5601 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java @@ -64,6 +64,13 @@ public PhysiciansReportCaseEditComponent(CaseDataDto caze, ExternalMessageDto ex tabsMenu = new SubMenu(); tabConfigs = createTabConfigs(); + // save on active tab on commit + setPreCommitListener(callback -> { + if (activeTabComponent.commitAndHandle()) { + callback.run(); + } + }); + backButton = ButtonHelper.createButton(Captions.actionBack, (e) -> { if (activeTabIndex > 0) { String previousTab = tabConfigs.get(activeTabIndex - 1).captionTag; @@ -88,8 +95,7 @@ public PhysiciansReportCaseEditComponent(CaseDataDto caze, ExternalMessageDto ex getButtonsPanel().addComponent(nextButton); saveAndOpenCaseButton = ButtonHelper.createButton(Captions.actionSaveAndOpenCase, (b) -> { - if (activeTabComponent.commitAndHandle()) { - commit(); + if (commitAndHandle()) { ControllerProvider.getCaseController().navigateToCase(caze.getUuid()); } }, ValoTheme.BUTTON_PRIMARY); diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java index 7d80e8e9dd4..2c77ff8dd7d 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java @@ -17,7 +17,6 @@ import static de.symeda.sormas.ui.utils.CssStyles.H3; -import de.symeda.sormas.ui.utils.DirtyCheckPopup; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -55,6 +54,7 @@ import de.symeda.sormas.ui.utils.CssStyles; import de.symeda.sormas.ui.utils.DateFormatHelper; import de.symeda.sormas.ui.utils.DeletableUtils; +import de.symeda.sormas.ui.utils.DirtyCheckPopup; import de.symeda.sormas.ui.vaccination.VaccinationEditForm; public class PhysiciansReportCaseImmunizationsComponent extends CommitDiscardWrapperComponent { @@ -208,12 +208,11 @@ private void handleEditVaccination(VaccinationDto vaccination, CaseDataDto caze) VaccinationListItem collapsedComponent = vaccinationList.getItemByVaccination(vaccination); currentVaccinationEditComponent = ControllerProvider.getVaccinationController() - .getVaccinationEditComponent( - vaccination, - caze.getDisease(), - UiFieldAccessCheckers.getDefault(caze.isPseudonymized()), - false, - vaccinationsToUpdate::add); + .getVaccinationEditComponent(vaccination, caze.getDisease(), UiFieldAccessCheckers.getDefault(caze.isPseudonymized()), false, (v) -> { + if (!vaccinationsToCreate.contains(v)) { + vaccinationsToUpdate.add(v); + } + }); currentVaccinationEditComponent.getDiscardButton().setCaption(I18nProperties.getCaption(Captions.actionCancel)); currentVaccinationEditComponent.getButtonsPanel() From d1da2f9bcd2d031c1834936d195c5ae14552a561 Mon Sep 17 00:00:00 2001 From: Levente Gal <62599627+leventegal-she@users.noreply.github.com> Date: Mon, 25 Jul 2022 10:28:43 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=20#9886=20S2S=20|=20When=20sharing=20back?= =?UTF-8?q?=20a=20Contact=20from=20target=20system=20to=20the=20so?= =?UTF-8?q?=E2=80=A6=20(#9919)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #9886 S2S | When sharing back a Contact from target system to the source system the Contact can't be accepted #9784 (Backport of #9784) * #9886 S2S | When sharing back a Contact from target system to the source system the Contact can't be accepted #9784 (Backport of #9784) - fix compilation issue * #9886 S2S | When sharing back a Contact from target system to the source system the Contact can't be accepted #9784 (Backport of #9784) - fix compilation issue - review suggestion Co-authored-by: Levente Gal --- .../entities/contact/SormasToSormasContactFacadeEjb.java | 5 ++++- .../sormas/ui/sormastosormas/SormasToSormasController.java | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/sormastosormas/entities/contact/SormasToSormasContactFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/sormastosormas/entities/contact/SormasToSormasContactFacadeEjb.java index 198aff96650..1e737c1b0a3 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/sormastosormas/entities/contact/SormasToSormasContactFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/sormastosormas/entities/contact/SormasToSormasContactFacadeEjb.java @@ -49,6 +49,7 @@ import de.symeda.sormas.api.sormastosormas.validation.ValidationErrorGroup; import de.symeda.sormas.api.sormastosormas.validation.ValidationErrorMessage; import de.symeda.sormas.api.sormastosormas.validation.ValidationErrors; +import de.symeda.sormas.backend.caze.CaseFacadeEjb.CaseFacadeEjbLocal; import de.symeda.sormas.backend.common.BaseAdoService; import de.symeda.sormas.backend.contact.Contact; import de.symeda.sormas.backend.contact.ContactService; @@ -83,6 +84,8 @@ public class SormasToSormasContactFacadeEjb extends AbstractSormasToSormasInterf private ImmunizationService immunizationService; @EJB private SormasToSormasShareRequestService shareRequestService; + @EJB + private CaseFacadeEjbLocal caseFacade; public SormasToSormasContactFacadeEjb() { super( @@ -206,7 +209,7 @@ protected void validateShareRequestBeforeAccept(SormasToSormasShareRequestDto sh ValidationErrors.create( new ValidationErrorGroup(Captions.Contact), new ValidationErrorMessage(Validations.sormasToSormasAcceptContactHasNoCase)))); - } else { + } else if (!caseFacade.exists(c.getCaze().getUuid())) { List caseRequests = shareRequestService.getShareRequestsForCase(c.getCaze()); if (caseRequests.isEmpty() || caseRequests.stream() diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/sormastosormas/SormasToSormasController.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/sormastosormas/SormasToSormasController.java index 7d0375bb230..108ccd20ede 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/sormastosormas/SormasToSormasController.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/sormastosormas/SormasToSormasController.java @@ -160,6 +160,11 @@ public void acceptShareRequest(SormasToSormasShareRequestIndexDto request, Runna List contacts = shareRequest.getContacts(); for (int i = 0, contactsSize = contacts.size(); i < contactsSize && !hasErrors; i++) { SormasToSormasContactPreview c = contacts.get(i); + + if (FacadeProvider.getCaseFacade().exists(c.getCaze().getUuid())) { + continue; + } + List caseRequests = FacadeProvider.getSormasToSormasShareRequestFacade().getShareRequestsForCase(c.getCaze()); if (caseRequests.isEmpty()) { From 35f9f6b3bb67c1bda41df1cae7a0a658dd20b2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9=20Strysewske?= Date: Mon, 25 Jul 2022 12:16:35 +0200 Subject: [PATCH 6/6] [GITFLOW]updating poms for branch'hotfix-1.73.3' with non-snapshot versions --- sormas-api/pom.xml | 2 +- sormas-app/pom.xml | 2 +- sormas-backend/pom.xml | 2 +- sormas-base/dependencies/serverlibs.pom | 2 +- sormas-base/pom.xml | 2 +- sormas-cargoserver/pom.xml | 2 +- sormas-ear/pom.xml | 2 +- sormas-keycloak-service-provider/pom.xml | 2 +- sormas-rest/pom.xml | 2 +- sormas-ui/pom.xml | 2 +- sormas-widgetset/pom.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sormas-api/pom.xml b/sormas-api/pom.xml index 73e09f2184e..d0a311b7ea6 100644 --- a/sormas-api/pom.xml +++ b/sormas-api/pom.xml @@ -2,7 +2,7 @@ de.symeda.sormas sormas-base - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base 4.0.0 diff --git a/sormas-app/pom.xml b/sormas-app/pom.xml index 47c0d53a8a8..e65a5777924 100644 --- a/sormas-app/pom.xml +++ b/sormas-app/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base 4.0.0 diff --git a/sormas-backend/pom.xml b/sormas-backend/pom.xml index 876e00ad480..3abceeab160 100644 --- a/sormas-backend/pom.xml +++ b/sormas-backend/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base 4.0.0 diff --git a/sormas-base/dependencies/serverlibs.pom b/sormas-base/dependencies/serverlibs.pom index 8a13dd2961e..69e9744ff4f 100644 --- a/sormas-base/dependencies/serverlibs.pom +++ b/sormas-base/dependencies/serverlibs.pom @@ -8,7 +8,7 @@ sormas-base de.symeda.sormas - 1.73.3-SNAPSHOT + 1.73.3 ../ diff --git a/sormas-base/pom.xml b/sormas-base/pom.xml index 4516e6b25cf..06685871db7 100644 --- a/sormas-base/pom.xml +++ b/sormas-base/pom.xml @@ -5,7 +5,7 @@ de.symeda.sormas sormas-base pom - 1.73.3-SNAPSHOT + 1.73.3 1.8 diff --git a/sormas-cargoserver/pom.xml b/sormas-cargoserver/pom.xml index 95f20503a62..a5dc1e24da7 100644 --- a/sormas-cargoserver/pom.xml +++ b/sormas-cargoserver/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base diff --git a/sormas-ear/pom.xml b/sormas-ear/pom.xml index 84ef32df396..8f70a162ff2 100644 --- a/sormas-ear/pom.xml +++ b/sormas-ear/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base diff --git a/sormas-keycloak-service-provider/pom.xml b/sormas-keycloak-service-provider/pom.xml index 629247b3b5a..0b5c779af8d 100644 --- a/sormas-keycloak-service-provider/pom.xml +++ b/sormas-keycloak-service-provider/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base 4.0.0 diff --git a/sormas-rest/pom.xml b/sormas-rest/pom.xml index 64dc339d8f8..23da96a5068 100644 --- a/sormas-rest/pom.xml +++ b/sormas-rest/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base diff --git a/sormas-ui/pom.xml b/sormas-ui/pom.xml index 6bb15ffc187..2fbd3799c4c 100644 --- a/sormas-ui/pom.xml +++ b/sormas-ui/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base 4.0.0 diff --git a/sormas-widgetset/pom.xml b/sormas-widgetset/pom.xml index 9b642b4d6e5..fb65ca8123a 100644 --- a/sormas-widgetset/pom.xml +++ b/sormas-widgetset/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.73.3-SNAPSHOT + 1.73.3 ../sormas-base 4.0.0