Class AbstractCuratableDao<C extends Curatable,VO extends AbstractCuratableValueObject<C>>
- java.lang.Object
-
- ubic.gemma.persistence.service.AbstractDao<O>
-
- ubic.gemma.persistence.service.AbstractVoEnabledDao<O,VO>
-
- ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao<O,VO>
-
- ubic.gemma.persistence.service.AbstractQueryFilteringVoEnabledDao<C,VO>
-
- ubic.gemma.persistence.service.common.auditAndSecurity.curation.AbstractCuratableDao<C,VO>
-
- All Implemented Interfaces:
InitializingBean
,BaseDao<C>
,BaseVoEnabledDao<C,VO>
,CachedFilteringDao<C>
,CachedFilteringVoEnabledDao<C,VO>
,CuratableDao<C>
,FilteringDao<C>
,FilteringVoEnabledDao<C,VO>
- Direct Known Subclasses:
ArrayDesignDaoImpl
,ExpressionExperimentDaoImpl
public abstract class AbstractCuratableDao<C extends Curatable,VO extends AbstractCuratableValueObject<C>> extends AbstractQueryFilteringVoEnabledDao<C,VO> implements CuratableDao<C>
Created by tesarst on 07/03/17. DAO covering methods common to all Curatable objects.- Author:
- tesarst
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer, AbstractFilteringVoEnabledDao.FilterablePropertyMeta
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CURATION_DETAILS_ALIAS
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
elementClass, log
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCuratableDao(String objectAlias, Class<C> elementClass, SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.FilterablePropertiesConfigurer configurer)
Register filterable properties.protected String
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.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.protected AbstractFilteringVoEnabledDao.FilterablePropertyMeta
getFilterablePropertyMeta(String propertyName)
protected String
groupByIfNecessary(Sort sort, String... oneToManyAliases)
Similar logic todistinctIfNecessary()
, but using a group by since it's more efficient.void
updateCurationDetailsFromAuditEvent(Curatable 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, 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, 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
-
Methods inherited from interface ubic.gemma.persistence.service.FilteringDao
getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyType, getSort
-
-
-
-
Field Detail
-
CURATION_DETAILS_ALIAS
protected static final String CURATION_DETAILS_ALIAS
HQL alias forCuratable.getCurationDetails()
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractCuratableDao
protected AbstractCuratableDao(String objectAlias, Class<C> elementClass, SessionFactory sessionFactory)
-
-
Method Detail
-
updateCurationDetailsFromAuditEvent
public void updateCurationDetailsFromAuditEvent(Curatable curatable, AuditEvent auditEvent)
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:
CuratableDao.updateCurationDetailsFromAuditEvent(Curatable, AuditEvent)
-
addEventsToMap
protected void addEventsToMap(Map<Long,Collection<AuditEvent>> eventMap, Long id, AuditEvent event)
-
addNonTroubledFilter
protected void addNonTroubledFilter(Filters filters, String objectAlias)
Restrict results to non-troubled curatable entities for non-administrators
-
distinctIfNecessary
protected String 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
@Nullable protected String groupByIfNecessary(@Nullable Sort sort, String... oneToManyAliases)
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
protected String formNonTroubledClause(String objectAlias, Class<? extends Curatable> clazz)
Form a non-troubled clause.
-
formNativeNonTroubledClause
protected String formNativeNonTroubledClause(String idColumn, Class<? extends Curatable> clazz)
Form a native non-troubled clause.
-
configureFilterableProperties
@OverridingMethodsMustInvokeSuper protected void configureFilterableProperties(AbstractFilteringVoEnabledDao.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)
andAbstractFilteringVoEnabledDao.getSort(String, Sort.Direction)
.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:
AbstractFilteringVoEnabledDao.getFilter(String, Filter.Operator, String)
,AbstractFilteringVoEnabledDao.getFilter(String, Filter.Operator, Collection)
,AbstractFilteringVoEnabledDao.getSort(String, Sort.Direction)
-
-