Package com.ocs.dynamo.envers.dao.impl
Class VersionedEntityDaoImpl<ID,T extends AbstractEntity<ID>,U extends VersionedEntity<ID,T>>
- java.lang.Object
-
- com.ocs.dynamo.dao.impl.BaseDaoImpl<RevisionKey<ID>,U>
-
- com.ocs.dynamo.envers.dao.impl.VersionedEntityDaoImpl<ID,T,U>
-
- Type Parameters:
ID- the type of the primary keyT- the type of the original entityU- the type of the versioned entity
- All Implemented Interfaces:
BaseDao<RevisionKey<ID>,U>,VersionedEntityDao<ID,T,U>
public abstract class VersionedEntityDaoImpl<ID,T extends AbstractEntity<ID>,U extends VersionedEntity<ID,T>> extends BaseDaoImpl<RevisionKey<ID>,U> implements VersionedEntityDao<ID,T,U>
Implementation of Data Access object for versioned entities- Author:
- bas.rutten
-
-
Constructor Summary
Constructors Constructor Description VersionedEntityDaoImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longcount(Filter filter, boolean distinct)Overwrite count method to query the revision tablesprotected abstract UcreateVersionedEntity(T t, int revision)Creates a new instance of the versioned entityprotected voiddoMap(U u)List<U>fetch(Filter filter, FetchJoinInformation... joins)List<U>fetch(Filter filter, Pageable pageable, FetchJoinInformation... joins)UfetchById(RevisionKey<ID> id, FetchJoinInformation... joins)List<U>fetchByIds(List<RevisionKey<ID>> ids, SortOrders sortOrders, FetchJoinInformation... joins)List<RevisionKey<ID>>findIds(Filter filter, SortOrder... sortOrders)NumberfindRevisionNumber(LocalDateTime ldt)Finds the revision number corresponding to a certain dateList<U>findRevisions(ID id)Returns a list of revisions for an entityabstract Class<T>getBaseEntityClass()Returns the class of the "base entity" (i.e.protected com.querydsl.core.types.dsl.EntityPathBase<U>getDslRoot()Returns the Query DSL root.voidinit()-
Methods inherited from class com.ocs.dynamo.dao.impl.BaseDaoImpl
addParameter, count, createDeleteClause, createQuery, createUpdateClause, delete, delete, fetch, fetchByIds, fetchByUniqueProperty, find, find, findAll, findAll, findById, findByUniqueProperty, findDistinct, findDistinctInCollectionTable, findIds, findSelect, findSelect, flushAndClear, getEntityManager, getFetchJoins, getFirstValue, getFirstValueOptional, save, save
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ocs.dynamo.dao.BaseDao
count, delete, delete, fetch, fetchByIds, fetchByUniqueProperty, find, find, findAll, findAll, findById, findByUniqueProperty, findDistinct, findDistinctInCollectionTable, findIds, findSelect, findSelect, flushAndClear, getEntityClass, save, save
-
-
-
-
Method Detail
-
count
@Transactional public long count(Filter filter, boolean distinct)
Overwrite count method to query the revision tables- Specified by:
countin interfaceBaseDao<ID,T extends AbstractEntity<ID>>- Overrides:
countin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
createVersionedEntity
protected abstract U createVersionedEntity(T t, int revision)
Creates a new instance of the versioned entity- Returns:
-
doMap
protected void doMap(U u)
-
fetch
@Transactional public List<U> fetch(Filter filter, FetchJoinInformation... joins)
- Specified by:
fetchin interfaceBaseDao<ID,T extends AbstractEntity<ID>>- Overrides:
fetchin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
fetch
@Transactional public List<U> fetch(Filter filter, Pageable pageable, FetchJoinInformation... joins)
- Specified by:
fetchin interfaceBaseDao<ID,T extends AbstractEntity<ID>>- Overrides:
fetchin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
fetchById
@Transactional public U fetchById(RevisionKey<ID> id, FetchJoinInformation... joins)
- Specified by:
fetchByIdin interfaceBaseDao<ID,T extends AbstractEntity<ID>>- Overrides:
fetchByIdin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
fetchByIds
public List<U> fetchByIds(List<RevisionKey<ID>> ids, SortOrders sortOrders, FetchJoinInformation... joins)
- Specified by:
fetchByIdsin interfaceBaseDao<ID,T extends AbstractEntity<ID>>- Overrides:
fetchByIdsin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
findIds
public List<RevisionKey<ID>> findIds(Filter filter, SortOrder... sortOrders)
- Specified by:
findIdsin interfaceBaseDao<ID,T extends AbstractEntity<ID>>- Overrides:
findIdsin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
findRevisionNumber
public Number findRevisionNumber(LocalDateTime ldt)
Description copied from interface:VersionedEntityDaoFinds the revision number corresponding to a certain date- Specified by:
findRevisionNumberin interfaceVersionedEntityDao<ID,T extends AbstractEntity<ID>,U extends VersionedEntity<ID,T>>- Parameters:
ldt- the date- Returns:
-
findRevisions
@Transactional public List<U> findRevisions(ID id)
Description copied from interface:VersionedEntityDaoReturns a list of revisions for an entity- Specified by:
findRevisionsin interfaceVersionedEntityDao<ID,T extends AbstractEntity<ID>,U extends VersionedEntity<ID,T>>- Parameters:
id- the ID of the original entity- Returns:
- a list of revisions of the entity
-
getBaseEntityClass
public abstract Class<T> getBaseEntityClass()
Returns the class of the "base entity" (i.e. the non-versioned class)- Returns:
-
getDslRoot
protected com.querydsl.core.types.dsl.EntityPathBase<U> getDslRoot()
Returns the Query DSL root. This is not supported for versioned entities- Specified by:
getDslRootin classBaseDaoImpl<RevisionKey<ID>,U extends VersionedEntity<ID,T>>
-
init
@PostConstruct public void init()
-
-