diff --git a/gemma-core/src/main/java/ubic/gemma/persistence/service/analysis/expression/diff/ExpressionAnalysisResultSetDaoImpl.java b/gemma-core/src/main/java/ubic/gemma/persistence/service/analysis/expression/diff/ExpressionAnalysisResultSetDaoImpl.java index f9b2b07b05..5eb48d1e65 100644 --- a/gemma-core/src/main/java/ubic/gemma/persistence/service/analysis/expression/diff/ExpressionAnalysisResultSetDaoImpl.java +++ b/gemma-core/src/main/java/ubic/gemma/persistence/service/analysis/expression/diff/ExpressionAnalysisResultSetDaoImpl.java @@ -26,11 +26,9 @@ import org.hibernate.sql.JoinType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; -import org.springframework.transaction.PlatformTransactionManager; import ubic.gemma.model.analysis.expression.diff.*; import ubic.gemma.model.common.description.Characteristic; import ubic.gemma.model.common.description.DatabaseEntry; -import ubic.gemma.model.common.measurement.Measurement; import ubic.gemma.model.common.protocol.Protocol; import ubic.gemma.model.expression.experiment.BioAssaySet; import ubic.gemma.model.expression.experiment.ExpressionExperiment; @@ -41,7 +39,10 @@ import ubic.gemma.persistence.util.*; import javax.annotation.Nullable; -import java.util.*; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -221,13 +222,13 @@ protected void configureFilterableProperties( FilterablePropertiesConfigurer con configurer.unregisterEntity( "analysis.protocol.", Protocol.class ); // use the characteristics instead - configurer.registerAlias( "analysis.subsetFactorValue.characteristics.", "sfvc", Characteristic.class, null, 1 ); + configurer.registerAlias( "analysis.subsetFactorValue.characteristics.", "sfvc", Characteristic.class, null, 1, true ); configurer.unregisterProperty( "analysis.subsetFactorValue.characteristics.originalValue" ); configurer.unregisterProperty( "analysis.subsetFactorValue.value" ); // baseline is always baseline configurer.unregisterProperty( "baselineGroup.isBaseline" ); - configurer.registerAlias( "baselineGroup.characteristics.", "bc", Characteristic.class, null, 1 ); + configurer.registerAlias( "baselineGroup.characteristics.", "bc", Characteristic.class, null, 1, true ); configurer.unregisterProperty( "baselineGroup.characteristics.originalValue" ); configurer.unregisterProperty( "baselineGroup.value" ); diff --git a/gemma-core/src/main/java/ubic/gemma/persistence/util/FilterCriteriaUtils.java b/gemma-core/src/main/java/ubic/gemma/persistence/util/FilterCriteriaUtils.java index ff99918df3..fced4e77a9 100644 --- a/gemma-core/src/main/java/ubic/gemma/persistence/util/FilterCriteriaUtils.java +++ b/gemma-core/src/main/java/ubic/gemma/persistence/util/FilterCriteriaUtils.java @@ -6,7 +6,8 @@ import javax.annotation.Nullable; import java.util.Collection; import java.util.List; -import java.util.Objects; + +import static java.util.Objects.requireNonNull; /** * Utilities for integrating {@link Filter} with Hibernate {@link Criteria} API. @@ -75,7 +76,8 @@ private static Criterion formRestrictionClause( Filter filter ) { return Restrictions.ne( property, filter.getRequiredValue() ); } case like: - return Restrictions.like( property, escapeLike( ( String ) Objects.requireNonNull( filter.getRequiredValue(), "Required value cannot be null for the like operator." ) ), MatchMode.START ); + return Restrictions.like( property, escapeLike( ( String ) requireNonNull( filter.getRequiredValue(), + "Required value cannot be null for the like operator." ) ), MatchMode.START ); case lessThan: return Restrictions.lt( property, filter.getRequiredValue() ); case greaterThan: @@ -85,8 +87,18 @@ private static Criterion formRestrictionClause( Filter filter ) { case greaterOrEq: return Restrictions.ge( property, filter.getRequiredValue() ); case in: - return Restrictions.in( property, ( Collection ) Objects.requireNonNull( filter.getRequiredValue(), + return Restrictions.in( property, ( Collection ) requireNonNull( filter.getRequiredValue(), "Required value cannot be null for a collection." ) ); + case inSubquery: + Subquery subquery = ( Subquery ) requireNonNull( filter.getRequiredValue(), + "Required value cannot be null for a subquery." ); + DetachedCriteria dc = DetachedCriteria.forEntityName( subquery.getEntityName() ) + .setProjection( Projections.id() ); + for ( Subquery.Alias a : subquery.getAliases() ) { + dc.createAlias( a.getPropertyName(), a.getAlias() ); + } + dc.add( formRestrictionClause( subquery.getFilter() ) ); + return Subqueries.propertyIn( "id", dc ); default: throw new IllegalStateException( "Unexpected operator for filter: " + filter.getOperator() ); }