From 1c98d056e1153f084fe7f82beb78222e45665048 Mon Sep 17 00:00:00 2001 From: teleivo Date: Fri, 5 Jan 2024 15:11:05 +0100 Subject: [PATCH 1/2] chore: fix wrongly renamed test files these tests are in the export package and have nothing to do with import. Remove Import from their names. This allows IntelliJ to find their implementation again --- ...eImportRequestParamsTest.java => PageRequestParamsTest.java} | 2 +- ...ParamsValidatorTest.java => RequestParamsValidatorTest.java} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/{PageImportRequestParamsTest.java => PageRequestParamsTest.java} (98%) rename dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/{ImportRequestParamsValidatorTest.java => RequestParamsValidatorTest.java} (99%) diff --git a/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/PageImportRequestParamsTest.java b/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParamsTest.java similarity index 98% rename from dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/PageImportRequestParamsTest.java rename to dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParamsTest.java index c54d9cf55d35..c5b124cf4f42 100644 --- a/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/PageImportRequestParamsTest.java +++ b/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParamsTest.java @@ -33,7 +33,7 @@ import lombok.Data; import org.junit.jupiter.api.Test; -class PageImportRequestParamsTest { +class PageRequestParamsTest { @Data private static class PaginationParameters implements PageRequestParams { diff --git a/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/ImportRequestParamsValidatorTest.java b/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidatorTest.java similarity index 99% rename from dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/ImportRequestParamsValidatorTest.java rename to dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidatorTest.java index aa852aa5ccc6..1df83aea6e16 100644 --- a/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/ImportRequestParamsValidatorTest.java +++ b/dhis-2/dhis-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidatorTest.java @@ -64,7 +64,7 @@ import org.junit.jupiter.params.provider.ValueSource; /** Tests {@link RequestParamsValidator}. */ -class ImportRequestParamsValidatorTest { +class RequestParamsValidatorTest { private static final String TEA_1_UID = "TvjwTPToKHO"; From b724c60f06d790140f5dbdadc6ba55b9a63c869c Mon Sep 17 00:00:00 2001 From: teleivo Date: Fri, 5 Jan 2024 15:25:10 +0100 Subject: [PATCH 2/2] fix: relationship used enrollment mapper for order We used the relationship mapper to validate any order field can be ordered by. We then accidentally used the enrollment mapper to map from view names to internal domain names. That worked in this case since relationships can only be ordered by createdAt/Client which is also supported by enrollment --- .../export/relationship/RelationshipRequestParamsMapper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipRequestParamsMapper.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipRequestParamsMapper.java index 88702d9d7b58..e43a6fdcf102 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipRequestParamsMapper.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipRequestParamsMapper.java @@ -45,7 +45,6 @@ import org.hisp.dhis.tracker.export.relationship.RelationshipOperationParams; import org.hisp.dhis.tracker.export.relationship.RelationshipOperationParams.RelationshipOperationParamsBuilder; import org.hisp.dhis.webapi.controller.event.webrequest.OrderCriteria; -import org.hisp.dhis.webapi.controller.tracker.export.enrollment.EnrollmentMapper; import org.springframework.stereotype.Component; /** @@ -128,9 +127,9 @@ private void mapOrderParam( } for (OrderCriteria order : orders) { - if (EnrollmentMapper.ORDERABLE_FIELDS.containsKey(order.getField())) { + if (RelationshipMapper.ORDERABLE_FIELDS.containsKey(order.getField())) { builder.orderBy( - EnrollmentMapper.ORDERABLE_FIELDS.get(order.getField()), order.getDirection()); + RelationshipMapper.ORDERABLE_FIELDS.get(order.getField()), order.getDirection()); } } }