Class AbstractNoopFilteringVoEnabledDao<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.AbstractNoopFilteringVoEnabledDao<O,VO>
-
- All Implemented Interfaces:
BaseDao<O>
,BaseVoEnabledDao<O,VO>
,FilteringDao<O>
,FilteringVoEnabledDao<O,VO>
- Direct Known Subclasses:
BioAssayDaoImpl
,CharacteristicDaoImpl
,DatabaseEntryDaoImpl
,FactorValueDaoImpl
public abstract class AbstractNoopFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> extends AbstractVoEnabledDao<O,VO> implements FilteringVoEnabledDao<O,VO>
Base class to use to pretend to offer filtering, but actually supporting no filterable properties.This is necessary because
AbstractFilteringVoEnabledDao
reroutes VO loading methods fromBaseVoEnabledDao
through theFilter
-based mechanism for consistency, so it is not a suitable base class if you don't want or need to implement the filtering aspect of the interface.
-
-
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
AbstractNoopFilteringVoEnabledDao(Class<? extends O> elementClass, SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
count(Filters filters)
Count VOs matching the given filters.<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 property)
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.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
.List<O>
load(Filters filters, Sort sort)
Load entities matching the given filters.Slice<O>
load(Filters filters, Sort sort, int offset, int limit)
Load a slice of entities matching the given filters.List<Long>
loadIds(Filters filters, Sort sort)
Load IDs of entities matching the given filters.List<VO>
loadValueObjects(Filters filters, Sort sort)
Load VOs with minimal ordering and filtering.Slice<VO>
loadValueObjects(Filters filters, Sort sort, int offset, int limit)
Load VOs with ordering, filtering and offset/limit.-
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
-
-
-
-
Constructor Detail
-
AbstractNoopFilteringVoEnabledDao
protected AbstractNoopFilteringVoEnabledDao(Class<? extends O> elementClass, SessionFactory sessionFactory)
-
-
Method Detail
-
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>
-
getFilterablePropertyType
public final 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 final 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 property)
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>
-
getFilterablePropertyIsUsingSubquery
public boolean getFilterablePropertyIsUsingSubquery(String property)
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>
-
getFilter
public final Filter getFilter(String property, Filter.Operator operator, String value) throws IllegalArgumentException
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
- Throws:
IllegalArgumentException
- if the property does not exist inFilteringDao
, or if the operator cannot be applied, or if the value cannot apply to the property an operator seeFilter.parse(String, String, Class, Filter.Operator, String, String)
for more details
-
getFilter
public 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) throws IllegalArgumentException
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>
- Throws:
IllegalArgumentException
-
getFilter
public 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) throws IllegalArgumentException
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)
- Throws:
IllegalArgumentException
- if no such field exists inFilteringDao
-
loadIds
public final List<Long> loadIds(@Nullable Filters filters, @Nullable Sort sort)
Description copied from interface:FilteringDao
Load IDs of entities matching the given filters.- Specified by:
loadIds
in interfaceFilteringDao<O extends Identifiable>
-
load
public final List<O> load(@Nullable Filters filters, @Nullable Sort sort)
Description copied from interface:FilteringDao
Load entities matching the given filters.- Specified by:
load
in interfaceFilteringDao<O extends Identifiable>
-
load
public final Slice<O> load(@Nullable Filters filters, @Nullable Sort sort, int offset, int limit)
Description copied from interface:FilteringDao
Load a slice of entities matching the given filters.- Specified by:
load
in interfaceFilteringDao<O extends Identifiable>
-
count
public final long count(@Nullable Filters filters)
Description copied from interface:FilteringDao
Count VOs matching the given filters.- Specified by:
count
in interfaceFilteringDao<O extends Identifiable>
-
loadValueObjects
public final Slice<VO> loadValueObjects(@Nullable Filters filters, @Nullable Sort sort, int offset, int limit)
Description copied from interface:FilteringVoEnabledDao
Load VOs with ordering, filtering and offset/limit.Consider using
FilteringDao.getFilter(String, Filter.Operator, String)
andFilteringDao.getSort(String, Sort.Direction, Sort.NullMode)
to produce the filters and sort safely from user input.- Specified by:
loadValueObjects
in interfaceFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
- Parameters:
filters
- filters applied on the search. The properties mentioned in theFilter
must exist and be visible to Hibernate. You can use nested properties such as "curationDetails.lastUpdated".sort
- an object property and direction to order by. This property must exist and be visible to Hibernate. You can use nested properties such as "curationDetails.lastUpdated".offset
- an offset from which entities are retrieved when sorted according to the sort argument, or 0 to ignorelimit
- a limit on the number of returned results, or -1 to ignore- Returns:
- a slice of the relevant data
- See Also:
FilteringDao.load(Filters, Sort, int, int)
-
loadValueObjects
public final List<VO> loadValueObjects(@Nullable Filters filters, @Nullable Sort sort)
Description copied from interface:FilteringVoEnabledDao
Load VOs with minimal ordering and filtering.Use this as an alternative to
FilteringVoEnabledDao.loadValueObjects(Filters, Sort, int, int)
if you do not intend to provide pagination capabilities.- Specified by:
loadValueObjects
in interfaceFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
- See Also:
FilteringDao.load(Filters, Sort)
,FilteringVoEnabledDao.loadValueObjects(Filters, Sort, int, int)
-
-