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 namejcr:frozenNode
as node primary typeuuid
andworkspace
obtained byJcrItemId
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. 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
JcrNodeItemId
by versionName - when node wrapped in
VersionedNode
wrapper is passed toJcrNodeAdaper
constructor, createJcrNodeItemId in JcrItemUtil.getItemId(Item)
VersionedNode.getBaseNode()
and versionName - for
VersionedNodeChild
we need to iterate troughgetParent
inJcrItemUtil.getItemId(Item)
until we don't get instance ofVersionedNode
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 inJcrNodeItemId
usingVersionManager
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
populateStoredChildItems
populate 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.