2.17.2: 2011-06-17

net.sf.basedb.util.overview.loader
Interface NodeLoader<I>

All Known Implementing Classes:
AbstractNodeLoader, AnnotationLoader, AnyToAnyLoader, ArrayBatchLoader, ArrayDesignLoader, ArraySlideLoader, AutoChildNodeLoader, BasicItemNodeLoader, BioSourceLoader, DataFileLoader, ExperimentalFactorLoader, ExperimentLoader, ExtractLoader, HardwareLoader, HybridizationLoader, ImageLoader, LabeledExtractLoader, NullNodeLoader, PlatformLoader, ProtocolLoader, ProtocolParameterLoader, RawBioAssayLoader, SampleLoader, ScanLoader, SoftwareLoader

public interface NodeLoader<I>

A node loader is an object that knows how to create a node for some specific item and how to load forward and reverse nodes for related items.

NOTE! This interface is not fixed on the implementor side. We reserve the right to add new methods and functionality to this interface without warning. We recommend that all implementations are subclasses of AbstractNodeLoader since this class will get default implementation of all new funcationality.

Version:
2.10
Author:
Nicklas
This class/package is not part of the Public API
This class is still being developed. It may change without notice in future versions of BASE.
Last modified
$Date: 2009-02-18 14:26:21 +0100 (Wed, 18 Feb 2009) $

Method Summary
 Node createForwardNode(DbControl dc, OverviewContext context, Node parentNode)
          Create a forward-loading (from parent to child) node for the given parent node.
 Node createPropertyNode(DbControl dc, OverviewContext context, Node parentNode)
          Create a property node for the given parent node.
 Node createReverseNode(DbControl dc, OverviewContext context, Node childNode)
          Create a reverse-loading (from child to parent) node for the given child node.
 Node createRootNode(DbControl dc, OverviewContext context, I item)
          Create a root node for the given item.
 boolean loadChildNodes(DbControl dc, OverviewContext context, Node node)
          Load child nodes of the current node unless they have been loaded already.
 

Method Detail

createRootNode

Node createRootNode(DbControl dc,
                    OverviewContext context,
                    I item)
Create a root node for the given item. A root node is a node with no parent. Typically, the direction of the created node is ChildNodeDirection.ALL so that both forward and reverse child nodes are loaded.

Parameters:
dc - The DbControl to use for database access
context - The overview context
item - The root item
Returns:
A root node
Throws:
UnsupportedOperationException - If the current item can't be used as a root node

createForwardNode

Node createForwardNode(DbControl dc,
                       OverviewContext context,
                       Node parentNode)
Create a forward-loading (from parent to child) node for the given parent node. The loader should use the information on the parent node to get the correct item (of type I) and create a node for that item. If the parent can have many child nodes, the loader should first create a folder-type node and put the children inside that.

The direction of the node(s) should usually be ChildNodeDirection.FORWARD. In case there is an error (permission denied, etc.) ChildNodeDirection.NONE should be used. If there is no child item null should be returned.

Errors, missing items, etc. should be reported as failures to the OverviewContext.

Parameters:
dc - The DbControl to use for database access
context - The overview context
parentNode - The parent node
Returns:
A forward-loading node (may be a folder-type node with many subnodes), or null
Throws:
UnsupportedOperationException - If the current item can't be used as a forward-loading node

createReverseNode

Node createReverseNode(DbControl dc,
                       OverviewContext context,
                       Node childNode)
Create a reverse-loading (from child to parent) node for the given child node. The loader should use the information on the child node to get the correct item (of type I) and create a node for that item. If the child can have many parent nodes, the loader should first create a folder-type node and put the parents inside that.

The direction of the node(s) should usually be ChildNodeDirection.REVERSE. In case there is an error (permission denied, etc.) ChildNodeDirection.NONE should be used. If there is no parent item null should be returned.

Errors, missing items, etc. should be reported as failures to the OverviewContext.

Parameters:
dc - The DbControl to use for database access
context - The overview context
childNode - The child node
Returns:
A reverse-loading node (may be a folder-type node with many subnodes), or null
Throws:
UnsupportedOperationException - If the current item can't be used as a reverse-loading node

createPropertyNode

Node createPropertyNode(DbControl dc,
                        OverviewContext context,
                        Node parentNode)
Create a property node for the given parent node. A property node is a node that is not on the main parent-child path. It is typically a node that can't be used a root node (for example, a protocol or software). If the parent node can have many properties of this type the loader can decide if it should first create a folder-type node and put the children inside the folder, or if all child nodes should be created directly in the parent node. In the first case, the folder node should be returned. In the latter case, null should be returned.

The direction of the node(s) should usually be ChildNodeDirection.NONE, but it may also be ChildNodeDirection.PROPERTY in case the property has sub-properties. One example is the ProtocolLoader which loads the protocol parameters as child nodes.

In case there is an error (permission denied, etc.) ChildNodeDirection.NONE should be used. If there is no property item null should be returned (but this may also indicate that more than one node was created).

Errors, missing items, etc. should be reported as failures to the OverviewContext.

Parameters:
dc - The DbControl to use for database access
context - The overview context
parentNode - The parent node
Returns:
A node (may be a folder-type node with many subnodes), or null
Throws:
UnsupportedOperationException - If the current item can't be used as a property node

loadChildNodes

boolean loadChildNodes(DbControl dc,
                       OverviewContext context,
                       Node node)
Load child nodes of the current node unless they have been loaded already. Note that which child nodes to load depends on the Node.getChildNodeDirection() of the node.

Parameters:
dc - The DbControl to use for database access
context - The overview context
node - The node
Returns:
TRUE if the call resulted in new nodes being loaded, FALSE otherwise

2.17.2: 2011-06-17