Interface FilteringDao<O extends Identifiable>
-
- All Superinterfaces:
BaseDao<O>
- All Known Subinterfaces:
ArrayDesignDao
,BioAssayDao
,CachedFilteringDao<O>
,CachedFilteringVoEnabledDao<O,VO>
,CharacteristicDao
,CompositeSequenceDao
,DatabaseEntryDao
,ExpressionAnalysisResultSetDao
,ExpressionExperimentDao
,FactorValueDao
,FilteringVoEnabledDao<O,VO>
,GeneDao
,QuantitationTypeDao
,TaxonDao
- All Known Implementing Classes:
AbstractCriteriaFilteringVoEnabledDao
,AbstractCuratableDao
,AbstractFilteringVoEnabledDao
,AbstractNoopFilteringVoEnabledDao
,AbstractQueryFilteringVoEnabledDao
,ArrayDesignDaoImpl
,BioAssayDaoImpl
,CharacteristicDaoImpl
,CompositeSequenceDaoImpl
,DatabaseEntryDaoImpl
,ExpressionAnalysisResultSetDaoImpl
,ExpressionExperimentDaoImpl
,FactorValueDaoImpl
,GeneDaoImpl
,QuantitationTypeDaoImpl
,TaxonDaoImpl
public interface FilteringDao<O extends Identifiable> extends BaseDao<O>
Interface for filtering-capable DAO.Filtering DAOs have the capability of using
Filters
andSort
abstractions for browsing entities. There are also extra conveniences for loading IDsloadIds(Filters, Sort)
and counting entitiescount(Filters)
without having to retrieve too much from the persistent storage.This interface also provides introspection capabilities for enumerating and getting some meta information about filterable properties.
- Author:
- poirigui
-
-
Method Summary
All Methods Instance Methods Abstract 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 togetFilter(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.-
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
-
-
-
-
Method Detail
-
getFilterableProperties
Set<String> getFilterableProperties()
List all properties availble for filtering.
-
getFilterablePropertyType
Class<?> getFilterablePropertyType(String propertyName) throws IllegalArgumentException
Obtain the type of the given filterable property.- Throws:
IllegalArgumentException
- if no such property exists, the cause will be aNoSuchFieldException
-
getFilterablePropertyDescription
@Nullable String getFilterablePropertyDescription(String propertyName) throws IllegalArgumentException
Obtain a short description for a given filterable property.- Throws:
IllegalArgumentException
- if no such property exists
-
getFilterablePropertyAllowedValues
@Nullable List<Object> getFilterablePropertyAllowedValues(String property) throws IllegalArgumentException
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
getFilterablePropertyType(String)
, generally a list ofString
orInteger
to denote possible values for an enumerated type.- Throws:
IllegalArgumentException
-
getFilterablePropertyIsUsingSubquery
boolean getFilterablePropertyIsUsingSubquery(String property) throws IllegalArgumentException
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.
- Throws:
IllegalArgumentException
- if the property does not exist
-
getFilter
Filter getFilter(String property, Filter.Operator operator, String value) throws IllegalArgumentException
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.
- 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
Filter getFilter(String property, Filter.Operator operator, String value, SubqueryMode subqueryMode)
-
getFilter
Filter getFilter(String property, Filter.Operator operator, Collection<String> values) throws IllegalArgumentException
Similar togetFilter(String, Filter.Operator, String)
, but with a collection of values.- Throws:
IllegalArgumentException
-
getFilter
Filter getFilter(String property, Filter.Operator operator, Collection<String> values, SubqueryMode subqueryMode)
-
getFilter
<T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, T value) throws IllegalArgumentException
Obtain aFilter
with an already parsed value.- Throws:
IllegalArgumentException
- See Also:
getFilter(String, Filter.Operator, String)
-
getFilter
<T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values) throws IllegalArgumentException
Obtain aFilter
with an already parsed collection of values.- Throws:
IllegalArgumentException
- See Also:
getFilter(String, Filter.Operator, Collection)
-
getSort
Sort getSort(String property, @Nullable Sort.Direction direction, Sort.NullMode nullMode) throws IllegalArgumentException
Obtain aSort
object for a property of theFilteringDao
.- 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
List<Long> loadIds(@Nullable Filters filters, @Nullable Sort sort)
Load IDs of entities matching the given filters.
-
load
List<O> load(@Nullable Filters filters, @Nullable Sort sort)
Load entities matching the given filters.
-
load
Slice<O> load(@Nullable Filters filters, @Nullable Sort sort, int offset, int limit)
Load a slice of entities matching the given filters.
-
-