diff --git a/modules/asset-manager-impl/pom.xml b/modules/asset-manager-impl/pom.xml index 709e7169af7..fadf56514fd 100644 --- a/modules/asset-manager-impl/pom.xml +++ b/modules/asset-manager-impl/pom.xml @@ -118,18 +118,22 @@ - com.mysema.querydsl + com.querydsl querydsl-apt provided - com.mysema.querydsl + com.querydsl querydsl-core - com.mysema.querydsl + com.querydsl querydsl-jpa + + com.querydsl + querydsl-sql-spatial + javax.inject javax.inject @@ -210,7 +214,6 @@ com.h2database:h2 javax.servlet:javax.servlet-api - com.mysema.querydsl:querydsl-apt @@ -242,7 +245,7 @@ target/generated-sources/java - com.mysema.query.apt.jpa.JPAAnnotationProcessor + com.querydsl.apt.jpa.JPAAnnotationProcessor diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/AssetDtos.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/AssetDtos.java index bb39fdbee88..0cacb4a5078 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/AssetDtos.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/AssetDtos.java @@ -21,17 +21,17 @@ package org.opencastproject.assetmanager.impl.persistence; import static com.entwinemedia.fn.Stream.$; -import static com.mysema.query.types.PathMetadataFactory.forVariable; +import static com.querydsl.core.types.PathMetadataFactory.forVariable; import org.opencastproject.assetmanager.api.Availability; import org.opencastproject.assetmanager.impl.VersionImpl; import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.data.ListBuilders; -import com.mysema.query.Tuple; -import com.mysema.query.jpa.impl.JPAQuery; -import com.mysema.query.types.Expression; -import com.mysema.query.types.path.PathInits; +import com.querydsl.core.Tuple; +import com.querydsl.core.types.Expression; +import com.querydsl.core.types.dsl.PathInits; +import com.querydsl.jpa.impl.JPAQuery; import javax.persistence.EntityManager; @@ -105,8 +105,8 @@ public String getOwner() { /** * Parameter for query execution methods like - * {@link com.mysema.query.jpa.impl.JPAQuery#singleResult(com.mysema.query.types.Expression[])} or - * {@link com.mysema.query.jpa.impl.JPAQuery#list(Expression[])}. + * {@link com.com.querydsl.jpa.JPAQuery#singleResult(com.querydsl.core.types.Expression[])} or + * {@link com.com.querydsl.jpa.JPAQuery#list(Expression[])}. */ public static final Expression[] select = new Expression[] { QAssetDto.assetDto, @@ -148,8 +148,8 @@ public VersionImpl getVersion() { /** * Parameter for query execution methods like - * {@link com.mysema.query.jpa.impl.JPAQuery#singleResult(com.mysema.query.types.Expression[])} or - * {@link com.mysema.query.jpa.impl.JPAQuery#list(Expression[])}. + * {@link com.com.querydsl.jpa.JPAQuery#singleResult(com.querydsl.core.types.Expression[])} or + * {@link com.com.querydsl.jpa.JPAQuery#list(Expression[])}. */ public static final Expression[] select = $(Medium.select).append(ListBuilders.SIA.mk( diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/Database.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/Database.java index c9d1440b59e..3c77ed695bb 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/Database.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/Database.java @@ -35,14 +35,14 @@ import org.opencastproject.util.data.Function; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.Tuple; -import com.mysema.query.jpa.EclipseLinkTemplates; -import com.mysema.query.jpa.JPQLTemplates; -import com.mysema.query.jpa.impl.JPADeleteClause; -import com.mysema.query.jpa.impl.JPAQuery; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.jpa.impl.JPAUpdateClause; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.Tuple; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.EclipseLinkTemplates; +import com.querydsl.jpa.JPQLTemplates; +import com.querydsl.jpa.impl.JPADeleteClause; +import com.querydsl.jpa.impl.JPAQuery; +import com.querydsl.jpa.impl.JPAQueryFactory; +import com.querydsl.jpa.impl.JPAUpdateClause; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/EntityPaths.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/EntityPaths.java index c1a0328fdcb..5c86bd94495 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/EntityPaths.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/EntityPaths.java @@ -24,7 +24,7 @@ import static com.entwinemedia.fn.Stream.empty; import com.entwinemedia.fn.Stream; -import com.mysema.query.types.EntityPath; +import com.querydsl.core.types.EntityPath; /** * Shortcuts to Querydsl entity paths. diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/SnapshotDtos.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/SnapshotDtos.java index e460643bb66..8f721beb0f4 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/SnapshotDtos.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/persistence/SnapshotDtos.java @@ -23,9 +23,9 @@ import org.opencastproject.assetmanager.api.Availability; import com.entwinemedia.fn.Fn; -import com.mysema.query.Tuple; -import com.mysema.query.jpa.impl.JPAQuery; -import com.mysema.query.types.Expression; +import com.querydsl.core.Tuple; +import com.querydsl.core.types.Expression; +import com.querydsl.jpa.impl.JPAQuery; import javax.persistence.EntityManager; @@ -102,8 +102,8 @@ public String getOwner() { /** * Parameter for query execution methods like - * {@link com.mysema.query.jpa.impl.JPAQuery#singleResult(com.mysema.query.types.Expression[])} or - * {@link com.mysema.query.jpa.impl.JPAQuery#list(Expression[])}. + * {@link com.com.querydsl.jpa.JPAQuery#singleResult(com.querydsl.core.types.Expression[])} or + * {@link com.com.querydsl.jpa.JPAQuery#list(Expression[])}. */ public static final Expression[] select = new Expression[] { QSnapshotDto.snapshotDto, diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AQueryBuilderImpl.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AQueryBuilderImpl.java index 244a9e1d8cd..b69b69fa86f 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AQueryBuilderImpl.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AQueryBuilderImpl.java @@ -46,9 +46,9 @@ import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.Stream; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.support.Expressions; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.impl.JPAQueryFactory; import java.util.Date; @@ -63,7 +63,7 @@ public AQueryBuilderImpl(AssetManagerImpl am) { this.am = am; } - /** Convert a {@link Target} into a Querydsl {@link com.mysema.query.types.Expression}. */ + /** Convert a {@link Target} into a Querydsl {@link com.querydsl.core.types.Expression}. */ private static Fn contributeSelect(final JPAQueryFactory f) { return new Fn() { @Override public SelectQueryContribution apply(Target t) { diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractADeleteQuery.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractADeleteQuery.java index 2b069fbb292..9c75a4fe2b7 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractADeleteQuery.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractADeleteQuery.java @@ -38,13 +38,13 @@ import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.data.SetB; -import com.mysema.query.Tuple; -import com.mysema.query.jpa.JPASubQuery; -import com.mysema.query.jpa.impl.JPADeleteClause; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.support.Expressions; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.Tuple; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.impl.JPADeleteClause; +import com.querydsl.jpa.impl.JPAQueryFactory; +import com.querydsl.sql.SQLExpressions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -233,12 +233,11 @@ private DeletionResult runQueries(JPAQueryFactory jpa, DeleteQueryContribution c WHERE (t2.organization_id = ?) */ where = Q_PROPERTY.mediaPackageId.in( - new JPASubQuery() - .from(Q_PROPERTY) - .join(Q_SNAPSHOT) + SQLExpressions.select(Q_PROPERTY) + .leftJoin(Q_SNAPSHOT) // move the join condition from the "ON" clause (mediapackage_id) to the // where clause. Find an explanation above. - .where(Q_PROPERTY.mediaPackageId.eq(Q_SNAPSHOT.mediaPackageId).and(w)) + .on(Q_PROPERTY.mediaPackageId.eq(Q_SNAPSHOT.mediaPackageId).and(w)) .distinct() .list(Q_PROPERTY.mediaPackageId)); } else { diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractASelectQuery.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractASelectQuery.java index 4b1cea4733d..1e8e8723288 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractASelectQuery.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractASelectQuery.java @@ -44,13 +44,13 @@ import com.entwinemedia.fn.data.Opt; import com.entwinemedia.fn.data.SetB; import com.entwinemedia.fn.fns.Booleans; -import com.mysema.query.Tuple; -import com.mysema.query.jpa.impl.JPAQuery; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.Expression; -import com.mysema.query.types.OrderSpecifier; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.Tuple; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.Expression; +import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQuery; +import com.querydsl.jpa.impl.JPAQueryFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -200,7 +200,7 @@ public Map, BooleanExpression> apply(Map, BooleanExp { // run query am.getDatabase().logQuery(q); - final List result = q.list(JpaFns.toExpressionArray(fetch)); + final List result = q.select(JpaFns.toExpressionArray(fetch)).fetch(); logger.debug("Pure query ms " + (System.nanoTime() - startTime) / 1000000); // map result based on the fact whether properties have been fetched or not if (!toFetchProperties) { diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractPredicate.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractPredicate.java index ea6ca4f9f2d..e4f2bfd3f64 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractPredicate.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractPredicate.java @@ -24,8 +24,8 @@ import org.opencastproject.assetmanager.impl.RuntimeTypes; import com.entwinemedia.fn.Fn2; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; public abstract class AbstractPredicate implements Predicate, QueryContributor { private final AbstractPredicate self = this; diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractSnapshotField.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractSnapshotField.java index 57a9b690cb1..27c89372edd 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractSnapshotField.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/AbstractSnapshotField.java @@ -33,15 +33,13 @@ import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.jpa.JPASubQuery; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.types.ConstantImpl; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.Operator; -import com.mysema.query.types.Ops; -import com.mysema.query.types.expr.BooleanExpression; -import com.mysema.query.types.expr.BooleanOperation; -import com.mysema.query.types.expr.ComparableExpressionBase; +import com.querydsl.core.types.ConstantImpl; +import com.querydsl.core.types.Operator; +import com.querydsl.core.types.Ops; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.ComparableExpressionBase; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.sql.SQLExpressions; /** * Generic implementation to query {@link org.opencastproject.assetmanager.impl.persistence.SnapshotDto} fields. @@ -144,7 +142,7 @@ protected static Predicate mkPredicate(final BooleanExpression where) { if (from instanceof QSnapshotDto) { return where; } else if (from instanceof QPropertyDto) { - return new JPASubQuery().from(Q_SNAPSHOT) + return SQLExpressions.select(Q_SNAPSHOT) .where(Q_SNAPSHOT.mediaPackageId.eq(Q_PROPERTY.mediaPackageId).and(where)) .exists(); } else { @@ -159,17 +157,17 @@ protected static Predicate mkPredicate(final BooleanExpression where) { /** * Create a predicate for comparisons with a constant value. */ - private Predicate mkComparison(final Operator op, A right) { - return mkPredicate(BooleanOperation.create(op, path, ConstantImpl.create(extract(right)))); + private Predicate mkComparison(final Operator op, A right) { + return mkPredicate(Expressions.booleanOperation(op, path, ConstantImpl.create(extract(right)))); } /** * Create a predicate for comparisons with a property field. */ - private Predicate mkComparison(final Operator op, final PropertyField right) { + private Predicate mkComparison(final Operator op, final PropertyField right) { return mkPredicate(PropertyPredicates.mkWhereSelect(right.name(), new Fn>() { @Override public Opt apply(QPropertyDto qPropertyDto) { - return Opt.some(BooleanOperation.create(op, path, RuntimeTypes.convert(right).getPath(qPropertyDto))); + return Opt.some(Expressions.booleanOperation(op, path, RuntimeTypes.convert(right).getPath(qPropertyDto))); } })); } diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/DeleteQueryContribution.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/DeleteQueryContribution.java index 09ce48a4238..01697171f4b 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/DeleteQueryContribution.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/DeleteQueryContribution.java @@ -26,8 +26,8 @@ import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.Stream; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.dsl.BooleanExpression; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/Join.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/Join.java index 7291d90cedd..459ef16ad42 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/Join.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/Join.java @@ -21,8 +21,8 @@ package org.opencastproject.assetmanager.impl.query; import com.entwinemedia.fn.Fn; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.dsl.BooleanExpression; final class Join { // CHECKSTYLE:OFF diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/JpaFns.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/JpaFns.java index e4ea7358789..da6071e7443 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/JpaFns.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/JpaFns.java @@ -28,10 +28,10 @@ import com.entwinemedia.fn.Fn2; import com.entwinemedia.fn.Fns; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.support.Expressions; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.Expression; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.Expression; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyFieldImpl.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyFieldImpl.java index 68e9efa1894..34413959de7 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyFieldImpl.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyFieldImpl.java @@ -41,14 +41,14 @@ import com.entwinemedia.fn.ProductBuilder; import com.entwinemedia.fn.Products; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.jpa.JPASubQuery; -import com.mysema.query.jpa.impl.JPAQueryFactory; -import com.mysema.query.types.ConstantImpl; -import com.mysema.query.types.Operator; -import com.mysema.query.types.Ops; -import com.mysema.query.types.Path; -import com.mysema.query.types.expr.BooleanExpression; -import com.mysema.query.types.expr.BooleanOperation; +import com.querydsl.core.types.ConstantImpl; +import com.querydsl.core.types.Operator; +import com.querydsl.core.types.Ops; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import com.querydsl.sql.SQLExpressions; import java.util.Date; @@ -148,8 +148,7 @@ public PropertyFieldImpl(ValueType mkValue, PropertyName name) { @Override public BooleanExpression fromProperty(QPropertyDto p) { return p.mediaPackageId.notIn( - new JPASubQuery() - .from(p) + SQLExpressions.select(p) .where(whereBase.fromProperty(p)) .distinct() .list(p.mediaPackageId)); @@ -176,29 +175,30 @@ public PropertyFieldImpl(ValueType mkValue, PropertyName name) { /** * Create a predicate to compare this field's value with a constant value. */ - private Fn> mkValuePredicate(final Operator op, final A value) { + private Fn> mkValuePredicate(final Operator op, final A value) { return new Fn>() { @Override public Opt apply(final QPropertyDto dto) { final BooleanExpression expr = mkValue.mk(value).decompose( new Fn() { @Override public BooleanExpression apply(String a) { - return BooleanOperation.create(op, dto.stringValue, ConstantImpl.create(a)); + return Expressions.booleanOperation(op, dto.stringValue, ConstantImpl.create(a)); } }, new Fn() { @Override public BooleanExpression apply(Date a) { - return BooleanOperation.create(op, dto.dateValue, ConstantImpl.create(a)); + return Expressions.booleanOperation(op, dto.dateValue, ConstantImpl.create(a)); } }, new Fn() { @Override public BooleanExpression apply(Long a) { - return BooleanOperation.create(op, dto.longValue, ConstantImpl.create(a)); + return Expressions.booleanOperation(op, dto.longValue, ConstantImpl.create(a)); } }, new Fn() { @Override public BooleanExpression apply(Boolean a) { - return BooleanOperation.create(op, dto.boolValue, ConstantImpl.create(a)); + return Expressions.booleanOperation(op, dto.boolValue, ConstantImpl.create(a)); } }, new Fn() { @Override public BooleanExpression apply(Version a) { - return BooleanOperation.create(op, dto.longValue, ConstantImpl.create(RuntimeTypes.convert(a).value())); + return Expressions.booleanOperation(op, dto.longValue, + ConstantImpl.create(RuntimeTypes.convert(a).value())); } }); return Opt.some(expr); @@ -225,7 +225,7 @@ public Path getPath(QPropertyDto dto) { // @Override public Opt apply(final QPropertyDto dto) { // final BooleanExpression expr = mkValue.match(new Fn() { // @Override public BooleanExpression apply(StringType stringType) { -// return BooleanOperation.create(op, dto.stringValue, PropertyPredicates.) +// return Expressions.booleanOperation(op, dto.stringValue, PropertyPredicates.) // } // }, new Fn() { // @Override public BooleanExpression apply(DateType dateType) { @@ -251,7 +251,7 @@ public Path getPath(QPropertyDto dto) { /** * Create a predicate that compares the property (of this field) with the given constant value. */ - private Predicate mkPredicate(final Operator op, final A value) { + private Predicate mkPredicate(final Operator op, final A value) { return new AbstractPredicate() { @Override public DeleteQueryContribution contributeDelete(String owner) { return DeleteQueryContribution.mk().where(mkWhereDeleteBase(mkValuePredicate(op, value))); diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyPredicates.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyPredicates.java index c340996157f..87b4d0ae90b 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyPredicates.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/PropertyPredicates.java @@ -28,8 +28,8 @@ import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.jpa.JPASubQuery; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.sql.SQLExpressions; /** * A place to share common predicate constructor methods for properties. @@ -76,7 +76,7 @@ public static BooleanExpression mkWhereSelect( Opt namespace, Opt propertyName, Fn> mkValueExpression) { - return new JPASubQuery().from(Q_PROPERTY_ALIAS) + return SQLExpressions.select(Q_PROPERTY_ALIAS) .where(Q_SNAPSHOT.mediaPackageId.eq(Q_PROPERTY_ALIAS.mediaPackageId) .and(namespace.isSome() ? Q_PROPERTY_ALIAS.namespace.eq(namespace.get()) @@ -111,16 +111,14 @@ public static Where mkWhereDelete( // return new Where() { @Override public BooleanExpression fromSnapshot(QSnapshotDto e) { - return new JPASubQuery() - .from(Q_PROPERTY) + return SQLExpressions.select(Q_PROPERTY) .where(e.mediaPackageId.eq(Q_PROPERTY.mediaPackageId).and(propertyPredicate)) .exists(); } @Override public BooleanExpression fromProperty(QPropertyDto p) { return p.mediaPackageId.in( - new JPASubQuery() - .from(p) + SQLExpressions.select(p) .where(propertyPredicate) .distinct() .list(p.mediaPackageId)); diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContribution.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContribution.java index 70ba9a63aac..aae61f4cea2 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContribution.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContribution.java @@ -25,10 +25,10 @@ import com.entwinemedia.fn.Fn; import com.entwinemedia.fn.Stream; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.Expression; -import com.mysema.query.types.OrderSpecifier; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.Expression; +import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.core.types.dsl.BooleanExpression; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContributor.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContributor.java index 2b7f5aac945..0875d82f581 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContributor.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SelectQueryContributor.java @@ -20,7 +20,7 @@ */ package org.opencastproject.assetmanager.impl.query; -import com.mysema.query.jpa.impl.JPAQueryFactory; +import com.querydsl.jpa.impl.JPAQueryFactory; /** * Implementations of this interface may contribute to a JPA query. diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SimpleSnapshotField.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SimpleSnapshotField.java index c2217756b09..da2a75a2254 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SimpleSnapshotField.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/SimpleSnapshotField.java @@ -20,7 +20,7 @@ */ package org.opencastproject.assetmanager.impl.query; -import com.mysema.query.types.expr.ComparableExpressionBase; +import com.querydsl.core.types.dsl.ComparableExpressionBase; /** * Implementation of {@link AbstractSnapshotField} where business and database type are equal. diff --git a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/VersionFieldImpl.java b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/VersionFieldImpl.java index 5c60d91551b..abdb908f6ca 100644 --- a/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/VersionFieldImpl.java +++ b/modules/asset-manager-impl/src/main/java/org/opencastproject/assetmanager/impl/query/VersionFieldImpl.java @@ -26,7 +26,7 @@ import org.opencastproject.assetmanager.impl.RuntimeTypes; import org.opencastproject.assetmanager.impl.persistence.QSnapshotDto; -import com.mysema.query.jpa.JPASubQuery; +import com.querydsl.sql.SQLExpressions; public class VersionFieldImpl extends AbstractSnapshotField implements VersionField { private static final QSnapshotDto Q_SNAPSHOT_ALIAS = new QSnapshotDto("s"); @@ -53,7 +53,7 @@ public VersionFieldImpl() { */ private Predicate mkFirstLatestPredicate(boolean isLatest) { return mkPredicate(Q_SNAPSHOT.version.eq( - new JPASubQuery().from(Q_SNAPSHOT_ALIAS) + SQLExpressions.select(Q_SNAPSHOT_ALIAS) .where(Q_SNAPSHOT_ALIAS.mediaPackageId.eq(Q_SNAPSHOT.mediaPackageId)) .unique(isLatest ? Q_SNAPSHOT_ALIAS.version.max() : Q_SNAPSHOT_ALIAS.version.min()))); } diff --git a/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeletePropertyTest.java b/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeletePropertyTest.java index 8642a0e1730..1cca89ef2cf 100644 --- a/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeletePropertyTest.java +++ b/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeletePropertyTest.java @@ -33,7 +33,7 @@ import org.opencastproject.security.api.DefaultOrganization; import com.entwinemedia.fn.data.Opt; -import com.mysema.query.jpa.JPASubQuery; +import com.querydsl.core.jpa.JPASubQuery; import org.junit.Test; diff --git a/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteSnapshotTest.java b/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteSnapshotTest.java index 35df0b51407..7dde8c55cee 100644 --- a/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteSnapshotTest.java +++ b/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteSnapshotTest.java @@ -26,7 +26,7 @@ import org.opencastproject.mediapackage.MediaPackage; import org.opencastproject.security.api.DefaultOrganization; -import com.mysema.query.jpa.JPASubQuery; +import com.querydsl.core.jpa.JPASubQuery; import org.junit.Test; diff --git a/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteTestBase.java b/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteTestBase.java index 7f6731a9ccb..65f986b2a45 100644 --- a/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteTestBase.java +++ b/modules/asset-manager-impl/src/test/java/org/opencastproject/assetmanager/impl/AssetManagerDeleteTestBase.java @@ -30,10 +30,10 @@ import org.opencastproject.db.DBTestEnv; import org.opencastproject.util.data.Function; -import com.mysema.query.jpa.impl.JPADeleteClause; -import com.mysema.query.jpa.impl.JPAQuery; -import com.mysema.query.types.EntityPath; -import com.mysema.query.types.Predicate; +import com.com.querydsl.jpa.JPADeleteClause; +import com.com.querydsl.jpa.JPAQuery; +import com.querydsl.core.types.EntityPath; +import com.querydsl.core.types.Predicate; import javax.persistence.EntityManager; diff --git a/modules/common-jpa-impl/src/main/java/org/opencastproject/security/impl/jpa/JpaOrganization.java b/modules/common-jpa-impl/src/main/java/org/opencastproject/security/impl/jpa/JpaOrganization.java index b12e6372378..03c6b1f06a4 100644 --- a/modules/common-jpa-impl/src/main/java/org/opencastproject/security/impl/jpa/JpaOrganization.java +++ b/modules/common-jpa-impl/src/main/java/org/opencastproject/security/impl/jpa/JpaOrganization.java @@ -99,7 +99,7 @@ public class JpaOrganization implements Organization { @Lob @ElementCollection @MapKeyColumn(name = "name", nullable = false) - @Column(name = "value", length = 65535) + @Column(name = "\"value\"", length = 65535) @CollectionTable( name = "oc_organization_property", joinColumns = @JoinColumn(name = "organization", nullable = false) diff --git a/modules/common/src/test/java/org/opencastproject/db/TestDto.java b/modules/common/src/test/java/org/opencastproject/db/TestDto.java index d8f14fa6876..8ae84f5ac6b 100644 --- a/modules/common/src/test/java/org/opencastproject/db/TestDto.java +++ b/modules/common/src/test/java/org/opencastproject/db/TestDto.java @@ -46,10 +46,10 @@ public class TestDto { @GeneratedValue private long id; - @Column(name = "key", length = 128, nullable = false) + @Column(name = "a", length = 128, nullable = false) private String key; - @Column(name = "value", length = 128, nullable = false) + @Column(name = "b", length = 128, nullable = false) private String value; public static TestDto create(String key, String value) { diff --git a/modules/scheduler-impl/pom.xml b/modules/scheduler-impl/pom.xml index c197b419937..4de4803ca3f 100644 --- a/modules/scheduler-impl/pom.xml +++ b/modules/scheduler-impl/pom.xml @@ -187,10 +187,25 @@ - com.mysema.querydsl + com.querydsl + querydsl-core + test + + + com.querydsl querydsl-apt test + + com.querydsl + querydsl-jpa + test + + + com.querydsl + querydsl-sql-spatial + test + @@ -208,7 +223,6 @@ org.mnode.ical4j:ical4j commons-codec:commons-codec - com.mysema.querydsl:querydsl-apt org.opencastproject:opencast-list-providers-service diff --git a/pom.xml b/pom.xml index eff7522d55b..fd9d4e2aef6 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ https://opencast.org 2009 - false + true ${basedir} UTF-8 UTF-8 @@ -55,7 +55,7 @@ 1.1.1 1.0.1 8.0.15 - 3.7.4 + 4.0.0 4.4.0 3.1.4.RELEASE 3.1.7.RELEASE @@ -1220,18 +1220,23 @@ - com.mysema.querydsl + com.querydsl querydsl-apt ${querydsl.version} provided - com.mysema.querydsl + com.querydsl querydsl-jpa ${querydsl.version} - com.mysema.querydsl + com.querydsl + querydsl-sql-spatial + ${querydsl.version} + + + com.querydsl querydsl-core ${querydsl.version} @@ -1305,7 +1310,7 @@ com.h2database h2 - 1.3.176 + 2.2.220 com.mchange