jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhihai Liu" <z...@cleverex.com>
Subject RE: createdBy & version number
Date Thu, 17 Apr 2008 20:41:28 GMT
Thanks a million, Brett! 

Something interesting pops up, though. I added/checked in the node once, but
found VersionHistory has two entries. Through frozen node, I can get the
property "createdBy" with the newer version (base version). The older
version (root version), however, does not have this property saved. 

Then I tested with more check out/in. It turns out that entries in
VersionHistory is always one more than the number of check out/in. Among the
entries, only the root version does not have the property. 

I don't quite understand the "extra" root version and why it does not save
the property...


-----Original Message-----
From: Conoly, Brett [mailto:Brett.Conoly@digitalinsight.com] 
Sent: Thursday, April 17, 2008 11:57 AM
To: users@jackrabbit.apache.org
Subject: RE: createdBy & version number

Took me a little while to find that also, but in order to get the
properties of the version you have to
getNode(JcrConstants.jcr_frozenNode).getProperty("createdBy") or
something like that.  To better explain it, the versions have a
frozenNode associated with them that contains readonly properties of
that version.
Hope this helps,
Brett

-----Original Message-----
From: Zhihai Liu [mailto:zliu@cleverex.com] 
Sent: Thursday, April 17, 2008 11:53 AM
To: users@jackrabbit.apache.org
Subject: createdBy & version number

Hi, 

 

I have a couple of questions regarding to the use of version. 

 

Firstly, it is my understanding that there is no built-in support to
save
the username who check in the node in version history. So I use a
property
"createdBy".

// set createdBy

node.setProperty("createdBy", session.getUserID());

session.save();

node.checkin();

 

Then I found that I cannot retrieve it from base version or version
history.


// retrieve from base version

String createdBy;

Version baseVersion = node.getBaseVersion();

if (baseVersion.hasProperty("createdBy")) {

  createdBy = baseVersion.getProperty("createdBy").getString();

}

 

But it is saved correctly and can be retrieved from node.

// retrieve from node

String createdBy = node.getProperty("createdBy").getString();

 

I know that versions are different nodes in repository. Don't they keep
all
the data that is saved before checkin? Did I do something wrong?

 

Secondly, is there built-in support to generate the version numbers like
1.1, 1.2, when checkin or do I have to set version label manually?

 

Thank you very much.

 



Mime
View raw message