-
1. Re: Date-based versioning
adamw Apr 25, 2008 11:59 AM (in response to twoilseree)Hello,
good idea! :) With each revision its timestamp is recorded, so adding this is really just a matter of adding a simple method to VersionsReader, getRevisionForDate(Date date), which would return the earliest revision after the specified date. I'll add that in the next release.
Adam -
2. Re: Date-based versioning
genman Apr 25, 2008 2:17 PM (in response to twoilseree)You probably mean the latest revision before that specified date...
-
3. Re: Date-based versioning
adamw Apr 26, 2008 4:31 AM (in response to twoilseree)Yes, of course :)
Adam -
4. Re: Date-based versioning
adamw Apr 28, 2008 3:00 PM (in response to twoilseree)Hello,
I've uploaded a development version of the library:
http://www.jboss.org/envers/downloads/development/
which includes the mentioned method: VersionsReader.getRevisionNumberForDate(Date date).
Adam -
5. Re: Date-based versioning
alessandro.moreira Nov 19, 2008 6:24 AM (in response to twoilseree)Dear Adam,
I know that's a old post but It's exactly what I am looking for. We need to get:
1. Revisions for a Date. ( What were the Revision at 2008/11/19 ? )
2. The stated Revision for a Date ( What was the deleted/modified/inserted Revison at 2008/11/19 ? )
3. Revisons for a Period. ( What were the Revison from 2008/11/01 to 2008/11/19 ? )
It is realy important to our reports. Please I studied your API a lot and didn't find a way to resolve these.
Regards.
Alessandro Moreira
Brazil, Ceara, Fortaleza -
6. Re: Date-based versioning
adamw Nov 19, 2008 11:27 AM (in response to twoilseree)Hello,
1. and 2. are in VersionsReader/AuditReader.
For 3, you can create a revisions-of-entity query. Using the trunk version:auditReader.createQuer() .forRevisionsOfEntity(YourEntity.class, false, true) .addProjection(AuditEntity.revisionNumber()) .add(AuditEntity.revisionProperty("timestamp").ge(startDate)) .add(AuditEntity.revisionProperty("timestamp").le(endDate)) .getResultList();
--
Adam -
7. Re: Date-based versioning
alessandro.moreira Nov 19, 2008 12:22 PM (in response to twoilseree)Dear Adam,
I didn't study the Envers Lib after moving to Hibernate. I am still using 1.1.0.GA release (for Hibernate 3.3.x). So, do you mind to post an exemplo for each one Lib to case 1 and 2 ? -
8. Re: Date-based versioning
alessandro.moreira Nov 19, 2008 1:13 PM (in response to twoilseree)Please Adam don't think I am lazy. I just didn't find out how to answer question 1 and 2 by the API, precisely in VersionsReader.
In question 1 I was not refering to Revison Numbers but the EntityRevison Object.
And in question 2 either. How to get a EntityRevison with stated "deleted" ( DEL) at a given date, for exemplo ???
Therefore, I ask for your helping ! :-D -
9. Re: Date-based versioning
adamw Nov 20, 2008 9:20 AM (in response to twoilseree)Hello,
as for 1 and 2 in 1.1.0, just take a look here:
http://www.jboss.org/files/envers/api/org/jboss/envers/VersionsReader.html
I think that the getRevisionDate and getRevisionNumberForDate methods will meet your needs.
I don't understand the question: "How to get a EntityRevison with stated "deleted" ( DEL) at a given date, for exemplo ???"
For a given date, there is a corresponding revision number. At that revision, some entities may have been removed, and then they will have revision type "DEL". So, you can read the revision number for a date, look for your entity at that revision and check the revision type.
--
Adam