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 Fri, 18 Apr 2008 17:49:58 GMT
Thanks for the explanation. Sorry for keep bugging, but what about my second
question below.

"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?"


-----Original Message-----
From: tripod@day.com [mailto:tripod@day.com] On Behalf Of Tobias Bocanegra
Sent: Friday, April 18, 2008 1:35 AM
To: users@jackrabbit.apache.org
Subject: Re: createdBy & version number

hi,
the root version is the initial version which never has any content.
it is more of a sentinel to make the version graph easier. it is also
the base version of the node when it is made versionable for the first
time, without a root version, the base version would be empty and this
would complicate things alot. this way the following invariants are
always fullfilled:

- every version but the root version has at least one predecessor version
- every versionable node has a base version (jcr:baseVersion)

regards, toby


On 4/17/08, Zhihai Liu <zliu@cleverex.com> wrote:
> 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