Add support for the Querydsl IN operator in LdapSerializer.#631
Open
Ashish-CodeJourney wants to merge 1 commit into
Open
Add support for the Querydsl IN operator in LdapSerializer.#631Ashish-CodeJourney wants to merge 1 commit into
Ashish-CodeJourney wants to merge 1 commit into
Conversation
Querydsl expresses collection-path contains as IN(element, path), which now translates to an equality filter on the multi-valued attribute. IN with a constant collection translates to an OR of equality filters. Signed-off-by: Ashish Vaghela <ashish.vaghela@nelkinda.com>
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.
Closes #82
Using a Querydsl predicate on a multi-valued attribute, e.g.:
fails with:
Querydsl translates
collectionPath.contains(value)into anOps.INoperation, whichLdapSerializerdid not handle.This PR adds
Ops.INhandling for both shapes Querydsl produces:collectionPath.contains(value)emitted asIN(element, path)maps to(attribute=value), since LDAP equality on a multi-valued attribute matches if any value is equal.path.in(a, b)emitted asIN(path, constantCollection)maps to(|(attribute=a)(attribute=b)).path.in(singleValue)already worked because Querydsl rewrites it toeq; a test now pins that behavior.Tests were written first and confirmed failing on unmodified
mainwith the exact exception from the issue, then made green by the change. The new tests reuse the existingQPerson/UnitTestPersonfixtures (thedescriptionattribute is already multi-valued). Full test suite passes: 86 tests, 0 failures.