Class AbstractCuratableDao<C extends Curatable,VO extends AbstractCuratableValueObject<C>>
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,BaseDao<C>
,BaseVoEnabledDao<C,
,VO> CachedFilteringDao<C>
,CachedFilteringVoEnabledDao<C,
,VO> CuratableDao<C>
,FilteringDao<C>
,FilteringVoEnabledDao<C,
VO>
- Direct Known Subclasses:
ArrayDesignDaoImpl
,ExpressionExperimentDaoImpl
- Author:
- tesarst
-
Nested Class Summary
Nested classes/interfaces inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer, AbstractFilteringVoEnabledDao.FilterablePropertyMeta
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
HQL alias forCuratable.getCurationDetails()
.Fields inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
REPORT_SLOW_QUERY_AFTER_MS
Fields inherited from class ubic.gemma.persistence.service.AbstractDao
log
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractCuratableDao
(String objectAlias, Class<C> elementClass, SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addEventsToMap
(Map<Long, Collection<AuditEvent>> eventMap, Long id, AuditEvent event) protected void
addNonTroubledFilter
(Filters filters, String objectAlias) Restrict results to non-troubled curatable entities for non-administratorsprotected void
configureFilterableProperties
(AbstractFilteringVoEnabledDao<C, VO>.FilterablePropertiesConfigurer configurer) Register filterable properties.protected String
If the filters or sort refer to one of the one-to-many relations, multiple rows will be returned per datasets, so the query has to use a "distinct" clause make pagination work properly.protected String
formNativeNonTroubledClause
(String idColumn, Class<? extends Curatable> clazz) Form a native non-troubled clause.protected String
formNonTroubledClause
(String objectAlias, Class<? extends Curatable> clazz) Form a non-troubled clause.getFilterablePropertyMeta
(String propertyName) protected String
groupByIfNecessary
(Sort sort, String... oneToManyAliases) Similar logic todistinctIfNecessary()
, but using a group by since it's more efficient.Load IDs of troubled entities.void
updateCurationDetailsFromAuditEvent
(C curatable, AuditEvent auditEvent) Update the curation details of a given curatable entity.Methods inherited from class ubic.gemma.persistence.service.AbstractQueryFilteringVoEnabledDao
count, countWithCache, getEntityTransformer, getFilteringCountQuery, getFilteringIdQuery, getFilteringQuery, getValueObjectTransformer, initializeCachedFilteringResult, load, load, loadIds, loadIdsWithCache, loadValueObjects, loadValueObjects, loadValueObjectsWithCache, loadValueObjectsWithCache, loadWithCache, loadWithCache
Methods inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
afterPropertiesSet, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyMeta, getFilterablePropertyType, getSort
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, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, streamQuery, 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, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, update, update
Methods inherited from interface ubic.gemma.persistence.service.BaseVoEnabledDao
loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds
Methods inherited from interface ubic.gemma.persistence.service.FilteringDao
getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyType, getSort
-
Field Details
-
CURATION_DETAILS_ALIAS
HQL alias forCuratable.getCurationDetails()
.- See Also:
-
-
Constructor Details
-
AbstractCuratableDao
protected AbstractCuratableDao(String objectAlias, Class<C> elementClass, SessionFactory sessionFactory)
-
-
Method Details
-
loadTroubledIds
Description copied from interface:CuratableDao
Load IDs of troubled entities.- Specified by:
loadTroubledIds
in interfaceCuratableDao<C extends Curatable>
-
updateCurationDetailsFromAuditEvent
Description copied from interface:CuratableDao
Update the curation details of a given curatable entity.This method should only be called from
AuditTrailService
, as the passed event has to already exist in the audit trail of the curatable object.Only use this method directly if you do not want the event to show up in the curatable objects audit trail.
This is marked as ignored for audit purposes since we don't want to audit the curation details update when it originated from an audit event.
- Specified by:
updateCurationDetailsFromAuditEvent
in interfaceCuratableDao<C extends Curatable>
- Parameters:
curatable
- curatableauditEvent
- the event containing information about the update. Method only accepts audit events whose type is one ofCurationDetailsEvent
extensions.- See Also:
-
addEventsToMap
-
addNonTroubledFilter
Restrict results to non-troubled curatable entities for non-administrators -
distinctIfNecessary
If the filters or sort refer to one of the one-to-many relations, multiple rows will be returned per datasets, so the query has to use a "distinct" clause make pagination work properly.Using "distinct" otherwise has a steep performance penalty when combined with "order by".
Note that non-admin users always need a group by because of the jointure on ACL entries.
FIXME: remove the need for a distinct altogether by using a sub-query to apply ACLs (see #784)
-
groupByIfNecessary
Similar logic todistinctIfNecessary()
, but using a group by since it's more efficient. It does not work for the counting queries, however.FIXME: remove the need for a group by altogether by using a sub-query to apply ACLs (see #784)
-
formNonTroubledClause
Form a non-troubled clause. -
formNativeNonTroubledClause
Form a native non-troubled clause. -
configureFilterableProperties
@OverridingMethodsMustInvokeSuper protected void configureFilterableProperties(AbstractFilteringVoEnabledDao<C, VO>.FilterablePropertiesConfigurer configurer) Description copied from class:AbstractFilteringVoEnabledDao
Register filterable properties.- Overrides:
configureFilterableProperties
in classAbstractFilteringVoEnabledDao<C extends Curatable,
VO extends AbstractCuratableValueObject<C>>
-
getFilterablePropertyMeta
protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta getFilterablePropertyMeta(String propertyName) throws IllegalArgumentException Obtain various meta-information used to infer what to use in aFilter
orSort
.This is used by
AbstractFilteringVoEnabledDao.getFilter(String, Filter.Operator, String)
andFilteringDao.getSort(String, Sort.Direction, Sort.NullMode)
.Include filtering by
lastUpdated
,troubled
andneedsAttention
from the associated curation details.- Overrides:
getFilterablePropertyMeta
in classAbstractFilteringVoEnabledDao<C extends Curatable,
VO extends AbstractCuratableValueObject<C>> - Throws:
IllegalArgumentException
- if no such propertyName exists inAbstractFilteringVoEnabledDao
- See Also:
-