Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make filtering case insensitive and restrict the limit violation enum values. #51

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

flomillot
Copy link
Contributor

No description provided.

Signed-off-by: Florent MILLOT <millotflo@gmail.com>
Copy link

sonarqubecloud bot commented Nov 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

75.0% 75.0% Coverage
0.0% 0.0% Duplication

@sBouzols sBouzols self-requested a review November 3, 2023 13:24
@YenguiSeddik YenguiSeddik self-requested a review November 3, 2023 14:10
}

public static <X> Specification<X> contains(String field, String value) {
return (root, cq, cb) -> cb.like(getColumnPath(root, field), "%" + EscapeCharacter.DEFAULT.escape(value) + "%", EscapeCharacter.DEFAULT.getEscapeCharacter());
return (root, cq, cb) -> cb.like(cb.upper(getColumnPath(root, field)), "%" + EscapeCharacter.DEFAULT.escape(value).toUpperCase() + "%", EscapeCharacter.DEFAULT.getEscapeCharacter());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value can't be null?
intellij suggest to add : Objects.requireNonNull(EscapeCharacter.DEFAULT.escape(value)).toUpperCase()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If value of filter is null it will broke before during the toString().
I didn't manage it but maybe I should use NonNull on every params of the record ?

Copy link
Contributor Author

@flomillot flomillot Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I use null in some cases (for EQUALS by instance, but I will probably change it later).
I add it in my TODO list to check when I'll come back.

@flomillot flomillot merged commit 9325a15 into main Nov 3, 2023
4 checks passed
@flomillot flomillot deleted the fix_sca_filtering branch November 3, 2023 16:49
EtienneLt pushed a commit that referenced this pull request Jul 2, 2024
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants