jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conoly, Brett" <Brett.Con...@digitalinsight.com>
Subject RE: createdBy & version number
Date Thu, 17 Apr 2008 15:56:46 GMT
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