jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Janssen <lars-listm...@ukmix.net>
Subject Trying to understand and use version cascade
Date Thu, 28 Feb 2013 15:55:15 GMT
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

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