Page tree
Skip to end of metadata
Go to start of metadata

Introduction

Problem occurs when JcrNodeAdaper wraps node that is pointing to the version store (/jcr:system/jcr:versionStorage/0f/b2/15/0fb21542-ffb9-42e7-81ad-bb189bebb8d7/1.0/jcr:frozenNode). User is not able to preview version in detail app if content has more complicated structure (child nodes). JcrNodeAdapters suffer from following problems:

  • jcr:frozenNode as node name
  • jcr:frozenNode as node primary type
  • uuid and workspace obtained by JcrItemId from adapter are pointing to the version workspace (maybe not a problem?)
  • obtaining child nodes is not possible due to filters that expect certain Magnolia node types (mgnl:contentNode, etc.)
  • all child nodes suffer from problems listed above

JcrNodeAdapter is not capable of handling wrapped nodes (e.g. PropertyAndChildWrappingNodeWrapperVersionedNode or VersionedChildNode)  properly. This is due to the fact that after getting node initially, adapter, or actually  JcrItemID keeps only workspace name and identifier of the node and uses those to retrieve it later. While this approach works for ordinary nodes, it doesn't work for any special nodes such as versioned nodes that would return UUID of original node rather than that of itself.

Proposed solution

Work is in progress on bugfix/MGNLUI-3699-detaileditorpresenter-do-not-v3 branch

  • for this we need extend JcrNodeItemId by versionName
  • when node wrapped in VersionedNode wrapper is passed to JcrNodeAdaper constructor, create  JcrNodeItemId in JcrItemUtil.getItemId(Item)  from VersionedNode.getBaseNode() and versionName
  • for VersionedNodeChild we need to iterate trough getParent in JcrItemUtil.getItemId(Item) until we don't get instance of VersionedNode to get versionName from it 
  • add new method to JcrNodeAdaper.getBaseNodeItemId() 

    getBaseNodeItemId()
    if (!StringUtils.isEmpty(getItemId().getVersion()) && getParent() !=null) {
        return getParent().getBaseNode();
    }
    return getItemId();
  • change JcrNodeAdaper.getJcrItem() to get wrapped nodes with version set in JcrNodeItemId using VersionManager

  • No labels

2 Comments

  1. Attached are two one-line patches for ui and personlization, which also fix the MGNLPN-239 ticket.

    1. I don't think just throwing away check on mgnl: type is good approach, now populateStoredChildItems populate all child nodes, not only nodes we want to work with. This is just workaround, not solving problem, that JcrNodeAdapter cannot work with VersionedNode's correctly.