info.magnolia.cms.util
Class ExtendingContentWrapper
java.lang.Object
info.magnolia.cms.core.ContentHandler
info.magnolia.cms.core.AbstractContent
info.magnolia.cms.util.ContentWrapper
info.magnolia.cms.util.ExtendingContentWrapper
- All Implemented Interfaces:
- Content, Cloneable
public class ExtendingContentWrapper
- extends ContentWrapper
This wrapper allows extending other nodes (mainly useful to extend configurations). A content node can define
a nodeData with the name 'extends'. Its value is either an absolute or relative path. The merge is then performed as follows:
- nodeDatas are merged and values are overwritten
- sub content nodes are merged, the original order is guaranteed, new nodes are added at the
end of the list
The mechanism supports multiple inheritances as such:
- the node the current node inherits from can again extend a node
- nodes laying deeper in the hierarchy can extend an other node
- Version:
- $Id$
- Author:
- pbaerfuss
- See Also:
a class supporting content inheritance.
Methods inherited from class info.magnolia.cms.util.ContentWrapper |
addMixin, addVersion, addVersion, createContent, delete, deleteNodeData, getAllVersions, getAncestor, getAncestors, getBaseVersion, getChildByName, getHandle, getHierarchyManager, getIndex, getItemType, getJCRNode, getLevel, getLock, getMetaData, getMixinNodeTypes, getName, getNodeDataCollection, getNodeType, getNodeTypeName, getParent, getTemplate, getTitle, getUUID, getVersionedContent, getVersionedContent, getVersionHistory, getWorkspace, hasMetaData, hasMixin, holdsLock, isGranted, isLocked, isModified, isNodeData, isNodeType, lock, lock, newNodeDataInstance, orderBefore, refresh, removeMixin, removeVersionHistory, restore, restore, restore, restoreByLabel, save, setWrappedContent, toString, unlock, updateMetaData, wrap, wrapContentNodes, wrapNodeDatas |
Methods inherited from class info.magnolia.cms.core.AbstractContent |
createContent, createContent, createNodeData, createNodeData, createNodeData, createNodeData, createNodeData, delete, getBinaryNodeDatas, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, hasChildren, hasChildren, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData |
EXTENDING_NODE_DATA
protected static final String EXTENDING_NODE_DATA
- See Also:
- Constant Field Values
EXTENDING_NODE_DATA_OVERRIDE
protected static final String EXTENDING_NODE_DATA_OVERRIDE
- See Also:
- Constant Field Values
ExtendingContentWrapper
public ExtendingContentWrapper(Content wrappedContent)
ExtendingContentWrapper
protected ExtendingContentWrapper(Content wrappedContent,
Content extendedContent)
- Does not support the extends nodedata but chains the two nodes directly. Each node is
wrapped internally to ensure that each of them support the extends nodedata for themselves.
isExtending
public boolean isExtending()
getWrappedContent
public Content getWrappedContent()
- Overrides:
getWrappedContent
in class ContentWrapper
hasContent
public boolean hasContent(String name)
throws javax.jcr.RepositoryException
- Specified by:
hasContent
in interface Content
- Overrides:
hasContent
in class ContentWrapper
- Throws:
javax.jcr.RepositoryException
- if an error occurs
getContent
public Content getContent(String name)
throws javax.jcr.RepositoryException
- Description copied from interface:
Content
- Gets the Content node of the current node with the specified name.
- Specified by:
getContent
in interface Content
- Overrides:
getContent
in class ContentWrapper
- Parameters:
name
- of the node acting as Content
- Returns:
- Content
- Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
- if an error occurs
AccessDeniedException
- if the current session does not have sufficient access rights
to complete the operation
getChildren
public Collection<Content> getChildren(Content.ContentFilter filter,
String namePattern,
Comparator<Content> orderCriteria)
- Overrides:
getChildren
in class ContentWrapper
namePattern
- ignored if null.
getNodeData
public NodeData getNodeData(String name)
- Description copied from class:
AbstractContent
- Returns a
NodeData
object. If the node data does not exist (respectively if it has no
value) an empty representation is returned whose NodeData.isExist()
will return
false.
Delegates to AbstractContent.newNodeDataInstance(String, int, boolean)
by setting the type to PropertyType.UNDEFINED. A subclass has to handle this by trying to determine the type if the node data exists. The reason for this is that implementations want to instantiate different node data classes per type
- Specified by:
getNodeData
in interface Content
- Overrides:
getNodeData
in class AbstractContent
- Returns:
- NodeData requested
NodeData
object
hasNodeData
public boolean hasNodeData(String name)
throws javax.jcr.RepositoryException
- Description copied from class:
AbstractContent
- Delegates to
NodeData.isExist()
.
- Specified by:
hasNodeData
in interface Content
- Overrides:
hasNodeData
in class AbstractContent
- Throws:
javax.jcr.RepositoryException
- if an error occurs
getNodeDataCollection
public Collection<NodeData> getNodeDataCollection()
- Description copied from interface:
Content
- Gets all properties bind in NodeData object excluding JCR system properties.
- Specified by:
getNodeDataCollection
in interface Content
- Overrides:
getNodeDataCollection
in class AbstractContent
wrap
protected Content wrap(Content node)
- Description copied from class:
ContentWrapper
- Override if a wrapper wants to wrap returned content objects. This method is called by getContent(), getParent(), ...
The default implementation does nothing.
- Overrides:
wrap
in class ContentWrapper
Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.