From b532a87d0eaf7cef1745bf18a2ad478c77260ac2 Mon Sep 17 00:00:00 2001 From: Stefan Kock Date: Wed, 23 Nov 2022 12:46:10 +0100 Subject: [PATCH 1/3] [GITFLOW]updating poms for 1.76.8 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 3d40d3303be..5a900c34417 100644 --- a/sormas-api/pom.xml +++ b/sormas-api/pom.xml @@ -2,7 +2,7 @@ de.symeda.sormas sormas-base - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-app/pom.xml b/sormas-app/pom.xml index 9cc792843ce..22cca466dab 100644 --- a/sormas-app/pom.xml +++ b/sormas-app/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-backend/pom.xml b/sormas-backend/pom.xml index cedd23ac60a..286d4fe9029 100644 --- a/sormas-backend/pom.xml +++ b/sormas-backend/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-base/dependencies/serverlibs.pom b/sormas-base/dependencies/serverlibs.pom index ece03ebf4d0..62bbf436b82 100644 --- a/sormas-base/dependencies/serverlibs.pom +++ b/sormas-base/dependencies/serverlibs.pom @@ -8,7 +8,7 @@ sormas-base de.symeda.sormas - 1.76.7 + 1.76.8-SNAPSHOT ../ diff --git a/sormas-base/pom.xml b/sormas-base/pom.xml index dd468f6989e..69ce7e4fac2 100644 --- a/sormas-base/pom.xml +++ b/sormas-base/pom.xml @@ -5,7 +5,7 @@ de.symeda.sormas sormas-base pom - 1.76.7 + 1.76.8-SNAPSHOT 1.8 diff --git a/sormas-cargoserver/pom.xml b/sormas-cargoserver/pom.xml index 6b15067ae4f..79294654a8d 100644 --- a/sormas-cargoserver/pom.xml +++ b/sormas-cargoserver/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base diff --git a/sormas-ear/pom.xml b/sormas-ear/pom.xml index 239b2bbf033..c86f1189b46 100644 --- a/sormas-ear/pom.xml +++ b/sormas-ear/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base diff --git a/sormas-keycloak-service-provider/pom.xml b/sormas-keycloak-service-provider/pom.xml index aadbfe850ea..7cebe8d633e 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.76.7 + 1.76.8-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-rest/pom.xml b/sormas-rest/pom.xml index 70aaf2340bb..3fd939d3f1a 100644 --- a/sormas-rest/pom.xml +++ b/sormas-rest/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base diff --git a/sormas-ui/pom.xml b/sormas-ui/pom.xml index 95924d15d12..997f8bbda40 100644 --- a/sormas-ui/pom.xml +++ b/sormas-ui/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base 4.0.0 diff --git a/sormas-widgetset/pom.xml b/sormas-widgetset/pom.xml index c2c775cc311..34c3fab8700 100644 --- a/sormas-widgetset/pom.xml +++ b/sormas-widgetset/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.7 + 1.76.8-SNAPSHOT ../sormas-base 4.0.0 From 9d65bf46f8bdb924595ac87782a05017e1c4e1e4 Mon Sep 17 00:00:00 2001 From: Levente Gal <62599627+leventegal-she@users.noreply.github.com> Date: Thu, 24 Nov 2022 10:10:02 +0200 Subject: [PATCH 2/3] #10987 Fixed filter 'only cases changed since last shared with reporting tool' (#10996) * #10987 [SurvNet] Filter 'only cases changed since last shared with reporting tool' does not work * #10987 [SurvNet] Filter 'only cases changed since last shared with reporting tool' does not work - use constant in tests * #10987 [SurvNet] Filter 'only cases changed since last shared with reporting tool' does not work - uncomment code Co-authored-by: Levente Gal --- .../sormas/backend/ExtendedPostgreSQL94Dialect.java | 8 ++++++-- .../de/symeda/sormas/backend/caze/CaseService.java | 10 +++------- .../sormas/backend/share/ExternalShareInfoService.java | 4 ++-- .../sormas/backend/vaccination/VaccinationService.java | 4 ++-- .../de/symeda/sormas/backend/AbstractBeanTest.java | 4 ++-- .../test/java/de/symeda/sormas/backend/H2Function.java | 5 +++-- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/ExtendedPostgreSQL94Dialect.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/ExtendedPostgreSQL94Dialect.java index 0e75d48f3ac..71a747359df 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/ExtendedPostgreSQL94Dialect.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/ExtendedPostgreSQL94Dialect.java @@ -9,6 +9,8 @@ import com.vladmihalcea.hibernate.type.json.JsonStringType; +import de.symeda.sormas.backend.vaccination.VaccinationService; + public class ExtendedPostgreSQL94Dialect extends PostgreSQL94Dialect { public final static String SIMILARITY_OPERATOR = "similarity_operator"; @@ -24,7 +26,7 @@ public class ExtendedPostgreSQL94Dialect extends PostgreSQL94Dialect { public final static String WINDOW_FIRST_VALUE_DESC = "window_first_value_desc"; public final static String WINDOW_COUNT = "window_count"; public final static String GREATEST = "greatest"; - public final static String TIMESTAMP_SUBTRACT_DAYS = "timestamp_subtract_days"; + public final static String TIMESTAMP_SUBTRACT_14_DAYS = "timestamp_subtract_14_days"; public final static String AT_END_OF_DAY = "at_end_of_day"; public ExtendedPostgreSQL94Dialect() { @@ -51,7 +53,9 @@ public ExtendedPostgreSQL94Dialect() { registerFunction(GREATEST, new StandardSQLFunction(GREATEST)); registerFunction(ARRAY_CONTAINS_TEXT, new SQLFunctionTemplate(StandardBasicTypes.BOOLEAN, "?1 @> array[?2]::text[]")); registerFunction(JSON_EXTRACT_PATH_TEXT, new SQLFunctionTemplate(StandardBasicTypes.STRING, "json_extract_path_text(?1, ?2)")); - registerFunction(TIMESTAMP_SUBTRACT_DAYS, new SQLFunctionTemplate(StandardBasicTypes.DATE, "?1 - interval '?2 days'")); + registerFunction( + TIMESTAMP_SUBTRACT_14_DAYS, + new SQLFunctionTemplate(StandardBasicTypes.DATE, "?1 - interval '" + VaccinationService.REPORT_DATE_RELEVANT_DAYS + " days'")); registerFunction(AT_END_OF_DAY, new SQLFunctionTemplate(StandardBasicTypes.DATE, "?1::date + interval '1 day' - interval '1 microsecond'")); } } diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java index e34ec55e25a..7f0eef920c1 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java @@ -956,7 +956,7 @@ public Predicate createCriteriaFilter(CaseCrite cb, from, ExternalShareInfo.CAZE, - (latestShareDate) -> createChangeDateFilter(cq, cb, from, latestShareDate, true, true))); + (latestShareDate) -> createChangeDateFilter(cq, cb, from, joins, latestShareDate, true, true))); return filter; } @@ -1224,6 +1224,7 @@ private Predicate createChangeDateFilter( CriteriaQuery cq, CriteriaBuilder cb, From casePath, + CaseJoins joins, Expression dateExpression, boolean includeExtendedChangeDateFilters, boolean includeRelevantVaccinations) { @@ -1231,12 +1232,7 @@ private Predicate createChangeDateFilter( ChangeDateFilterBuilder builder = addChangeDates(new ChangeDateFilterBuilder(cb, dateExpression), casePath, includeExtendedChangeDateFilters); if (includeRelevantVaccinations) { - Subquery symptomsSq = cq.subquery(Symptoms.class); - Root symptomsSqRoot = symptomsSq.from(Symptoms.class); - symptomsSq.select(symptomsSqRoot.get(Symptoms.ONSET_DATE)); - symptomsSq.where(cb.equal(symptomsSqRoot, casePath.get(Case.SYMPTOMS))); - - Join immunizationJoin = casePath.join(Case.PERSON, JoinType.LEFT).join(Person.IMMUNIZATIONS, JoinType.LEFT); + Join immunizationJoin = joins.getPersonJoins().getImmunization(); Join vaccinationsJoin = immunizationJoin.join(Immunization.VACCINATIONS, JoinType.LEFT); builder.add(vaccinationsJoin.on(vaccinationService.getRelevantVaccinationPredicate(casePath, cq, cb, vaccinationsJoin))); diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/share/ExternalShareInfoService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/share/ExternalShareInfoService.java index 84ca6e1d979..ec3783d4fa9 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/share/ExternalShareInfoService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/share/ExternalShareInfoService.java @@ -261,7 +261,7 @@ public Predicate buildLatestSurvToolShareDateFilter( String associatedObjectName, Function, Predicate> shareDatePredicateBuilder) { - Subquery survToolShareSubQuery = cq.subquery(Timestamp.class); + Subquery survToolShareSubQuery = cq.subquery(Object.class); Root survToolShareRoot = survToolShareSubQuery.from(ExternalShareInfo.class); Join associatedObject = survToolShareRoot.join(associatedObjectName, JoinType.LEFT); @SuppressWarnings({ @@ -271,7 +271,7 @@ public Predicate buildLatestSurvToolShareDateFilter( // double conversion because hibernate doesn't know the `max` function for timestamps (Expression) ((Expression) cb.max(survToolShareRoot.get(ExternalShareInfo.CREATION_DATE))); - Path associatedObjectId = associatedObject.get(AbstractDomainObject.ID); + Path associatedObjectId = associatedObject.get(AbstractDomainObject.ID); survToolShareSubQuery.select(associatedObjectId); survToolShareSubQuery.where(cb.equal(associatedObject, from.get(AbstractDomainObject.ID))); 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 00082a81ed2..f3f487c44f1 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,7 +16,7 @@ package de.symeda.sormas.backend.vaccination; import static de.symeda.sormas.backend.ExtendedPostgreSQL94Dialect.AT_END_OF_DAY; -import static de.symeda.sormas.backend.ExtendedPostgreSQL94Dialect.TIMESTAMP_SUBTRACT_DAYS; +import static de.symeda.sormas.backend.ExtendedPostgreSQL94Dialect.TIMESTAMP_SUBTRACT_14_DAYS; import java.util.ArrayList; import java.util.Comparator; @@ -291,7 +291,7 @@ public Predicate getRelevantVaccinationPredicate( Expression vaccinationDateExpr = cb. selectCase() .when( cb.isNull(vaccinationDate), - cb.function(TIMESTAMP_SUBTRACT_DAYS, Date.class, vaccinationPath.get(Vaccination.REPORT_DATE), cb.literal(REPORT_DATE_RELEVANT_DAYS))) + cb.function(TIMESTAMP_SUBTRACT_14_DAYS, Date.class, vaccinationPath.get(Vaccination.REPORT_DATE))) .otherwise(vaccinationDate); return getRelevantVaccinationPredicate(cb, vaccinationDateExpr, primaryDatePath, fallbackDatePath); diff --git a/sormas-backend/src/test/java/de/symeda/sormas/backend/AbstractBeanTest.java b/sormas-backend/src/test/java/de/symeda/sormas/backend/AbstractBeanTest.java index 8a0fc57e320..26c00c9d45e 100644 --- a/sormas-backend/src/test/java/de/symeda/sormas/backend/AbstractBeanTest.java +++ b/sormas-backend/src/test/java/de/symeda/sormas/backend/AbstractBeanTest.java @@ -25,7 +25,6 @@ import javax.persistence.EntityManager; import javax.persistence.Query; -import de.symeda.sormas.backend.sormastosormas.origin.SormasToSormasOriginInfoFacadeEjb.SormasToSormasOriginInfoFacadeEjbLocal; import org.junit.Before; import de.symeda.sormas.api.ConfigFacade; @@ -204,6 +203,7 @@ import de.symeda.sormas.backend.sormastosormas.entities.immunization.SormasToSormasImmunizationDtoValidator; import de.symeda.sormas.backend.sormastosormas.entities.sample.ReceivedSampleProcessor; import de.symeda.sormas.backend.sormastosormas.entities.sample.SormasToSormasSampleDtoValidator; +import de.symeda.sormas.backend.sormastosormas.origin.SormasToSormasOriginInfoFacadeEjb.SormasToSormasOriginInfoFacadeEjbLocal; import de.symeda.sormas.backend.sormastosormas.share.ShareDataBuilderHelper; import de.symeda.sormas.backend.sormastosormas.share.incoming.SormasToSormasShareRequestFacadeEJB.SormasToSormasShareRequestFacadeEJBLocal; import de.symeda.sormas.backend.sormastosormas.share.incoming.SormasToSormasShareRequestService; @@ -287,7 +287,7 @@ protected void initH2Functions() { nativeQuery = em.createNativeQuery("CREATE ALIAS date FOR \"de.symeda.sormas.backend.H2Function.date\""); nativeQuery.executeUpdate(); nativeQuery = - em.createNativeQuery("CREATE ALIAS timestamp_subtract_days FOR \"de.symeda.sormas.backend.H2Function.timestamp_subtract_days\""); + em.createNativeQuery("CREATE ALIAS timestamp_subtract_14_days FOR \"de.symeda.sormas.backend.H2Function.timestamp_subtract_14_days\""); nativeQuery.executeUpdate(); nativeQuery = em.createNativeQuery("CREATE ALIAS at_end_of_day FOR \"de.symeda.sormas.backend.H2Function.at_end_of_day\""); nativeQuery.executeUpdate(); diff --git a/sormas-backend/src/test/java/de/symeda/sormas/backend/H2Function.java b/sormas-backend/src/test/java/de/symeda/sormas/backend/H2Function.java index 05969ec4dd5..97fc9b6fbeb 100644 --- a/sormas-backend/src/test/java/de/symeda/sormas/backend/H2Function.java +++ b/sormas-backend/src/test/java/de/symeda/sormas/backend/H2Function.java @@ -4,6 +4,7 @@ import de.symeda.sormas.api.utils.DateHelper; import de.symeda.sormas.api.utils.UtilDate; +import de.symeda.sormas.backend.vaccination.VaccinationService; /** * When extending this class make sure to also extend {@link AbstractBeanTest#initH2Functions()} and {@link ExtendedH2Dialect}. @@ -45,8 +46,8 @@ public static Date date(Date timestamp) { return DateHelper.getStartOfDay(timestamp); } - public static Date timestamp_subtract_days(Date timestamp, int days) { - return DateHelper.subtractDays(timestamp, days); + public static Date timestamp_subtract_14_days(Date timestamp) { + return DateHelper.subtractDays(timestamp, VaccinationService.REPORT_DATE_RELEVANT_DAYS); } public static Date at_end_of_day(Date timestamp) { From 1a74967b3903650977cff58388cd316fde51a048 Mon Sep 17 00:00:00 2001 From: Stefan Kock Date: Thu, 24 Nov 2022 10:33:02 +0100 Subject: [PATCH 3/3] [GITFLOW]updating poms for branch'hotfix-1.76.8' 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 5a900c34417..4fc9c5d6aeb 100644 --- a/sormas-api/pom.xml +++ b/sormas-api/pom.xml @@ -2,7 +2,7 @@ de.symeda.sormas sormas-base - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base 4.0.0 diff --git a/sormas-app/pom.xml b/sormas-app/pom.xml index 22cca466dab..e887b02f78d 100644 --- a/sormas-app/pom.xml +++ b/sormas-app/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base 4.0.0 diff --git a/sormas-backend/pom.xml b/sormas-backend/pom.xml index 286d4fe9029..32d18e3f1c7 100644 --- a/sormas-backend/pom.xml +++ b/sormas-backend/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base 4.0.0 diff --git a/sormas-base/dependencies/serverlibs.pom b/sormas-base/dependencies/serverlibs.pom index 62bbf436b82..c538e64bb6f 100644 --- a/sormas-base/dependencies/serverlibs.pom +++ b/sormas-base/dependencies/serverlibs.pom @@ -8,7 +8,7 @@ sormas-base de.symeda.sormas - 1.76.8-SNAPSHOT + 1.76.8 ../ diff --git a/sormas-base/pom.xml b/sormas-base/pom.xml index 69ce7e4fac2..5f3e89adf34 100644 --- a/sormas-base/pom.xml +++ b/sormas-base/pom.xml @@ -5,7 +5,7 @@ de.symeda.sormas sormas-base pom - 1.76.8-SNAPSHOT + 1.76.8 1.8 diff --git a/sormas-cargoserver/pom.xml b/sormas-cargoserver/pom.xml index 79294654a8d..82b2e85c55c 100644 --- a/sormas-cargoserver/pom.xml +++ b/sormas-cargoserver/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base diff --git a/sormas-ear/pom.xml b/sormas-ear/pom.xml index c86f1189b46..772e510a90f 100644 --- a/sormas-ear/pom.xml +++ b/sormas-ear/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base diff --git a/sormas-keycloak-service-provider/pom.xml b/sormas-keycloak-service-provider/pom.xml index 7cebe8d633e..cae729ed1a3 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.76.8-SNAPSHOT + 1.76.8 ../sormas-base 4.0.0 diff --git a/sormas-rest/pom.xml b/sormas-rest/pom.xml index 3fd939d3f1a..50f3989fc66 100644 --- a/sormas-rest/pom.xml +++ b/sormas-rest/pom.xml @@ -3,7 +3,7 @@ de.symeda.sormas sormas-base - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base diff --git a/sormas-ui/pom.xml b/sormas-ui/pom.xml index 997f8bbda40..dd7f458c2f7 100644 --- a/sormas-ui/pom.xml +++ b/sormas-ui/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base 4.0.0 diff --git a/sormas-widgetset/pom.xml b/sormas-widgetset/pom.xml index 34c3fab8700..95f1b213a73 100644 --- a/sormas-widgetset/pom.xml +++ b/sormas-widgetset/pom.xml @@ -3,7 +3,7 @@ sormas-base de.symeda.sormas - 1.76.8-SNAPSHOT + 1.76.8 ../sormas-base 4.0.0