jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Brosius" <dbros...@mebigfatguy.com>
Subject RE: Changing a Node after creating a version
Date Fri, 04 Apr 2008 17:17:58 GMT
The version object has access to the same properties as the base object even if using a custom
node type. When you get the properties on the base object, you get the latest version's values.
To see the values on the various versions, do:

VersionHistory history = node.getVersionHistory();
VersionIterator iterator = history.getAllVersions();

which gives you an iterator to walk the Version object. Now the version object doesn't actually
have the properties as defined in the base object, it just has information about the version
itself (say for instance the version name)

There is a child object of the Version object, referred to as the frozen node, which contains
all the original properties.

To get this node do

Version v = iterator.nextVersion();
Node frozenNode = v.getNode("jcr:frozenNode");

on this frozenNode you can call getProperty on all of your custom properties.


-----Original Message-----
From: "Conoly, Brett" <Brett.Conoly@digitalinsight.com>
Sent: Friday, April 4, 2008 12:17pm
To: users@jackrabbit.apache.org, dbrosius@mebigfatguy.com
Subject: RE: Changing a Node after creating a version

What if you have a custom node type with custom properties?  Do the
Version's inherit these and if so, how do you access them?
Thanks,
Brett

-----Original Message-----
From: Dave Brosius [mailto:dbrosius@mebigfatguy.com] 
Sent: Friday, April 04, 2008 12:16 PM
To: users@jackrabbit.apache.org
Subject: RE: Changing a Node after creating a version

When you first create a node that is versionable and set properties on
it, you call save on the node. Then the base version of the node has
that property value. From there, everytime you checkout, set properties,
checkin, you get a new version with potentially different properties in
subsequent versions.


-----Original Message-----
From: Katia Santos <katiasantos@gmail.com>
Sent: Thursday, April 3, 2008 7:12am
To: users@jackrabbit.apache.org
Subject: Changing a Node after creating a version

Hello

I have a node with some properties, and i want to make a version of the
node
with that same properties, and after making the version I want to change
the
value of the the properties of  initial node.

Do i have to checkout the node, checkin the node (creating a version)
and
then checkout the node again so I can change the properties?? Is this
the
correct way of doing it?

something like this:

Node node;  // (has a property NAME with the value "Katia")

node.checkout();
node.checkin();
node.checkout();
node.setProperty("NAME","Mary");

I want the version to be with the name Katia and the node to be with the
name Mary.
Maybe I didnt get the version steps right...

Thanks

Katia





Mime
View raw message