Class AbstractQueryFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,BaseDao<O>,BaseVoEnabledDao<O,,VO> CachedFilteringDao<O>,CachedFilteringVoEnabledDao<O,,VO> FilteringDao<O>,FilteringVoEnabledDao<O,VO>
- Direct Known Subclasses:
AbstractCuratableDao,CompositeSequenceDaoImpl,GeneDaoImpl,TaxonDaoImpl
FilteringVoEnabledDao based on the Hibernate Query API.- Author:
- poirigui
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer, AbstractFilteringVoEnabledDao.FilterablePropertyMeta -
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
ConstructorsModifierConstructorDescriptionprotectedAbstractQueryFilteringVoEnabledDao(String objectAlias, Class<O> elementClass, SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionlongCount VOs matching the given filters.longcountWithCache(Filters filters) protected TypedResultTransformer<O> Obtain an entity transformer for the results ofgetFilteringQuery(Filters, Sort).protected QuerygetFilteringCountQuery(Filters filters) Produce a query that will be used to retrieve the size ofgetFilteringQuery(Filters, Sort).protected QuerygetFilteringIdQuery(Filters filters, Sort sort) Produce a query that will be used to retrieve IDs ofgetFilteringQuery(Filters, Sort).protected abstract QuerygetFilteringQuery(Filters filters, Sort sort) Produce a query for retrieving value objects after applying a set of filters and a given ordering.protected TypedResultTransformer<VO> Obtain a value object transformer for the results ofgetFilteringQuery(Filters, Sort).protected abstract voidinitializeCachedFilteringResult(O cachedEntity) Initialize a result fromgetFilteringQuery(Filters, Sort)retrieved from the HibernateStandardQueryCache.Load entities matching the given filters.Load a slice of entities matching the given filters.Load IDs of entities matching the given filters.loadIdsWithCache(Filters filters, Sort sort) loadValueObjects(Filters filters, Sort sort) Load VOs with minimal ordering and filtering.loadValueObjects(Filters filters, Sort sort, int offset, int limit) Load VOs with ordering, filtering and offset/limit.loadValueObjectsWithCache(Filters filters, Sort sort) loadValueObjectsWithCache(Filters filters, Sort sort, int offset, int limit) loadWithCache(Filters filters, Sort sort) loadWithCache(Filters filters, Sort sort, int offset, int limit) Methods inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
afterPropertiesSet, configureFilterableProperties, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyMeta, getFilterablePropertyType, getSort, isFilterablePropertyDeprecated, isFilterablePropertyUsingSubquery, resolveFilterablePropertyMeta, resolveFilterablePropertyMetaMethods 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, findIdByProperty, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getEntityName, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, 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, 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
getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyType, getSort, isFilterablePropertyDeprecated, isFilterablePropertyUsingSubquery
-
Constructor Details
-
AbstractQueryFilteringVoEnabledDao
protected AbstractQueryFilteringVoEnabledDao(String objectAlias, Class<O> elementClass, SessionFactory sessionFactory)
-
-
Method Details
-
getFilteringQuery
Produce a query for retrieving value objects after applying a set of filters and a given ordering.Note that if your implementation does not produce a
ListofAbstractQueryFilteringVoEnabledDaowhenQuery.list()is invoked, you must overridegetValueObjectTransformer().The make the cached query (i.e.
loadWithCache(Filters, Sort)behave the same, you also have to explicitly initialize any lazy relations inAbstractVoEnabledDao.doLoadValueObject(Identifiable)because the VO constructor will not initialize them.- Returns:
- a
Querythat produce a list ofAbstractQueryFilteringVoEnabledDao
-
initializeCachedFilteringResult
Initialize a result fromgetFilteringQuery(Filters, Sort)retrieved from the HibernateStandardQueryCache.Lazy-loaded relations that are fetched in
getFilteringQuery(Filters, Sort)must be initialized manually in this method to ensure that the entity has all the expected fields if they are retrieved from the second-level cache. -
getFilteringIdQuery
Produce a query that will be used to retrieve IDs ofgetFilteringQuery(Filters, Sort). -
getFilteringCountQuery
Produce a query that will be used to retrieve the size ofgetFilteringQuery(Filters, Sort). -
getEntityTransformer
Obtain an entity transformer for the results ofgetFilteringQuery(Filters, Sort).The default entity transformer simply returns the first element of the tuple and omit null values.
-
getValueObjectTransformer
Obtain a value object transformer for the results ofgetFilteringQuery(Filters, Sort).By default, it will process the first element of the tuple with
AbstractVoEnabledDao.doLoadValueObjects(Collection)and then post-process the resulting VOs withAbstractVoEnabledDao.postProcessValueObjects(List). -
loadIds
Description copied from interface:FilteringDaoLoad IDs of entities matching the given filters.- Specified by:
loadIdsin interfaceFilteringDao<O extends Identifiable>
-
loadIdsWithCache
- Specified by:
loadIdsWithCachein interfaceCachedFilteringDao<O extends Identifiable>- See Also:
-
load
Description copied from interface:FilteringDaoLoad entities matching the given filters.- Specified by:
loadin interfaceFilteringDao<O extends Identifiable>
-
loadWithCache
public Slice<O> loadWithCache(@Nullable Filters filters, @Nullable Sort sort, int offset, int limit) - Specified by:
loadWithCachein interfaceCachedFilteringDao<O extends Identifiable>- See Also:
-
load
Description copied from interface:FilteringDaoLoad a slice of entities matching the given filters.- Specified by:
loadin interfaceFilteringDao<O extends Identifiable>
-
loadWithCache
- Specified by:
loadWithCachein interfaceCachedFilteringDao<O extends Identifiable>- See Also:
-
loadValueObjects
public Slice<VO> loadValueObjects(@Nullable Filters filters, @Nullable Sort sort, int offset, int limit) Description copied from interface:FilteringVoEnabledDaoLoad 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:
loadValueObjectsin interfaceFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> - Parameters:
filters- filters applied on the search. The properties mentioned in theFiltermust 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:
-
loadValueObjectsWithCache
public Slice<VO> loadValueObjectsWithCache(@Nullable Filters filters, @Nullable Sort sort, int offset, int limit) - Specified by:
loadValueObjectsWithCachein interfaceCachedFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
-
loadValueObjects
Description copied from interface:FilteringVoEnabledDaoLoad 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:
loadValueObjectsin interfaceFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> - See Also:
-
loadValueObjectsWithCache
- Specified by:
loadValueObjectsWithCachein interfaceCachedFilteringVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
-
count
Description copied from interface:FilteringDaoCount VOs matching the given filters.- Specified by:
countin interfaceFilteringDao<O extends Identifiable>
-
countWithCache
- Specified by:
countWithCachein interfaceCachedFilteringDao<O extends Identifiable>- See Also:
-