Skip to content

update master #8

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

Merged
merged 6 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: java
sudo: required

jdk:
- oraclejdk8
- openjdk8
- openjdk11

services:
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log

## 0.3.34-SNAPSHOT
## 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)
* 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)
Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-dependencies</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-dependencies</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>
<artifactId>graphql-jpa-query-autoconfigure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-dependencies</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-dependencies</relativePath>
</parent>
<artifactId>graphql-jpa-query-build</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>graphql-jpa-query-dependencies</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-example-merge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-example-model-books/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>
<artifactId>graphql-jpa-query-example-model-books</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-example-model-starwars/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-example-simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-graphiql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
</parent>
<artifactId>graphql-jpa-query-graphiql</artifactId>
</project>
2 changes: 1 addition & 1 deletion graphql-jpa-query-schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected Predicate getStringPredicate(Path<String> root, PredicateFilter filter
if(arrayValuePredicate == null) {
String compareValue = filter.getValue().toString();
Expression<String> fieldValue = root;

if (filter.getCriterias().contains(PredicateFilter.Criteria.IN)) {
CriteriaBuilder.In<Object> in = cb.in(root);
return in.value(compareValue);
Expand All @@ -141,6 +141,10 @@ protected Predicate getStringPredicate(Path<String> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ public enum Criteria {
* case sensitive (strings)
*/
CASE,
/**
* case insensitive match
* <pre>LOWER(field) = LOWER(SEARCH)</pre>
*/
LOWER,
/**
* end of the string matches
* <pre>LOWER(field) LIKE LOWER(SEARCH)</pre> if not set then case
* insensitive match
*/
ENDS,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion graphql-jpa-query-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query-build</artifactId>
<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>
<relativePath>../graphql-jpa-query-build</relativePath>
</parent>
<artifactId>graphql-jpa-query-web</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.introproventures</groupId>
<artifactId>graphql-jpa-query</artifactId>

<version>0.3.34-SNAPSHOT</version>
<version>0.3.35-SNAPSHOT</version>

<packaging>pom</packaging>

Expand Down