Here is the exact code that I committed in my feature branch, which was
created from a fork of the OFBiz trunk.

https://github.com/diveshdut/ofbiz-framework/commit/4cbcd3c41be0f4e1bb6b8ffde1055dc5f67ea2c8

If this looks generally acceptable, I will create the Jira ticket and pull
request for OFBiz trunk.

Thanks
--
Divesh Dutta
www.hotwaxsystems.com

On Tue, Jul 7, 2026 at 11:32 AM Divesh Dutta <[email protected]>
wrote:

> Hi all,
>
> While working on PWA apps for Manufacturing, I encountered the same REST
> pagination logic in a few places. Since the need itself is generic and not
> really manufacturing-specific, I thought it might make sense to move that
> logic into RestApiUtil as reusable helpers.
>
> I’m thinking about adding these four methods to:
>
> framework/restapi/src/main/java/org/apache/ofbiz/ws/rs/util/RestApiUtil.java:
>
> Here are the 4 methods:
>
> 1) getPagingParameters(Map<String, ?> parameters):
>
>     This would normalize paging inputs into a standard pageIndex and
> pageSize, including defaults and support for both pageIndex/pageSize and
> VIEW_INDEX/VIEW_SIZE.
>
>
> 2) getPartialList(EntityQuery query, int pageIndex, int pageSize):
>
>     This would wrap the usual EntityListIterator.getPartialList(...) usage
> so services avoid repeating paging calculations and iterator handling.
>
>
>
> 3) getPagedResult(int pageIndex, int pageSize, long totalCount, String
> listName, List<?> rows) :
>
>
>     This would create a standard paged REST response map with metadata
> like page index, page size, total count, and the actual result list.
>
> 4) getParameterValueIgnoreCase(Map<String, ?> parameters, String... names)
> :
>
>     This would help look up request parameters by accepted aliases
> case-insensitively.
>
>
>
> The main goal is to avoid repeating the same small pieces of logic in REST
> services and to keep pagination handling more consistent across endpoints.
>
> Although I first needed this while building Manufacturing PWAs, the
> methods themselves are generic, so I think RestApiUtil is the right place
> for them.
>
> If this sounds reasonable, I can prepare a Jira ticket and contribute the
> code.
>
> Thanks
> --
> Divesh Dutta
> www.hotwaxsystems.com
>
>

Reply via email to