org.jboss.envers
Interface VersionsReader

All Superinterfaces:
AuditReader
All Known Subinterfaces:
AuditReaderImplementor
All Known Implementing Classes:
AuditReaderImpl

Deprecated.

public interface VersionsReader
extends AuditReader

Author:
Adam Warski (adam at warski dot org)
See Also:
AuditReader

Method Summary
 VersionsQueryCreator createQuery()
          Deprecated.  
<T> T
find(Class<T> cls, Object primaryKey, Number revision)
          Deprecated. Find an entity by primary key at the given revision.
<T> T
findRevision(Class<T> revisionEntityClass, Number revision)
          Deprecated. A helper method; should be used only if a custom revision entity is used.
 Date getRevisionDate(Number revision)
          Deprecated. Get the date, at which a revision was created.
 Number getRevisionNumberForDate(Date date)
          Deprecated. Gets the revision number, that corresponds to the given date.
 List<Number> getRevisions(Class<?> cls, Object primaryKey)
          Deprecated. Get a list of revision numbers, at which an entity was modified.
 

Method Detail

find

<T> T find(Class<T> cls,
           Object primaryKey,
           Number revision)
       throws IllegalArgumentException,
              NotVersionedException,
              IllegalStateException
Deprecated. 
Description copied from interface: AuditReader
Find an entity by primary key at the given revision.

Specified by:
find in interface AuditReader
Parameters:
cls - Class of the entity.
primaryKey - Primary key of the entity.
revision - Revision in which to get the entity.
Returns:
The found entity instance at the given revision (its properties may be partially filled if not all properties are audited) or null, if an entity with that id didn't exist at that revision.
Throws:
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.
NotVersionedException

getRevisions

List<Number> getRevisions(Class<?> cls,
                          Object primaryKey)
                          throws IllegalArgumentException,
                                 NotVersionedException,
                                 IllegalStateException
Deprecated. 
Description copied from interface: AuditReader
Get a list of revision numbers, at which an entity was modified.

Specified by:
getRevisions in interface AuditReader
Parameters:
cls - Class of the entity.
primaryKey - Primary key of the entity.
Returns:
A list of revision numbers, at which the entity was modified, sorted in ascending order (so older revisions come first).
Throws:
IllegalArgumentException - If cls or primaryKey is null.
NotAuditedException - When entities of the given class are not audited.
IllegalStateException - If the associated entity manager is closed.
NotVersionedException

getRevisionDate

Date getRevisionDate(Number revision)
                     throws IllegalArgumentException,
                            RevisionDoesNotExistException,
                            IllegalStateException
Deprecated. 
Description copied from interface: AuditReader
Get the date, at which a revision was created.

Specified by:
getRevisionDate in interface AuditReader
Parameters:
revision - Number of the revision for which to get the date.
Returns:
Date of commiting the given revision.
Throws:
IllegalArgumentException - If revision is less or equal to 0.
RevisionDoesNotExistException - If the revision does not exist.
IllegalStateException - If the associated entity manager is closed.
RevisionDoesNotExistException

getRevisionNumberForDate

Number getRevisionNumberForDate(Date date)
                                throws IllegalStateException,
                                       RevisionDoesNotExistException,
                                       IllegalArgumentException
Deprecated. 
Description copied from interface: AuditReader
Gets the revision number, that corresponds to the given date. More precisely, returns the number of the highest revision, which was created on or before the given date. So: getRevisionDate(getRevisionNumberForDate(date)) <= date and getRevisionDate(getRevisionNumberForDate(date)+1) > date.

Specified by:
getRevisionNumberForDate in interface AuditReader
Parameters:
date - Date for which to get the revision.
Returns:
Revision number corresponding to the given date.
Throws:
IllegalStateException - If the associated entity manager is closed.
RevisionDoesNotExistException - If the given date is before the first revision.
IllegalArgumentException - If date is null.
RevisionDoesNotExistException

findRevision

<T> T findRevision(Class<T> revisionEntityClass,
                   Number revision)
               throws IllegalArgumentException,
                      RevisionDoesNotExistException,
                      IllegalStateException
Deprecated. 
Description copied from interface: AuditReader
A helper method; should be used only if a custom revision entity is used. See also RevisionEntity.

Specified by:
findRevision in interface AuditReader
Parameters:
revisionEntityClass - Class of the revision entity. Should be annotated with RevisionEntity.
revision - Number of the revision for which to get the data.
Returns:
Entity containing data for the given revision.
Throws:
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.
RevisionDoesNotExistException

createQuery

VersionsQueryCreator createQuery()
Deprecated. 
Specified by:
createQuery in interface AuditReader
Returns:
A query creator, associated with this AuditReader instance, with which queries can be created and later executed. Shouldn't be used after the associated Session or EntityManager is closed.


Copyright © 2008 Hibernate.org. All Rights Reserved.