You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by James Hang <jh...@bea.com> on 2006/11/01 23:09:38 UTC

Version history - paths and node types

I noticed that when traversing a node's version history by calling
Node.getVersionHistory(), the versions returned contains paths and node
types of the node in the version workspace, not in the workspace of the node
that was versioned.  So calling Version.getPath() returns something like
"/jcr:system/jcr:versionStorage/b1/5352456..." and calling
Version.getPrimaryNodeType() returns "nt:version".

I assume this is because the path and type of a node is not part of its
state?  Is there a way to get this information in the version history
besides having to store the path and type as properties of the node?


-- 
View this message in context: http://www.nabble.com/Version-history---paths-and-node-types-tf2556306.html#a7123665
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Version history - paths and node types

Posted by James Hang <jh...@bea.com>.
Makes sense.  Thanks!



Jukka Zitting-3 wrote:
> 
> Hi,
> 
> On 11/2/06, James Hang <jh...@bea.com> wrote:
>> I noticed that when traversing a node's version history by calling
>> Node.getVersionHistory(), the versions returned contains paths and node
>> types of the node in the version workspace, not in the workspace of the
>> node
>> that was versioned.  So calling Version.getPath() returns something like
>> "/jcr:system/jcr:versionStorage/b1/5352456..." and calling
>> Version.getPrimaryNodeType() returns "nt:version".
>>
>> I assume this is because the path and type of a node is not part of its
>> state?  Is there a way to get this information in the version history
>> besides having to store the path and type as properties of the node?
> 
> The Version object represents the nt:version node within the version
> storage. The node contains a jcr:frozenNode child that represents the
> actual frozen state of the node when the version was created. You can
> get the frozen type and UUID information as follows:
> 
>     Node frozen = version.getNode("jcr:frozenNode");
>     // Access the type and UUID information
>     frozen.getProperty("jcr:frozenPrimaryType");
>     frozen.getProperty("jcr:frozenMixinTypes");
>     frozen.getProperty("jcr:frozenUUID");
>     // You can also access the normal properties
>     frozen.getProperty("someProperty");
> 
> The path of a versioned node is not a part of the frozen state.
> 
> BR,
> 
> Jukka Zitting
> 
> 

-- 
View this message in context: http://www.nabble.com/Version-history---paths-and-node-types-tf2556306.html#a7124913
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Version history - paths and node types

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 11/2/06, James Hang <jh...@bea.com> wrote:
> I noticed that when traversing a node's version history by calling
> Node.getVersionHistory(), the versions returned contains paths and node
> types of the node in the version workspace, not in the workspace of the node
> that was versioned.  So calling Version.getPath() returns something like
> "/jcr:system/jcr:versionStorage/b1/5352456..." and calling
> Version.getPrimaryNodeType() returns "nt:version".
>
> I assume this is because the path and type of a node is not part of its
> state?  Is there a way to get this information in the version history
> besides having to store the path and type as properties of the node?

The Version object represents the nt:version node within the version
storage. The node contains a jcr:frozenNode child that represents the
actual frozen state of the node when the version was created. You can
get the frozen type and UUID information as follows:

    Node frozen = version.getNode("jcr:frozenNode");
    // Access the type and UUID information
    frozen.getProperty("jcr:frozenPrimaryType");
    frozen.getProperty("jcr:frozenMixinTypes");
    frozen.getProperty("jcr:frozenUUID");
    // You can also access the normal properties
    frozen.getProperty("someProperty");

The path of a versioned node is not a part of the frozen state.

BR,

Jukka Zitting