Class AbstractGenericRevisionedDao<ID,ENTITY extends com.devonfw.module.basic.common.api.entity.RevisionedPersistenceEntity<ID>>
- java.lang.Object
-
- com.devonfw.module.jpa.dataaccess.api.QueryHelper
-
- com.devonfw.module.jpa.dataaccess.base.AbstractGenericDao<ID,ENTITY>
-
- com.devonfw.module.jpa.dataaccess.base.AbstractGenericRevisionedDao<ID,ENTITY>
-
- Type Parameters:
ID
- is the type of theprimary key
of the managedentity
.ENTITY
- is thetype
of the managed entity.
- All Implemented Interfaces:
com.devonfw.module.jpa.dataaccess.api.feature.FeatureForceIncrementModificationCounter<ENTITY>
,GenericDao<ID,ENTITY>
,GenericRevisionedDao<ID,ENTITY>
- Direct Known Subclasses:
AbstractRevisionedDao
public abstract class AbstractGenericRevisionedDao<ID,ENTITY extends com.devonfw.module.basic.common.api.entity.RevisionedPersistenceEntity<ID>> extends AbstractGenericDao<ID,ENTITY> implements GenericRevisionedDao<ID,ENTITY>
This is the abstract base-implementation of aAbstractGenericDao
using to manage the revision-control.- Since:
- 3.0.0
-
-
Field Summary
-
Fields inherited from class com.devonfw.module.jpa.dataaccess.api.QueryHelper
QUERY_PROPERTY_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description AbstractGenericRevisionedDao()
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.hibernate.envers.AuditReader
getAuditReader()
List<Number>
getRevisionHistory(ID id)
This method will get theList
of historicrevisions
of theentity
with the givenid
.
If theentity
is NOT revision controlled, anempty list
is returned.List<com.devonfw.module.basic.common.api.RevisionMetadata>
getRevisionHistoryMetadata(Object id)
This method will get theList
ofRevisionMetadata
from therevision
-history of the entity with the givenid
.ENTITY
load(ID id, Number revision)
This method loads a historicrevision
of theRevisionedEntity
with the givenid
from the persistent store.protected ENTITY
loadRevision(Object id, Number revision)
This method gets a historic revision of theentity
with the givenid
.-
Methods inherited from class com.devonfw.module.jpa.dataaccess.base.AbstractGenericDao
delete, delete, delete, exists, find, findAll, findAll, findOne, forceIncrementModificationCounter, get, getEntityClass, getEntityManager, getEntityName, isNew, save, save, setEntityManager, toCollection
-
Methods inherited from class com.devonfw.module.jpa.dataaccess.api.QueryHelper
applySort, applyTimeout, findPaginatedGeneric, newInClause, newLikeClause, newLikeClause, newNotLikeClause, newStringClause, newStringClause, whereIn, whereLike, whereNotLike, whereString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.devonfw.module.jpa.dataaccess.api.feature.FeatureForceIncrementModificationCounter
forceIncrementModificationCounter
-
Methods inherited from interface com.devonfw.module.jpa.dataaccess.api.GenericDao
delete, delete, exists, find, findAll, findOne, get, save, save
-
Methods inherited from interface com.devonfw.module.jpa.dataaccess.api.GenericRevisionedDao
delete
-
-
-
-
Method Detail
-
getAuditReader
protected org.hibernate.envers.AuditReader getAuditReader()
- Returns:
- the auditReader
-
load
public ENTITY load(ID id, Number revision)
Description copied from interface:GenericRevisionedDao
This method loads a historicrevision
of theRevisionedEntity
with the givenid
from the persistent store.
However if the givenrevision
isRevisionedEntity.LATEST_REVISION
thelatest revision will be loaded
.
ATTENTION:
You should not make assumptions about therevision
numbering of the underlying implementation. Please useGenericRevisionedDao.getRevisionHistory(Object)
orGenericRevisionedDao.getRevisionHistoryMetadata(Object)
to find revision numbers.- Specified by:
load
in interfaceGenericRevisionedDao<ID,ENTITY extends com.devonfw.module.basic.common.api.entity.RevisionedPersistenceEntity<ID>>
- Parameters:
id
- is theprimary key
of the requestedentity
.revision
- is therevision
of the requested entity orRevisionedEntity.LATEST_REVISION
to get thelatest
revision. A specific revision has to be greater than0
.- Returns:
- the requested
entity
.
-
loadRevision
protected ENTITY loadRevision(Object id, Number revision)
This method gets a historic revision of theentity
with the givenid
.- Parameters:
id
- is theID
of the requestedentity
.revision
- is therevision
- Returns:
- the requested
entity
.
-
getRevisionHistory
public List<Number> getRevisionHistory(ID id)
Description copied from interface:GenericRevisionedDao
This method will get theList
of historicrevisions
of theentity
with the givenid
.
If theentity
is NOT revision controlled, anempty list
is returned.- Specified by:
getRevisionHistory
in interfaceGenericRevisionedDao<ID,ENTITY extends com.devonfw.module.basic.common.api.entity.RevisionedPersistenceEntity<ID>>
- Parameters:
id
- theprimary key
of theentity
to retrieve the history for.- Returns:
- the
List
of historicrevisions
.
-
getRevisionHistoryMetadata
public List<com.devonfw.module.basic.common.api.RevisionMetadata> getRevisionHistoryMetadata(Object id)
Description copied from interface:GenericRevisionedDao
This method will get theList
ofRevisionMetadata
from therevision
-history of the entity with the givenid
.- Specified by:
getRevisionHistoryMetadata
in interfaceGenericRevisionedDao<ID,ENTITY extends com.devonfw.module.basic.common.api.entity.RevisionedPersistenceEntity<ID>>
- Parameters:
id
- is theprimary key
of the entity for which the history-metadata is requested.- Returns:
- the requested
List
ofRevisionMetadata
.
-
-