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:frozenNodeas node namejcr:frozenNodeas node primary typeuuidandworkspaceobtained byJcrItemIdfrom 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. PropertyAndChildWrappingNodeWrapper, VersionedNode 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
JcrNodeItemIdby versionName - when node wrapped in
VersionedNodewrapper is passed toJcrNodeAdaperconstructor, createfromJcrNodeItemId in JcrItemUtil.getItemId(Item)VersionedNode.getBaseNode()and versionName - for
VersionedNodeChildwe need to iterate troughgetParentinJcrItemUtil.getItemId(Item)until we don't get instance ofVersionedNodeto 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 inJcrNodeItemIdusingVersionManager
2 Comments
Espen Jervidalo
Attached are two one-line patches for ui and personlization, which also fix the MGNLPN-239 ticket.
Evzen Fochr
I don't think just throwing away check on mgnl: type is good approach, now
populateStoredChildItemspopulate all child nodes, not only nodes we want to work with. This is just workaround, not solving problem, that JcrNodeAdapter cannot work withVersionedNode's correctly.