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
Filtering DAOs have the capability of using Filters and Sort abstractions for browsing entities.
There are also extra conveniences for loading IDs loadIds(Filters, Sort) and counting entities
count(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
Modifier and TypeMethodDescriptionlongCount VOs matching the given filters.<T> FiltergetFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values) Obtain aFilterwith an already parsed collection of values.<T> FiltergetFilter(String property, Class<T> propertyType, Filter.Operator operator, T value) Obtain aFilterwith an already parsed value.getFilter(String property, Filter.Operator operator, String value) Obtain anFilterfor the entity this DAO is providing.getFilter(String property, Filter.Operator operator, String value, SubqueryMode subqueryMode) getFilter(String property, Filter.Operator operator, Collection<String> values) Similar togetFilter(String, Filter.Operator, String), but with a collection of values.getFilter(String property, Filter.Operator operator, Collection<String> values, SubqueryMode subqueryMode) List all properties availble for filtering.getFilterablePropertyAllowedValues(String property) 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.Class<?> getFilterablePropertyType(String propertyName) Obtain the type of the given filterable property.getSort(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.Load entities matching the given filters.Load a slice of entities matching the given filters.Load IDs of entities matching the given filters.
-
Method Details
-
getFilterableProperties
List all properties availble for filtering. -
getFilterablePropertyType
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 ofStringorIntegerto denote possible values for an enumerated type.- Throws:
IllegalArgumentException
-
isFilterablePropertyUsingSubquery
Indicate if the given property is using a subquery for filtering.- Throws:
IllegalArgumentException- if the property does not exist
-
isFilterablePropertyDeprecated
Indicate if the given property is deprecated.- Throws:
IllegalArgumentException- if the property does not exist
-
getFilter
Filter getFilter(String property, Filter.Operator operator, String value) throws IllegalArgumentException Obtain 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.
- 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 aFilterwith an already parsed value.- Throws:
IllegalArgumentException- See Also:
-
getFilter
<T> Filter getFilter(String property, Class<T> propertyType, Filter.Operator operator, Collection<T> values) throws IllegalArgumentException Obtain aFilterwith an already parsed collection of values.- Throws:
IllegalArgumentException- See Also:
-
getSort
Sort getSort(String property, @Nullable Sort.Direction direction, Sort.NullMode nullMode) throws IllegalArgumentException Obtain aSortobject for a property of theFilteringDao.- 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) - Throws:
IllegalArgumentException- if no such field exists inFilteringDao
-
loadIds
Load IDs of entities matching the given filters. -
load
Load entities matching the given filters. -
load
Load a slice of entities matching the given filters. -
count
Count VOs matching the given filters.
-