|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AuditReader
Method Summary | ||
---|---|---|
AuditQueryCreator |
createQuery()
|
|
|
find(Class<T> cls,
Object primaryKey,
Number revision)
Find an entity by primary key at the given revision. |
|
|
find(Class<T> cls,
String entityName,
Object primaryKey,
Number revision)
Find an entity by primary key at the given revision with the specified entityName. |
|
|
findRevision(Class<T> revisionEntityClass,
Number revision)
A helper method; should be used only if a custom revision entity is used. |
|
|
getCurrentRevision(Class<T> revisionEntityClass,
boolean persist)
Gets an instance of the current revision entity, to which any entries in the audit tables will be bound. |
|
Date |
getRevisionDate(Number revision)
Get the date, at which a revision was created. |
|
Number |
getRevisionNumberForDate(Date date)
Gets the revision number, that corresponds to the given date. |
|
List<Number> |
getRevisions(Class<?> cls,
Object primaryKey)
Get a list of revision numbers, at which an entity was modified. |
|
List<Number> |
getRevisions(Class<?> cls,
String entityName,
Object primaryKey)
Get a list of revision numbers, at which an entity was modified, looking by entityName. |
|
boolean |
isEntityClassAudited(Class<?> entityClass)
Checks if the entityClass was configured to be audited. |
Method Detail |
---|
<T> T find(Class<T> cls, Object primaryKey, Number revision) throws IllegalArgumentException, NotAuditedException, IllegalStateException
cls
- Class of the entity.primaryKey
- Primary key of the entity.revision
- Revision in which to get the entity.
IllegalArgumentException
- If cls or primaryKey is null or revision is less or equal to 0.
NotAuditedException
- When entities of the given class are not audited.
IllegalStateException
- If the associated entity manager is closed.<T> T find(Class<T> cls, String entityName, Object primaryKey, Number revision) throws IllegalArgumentException, NotAuditedException, IllegalStateException
cls
- Class of the entity.entityName
- EntityName to find.primaryKey
- Primary key of the entity.revision
- Revision in which to get the entity.
IllegalArgumentException
- If cls or primaryKey is null or revision is less or equal to 0.
NotAuditedException
- When entities of the given class are not audited.
IllegalStateException
- If the associated entity manager is closed.List<Number> getRevisions(Class<?> cls, Object primaryKey) throws IllegalArgumentException, NotAuditedException, IllegalStateException
cls
- Class of the entity.primaryKey
- Primary key of the entity.
NotAuditedException
- When entities of the given class are not audited.
IllegalArgumentException
- If cls or primaryKey is null.
IllegalStateException
- If the associated entity manager is closed.List<Number> getRevisions(Class<?> cls, String entityName, Object primaryKey) throws IllegalArgumentException, NotAuditedException, IllegalStateException
cls
- Class of the entity.entityName
- EntityName to find.primaryKey
- Primary key of the entity.
NotAuditedException
- When entities of the given class are not audited.
IllegalArgumentException
- If cls or primaryKey is null.
IllegalStateException
- If the associated entity manager is closed.Date getRevisionDate(Number revision) throws IllegalArgumentException, RevisionDoesNotExistException, IllegalStateException
revision
- Number of the revision for which to get the date.
IllegalArgumentException
- If revision is less or equal to 0.
RevisionDoesNotExistException
- If the revision does not exist.
IllegalStateException
- If the associated entity manager is closed.Number getRevisionNumberForDate(Date date) throws IllegalStateException, RevisionDoesNotExistException, IllegalArgumentException
getRevisionDate(getRevisionNumberForDate(date)) <= date
and
getRevisionDate(getRevisionNumberForDate(date)+1) > date
.
date
- Date for which to get the revision.
IllegalStateException
- If the associated entity manager is closed.
RevisionDoesNotExistException
- If the given date is before the first revision.
IllegalArgumentException
- If date
is null
.<T> T findRevision(Class<T> revisionEntityClass, Number revision) throws IllegalArgumentException, RevisionDoesNotExistException, IllegalStateException
RevisionEntity
.
revisionEntityClass
- Class of the revision entity. Should be annotated with RevisionEntity
.revision
- Number of the revision for which to get the data.
IllegalArgumentException
- If revision is less or equal to 0 or if the class of the revision entity
is invalid.
RevisionDoesNotExistException
- If the revision does not exist.
IllegalStateException
- If the associated entity manager is closed.<T> T getCurrentRevision(Class<T> revisionEntityClass, boolean persist)
persist
is false
, and no audited entities are modified in this session,
then the obtained revision entity instance won't be persisted. If persist
is true
, the revision
entity instance will always be persisted, regardless of whether audited entities are changed or not.
revisionEntityClass
- Class of the revision entity. Should be annotated with RevisionEntity
.persist
- If the revision entity is not yet persisted, should it become persisted. This way, the primary
identifier (id) will be filled (if it's assigned by the DB) and available, but the revision entity will be
persisted even if there are no changes to audited entities. Otherwise, the revision number (id) can be
null
.
AuditQueryCreator createQuery()
boolean isEntityClassAudited(Class<?> entityClass)
entityClass
- Class of the entity asking for audit support
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |