Skip to content

Commit

Permalink
Merge pull request #16 from wwadge/feature/querydsl4
Browse files Browse the repository at this point in the history
QueryDSL v4.x support.
  • Loading branch information
vineey committed May 20, 2016
2 parents 6d95d1d + 6356061 commit a49e1a0
Show file tree
Hide file tree
Showing 68 changed files with 261 additions and 219 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ buildscript {

dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")

}

}
Expand All @@ -35,7 +37,10 @@ allprojects {
maven {
url 'http://repo.spring.io/plugins-release'
}
maven {url 'https://repo.spring.io/libs-milestone'}
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }

maven { url 'https://jitpack.io' }
jcenter()
}
Expand Down
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Thu Mar 24 17:59:59 PHT 2016
#Thu May 19 21:17:54 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
org.gradle.daemon=true
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
Empty file modified gradlew
100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions rsql-querydsl-parent/rsql-querydsl-all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ dependencies {
compile project(':rsql-querydsl-parent:rsql-querydsl-filter')
compile project(':rsql-querydsl-parent:rsql-querydsl-page')
compile project(':rsql-querydsl-parent:rsql-querydsl-sort')
provided 'com.mysema.querydsl:querydsl-core:3.7.2'
provided 'com.querydsl:querydsl-core:4.1.1'

testCompile project(':rsql-querydsl-parent:rsql-querydsl-test')
testCompile "org.hibernate:hibernate-entitymanager:4.3.5.Final"
testCompile "com.mysema.querydsl:querydsl-jpa:3.7.2"
testCompile 'com.mysema.querydsl:querydsl-sql:3.7.2'
testCompile 'com.mysema.querydsl:querydsl-mongodb:3.7.2'
testCompile "com.querydsl:querydsl-jpa:4.1.1"
testCompile 'com.querydsl:querydsl-sql:4.1.1'
testCompile 'com.querydsl:querydsl-mongodb:4.1.1'
testCompile 'com.google.guava:guava:19.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
package com.github.vineey.rql.querydsl;

import com.github.vineey.rql.RqlInput;
import com.github.vineey.rql.core.util.StringUtils;
import com.github.vineey.rql.filter.parser.DefaultFilterParser;
import com.github.vineey.rql.filter.parser.FilterParser;
import com.github.vineey.rql.querydsl.filter.QueryDslFilterContext;
import com.github.vineey.rql.core.util.StringUtils;
import com.github.vineey.rql.querydsl.page.QuerydslPageParser;
import com.github.vineey.rql.querydsl.select.QuerydslSelectContext;
import com.github.vineey.rql.querydsl.sort.QuerydslSortContext;
import com.github.vineey.rql.select.parser.DefaultSelectParser;
import com.github.vineey.rql.select.parser.SelectParser;
import com.github.vineey.rql.sort.parser.DefaultSortParser;
import com.github.vineey.rql.sort.parser.SortParser;
import com.mysema.query.types.Path;
import com.querydsl.core.types.Path;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
*/
package com.github.vineey.rql.querydsl;

import com.mysema.query.types.EntityPath;
import com.mysema.query.types.Path;

import com.querydsl.core.types.EntityPath;
import com.querydsl.core.types.Path;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
*/
package com.github.vineey.rql.querydsl;

import com.mysema.query.QueryModifiers;
import com.mysema.query.types.Expression;
import com.mysema.query.types.OrderSpecifier;
import com.mysema.query.types.Predicate;
import com.querydsl.core.QueryModifiers;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.OrderSpecifier;
import com.querydsl.core.types.Predicate;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
import com.github.vineey.rql.querydsl.QuerydslMappingParam;
import com.github.vineey.rql.querydsl.QuerydslMappingResult;
import com.github.vineey.rql.querydsl.QuerydslRqlParser;
import com.github.vineey.rql.querydsl.test.jpa.QEmployee;
import com.github.vineey.rql.querydsl.test.mongo.QContactDocument;
import com.google.common.collect.ImmutableMap;
import com.mysema.query.QueryModifiers;
import com.mysema.query.types.*;
import com.mysema.query.types.expr.BooleanOperation;
import com.querydsl.core.QueryModifiers;
import com.querydsl.core.types.*;
import com.querydsl.core.types.dsl.BooleanOperation;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -43,11 +44,7 @@
import java.util.List;
import java.util.Map;

import com.github.vineey.rql.querydsl.test.jpa.QEmployee;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
/**
* @author vrustia - 4/24/16.
*/
Expand Down
8 changes: 4 additions & 4 deletions rsql-querydsl-parent/rsql-querydsl-filter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ description = 'Querydsl integration for rsql filter'

dependencies {
compile project(':rsql-api-parent:rsql-api-filter')
provided 'com.mysema.querydsl:querydsl-core:3.7.2'
provided 'com.querydsl:querydsl-core:4.1.1'

testCompile project(':rsql-querydsl-parent:rsql-querydsl-test')
testCompile "org.hibernate:hibernate-entitymanager:4.3.5.Final"
testCompile "com.mysema.querydsl:querydsl-jpa:3.7.2"
testCompile 'com.mysema.querydsl:querydsl-sql:3.7.2'
testCompile 'com.mysema.querydsl:querydsl-mongodb:3.7.2'
testCompile "com.querydsl:querydsl-jpa:4.1.1"
testCompile 'com.querydsl:querydsl-sql:4.1.1'
testCompile 'com.querydsl:querydsl-mongodb:4.1.1'
testCompile 'com.google.guava:guava:19.0'

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
package com.github.vineey.rql.querydsl.filter;

import com.github.vineey.rql.filter.FilterContext;
import com.mysema.query.types.Path;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.github.vineey.rql.querydsl.filter;

import com.github.vineey.rql.filter.FilterBuilder;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Predicate;
import cz.jirutka.rsql.parser.ast.Node;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.github.vineey.rql.querydsl.filter;

import com.github.vineey.rql.filter.FilterParam;
import com.mysema.query.types.Path;
import com.querydsl.core.types.Path;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@

import com.github.vineey.rql.querydsl.filter.converter.PathConverterContext;
import com.google.common.collect.Lists;
import com.mysema.query.types.Operator;
import com.mysema.query.types.Ops;
import com.mysema.query.types.Path;
import com.mysema.query.types.Predicate;
import com.mysema.query.types.expr.BooleanExpression;
import com.querydsl.core.types.Ops;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.BooleanExpression;
import cz.jirutka.rsql.parser.ast.*;

import java.util.List;
Expand All @@ -47,7 +46,7 @@ public Predicate visit(AndNode node, QuerydslFilterParam param) {
return evaluateLogicalExpression(node, param, Ops.AND);
}

private BooleanExpression evaluateLogicalExpression(LogicalNode node, QuerydslFilterParam param, Operator<Boolean> logicalOperator) {
private BooleanExpression evaluateLogicalExpression(LogicalNode node, QuerydslFilterParam param, Ops logicalOperator) {

List<Node> children = Lists.newArrayList(node.getChildren());
Node firstNode = children.remove(0);
Expand All @@ -59,7 +58,7 @@ private BooleanExpression evaluateLogicalExpression(LogicalNode node, QuerydslFi
return predicate;
}

private BooleanExpression combineByLogicalExpression(Operator<Boolean> logicalOperator, BooleanExpression predicate, Predicate subPredicate) {
private BooleanExpression combineByLogicalExpression(Ops logicalOperator, BooleanExpression predicate, Predicate subPredicate) {
BooleanExpression combinedPredicate = predicate;
if (Ops.AND.equals(logicalOperator)) {
combinedPredicate = predicate.and(subPredicate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
*/
package com.github.vineey.rql.querydsl.filter;

import com.mysema.query.types.Expression;

import com.querydsl.core.types.Expression;
import cz.jirutka.rsql.parser.ast.ComparisonNode;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* SOFTWARE. * */
package com.github.vineey.rql.querydsl.filter.converter;

import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.github.vineey.rql.core.util.CollectionUtils;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.expr.SimpleExpression;
import com.mysema.query.types.path.CollectionPathBase;
import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.CollectionPathBase;
import com.querydsl.core.types.dsl.SimpleExpression;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.google.common.collect.Lists;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.expr.TemporalExpression;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.TemporalExpression;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package com.github.vineey.rql.querydsl.filter.converter;

import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.path.BooleanPath;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.BooleanPath;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.github.vineey.rql.querydsl.filter.converter;

import com.github.vineey.rql.querydsl.filter.util.DateUtil;
import com.mysema.query.types.path.DatePath;
import com.querydsl.core.types.dsl.DatePath;

import java.time.LocalDate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.github.vineey.rql.querydsl.filter.converter;

import com.github.vineey.rql.querydsl.filter.util.DateUtil;
import com.mysema.query.types.path.DateTimePath;
import com.querydsl.core.types.dsl.DateTimePath;

import java.time.LocalDateTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
*/
package com.github.vineey.rql.querydsl.filter.converter;

import com.mysema.query.types.expr.SimpleExpression;
import com.mysema.query.types.path.CollectionPathBase;

import com.querydsl.core.types.dsl.CollectionPathBase;
import com.querydsl.core.types.dsl.SimpleExpression;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.github.vineey.rql.querydsl.filter.util.Enums;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.path.EnumPath;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.EnumPath;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.github.vineey.rql.querydsl.filter.util.ConverterUtil;
import com.google.common.collect.Lists;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.path.NumberPath;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.NumberPath;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
package com.github.vineey.rql.querydsl.filter.converter;

import com.mysema.query.types.Expression;
import com.mysema.query.types.expr.BooleanExpression;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.dsl.BooleanExpression;
import cz.jirutka.rsql.parser.ast.ComparisonNode;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
package com.github.vineey.rql.querydsl.filter.converter;

import com.google.common.collect.ImmutableMap;
import com.mysema.query.types.Path;
import com.mysema.query.types.expr.SimpleExpression;
import com.mysema.query.types.path.*;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.*;

import java.util.Collection;

Expand All @@ -39,7 +38,10 @@ public final class PathConverterContext {
private static final TimePathConverter TIME_PATH_CONVERTER = new TimePathConverter();
private static final DateTimePathConverter DATE_TIME_PATH_CONVERTER = new DateTimePathConverter();
private static final DatePathConverter DATE_PATH_CONVERTER = new DatePathConverter();
private static final DefaultCollectionPathConverter<Object, SimpleExpression<? super Object>, Collection<Object>, CollectionPathBase<Collection<Object>, Object, SimpleExpression<? super Object>>> DEFAULT_COLLECTION_PATH_CONVERTER = new DefaultCollectionPathConverter<>();
private static final DefaultCollectionPathConverter<Object, SimpleExpression<? super Object>,
Collection<Object>, CollectionPathBase<Collection<Object>,
Object,
SimpleExpression<? super Object>>> DEFAULT_COLLECTION_PATH_CONVERTER = new DefaultCollectionPathConverter<>();
private final static ImmutableMap<Class<? extends Path>, PathConverter> map = ImmutableMap.<Class<? extends Path>, PathConverter>builder()
.put(StringPath.class, STRING_PATH_CONVERTER)
.put(EnumPath.class, ENUM_PATH_CONVERTER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
package com.github.vineey.rql.querydsl.filter.converter;

import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.expr.StringExpression;
import com.mysema.query.types.path.StringPath;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.StringExpression;
import com.querydsl.core.types.dsl.StringPath;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.github.vineey.rql.querydsl.filter.converter;

import com.github.vineey.rql.querydsl.filter.util.DateUtil;
import com.mysema.query.types.path.TimePath;
import com.querydsl.core.types.dsl.TimePath;

import java.time.LocalTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
*/
package com.github.vineey.rql.querydsl.filter.converter;

import com.mysema.query.types.Path;

import com.querydsl.core.types.Path;

/**
* @author vrustia on 10/10/2015.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* @author vrustia - 4/17/16.
*/
public class CustomNumber extends Number {
public class CustomNumber extends Number implements Comparable {
@Override
public double doubleValue() {
return 0;
Expand All @@ -47,4 +47,9 @@ public long longValue() {
public float floatValue() {
return 0;
}

@Override
public int compareTo(Object o) {
return 0;
}
}
Loading

0 comments on commit a49e1a0

Please sign in to comment.