jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: jcr 2 mix:lifecycle
Date Fri, 05 Aug 2011 13:35:34 GMT

On Fri, Aug 5, 2011 at 3:03 PM, s1a2 <s1a2n3d4m5a6n7@yahoo.it> wrote:
> Can someone help me to understand what I'm doing wrong
> or link me a page where I can find an example or documentation ?

As described in [1], you need to put the transition nodes under a
"transitions" child of the policy node. Note also that the current
lifecycle implementation doesn't care about specific state nodes, the
state names are only encoded as possible values of the "from" and "to"
properties (not "jcr:from" or "jcr:to") of the transition nodes.

If I understand your example correctly, what you really should be
doing is something like this:

Node lifecycle = root.addNode("lifecycle", "nt:unstructured");
Node transitions = lifecycle.addNode("transitions", "nt:unstructured");

Node release = transitions.addNode("release", "nt:unstructured");
release.setProperty("from", "CREATED");
release.setProperty("to", "RELEASED");

Node unrelease = transitions.addNode("unrelease", "nt:unstructured");
unrelease.setProperty("from", "RELEASED");
unrelease.setProperty("to", "CREATED");

Then, once this lifecycle definition has been saved, you can use it like this:

Node NodeWL= root.addNode("NodeWL");

NodeWL.assignLifecyclePolicy(lifecycle, "CREATED");

String[] StatesAllowed=NodeWL.getAllowedLifecycleTransistions();

As a result the StatesAllowed array should contain the string "RELEASED".

[1] http://jackrabbit.apache.org/api/2.1/org/apache/jackrabbit/core/NodeImpl.html#getAllowedLifecycleTransistions()


Jukka Zitting

View raw message