info.magnolia.templating.inheritance
Class DefaultInheritanceContentDecorator

java.lang.Object
  extended by info.magnolia.jcr.decoration.AbstractContentDecorator
      extended by info.magnolia.jcr.inheritance.InheritanceContentDecorator
          extended by info.magnolia.templating.inheritance.DefaultInheritanceContentDecorator
All Implemented Interfaces:
info.magnolia.jcr.decoration.ContentDecorator

public class DefaultInheritanceContentDecorator
extends info.magnolia.jcr.inheritance.InheritanceContentDecorator

Provides an inheritance model that can be customized with configuration on the nodes. Inheritance can be completely turned off or inheritance of nodes or properties can be turned off separately.

The inheritance sources are found by looking at the node hierarchy, each node that qualifies as an anchor (node type is mgnl:content) and has a node that with the same sub-path as the destination node has to its nearest parent is used.

That is, for a destination node /page1/page2/main, the nearest anchor node is /page1/page2, therefor if there is a node /page1/main then that is used as a source.

Version:
$Id$

Nested Class Summary
 
Nested classes/interfaces inherited from class info.magnolia.jcr.inheritance.InheritanceContentDecorator
info.magnolia.jcr.inheritance.InheritanceContentDecorator.DestinationNodeInheritanceNodeWrapper
 
Constructor Summary
DefaultInheritanceContentDecorator(javax.jcr.Node destination, info.magnolia.rendering.template.InheritanceConfiguration configuration)
           
 
Method Summary
protected  javax.jcr.Node findFirstAnchor()
           
protected  boolean inheritsNodes(javax.jcr.Node node)
           
protected  boolean inheritsProperties(javax.jcr.Node node)
           
protected  boolean isAnchor(javax.jcr.Node node)
          True if this node is an anchor.
protected  boolean isSourceChildInherited(javax.jcr.Node node)
           
protected  javax.jcr.NodeIterator sortInheritedNodes(javax.jcr.NodeIterator destinationChildren, List<javax.jcr.NodeIterator> sourceChildren)
           
 
Methods inherited from class info.magnolia.jcr.inheritance.InheritanceContentDecorator
addSource, combinePropertyIterators, getDestination, wrapNode
 
Methods inherited from class info.magnolia.jcr.decoration.AbstractContentDecorator
evaluateNode, evaluateProperty, wrapNodeIterator, wrapProperty, wrapPropertyIterator, wrapSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInheritanceContentDecorator

public DefaultInheritanceContentDecorator(javax.jcr.Node destination,
                                          info.magnolia.rendering.template.InheritanceConfiguration configuration)
                                   throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException
Method Detail

findFirstAnchor

protected javax.jcr.Node findFirstAnchor()
                                  throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

isAnchor

protected boolean isAnchor(javax.jcr.Node node)
                    throws javax.jcr.RepositoryException
True if this node is an anchor. By default true if this node is of type MgnlNodeType.NT_CONTENT.

Parameters:
node - the node to evaluate
Returns:
true if the node is an anchor
Throws:
javax.jcr.RepositoryException - if a problem occurs accessing the node

inheritsNodes

protected boolean inheritsNodes(javax.jcr.Node node)
                         throws javax.jcr.RepositoryException
Overrides:
inheritsNodes in class info.magnolia.jcr.inheritance.InheritanceContentDecorator
Throws:
javax.jcr.RepositoryException

inheritsProperties

protected boolean inheritsProperties(javax.jcr.Node node)
                              throws javax.jcr.RepositoryException
Overrides:
inheritsProperties in class info.magnolia.jcr.inheritance.InheritanceContentDecorator
Throws:
javax.jcr.RepositoryException

isSourceChildInherited

protected boolean isSourceChildInherited(javax.jcr.Node node)
                                  throws javax.jcr.RepositoryException
Overrides:
isSourceChildInherited in class info.magnolia.jcr.inheritance.InheritanceContentDecorator
Throws:
javax.jcr.RepositoryException

sortInheritedNodes

protected javax.jcr.NodeIterator sortInheritedNodes(javax.jcr.NodeIterator destinationChildren,
                                                    List<javax.jcr.NodeIterator> sourceChildren)
                                             throws javax.jcr.RepositoryException
Overrides:
sortInheritedNodes in class info.magnolia.jcr.inheritance.InheritanceContentDecorator
Throws:
javax.jcr.RepositoryException


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.