You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ati Rosselet <at...@gmail.com> on 2011/10/17 11:00:45 UTC

versioning and children question

Hi, I've been trying to get this working for a while now, and am going
slightly nuts.

Basically I have a structure like
A
-->B
-->C

where A is versionable and so are its child nodes (B,C)
When I create a new version of A, I would need to have a reference to the
point-in-time versions of the B/C nodes beneath it, so I can say that
for  A(v1.0) has B(v1.0) and C(v1.3)
I can get the version history of A and I can get the version history and
iterate over it, and separately I can get the versionhistory of B & C.
What I can't seem to do, is get WHICH versions of B & C are associated with
a specific version of A.

I've tried setting OVP=COPY.. but still missing something :(
Can anyone help me with a code example?
Thanx
Ati

Re: versioning and children question

Posted by rosselet <at...@gmail.com>.
Hi,
Any hints?  I can get the configuration... turns out that to get new
configurations, you need to checkout/checkin the configuration node as well
(or at least so it seems).   In the properties i find 2 "rep:versions" 
which seem to point to the frozen nodes of the correct A/B versions, but no
information as to which is which... :(  How do you get the configuration
subtree with the correct structure and references to the proper frozen
nodes?

I see that if the subnode is not versioned, then versioning the parent node
only will work in most cases and retain the correct child node values under
the frozen node, but here we need to version the subnode separately (i.e.
subnode B update does not create a new parentnode A version).
Cheers + Thnx

--
View this message in context: http://jackrabbit.510166.n4.nabble.com/versioning-and-children-question-tp3911436p3918227.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: versioning and children question

Posted by rosselet <at...@gmail.com>.
So this should contain the baselines

vm.getVersionHistory(session.getNodeByIdentifier(session.getNode(newNode.getPath()).getProperty("jcr:configuration").getString()).getPath()).getAllVersions();
[ is there no shorter way to get there??]

and .getVersion("1.0")  should then give me the baseline for v1.0

oddly  enough "1.1" does not exist, even though I did do a second commit for
both the node and config, which leads me to believe that the above line is
not correct 
If it were correct, how could the result be traversed to get the node itself
(frozenNode for newNode v1.0)? and the child at that time (subNode v1.0)? Am
I missing something obvious? 

and thanks for your help...

--
View this message in context: http://jackrabbit.510166.n4.nabble.com/versioning-and-children-question-tp3911436p3912469.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: versioning and children question

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

On Mon, Oct 17, 2011 at 3:29 PM, rosselet <at...@gmail.com> wrote:
> So now each checkin should be on the proxy as I understand as opposed to the
> newNode. Does this mean that the node itself no longer needs to be checked in?

No, you still need to checkin each node by itself. The baseline
created by the proxy checkin just contains references to all the
current versions within a configuration (i.e. subtree).

> How can I find the proxy(Configuration) in another session? There does not
> appear to be any getConfiguration() in the VersionManager API..

You can find the configuration node by following the jcr:configuration
property of the root node of the subtree you're managing. The version
history of that configuration node contains the baselines as separate
versions.

BR,

Jukka Zitting

Re: versioning and children question

Posted by rosselet <at...@gmail.com>.
Ok.. it states that createConfiguration will fail if no jcr:root exists, ie
node has not yet been checked in,
so logically:

            Node newNode = root.addNode("123456789_1");
            newNode.addMixin("mix:versionable");
            newNode.setProperty("entryid", 1L);
            newNode.setProperty("tmp","v1");

[... add subnodes here ]

            VersionManager vm = session.getWorkspace().getVersionManager();   
            Node proxy =vm.createConfiguration(newNode.getPath());
            vm.checkin(proxy.getPath());        

AFAIU, this should make newNode a versionable node, and then set a baseline.

"A baseline is created by performing a checkin on a configuration proxy
node..."

So now each checkin should be on the proxy as I understand as opposed to the
newNode.
Does this mean that the node itself no longer needs to be checked in?

How can I find the proxy(Configuration) in another session? There does not
appear to be any getConfiguration() in the VersionManager API..   

I would assume that this is a common problem, but no tips to be found. Is it
trivial?  Can anyone provide some pseudo code or a code fragment for storing
a simple node+child with baseline, and retrieving versions of the node with
the associated version of the child ?


--
View this message in context: http://jackrabbit.510166.n4.nabble.com/versioning-and-children-question-tp3911436p3912035.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: versioning and children question

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

On Mon, Oct 17, 2011 at 12:28 PM, rosselet <at...@gmail.com> wrote:
> yep... that looks like that's what I'm looking for, and the Repository I'm
> using has option.baselines.supported=true,
> just don't see how to use them..

Section 15.13 of the JCR 2.0 spec describes how to use this feature.

BR,

Jukka Zitting

Re: versioning and children question

Posted by rosselet <at...@gmail.com>.
yep... that looks like that's what I'm looking for, and the Repository I'm
using has option.baselines.supported=true,
just don't see how to use them..   is this an additional property that has
to be set for versionable nodes?


--
View this message in context: http://jackrabbit.510166.n4.nabble.com/versioning-and-children-question-tp3911436p3911580.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: versioning and children question

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

On Mon, Oct 17, 2011 at 11:00 AM, Ati Rosselet <at...@gmail.com> wrote:
> What I can't seem to do, is get WHICH versions of B & C are associated with
> a specific version of A.

What you're looking for is the baseline feature added in JCR 2.0:
http://www.day.com/specs/jcr/2.0/15_Versioning.html#15.13%20Configurations%20and%20Baselines

BR,

Jukka Zitting