3.2.1: 2012-12-13

net.sf.basedb.util.overview.loader
Class ExtensionChildNodeLoader<I>

java.lang.Object
  extended by net.sf.basedb.util.overview.loader.ExtensionChildNodeLoader<I>
All Implemented Interfaces:
NodeLoader<I>

public class ExtensionChildNodeLoader<I>
extends Object
implements NodeLoader<I>

Wrapper for node loaders that automatically hooks into the extension system when loading child nodes for a parent node. It works by first delegating all method calls to the parent node loader, but the loadChildNodes(DbControl, OverviewContext, Node) contains additional logic to query the extension system and call ChildNodeLoaderAction.createChildNodes(DbControl, OverviewContext, Node) for any action created by the an extension.

Since:
3.2
Author:
Nicklas

Field Summary
private  NodeLoader<I> parent
           
 
Constructor Summary
ExtensionChildNodeLoader(NodeLoader<I> parent)
          Wrap the given parent node loader.
 
Method Summary
 Node createForwardNode(DbControl dc, OverviewContext context, Node parentNode)
          Call the same method on the 'parent' node loader.
 Node createPropertyNode(DbControl dc, OverviewContext context, Node parentNode)
          Call the same method on the 'parent' node loader.
 Node createReverseNode(DbControl dc, OverviewContext context, Node childNode)
          Call the same method on the 'parent' node loader.
 Node createRootNode(DbControl dc, OverviewContext context, I item)
          Call the same method on the 'parent' node loader.
 boolean loadChildNodes(DbControl dc, OverviewContext context, Node node)
          Call the same method on the 'parent' node loader.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

private final NodeLoader<I> parent
Constructor Detail

ExtensionChildNodeLoader

public ExtensionChildNodeLoader(NodeLoader<I> parent)
Wrap the given parent node loader.

Method Detail

createForwardNode

public Node createForwardNode(DbControl dc,
                              OverviewContext context,
                              Node parentNode)
Call the same method on the 'parent' node loader.

Specified by:
createForwardNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
parentNode - The parent node
Returns:
The node that the parent node loader creates (may be null)

createPropertyNode

public Node createPropertyNode(DbControl dc,
                               OverviewContext context,
                               Node parentNode)
Call the same method on the 'parent' node loader.

Specified by:
createPropertyNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
parentNode - The parent node
Returns:
The node that the parent node loader creates (may be null)

createReverseNode

public Node createReverseNode(DbControl dc,
                              OverviewContext context,
                              Node childNode)
Call the same method on the 'parent' node loader. If one or more child nodes are added to the parent node, the loadChildNodes(DbControl, OverviewContext, Node) is called for each of the new nodes.

Specified by:
createReverseNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
childNode - The child node
Returns:
The node that the parent node loader creates (may be null)

createRootNode

public Node createRootNode(DbControl dc,
                           OverviewContext context,
                           I item)
Call the same method on the 'parent' node loader.

Specified by:
createRootNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
item - The root item
Returns:
The node that the parent node loader creates (may be null)

loadChildNodes

public boolean loadChildNodes(DbControl dc,
                              OverviewContext context,
                              Node node)
Call the same method on the 'parent' node loader. Then, check the extension system for extensions to the 'net.sf.basedb.util.overview.loader' extension point and ask the factories for ChildNodeLoaderAction:s and let each of them create their child nodes.

Specified by:
loadChildNodes in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
node - The node
Returns:
TRUE if new nodes were added to the parent node, FALSE if not

toString

public String toString()
Overrides:
toString in class Object

3.2.1: 2012-12-13