diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParams.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParams.java index 0baedb648fb5..b4cbdb40f28e 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParams.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/PageRequestParams.java @@ -27,7 +27,6 @@ */ package org.hisp.dhis.webapi.controller.tracker.export; -import java.util.Objects; import org.hisp.dhis.common.OpenApi; /** @@ -61,7 +60,7 @@ public interface PageRequestParams { */ @OpenApi.Ignore default boolean isPaged() { - return Objects.requireNonNullElse(getSkipPaging(), true); + return !Boolean.TRUE.equals(getSkipPaging()); } /** Indicates whether to include the total number of items and pages in the paginated response. */ diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidator.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidator.java index 722bd5c29bba..f5c7aeebe9a1 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidator.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/RequestParamsValidator.java @@ -404,7 +404,7 @@ private static boolean orgUnitModeDoesNotRequireOrgUnit( public static void validatePaginationParameters(PageRequestParams params) throws BadRequestException { - if (Boolean.TRUE.equals(params.getSkipPaging()) + if (!params.isPaged() && (ObjectUtils.firstNonNull(params.getPage(), params.getPageSize()) != null || Boolean.TRUE.equals(params.getTotalPages()))) { throw new BadRequestException( 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/PageImportRequestParamsTest.java index e91aa9135d5c..c54d9cf55d35 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/PageImportRequestParamsTest.java @@ -51,9 +51,9 @@ void shouldBePagedIfSkipPagingIsNull() { } @Test - void shouldBePagedIfSkipPagingIsTrue() { + void shouldBePagedIfSkipPagingIsFalse() { PaginationParameters parameters = new PaginationParameters(); - parameters.setSkipPaging(true); + parameters.setSkipPaging(false); assertTrue(parameters.isPaged()); } @@ -61,7 +61,7 @@ void shouldBePagedIfSkipPagingIsTrue() { @Test void shouldBeUnpagedIfSkipPagingIsTrue() { PaginationParameters parameters = new PaginationParameters(); - parameters.setSkipPaging(false); + parameters.setSkipPaging(true); assertFalse(parameters.isPaged()); }