Package ubic.gemma.persistence.service
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 for
FilteringVoEnabledDao.- Author:
- poirigui
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classConfigurer for filterable properties and their aliases.protected static final classMeta-information for a filterable property. -
Field Summary
Fields inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
REPORT_SLOW_QUERY_AFTER_MSFields inherited from class ubic.gemma.persistence.service.AbstractDao
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFilteringVoEnabledDao(String objectAlias, Class<? extends O> elementClass, SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidconfigureFilterableProperties(AbstractFilteringVoEnabledDao<O, VO>.FilterablePropertiesConfigurer configurer) Register filterable properties.final <T> FiltergetFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values) Obtain aFilterwith an already parsed collection of values.final <T> FiltergetFilter(String property, Class<T> propertyType, Filter.Operator operator, T value) Obtain aFilterwith an already parsed value.final FiltergetFilter(String property, Filter.Operator operator, String value) Obtain anFilterfor the entity this DAO is providing.final FiltergetFilter(String property, Filter.Operator operator, String value, SubqueryMode subqueryMode) final FiltergetFilter(String property, Filter.Operator operator, Collection<String> values) Similar toFilteringDao.getFilter(String, Filter.Operator, String), but with a collection of values.final FiltergetFilter(String property, Filter.Operator operator, Collection<String> values, SubqueryMode subqueryMode) List all properties availble for filtering.getFilterablePropertyAllowedValues(String propertyName) Obtain a short list of allowed values for the given property, or null if unrestricted.getFilterablePropertyDescription(String propertyName) Obtain a short description for a given filterable property.protected final AbstractFilteringVoEnabledDao.FilterablePropertyMetagetFilterablePropertyMeta(String propertyName) Class<?> getFilterablePropertyType(String propertyName) Obtain the type of the given filterable property.final SortgetSort(String property, Sort.Direction direction, Sort.NullMode nullMode) Obtain aSortobject for a property of theFilteringDao.booleanisFilterablePropertyDeprecated(String property) Indicate if the given property is deprecated.booleanisFilterablePropertyUsingSubquery(String property) Indicate if the given property is using a subquery for filtering.resolveFilterablePropertyMeta(String propertyName) resolveFilterablePropertyMeta(String objectAlias, Class<? extends Identifiable> clazz, String propertyName) Methods inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
doLoadValueObject, doLoadValueObjects, loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds, postProcessValueObjectsMethods inherited from class ubic.gemma.persistence.service.AbstractDao
countAll, create, create, find, findByProperty, findByPropertyIn, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getEntityName, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, streamQuery, update, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ubic.gemma.persistence.service.BaseDao
countAll, create, create, find, findOrCreate, getElementClass, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, update, updateMethods inherited from interface ubic.gemma.persistence.service.BaseVoEnabledDao
loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIdsMethods inherited from interface ubic.gemma.persistence.service.FilteringDao
count, load, load, loadIdsMethods inherited from interface ubic.gemma.persistence.service.FilteringVoEnabledDao
loadValueObjects, loadValueObjects
-
Constructor Details
-
AbstractFilteringVoEnabledDao
protected AbstractFilteringVoEnabledDao(@Nullable String objectAlias, Class<? extends O> elementClass, SessionFactory sessionFactory)
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getFilterableProperties
Description copied from interface:FilteringDaoList all properties availble for filtering.- Specified by:
getFilterablePropertiesin interfaceFilteringDao<O extends Identifiable>
-
configureFilterableProperties
@OverridingMethodsMustInvokeSuper protected void configureFilterableProperties(AbstractFilteringVoEnabledDao<O, VO>.FilterablePropertiesConfigurer configurer) Register filterable properties. -
getFilterablePropertyType
Description copied from interface:FilteringDaoObtain the type of the given filterable property.- Specified by:
getFilterablePropertyTypein 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:FilteringDaoObtain a short description for a given filterable property.- Specified by:
getFilterablePropertyDescriptionin 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:FilteringDaoObtain 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 ofStringorIntegerto denote possible values for an enumerated type.- Specified by:
getFilterablePropertyAllowedValuesin interfaceFilteringDao<O extends Identifiable>- Throws:
IllegalArgumentException
-
isFilterablePropertyUsingSubquery
Description copied from interface:FilteringDaoIndicate if the given property is using a subquery for filtering.- Specified by:
isFilterablePropertyUsingSubqueryin interfaceFilteringDao<O extends Identifiable>- Throws:
IllegalArgumentException- if the property does not exist
-
isFilterablePropertyDeprecated
Description copied from interface:FilteringDaoIndicate if the given property is deprecated.- Specified by:
isFilterablePropertyDeprecatedin interfaceFilteringDao<O extends Identifiable>- Throws:
IllegalArgumentException- if the property does not exist
-
getFilter
Description copied from interface:FilteringDaoObtain anFilterfor 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
BioAssayof 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:
getFilterin 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:
getFilterin interfaceFilteringDao<O extends Identifiable>
-
getFilter
Description copied from interface:FilteringDaoSimilar toFilteringDao.getFilter(String, Filter.Operator, String), but with a collection of values.- Specified by:
getFilterin interfaceFilteringDao<O extends Identifiable>
-
getFilter
public final Filter getFilter(String property, Filter.Operator operator, Collection<String> values, SubqueryMode subqueryMode) - Specified by:
getFilterin interfaceFilteringDao<O extends Identifiable>
-
getFilter
public final <T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, T value) Description copied from interface:FilteringDaoObtain aFilterwith an already parsed value.- Specified by:
getFilterin interfaceFilteringDao<O extends Identifiable>- See Also:
-
getFilter
public final <T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values) Description copied from interface:FilteringDaoObtain aFilterwith an already parsed collection of values.- Specified by:
getFilterin interfaceFilteringDao<O extends Identifiable>- See Also:
-
getSort
public final Sort getSort(String property, @Nullable Sort.Direction direction, Sort.NullMode nullMode) Description copied from interface:FilteringDaoObtain aSortobject for a property of theFilteringDao.- Specified by:
getSortin interfaceFilteringDao<O extends Identifiable>- Parameters:
property- a property ofFilteringDaoto sort bydirection- a sorting direction, or null if the default direction appliesnullMode- behavior for null values when sorting- Returns:
- a
Sortobject that can be used, for example, onFilteringVoEnabledDao.loadValueObjects(Filters, Sort, int, int)
-
getFilterablePropertyMeta
protected final AbstractFilteringVoEnabledDao.FilterablePropertyMeta getFilterablePropertyMeta(String propertyName) -
resolveFilterablePropertyMeta
protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta.FilterablePropertyMetaBuilder resolveFilterablePropertyMeta(String propertyName) throws IllegalArgumentException Obtain various meta-information used to infer what to use in aFilterorSort.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:
-
resolveFilterablePropertyMeta
protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta.FilterablePropertyMetaBuilder resolveFilterablePropertyMeta(@Nullable String objectAlias, Class<? extends Identifiable> clazz, String propertyName) throws IllegalArgumentException - Throws:
IllegalArgumentException
-