OFBIZ-13457 : Add generic REST collection query, filter, sort, and pagination helpers#1471
Open
diveshdut wants to merge 5 commits into
Open
OFBIZ-13457 : Add generic REST collection query, filter, sort, and pagination helpers#1471diveshdut wants to merge 5 commits into
diveshdut wants to merge 5 commits into
Conversation
diveshdut
force-pushed
the
rest-collection-query-impl
branch
from
July 20, 2026 12:48
f8fc5fc to
dbd0d8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Ticket:
https://issues.apache.org/jira/browse/OFBIZ-13457
Summary
Adds generic framework support in
framework/rest-apifor REST collection query handling and paged response construction.This contribution introduces reusable helpers for:
Linkheader generation for paged REST responses400 Bad Requestmapping for malformed or unsupported query-contract inputThe implementation is intended to be reusable across OFBiz REST endpoints while keeping endpoint-specific query policies optional.
What’s Included
pageIndex/pageSizeVIEW_INDEX/VIEW_SIZE-prefix-pageIndexpageSizetotalCounttotalPageshasNextselfprevnextfirstlastLinkheader generation for paged success responsesIllegalArgumentExceptionfailures to HTTP400 Bad RequestLinkheader behavior400mapping behaviorQuery Contract Behavior
Current framework support in this PR is aligned to direct query parameters such as:
?pageIndex=0&pageSize=20?sort=statusId,-createdStamp?facilityId=WebStoreWarehouse&statusId=PRUN_CREATEDThe framework now supports returning
400 Bad Requestwhen the query contract is malformed or unsupported in these areas:Not Included
filter=grammar yeteq,ne,gt,lt, etc.Verification
compileJavatest --tests org.apache.ofbiz.ws.rs.util.RestListResponseBuilderTest --tests org.apache.ofbiz.ws.rs.util.RestApiUtilPaginationTest --tests org.apache.ofbiz.ws.rs.util.RestQueryOptionsTest --tests org.apache.ofbiz.ws.rs.spi.impl.GlobalExceptionMapperTestCompile and focused tests passed locally.