Class AbstractFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
- java.lang.Object
-
- ubic.gemma.persistence.service.AbstractDao<O>
-
- ubic.gemma.persistence.service.AbstractVoEnabledDao<O,VO>
-
- ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao<O,VO>
-
- Type Parameters:
O
- the entity typeVO
- the corresponding VO type
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,BaseDao<O>
,BaseVoEnabledDao<O,VO>
,FilteringDao<O>
,FilteringVoEnabledDao<O,VO>
- Direct Known Subclasses:
AbstractCriteriaFilteringVoEnabledDao
,AbstractQueryFilteringVoEnabledDao
public abstract class AbstractFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> extends AbstractVoEnabledDao<O,VO> implements FilteringVoEnabledDao<O,VO>, org.springframework.beans.factory.InitializingBean
Base implementation forFilteringVoEnabledDao
.- Author:
- poirigui
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer
Configurer for filterable properties and their aliases.protected static class
AbstractFilteringVoEnabledDao.FilterablePropertyMeta
Meta-information for a filterable property.
-
Field Summary
-
Fields inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
REPORT_SLOW_QUERY_AFTER_MS
-
Fields inherited from class ubic.gemma.persistence.service.AbstractDao
elementClass, log
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractFilteringVoEnabledDao(String objectAlias, Class<? extends O> elementClass, SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
protected void
configureFilterableProperties(AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer configurer)
Register filterable properties.<T> Filter
getFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values)
Obtain aFilter
with an already parsed collection of values.<T> Filter
getFilter(String property, Class<T> propertyType, Filter.Operator operator, T value)
Obtain aFilter
with an already parsed value.Filter
getFilter(String property, Filter.Operator operator, String value)
Obtain anFilter
for the entity this DAO is providing.Filter
getFilter(String property, Filter.Operator operator, String value, SubqueryMode subqueryMode)
Filter
getFilter(String property, Filter.Operator operator, Collection<String> values)
Similar toFilteringDao.getFilter(String, Filter.Operator, String)
, but with a collection of values.Filter
getFilter(String property, Filter.Operator operator, Collection<String> values, SubqueryMode subqueryMode)
Set<String>
getFilterableProperties()
List all properties availble for filtering.List<Object>
getFilterablePropertyAllowedValues(String propertyName)
Obtain a short list of allowed values for the given property, or null if unrestricted.String
getFilterablePropertyDescription(String propertyName)
Obtain a short description for a given filterable property.boolean
getFilterablePropertyIsUsingSubquery(String property)
Indicate if the given property is using a subquery for filtering.protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta
getFilterablePropertyMeta(String propertyName)
protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta
getFilterablePropertyMeta(String objectAlias, String propertyName, Class<?> clazz)
Class<?>
getFilterablePropertyType(String propertyName)
Obtain the type of the given filterable property.Sort
getSort(String property, Sort.Direction direction, Sort.NullMode nullMode)
Obtain aSort
object for a property of theFilteringDao
.-
Methods inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
doLoadValueObject, doLoadValueObjects, loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds, postProcessValueObjects
-
Methods inherited from class ubic.gemma.persistence.service.AbstractDao
countAll, create, create, find, findByProperty, findByPropertyIn, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, remove, remove, remove, save, save, update, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ubic.gemma.persistence.service.BaseDao
countAll, create, create, find, findOrCreate, getElementClass, getIdentifierPropertyName, load, load, loadAll, loadReference, loadReference, remove, remove, remove, save, save, update, update
-
Methods inherited from interface ubic.gemma.persistence.service.BaseVoEnabledDao
loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds
-
Methods inherited from interface ubic.gemma.persistence.service.FilteringDao
count, load, load, loadIds
-
Methods inherited from interface ubic.gemma.persistence.service.FilteringVoEnabledDao
loadValueObjects, loadValueObjects
-
-
-
-
Constructor Detail
-
AbstractFilteringVoEnabledDao
protected AbstractFilteringVoEnabledDao(@Nullable String objectAlias, Class<? extends O> elementClass, SessionFactory sessionFactory)
-
-
Method Detail
-
afterPropertiesSet
@OverridingMethodsMustInvokeSuper public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getFilterableProperties
public final Set<String> getFilterableProperties()
Description copied from interface:FilteringDao
List all properties availble for filtering.- Specified by:
getFilterableProperties
in interfaceFilteringDao<O extends Identifiable>
-
configureFilterableProperties
@OverridingMethodsMustInvokeSuper protected void configureFilterableProperties(AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer configurer)
Register filterable properties.
-
getFilterablePropertyType
public Class<?> getFilterablePropertyType(String propertyName) throws IllegalArgumentException
Description copied from interface:FilteringDao
Obtain the type of the given filterable property.- Specified by:
getFilterablePropertyType
in interfaceFilteringDao<O extends Identifiable>
- Throws:
IllegalArgumentException
- if no such property exists, the cause will be aNoSuchFieldException
-
getFilterablePropertyDescription
@Nullable public String getFilterablePropertyDescription(String propertyName) throws IllegalArgumentException
Description copied from interface:FilteringDao
Obtain a short description for a given filterable property.- Specified by:
getFilterablePropertyDescription
in interfaceFilteringDao<O extends Identifiable>
- Throws:
IllegalArgumentException
- if no such property exists
-
getFilterablePropertyAllowedValues
@Nullable public List<Object> getFilterablePropertyAllowedValues(String propertyName) throws IllegalArgumentException
Description copied from interface:FilteringDao
Obtain a short list of allowed values for the given property, or null if unrestricted.The returned values must be of the type outlined by
FilteringDao.getFilterablePropertyType(String)
, generally a list ofString
orInteger
to denote possible values for an enumerated type.- Specified by:
getFilterablePropertyAllowedValues
in interfaceFilteringDao<O extends Identifiable>
- Throws:
IllegalArgumentException
-
getFilterablePropertyIsUsingSubquery
public boolean getFilterablePropertyIsUsingSubquery(String property) throws IllegalArgumentException
Description copied from interface:FilteringDao
Indicate if the given property is using a subquery for filtering.When this is the case, the filter will only check if at least one related entity is matching.
- Specified by:
getFilterablePropertyIsUsingSubquery
in interfaceFilteringDao<O extends Identifiable>
- Throws:
IllegalArgumentException
- if the property does not exist
-
getFilter
public final Filter getFilter(String property, Filter.Operator operator, String value)
Description copied from interface:FilteringDao
Obtain anFilter
for the entity this DAO is providing.It is the responsibility of the DAO to infer the filter property type as well as the alias to use.
If the filter refers to a related entity (i.e. a
BioAssay
of anExpressionExperiment
), then the DAO should inject the corresponding DAO and delegate it the work of creating the filter.In the frontend, that correspond to a FilterArg, but since the definition is not available here, we unpack its attributes.
- Specified by:
getFilter
in interfaceFilteringDao<O extends Identifiable>
- Parameters:
property
- property name in the entity use as a left-hand side of the operatoroperator
- an operatorvalue
- the corresponding, unparsed value, to the right-hand side of the operator- Returns:
- a filter filled with the object alias, property, inferred type, operator and parsed value
-
getFilter
public final Filter getFilter(String property, Filter.Operator operator, String value, SubqueryMode subqueryMode)
- Specified by:
getFilter
in interfaceFilteringDao<O extends Identifiable>
-
getFilter
public final Filter getFilter(String property, Filter.Operator operator, Collection<String> values)
Description copied from interface:FilteringDao
Similar toFilteringDao.getFilter(String, Filter.Operator, String)
, but with a collection of values.- Specified by:
getFilter
in interfaceFilteringDao<O extends Identifiable>
-
getFilter
public final Filter getFilter(String property, Filter.Operator operator, Collection<String> values, SubqueryMode subqueryMode)
- Specified by:
getFilter
in interfaceFilteringDao<O extends Identifiable>
-
getFilter
public final <T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, T value)
Description copied from interface:FilteringDao
Obtain aFilter
with an already parsed value.- Specified by:
getFilter
in interfaceFilteringDao<O extends Identifiable>
- See Also:
FilteringDao.getFilter(String, Filter.Operator, String)
-
getFilter
public final <T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values)
Description copied from interface:FilteringDao
Obtain aFilter
with an already parsed collection of values.- Specified by:
getFilter
in interfaceFilteringDao<O extends Identifiable>
- See Also:
FilteringDao.getFilter(String, Filter.Operator, Collection)
-
getSort
public final Sort getSort(String property, @Nullable Sort.Direction direction, Sort.NullMode nullMode)
Description copied from interface:FilteringDao
Obtain aSort
object for a property of theFilteringDao
.- Specified by:
getSort
in interfaceFilteringDao<O extends Identifiable>
- Parameters:
property
- a property ofFilteringDao
to sort bydirection
- a sorting direction, or null if the default direction appliesnullMode
- behavior for null values when sorting- Returns:
- a
Sort
object that can be used, for example, onFilteringVoEnabledDao.loadValueObjects(Filters, Sort, int, int)
-
getFilterablePropertyMeta
protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta getFilterablePropertyMeta(String propertyName) throws IllegalArgumentException
Obtain various meta-information used to infer what to use in aFilter
orSort
.This is used by
getFilter(String, Filter.Operator, String)
andFilteringDao.getSort(String, Sort.Direction, Sort.NullMode)
.- Throws:
IllegalArgumentException
- if no such propertyName exists inAbstractFilteringVoEnabledDao
- See Also:
getFilter(String, Filter.Operator, String)
,getFilter(String, Filter.Operator, Collection)
,FilteringDao.getSort(String, Sort.Direction, Sort.NullMode)
-
getFilterablePropertyMeta
protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta getFilterablePropertyMeta(@Nullable String objectAlias, String propertyName, Class<?> clazz) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-