jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Janssen <l...@fazy.net>
Subject Re: Trying to understand and use version cascade
Date Tue, 05 Mar 2013 15:49:07 GMT
Hi David,

Thanks for the link. From what I can gather, using just 'version' or 'copy'
in the CND format implies OnParventVersion=version or copy. I *think* I
want copy, as it appears to fully cascade the version rather than just
creating a reference to the parent history.

However, I'm not sure if I should apply it to specific properties, or to
children. For example, I'm now using:

[phpcr:versionCascade] > nt:unstructured
    - foo_c (String) copy
    + * copy

After running the code this PR (but with the above node definition):
https://github.com/phpcr/phpcr-api-tests/pull/85

Here is how my repository looks:
https://gist.github.com/fazy/5091056

There is evidence of versions of the "foo_c" parameter being captured; if
you search the Gist for "foo_c" there are different values at different
version stages. However, I'm not sure how to get to these values. I have
some test code that just
calls getVersionHistory('/tests_version_base/versioned/version_child') and
then loops through the results... unfortunately none of them contains a
'foo_c' parameter at all.

I'm wondering if anyone has had any experience of using cascading versions
at all (especially if it's an open source project where I can see the code).

Otherwise, as a temporary solution I might need to move the cascade logic
up into my application. i.e. when versioning a page node, iterate through
all child nodes and version those too. It means potentially duplicating
what's already possible in Jackrabbit, but on the other hand if my
application needs very specific rules (e.g. how to handle a 'reference
block' if I add that in future), then it might make sense to control it
there. Again, has anyone tried doing this?

Best regards,

Lars.



On Sat, Mar 2, 2013 at 12:55 PM, David Buchmann <david@liip.ch> wrote:

> hi,
>
> i don't fully grasp things, but after another hunt through the jcr doc,
> i think your cnd is not correct. there is an on-parent-version or
> onParentVersion attribute that controls if children are versioned along.
> best try to read this chapter:
> http://www.day.com/specs/jcr/2.0/15_Versioning.html
> it will mostly shorten the feature to OPV - maybe this helps?
>
>      [phpcr:versionCascade] > nt:unstructured
>          + * multiple copy
>
> i think the "multiple" here means there may be same-name siblings (which
> you should not need to explicitly allow as its the default. and in the
> context of jackalope and phpcr-odm, its actually not working at all.
> i don't know what the "copy" stands for, but i think you need an
> onParentVersion attribute set somewhere.
>
> btw,
> > The nt:unstructured type I'm inheriting from comes from part of the
> > PHPCR project, I believe it uses this:
>
> nt:unstructured is not a PHPCR specific thing but part of JCR too.
>
> cheers,
> david
>
>
>
> Am 28.02.2013 16:55, schrieb Lars Janssen:
> > Hi all,
> >
> > I'm new to the list, but did have a good look through the archives. :)
> >
> > My problem: I have nodes representing pages and blocks (of content) in a
> > CMS. Pages can contain pages or blocks. I'm looking to add page
> versioning
> > capability, such that if I create a checkpoint (version) on a page, the
> > same is done for all child blocks (although to keep this simple, I'm
> > initially just trying to let it happen for all children).
> >
> > I'm using Jackrabbit 2.4.3 and PHP Content
> > Repository[1]/Jackalope-Jackrabbit[2] to connect my PHP application to
> it.
> >
> > Here's the CND for the node type I'm using:
> >
> >     [phpcr:versionCascade] > nt:unstructured
> >         + * multiple copy
> >
> > The nt:unstructured type I'm inheriting from comes from part of the PHPCR
> > project, I believe it uses this:
> >
> >     [nt:unstructured]
> >       ORDERABLE
> >       - * (UNDEFINED) MULTIPLE
> >       - * (UNDEFINED)
> >       + * (nt:base) = nt:unstructured SNS VERSION
> >
> > If you don't mind looking at some PHP code, you can see what I'm trying
> to
> > do in my Github tests pull request[3][4] otherwise, here are the steps in
> > mostly pseudo-code:
> >
> >     create parent/child nodes:
> >          /tests_version_base/versioned    (with property foo = something)
> >          /tests_version_base/versioned/version_child    (with property
> > foo_c = something_c)
> >     checkpoint('/tests_version_base/versioned')
> >     node->setProperty('foo', 'bar')
> >     childNode->setProperty('foo_c', 'bar_c')
> >     session->save()
> >     checkin('/tests_version_base/versioned')
> >
> > What I'm hoping to see at this point is that both the nodes (parent and
> > child) have a corresponding frozen node, even though I only did a
> > checkpoint on the parent. What I actually see is a frozen node for the
> > parent (as expected) but not for the child.
> >
> > I suspect my understanding of how this works is not right. Should child
> > nodes automatically be versioned like this, or is there another way to
> get
> > something like this behaviour?
> >
> > Thanks,
> >
> > Lars.
> >
> > References:
> > [1] https://github.com/phpcr/phpcr
> > [2] https://github.com/jackalope/jackalope-jackrabbit
> > [3]
> >
> https://github.com/fazy/phpcr-api-tests/blob/c7cd60c7bfaf9bdb2211e8c8676344a58fa38a9b/tests/15_Versioning/VersionTest.php#L20
> > [4]
> >
> https://github.com/fazy/phpcr-api-tests/blob/c7cd60c7bfaf9bdb2211e8c8676344a58fa38a9b/tests/15_Versioning/VersionTest.php#L91
> >
>
> --
> Liip AG // Agile Web Development // T +41 26 422 25 11
> CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message