info.magnolia.cms.util
Class ExtendingContentWrapper

java.lang.Object
  extended by info.magnolia.cms.core.ContentHandler
      extended by info.magnolia.cms.core.AbstractContent
          extended by info.magnolia.cms.util.ContentWrapper
              extended by 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:

The mechanism supports multiple inheritances as such:

Version:
$Id$
See Also:
a class supporting content inheritance.

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.cms.core.Content
Content.ContentFilter
 
Field Summary
protected static String EXTENDING_NODE_DATA
           
protected static String EXTENDING_NODE_DATA_OVERRIDE
           
 
Constructor Summary
  ExtendingContentWrapper(Content wrappedContent)
           
protected ExtendingContentWrapper(Content wrappedContent, Content extendedContent)
          Does not support the extends nodedata but chains the two nodes directly.
 
Method Summary
 Collection<Content> getChildren(Content.ContentFilter filter, String namePattern, Comparator<Content> orderCriteria)
           
 Content getContent(String name)
          Gets the Content node of the current node with the specified name.
 NodeData getNodeData(String name)
          Returns a NodeData object.
 Collection<NodeData> getNodeDataCollection()
          Gets all properties bind in NodeData object excluding JCR system properties.
 Content getWrappedContent()
           
 boolean hasContent(String name)
           
 boolean hasNodeData(String name)
          Delegates to NodeData.isExist().
 boolean isExtending()
           
protected  Content wrap(Content node)
          Override if a wrapper wants to wrap returned content objects.
 
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
 
Methods inherited from class info.magnolia.cms.core.ContentHandler
clone, getAccessManager, setAccessManager
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface info.magnolia.cms.core.Content
getAccessManager
 

Field Detail

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
Constructor Detail

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.

Method Detail

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–2014 Magnolia International Ltd.. All rights reserved.