public abstract class VersionableDaoBase<T extends VersionableEntity> extends CdmEntityDaoBase<T> implements IVersionableDao<T>
defaultBeanInitializer, flushAfterNo, LEFTOUTER_OPS, type
INCLUDE_UNPUBLISHED, NO_UNPUBLISHED
Constructor and Description |
---|
VersionableDaoBase(java.lang.Class<T> type) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCriteria(org.hibernate.envers.query.AuditQuery query,
java.util.List<org.hibernate.envers.query.criteria.AuditCriterion> criteria) |
protected void |
addOrder(org.hibernate.envers.query.AuditQuery query,
java.util.List<OrderHint> orderHints) |
protected void |
checkNotInPriorView(java.lang.String message) |
long |
count() |
long |
count(java.lang.Class<? extends T> clazz)
Returns the number of objects of type
|
long |
count(T example,
java.util.Set<java.lang.String> includeProperties)
Method that counts the number of objects matching the example provided.
|
long |
countAuditEvents(java.lang.Class<? extends T> clazz,
AuditEvent from,
AuditEvent to,
java.util.List<org.hibernate.envers.query.criteria.AuditCriterion> criteria)
Returns a count of the total number of audit events affecting objects of class T, optionally restricted to objects of
class clazz, the AuditEvents from and to, inclusive, optionally filtered by other criteria
|
long |
countAuditEvents(T t,
AuditEventSort sort)
Returns a count of audit events which affected the state of an entity t.
|
long |
countByParam(java.lang.Class<? extends T> clazz,
java.lang.String param,
java.lang.String queryString,
MatchMode matchmode,
java.util.List<org.hibernate.criterion.Criterion> criterion) |
java.lang.Boolean |
exists(java.util.UUID uuid) |
<S extends T> |
findByParam(java.lang.Class<S> clazz,
java.lang.String param,
java.lang.String queryString,
MatchMode matchmode,
java.util.List<org.hibernate.criterion.Criterion> criterion,
java.lang.Integer pageSize,
java.lang.Integer pageNumber,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
NOTE: We can't reuse
{@link #list(Class, String, Object, MatchMode, Integer, Integer, List, List)
here due to different default behavior of the
matchmode
parameter. |
<S extends T> |
findByParamWithRestrictions(java.lang.Class<S> clazz,
java.lang.String param,
java.lang.String queryString,
MatchMode matchmode,
java.util.List<Restriction<?>> restrictions,
java.lang.Integer pageSize,
java.lang.Integer pageNumber,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths) |
T |
findByUuid(java.util.UUID uuid) |
protected AuditEvent |
getAuditEventFromContext() |
java.util.List<AuditEventRecord<T>> |
getAuditEvents(java.lang.Class<? extends T> clazz,
AuditEvent from,
AuditEvent to,
java.util.List<org.hibernate.envers.query.criteria.AuditCriterion> criteria,
java.lang.Integer pageSize,
java.lang.Integer pageNumber,
AuditEventSort sort,
java.util.List<java.lang.String> propertyPaths)
Returns a list of all audit events occurring to objects of type T, optionally restricted to objects of type clazz
between the AuditEvents from and to, inclusive, optionally filtered by other criteria
|
java.util.List<AuditEventRecord<T>> |
getAuditEvents(T t,
java.lang.Integer pageSize,
java.lang.Integer pageNumber,
AuditEventSort sort,
java.util.List<java.lang.String> propertyPaths)
Returns a list of audit events (in order) which affected the state of an entity t.
|
AuditEventRecord<T> |
getNextAuditEvent(T t)
A convenience method which returns a record of the next (relative to the audit event in context)
audit event to affect the entity t.
|
AuditEventRecord<T> |
getPreviousAuditEvent(T t)
A convenience method which returns a record of the previous (relative to the audit event in context)
audit event to affect the entity t.
|
<S extends T> |
list(java.lang.Class<S> type,
java.lang.Integer limit,
java.lang.Integer start)
Returns a sublist of CdmBase instances of type
|
<S extends T> |
list(java.lang.Class<S> clazz,
java.lang.Integer limit,
java.lang.Integer start,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Returns a sublist of CdmBase instances stored in the database.
|
java.util.List<T> |
list(java.lang.Integer limit,
java.lang.Integer start)
Returns a sublist of CdmBase instances stored in the database.
|
<S extends T> |
list(S example,
java.util.Set<java.lang.String> includeProperties,
java.lang.Integer limit,
java.lang.Integer start,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Method that lists the objects matching the example provided.
|
T |
load(java.util.UUID uuid)
Finds the cdm entity specified by the
uuid parameter and
initializes all its *ToOne relations. |
protected T |
load(java.util.UUID uuid,
boolean includeUnpublished,
java.util.List<java.lang.String> propertyPaths) |
T |
load(java.util.UUID uuid,
java.util.List<java.lang.String> propertyPaths)
Finds the cdm entity specified by the
uuid parameter and
recursively initializes all bean properties given in the
propertyPaths parameter. |
addExample, addGroups, clear, count, countByParamWithRestrictions, countGroups, createCriteria, delete, entityType, findById, findByParam, findByUuid, findByUuidWithoutFlush, getAuditReader, getCriteria, getSession, getType, group, list, list, list, list, list, list, load, loadList, lock, makeAuditQuery, merge, merge, refresh, refresh, replace, save, saveAll, saveCdmObj, saveOrUpdate, saveOrUpdateAll, setDefaultBeanInitializer, setPagingParameter, setPagingParameter, update
addCriteria, addFieldPredicate, addLimitAndStart, addLimitAndStart, addLimitAndStart, addOrder, addOrder, addOrder, addPageSizeAndNumber, addPageSizeAndNumber, addPageSizeAndNumber, addPageSizeAndNumber, flush, getSessionFactory, orderByClause, setSessionFactory, splitCollection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, count, countByParamWithRestrictions, delete, findById, findByParam, findByUuidWithoutFlush, flush, getSession, getType, group, list, list, list, list, list, load, loadList, lock, merge, merge, refresh, refresh, replace, save, saveAll, saveOrUpdate, saveOrUpdateAll, update
public VersionableDaoBase(java.lang.Class<T> type)
protected AuditEvent getAuditEventFromContext()
protected void checkNotInPriorView(java.lang.String message)
public T findByUuid(java.util.UUID uuid)
findByUuid
in interface ICdmEntityDao<T extends VersionableEntity>
findByUuid
in class CdmEntityDaoBase<T extends VersionableEntity>
public <S extends T> java.util.List<S> findByParam(java.lang.Class<S> clazz, java.lang.String param, java.lang.String queryString, MatchMode matchmode, java.util.List<org.hibernate.criterion.Criterion> criterion, java.lang.Integer pageSize, java.lang.Integer pageNumber, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
CdmEntityDaoBase
matchmode
parameter.findByParam
in interface ICdmEntityDao<T extends VersionableEntity>
findByParam
in class CdmEntityDaoBase<T extends VersionableEntity>
public <S extends T> java.util.List<S> findByParamWithRestrictions(java.lang.Class<S> clazz, java.lang.String param, java.lang.String queryString, MatchMode matchmode, java.util.List<Restriction<?>> restrictions, java.lang.Integer pageSize, java.lang.Integer pageNumber, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
findByParamWithRestrictions
in interface ICdmEntityDao<T extends VersionableEntity>
findByParamWithRestrictions
in class CdmEntityDaoBase<T extends VersionableEntity>
public T load(java.util.UUID uuid)
ICdmEntityDao
uuid
parameter and
initializes all its *ToOne relations.load
in interface ICdmEntityDao<T extends VersionableEntity>
load
in class CdmEntityDaoBase<T extends VersionableEntity>
public T load(java.util.UUID uuid, java.util.List<java.lang.String> propertyPaths)
ICdmEntityDao
uuid
parameter and
recursively initializes all bean properties given in the
propertyPaths
parameter.
For detailed description and examples please refer to:
IBeanInitializer.initialize(Object, List)
load
in interface ICdmEntityDao<T extends VersionableEntity>
load
in class CdmEntityDaoBase<T extends VersionableEntity>
propertyPaths
- properties to be initializedprotected T load(java.util.UUID uuid, boolean includeUnpublished, java.util.List<java.lang.String> propertyPaths)
load
in class CdmEntityDaoBase<T extends VersionableEntity>
public java.lang.Boolean exists(java.util.UUID uuid)
exists
in interface ICdmEntityDao<T extends VersionableEntity>
exists
in class CdmEntityDaoBase<T extends VersionableEntity>
public long count()
count
in interface ICdmEntityDao<T extends VersionableEntity>
count
in class CdmEntityDaoBase<T extends VersionableEntity>
public long count(java.lang.Class<? extends T> clazz)
ICdmEntityDao
count
in interface ICdmEntityDao<T extends VersionableEntity>
count
in class CdmEntityDaoBase<T extends VersionableEntity>
public java.util.List<T> list(java.lang.Integer limit, java.lang.Integer start)
ICdmEntityDao
list
in interface ICdmEntityDao<T extends VersionableEntity>
list
in class CdmEntityDaoBase<T extends VersionableEntity>
limit
- the maximum number of entities returned (can be null to return all entities)public <S extends T> java.util.List<S> list(java.lang.Class<S> type, java.lang.Integer limit, java.lang.Integer start)
ICdmEntityDao
list
in interface ICdmEntityDao<T extends VersionableEntity>
list
in class CdmEntityDaoBase<T extends VersionableEntity>
limit
- the maximum number of entities returned (can be null to return all entities)public <S extends T> java.util.List<S> list(java.lang.Class<S> clazz, java.lang.Integer limit, java.lang.Integer start, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
ICdmEntityDao
list
in interface ICdmEntityDao<T extends VersionableEntity>
list
in class CdmEntityDaoBase<T extends VersionableEntity>
limit
- the maximum number of entities returned (can be null to return
all entities)orderHints
- Supports path like orderHints.propertyNames
which
include *-to-one properties like createdBy.username or
authorTeam.persistentTitleCacheprotected void addOrder(org.hibernate.envers.query.AuditQuery query, java.util.List<OrderHint> orderHints)
public java.util.List<AuditEventRecord<T>> getAuditEvents(T t, java.lang.Integer pageSize, java.lang.Integer pageNumber, AuditEventSort sort, java.util.List<java.lang.String> propertyPaths)
IVersionableDao
getAuditEvents
in interface IVersionableDao<T extends VersionableEntity>
t
- The versionable entity which was affected by the audit eventspageSize
- The maximum number of audit event records returned (can be null for all audit event records)pageNumber
- The offset (in pageSize chunks) from the start of the result set (0 - based)sort
- should the list be sorted going forward in time (AuditEventSort.FORWARDS) or backwards (AuditEventSort.BACKWARDS)propertyPaths
- paths initialized on the returned audited objectspublic long countAuditEvents(T t, AuditEventSort sort)
IVersionableDao
countAuditEvents
in interface IVersionableDao<T extends VersionableEntity>
t
- The versionable entity which was affected by the audit eventssort
- should the events considered start now and go forward in time (AuditEventSort.FORWARDS) or backwards (AuditEventSort.BACKWARDS)public AuditEventRecord<T> getNextAuditEvent(T t)
IVersionableDao
getNextAuditEvent
in interface IVersionableDao<T extends VersionableEntity>
t
- The versionable entity affected by these audit eventspublic AuditEventRecord<T> getPreviousAuditEvent(T t)
IVersionableDao
getPreviousAuditEvent
in interface IVersionableDao<T extends VersionableEntity>
t
- The versionable entity affected by these audit eventspublic long countAuditEvents(java.lang.Class<? extends T> clazz, AuditEvent from, AuditEvent to, java.util.List<org.hibernate.envers.query.criteria.AuditCriterion> criteria)
IVersionableDao
countAuditEvents
in interface IVersionableDao<T extends VersionableEntity>
clazz
- Restrict the results returned to objects of this classfrom
- The audit event to start from (or pass null to start from the beginning of the recordset)to
- The audit event to continue until (or pass null to return audit events up to the time of the query)criteria
- Extra criteria to filter byprotected void addCriteria(org.hibernate.envers.query.AuditQuery query, java.util.List<org.hibernate.envers.query.criteria.AuditCriterion> criteria)
public java.util.List<AuditEventRecord<T>> getAuditEvents(java.lang.Class<? extends T> clazz, AuditEvent from, AuditEvent to, java.util.List<org.hibernate.envers.query.criteria.AuditCriterion> criteria, java.lang.Integer pageSize, java.lang.Integer pageNumber, AuditEventSort sort, java.util.List<java.lang.String> propertyPaths)
IVersionableDao
getAuditEvents
in interface IVersionableDao<T extends VersionableEntity>
clazz
- Restrict the results returned to objects of this classfrom
- The audit event to start from (inclusive, or pass null to start from the beginning of the recordset)to
- The audit event to continue until (exclusive, or pass null to return audit events up to the time of the query)criteria
- Extra criteria to filter bypageSize
- The maximum number of objects returned (can be null for all matching objects)pageNumber
- The offset (in pageSize chunks) from the start of the result set (0 - based,
can be null, equivalent of starting at the beginning of the recordset)sort
- Sort the events either forwards or backwards in timepropertyPaths
- properties to be initializedpublic long countByParam(java.lang.Class<? extends T> clazz, java.lang.String param, java.lang.String queryString, MatchMode matchmode, java.util.List<org.hibernate.criterion.Criterion> criterion)
countByParam
in interface ICdmEntityDao<T extends VersionableEntity>
countByParam
in class CdmEntityDaoBase<T extends VersionableEntity>
public long count(T example, java.util.Set<java.lang.String> includeProperties)
ICdmEntityDao
count
in interface ICdmEntityDao<T extends VersionableEntity>
count
in class CdmEntityDaoBase<T extends VersionableEntity>
public <S extends T> java.util.List<S> list(S example, java.util.Set<java.lang.String> includeProperties, java.lang.Integer limit, java.lang.Integer start, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
ICdmEntityDao
list
in interface ICdmEntityDao<T extends VersionableEntity>
list
in class CdmEntityDaoBase<T extends VersionableEntity>
limit
- the maximum number of entities returned (can be null to return
all entities)start
- The (0-based) offset from the start of the recordsetorderHints
- Supports path like orderHints.propertyNames
which
include *-to-one properties like createdBy.username orpropertyPaths
- paths initialized on the returned objects - only applied to the objects returned from the first groupingCopyright © 2007-2020 EDIT. All Rights Reserved.