From 8f1e36c302a1083f11ff4342e96005ead23e38ef Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Fri, 11 Oct 2019 10:20:26 -0700 Subject: [PATCH 1/6] fix(travis): changed to openjdk8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6cba97ed6..c0d692ce8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: java sudo: required jdk: - - oraclejdk8 + - openjdk8 - openjdk11 services: From 6ff699284a2340de0f22d7a5e447444e8347f0f7 Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Sat, 12 Oct 2019 17:01:05 -0700 Subject: [PATCH 2/6] feat(GH-204): added LOWER predicate for case insensitive match (#206) --- .../schema/impl/GraphQLJpaSchemaBuilder.java | 6 ++++ .../schema/impl/JpaPredicateBuilder.java | 6 +++- .../query/schema/impl/PredicateFilter.java | 7 ++-- .../query/schema/GraphQLExecutorTests.java | 32 +++++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java b/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java index 8e7708f55..c1f081c03 100644 --- a/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java +++ b/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java @@ -515,6 +515,12 @@ private GraphQLInputType getWhereAttributeType(Attribute attribute) { .type(getAttributeInputType(attribute)) .build() ) + .field(GraphQLInputObjectField.newInputObjectField() + .name(Criteria.LOWER.name()) + .description("Case insensitive match criteria") + .type(getAttributeInputType(attribute)) + .build() + ) .field(GraphQLInputObjectField.newInputObjectField() .name(Criteria.CASE.name()) .description("Case sensitive match criteria") diff --git a/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/JpaPredicateBuilder.java b/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/JpaPredicateBuilder.java index f823e021a..1b79ed7bb 100644 --- a/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/JpaPredicateBuilder.java +++ b/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/JpaPredicateBuilder.java @@ -129,7 +129,7 @@ protected Predicate getStringPredicate(Path root, PredicateFilter filter if(arrayValuePredicate == null) { String compareValue = filter.getValue().toString(); Expression fieldValue = root; - + if (filter.getCriterias().contains(PredicateFilter.Criteria.IN)) { CriteriaBuilder.In in = cb.in(root); return in.value(compareValue); @@ -141,6 +141,10 @@ protected Predicate getStringPredicate(Path root, PredicateFilter filter if (filter.getCriterias().contains(PredicateFilter.Criteria.EQ)) { return cb.equal(fieldValue, compareValue); } + else if (filter.getCriterias().contains(PredicateFilter.Criteria.LOWER)) { + return cb.equal(cb.lower(fieldValue), + compareValue.toLowerCase()); + } else if (filter.getCriterias().contains(PredicateFilter.Criteria.NE)) { return cb.notEqual(fieldValue, compareValue); } diff --git a/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/PredicateFilter.java b/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/PredicateFilter.java index 8e7080ced..b4840ec39 100644 --- a/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/PredicateFilter.java +++ b/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/PredicateFilter.java @@ -60,10 +60,13 @@ public enum Criteria { * case sensitive (strings) */ CASE, + /** + * case insensitive match + *
LOWER(field) = LOWER(SEARCH)
+ */ + LOWER, /** * end of the string matches - *
LOWER(field) LIKE LOWER(SEARCH)
if not set then case - * insensitive match */ ENDS, /** diff --git a/graphql-jpa-query-schema/src/test/java/com/introproventures/graphql/jpa/query/schema/GraphQLExecutorTests.java b/graphql-jpa-query-schema/src/test/java/com/introproventures/graphql/jpa/query/schema/GraphQLExecutorTests.java index b909ff962..cc4a35591 100644 --- a/graphql-jpa-query-schema/src/test/java/com/introproventures/graphql/jpa/query/schema/GraphQLExecutorTests.java +++ b/graphql-jpa-query-schema/src/test/java/com/introproventures/graphql/jpa/query/schema/GraphQLExecutorTests.java @@ -1550,6 +1550,38 @@ public void queryWithEQMatchingCase() { assertThat(result.toString()).isEqualTo(expected); } + @Test + public void queryWithLOWERNotMatchingCase() { + //given: + String query = "query { Books ( where: { title: {LOWER: \"WAR AND PEACE\"}}) { select { id title} } }"; + + String expected = "{Books={select=[" + + "{id=2, title=War and Peace}" + + "]}}"; + + //when: + Object result = executor.execute(query).getData(); + + //then: + assertThat(result.toString()).isEqualTo(expected); + } + + @Test + public void queryWithLOWERMatchingCase() { + //given: + String query = "query { Books ( where: { title: {LOWER: \"War and Peace\"}}) { select { id title} } }"; + + String expected = "{Books={select=[" + + "{id=2, title=War and Peace}" + + "]}}"; + + //when: + Object result = executor.execute(query).getData(); + + //then: + assertThat(result.toString()).isEqualTo(expected); + } + @Test public void shouldNotReturnStaleCacheResultsFromPreviousQueryForCollectionCriteriaExpression() { //given: From b3485d5e7f75065f3399bc5e27f93cd2125dd014 Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Sat, 12 Oct 2019 21:44:34 -0700 Subject: [PATCH 3/6] [maven-release-plugin] Update CHANGELOG.md --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6102840ee..e11f2cf0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log -## 0.3.34-SNAPSHOT +## 0.3.34 +* feat(GH-204): added LOWER predicate for case insensitive match (#206) [6ff6992](https://github.com/introproventures/graphql-jpa-query/commit/6ff699284a2340de0f22d7a5e447444e8347f0f7) +* fix(travis): changed to openjdk8 [8f1e36c](https://github.com/introproventures/graphql-jpa-query/commit/8f1e36c302a1083f11ff4342e96005ead23e38ef) +* docs(README): polish description [skip travis] [4ad2ad2](https://github.com/introproventures/graphql-jpa-query/commit/4ad2ad245659f3c6b78a9b119c1e791d99129925) * fix(GH-193): Fixed error in GQL Queries when `total` or `pages` is included with condition `where: NOT_EXISTS` or `EXISTS` (#201) [40a0e2d](https://github.com/introproventures/graphql-jpa-query/commit/40a0e2d844854f8888e3502d1d6434db9cb1dd7e) * fix(GH-198): adedd support for fetching optional element collections elements (#200) [5d99c3b](https://github.com/introproventures/graphql-jpa-query/commit/5d99c3b4629521ebee2788c6b877250c279c8bf2) * fix: Added support for binding orderBy argument as a variable (#195) [2a01382](https://github.com/introproventures/graphql-jpa-query/commit/2a0138237cb639427f169b18f6b6f159c430afac) From a18989d434a49bb6650f90e351050e090fb3e935 Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Sat, 12 Oct 2019 21:45:22 -0700 Subject: [PATCH 4/6] [maven-release-plugin] prepare release 0.3.34 --- graphql-jpa-query-annotations/pom.xml | 2 +- graphql-jpa-query-autoconfigure/pom.xml | 2 +- graphql-jpa-query-boot-starter/pom.xml | 2 +- graphql-jpa-query-build/pom.xml | 2 +- graphql-jpa-query-dependencies/pom.xml | 2 +- graphql-jpa-query-example-merge/pom.xml | 2 +- graphql-jpa-query-example-model-books/pom.xml | 2 +- graphql-jpa-query-example-model-starwars/pom.xml | 2 +- graphql-jpa-query-example-simple/pom.xml | 2 +- graphql-jpa-query-graphiql/pom.xml | 2 +- graphql-jpa-query-schema/pom.xml | 2 +- graphql-jpa-query-web/pom.xml | 2 +- pom.xml | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/graphql-jpa-query-annotations/pom.xml b/graphql-jpa-query-annotations/pom.xml index 310c94a5a..e90905652 100644 --- a/graphql-jpa-query-annotations/pom.xml +++ b/graphql-jpa-query-annotations/pom.xml @@ -6,7 +6,7 @@ com.introproventures graphql-jpa-query-dependencies - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-dependencies diff --git a/graphql-jpa-query-autoconfigure/pom.xml b/graphql-jpa-query-autoconfigure/pom.xml index 0e47a05d5..86253be41 100644 --- a/graphql-jpa-query-autoconfigure/pom.xml +++ b/graphql-jpa-query-autoconfigure/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build graphql-jpa-query-autoconfigure diff --git a/graphql-jpa-query-boot-starter/pom.xml b/graphql-jpa-query-boot-starter/pom.xml index 6560dfa4d..7996fa30b 100644 --- a/graphql-jpa-query-boot-starter/pom.xml +++ b/graphql-jpa-query-boot-starter/pom.xml @@ -7,7 +7,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build diff --git a/graphql-jpa-query-build/pom.xml b/graphql-jpa-query-build/pom.xml index 2a2fca240..74efbf2fe 100644 --- a/graphql-jpa-query-build/pom.xml +++ b/graphql-jpa-query-build/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-dependencies - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-dependencies graphql-jpa-query-build diff --git a/graphql-jpa-query-dependencies/pom.xml b/graphql-jpa-query-dependencies/pom.xml index 6709c8b19..e3064e1ef 100644 --- a/graphql-jpa-query-dependencies/pom.xml +++ b/graphql-jpa-query-dependencies/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query - 0.3.34-SNAPSHOT + 0.3.34 .. graphql-jpa-query-dependencies diff --git a/graphql-jpa-query-example-merge/pom.xml b/graphql-jpa-query-example-merge/pom.xml index cf4d61ac6..6df79519d 100644 --- a/graphql-jpa-query-example-merge/pom.xml +++ b/graphql-jpa-query-example-merge/pom.xml @@ -7,7 +7,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build diff --git a/graphql-jpa-query-example-model-books/pom.xml b/graphql-jpa-query-example-model-books/pom.xml index ff711c100..83c3f5db1 100644 --- a/graphql-jpa-query-example-model-books/pom.xml +++ b/graphql-jpa-query-example-model-books/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build graphql-jpa-query-example-model-books diff --git a/graphql-jpa-query-example-model-starwars/pom.xml b/graphql-jpa-query-example-model-starwars/pom.xml index 68994082c..c68fb2b3a 100644 --- a/graphql-jpa-query-example-model-starwars/pom.xml +++ b/graphql-jpa-query-example-model-starwars/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build diff --git a/graphql-jpa-query-example-simple/pom.xml b/graphql-jpa-query-example-simple/pom.xml index d240d315e..76153ce62 100644 --- a/graphql-jpa-query-example-simple/pom.xml +++ b/graphql-jpa-query-example-simple/pom.xml @@ -7,7 +7,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build diff --git a/graphql-jpa-query-graphiql/pom.xml b/graphql-jpa-query-graphiql/pom.xml index b0c5c492b..a71a14aaf 100644 --- a/graphql-jpa-query-graphiql/pom.xml +++ b/graphql-jpa-query-graphiql/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query - 0.3.34-SNAPSHOT + 0.3.34 graphql-jpa-query-graphiql \ No newline at end of file diff --git a/graphql-jpa-query-schema/pom.xml b/graphql-jpa-query-schema/pom.xml index b2fbee6df..6df91d606 100644 --- a/graphql-jpa-query-schema/pom.xml +++ b/graphql-jpa-query-schema/pom.xml @@ -5,7 +5,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build diff --git a/graphql-jpa-query-web/pom.xml b/graphql-jpa-query-web/pom.xml index 37583511e..f7be53c64 100644 --- a/graphql-jpa-query-web/pom.xml +++ b/graphql-jpa-query-web/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34-SNAPSHOT + 0.3.34 ../graphql-jpa-query-build graphql-jpa-query-web diff --git a/pom.xml b/pom.xml index 3adcbf567..6bac23d36 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.introproventures graphql-jpa-query - 0.3.34-SNAPSHOT + 0.3.34 pom @@ -65,7 +65,7 @@ scm:git:https://github.com/introproventures/graphql-jpa-query.git scm:git:git@github.com:introproventures/graphql-jpa-query.git https://github.com/introproventures/graphql-jpa-query - HEAD + 0.3.34 2017 From 73673f35fadaca75fe7d93d3c5094e4d90c16971 Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Sat, 12 Oct 2019 21:45:36 -0700 Subject: [PATCH 5/6] [maven-release-plugin] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e11f2cf0d..6228411ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## 0.3.34 +## 0.3.35-SNAPSHOT * feat(GH-204): added LOWER predicate for case insensitive match (#206) [6ff6992](https://github.com/introproventures/graphql-jpa-query/commit/6ff699284a2340de0f22d7a5e447444e8347f0f7) * fix(travis): changed to openjdk8 [8f1e36c](https://github.com/introproventures/graphql-jpa-query/commit/8f1e36c302a1083f11ff4342e96005ead23e38ef) * docs(README): polish description [skip travis] [4ad2ad2](https://github.com/introproventures/graphql-jpa-query/commit/4ad2ad245659f3c6b78a9b119c1e791d99129925) From 08ab48e0724b81ac5d3c343ec3957631231efbd9 Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Sat, 12 Oct 2019 21:45:36 -0700 Subject: [PATCH 6/6] [maven-release-plugin] prepare for next development iteration --- graphql-jpa-query-annotations/pom.xml | 2 +- graphql-jpa-query-autoconfigure/pom.xml | 2 +- graphql-jpa-query-boot-starter/pom.xml | 2 +- graphql-jpa-query-build/pom.xml | 2 +- graphql-jpa-query-dependencies/pom.xml | 2 +- graphql-jpa-query-example-merge/pom.xml | 2 +- graphql-jpa-query-example-model-books/pom.xml | 2 +- graphql-jpa-query-example-model-starwars/pom.xml | 2 +- graphql-jpa-query-example-simple/pom.xml | 2 +- graphql-jpa-query-graphiql/pom.xml | 2 +- graphql-jpa-query-schema/pom.xml | 2 +- graphql-jpa-query-web/pom.xml | 2 +- pom.xml | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/graphql-jpa-query-annotations/pom.xml b/graphql-jpa-query-annotations/pom.xml index e90905652..2fcdc6188 100644 --- a/graphql-jpa-query-annotations/pom.xml +++ b/graphql-jpa-query-annotations/pom.xml @@ -6,7 +6,7 @@ com.introproventures graphql-jpa-query-dependencies - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-dependencies diff --git a/graphql-jpa-query-autoconfigure/pom.xml b/graphql-jpa-query-autoconfigure/pom.xml index 86253be41..cab9e80f8 100644 --- a/graphql-jpa-query-autoconfigure/pom.xml +++ b/graphql-jpa-query-autoconfigure/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build graphql-jpa-query-autoconfigure diff --git a/graphql-jpa-query-boot-starter/pom.xml b/graphql-jpa-query-boot-starter/pom.xml index 7996fa30b..29da7de4c 100644 --- a/graphql-jpa-query-boot-starter/pom.xml +++ b/graphql-jpa-query-boot-starter/pom.xml @@ -7,7 +7,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build diff --git a/graphql-jpa-query-build/pom.xml b/graphql-jpa-query-build/pom.xml index 74efbf2fe..f3dad9997 100644 --- a/graphql-jpa-query-build/pom.xml +++ b/graphql-jpa-query-build/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-dependencies - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-dependencies graphql-jpa-query-build diff --git a/graphql-jpa-query-dependencies/pom.xml b/graphql-jpa-query-dependencies/pom.xml index e3064e1ef..9489c27b1 100644 --- a/graphql-jpa-query-dependencies/pom.xml +++ b/graphql-jpa-query-dependencies/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query - 0.3.34 + 0.3.35-SNAPSHOT .. graphql-jpa-query-dependencies diff --git a/graphql-jpa-query-example-merge/pom.xml b/graphql-jpa-query-example-merge/pom.xml index 6df79519d..71dbf360f 100644 --- a/graphql-jpa-query-example-merge/pom.xml +++ b/graphql-jpa-query-example-merge/pom.xml @@ -7,7 +7,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build diff --git a/graphql-jpa-query-example-model-books/pom.xml b/graphql-jpa-query-example-model-books/pom.xml index 83c3f5db1..2ebb6c9c5 100644 --- a/graphql-jpa-query-example-model-books/pom.xml +++ b/graphql-jpa-query-example-model-books/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build graphql-jpa-query-example-model-books diff --git a/graphql-jpa-query-example-model-starwars/pom.xml b/graphql-jpa-query-example-model-starwars/pom.xml index c68fb2b3a..4b48fc5fd 100644 --- a/graphql-jpa-query-example-model-starwars/pom.xml +++ b/graphql-jpa-query-example-model-starwars/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build diff --git a/graphql-jpa-query-example-simple/pom.xml b/graphql-jpa-query-example-simple/pom.xml index 76153ce62..22dfff6c0 100644 --- a/graphql-jpa-query-example-simple/pom.xml +++ b/graphql-jpa-query-example-simple/pom.xml @@ -7,7 +7,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build diff --git a/graphql-jpa-query-graphiql/pom.xml b/graphql-jpa-query-graphiql/pom.xml index a71a14aaf..47b97bd48 100644 --- a/graphql-jpa-query-graphiql/pom.xml +++ b/graphql-jpa-query-graphiql/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query - 0.3.34 + 0.3.35-SNAPSHOT graphql-jpa-query-graphiql \ No newline at end of file diff --git a/graphql-jpa-query-schema/pom.xml b/graphql-jpa-query-schema/pom.xml index 6df91d606..63cc7858b 100644 --- a/graphql-jpa-query-schema/pom.xml +++ b/graphql-jpa-query-schema/pom.xml @@ -5,7 +5,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build diff --git a/graphql-jpa-query-web/pom.xml b/graphql-jpa-query-web/pom.xml index f7be53c64..f3a3d096c 100644 --- a/graphql-jpa-query-web/pom.xml +++ b/graphql-jpa-query-web/pom.xml @@ -3,7 +3,7 @@ com.introproventures graphql-jpa-query-build - 0.3.34 + 0.3.35-SNAPSHOT ../graphql-jpa-query-build graphql-jpa-query-web diff --git a/pom.xml b/pom.xml index 6bac23d36..1519cee7b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.introproventures graphql-jpa-query - 0.3.34 + 0.3.35-SNAPSHOT pom @@ -65,7 +65,7 @@ scm:git:https://github.com/introproventures/graphql-jpa-query.git scm:git:git@github.com:introproventures/graphql-jpa-query.git https://github.com/introproventures/graphql-jpa-query - 0.3.34 + HEAD 2017