|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.overview.loader.AbstractNodeLoader<I>
public abstract class AbstractNodeLoader<I>
Abstract node loader implementation that does nothing/throws an
exception. It is recommended that all NodeLoader
implementations
extend this class (or a subclass) and only override the methods
they need to support. The node loader interface may be extended in the
future with new methods. Default implementations will be added to this class
which ensures that subclass implementation will continue to work.
Field Summary | |
---|---|
private static boolean |
debug
|
private static Logger |
log
|
Constructor Summary | |
---|---|
protected |
AbstractNodeLoader()
|
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 rootItem)
Create a root node for the given item. |
boolean |
loadChildNodes(DbControl dc,
OverviewContext context,
Node node)
Load childs nodes. |
protected boolean |
loadChildNodesOfFolderNode(DbControl dc,
OverviewContext context,
Node node)
Iterates the children of a folder-type node and loads the children for each one of them. |
protected boolean |
loadChildNodesOfItemNode(DbControl dc,
OverviewContext context,
Node node)
Loads child nodes of an item-type node. |
protected void |
loadForwardChildNodes(DbControl dc,
OverviewContext context,
Node node)
Load forward-loading child nodes. |
protected void |
loadPropertyChildNodes(DbControl dc,
OverviewContext context,
Node node)
Load property-type child nodes. |
protected void |
loadReverseChildNodes(DbControl dc,
OverviewContext context,
Node node)
Load reverse-loading child nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private static final boolean debug
Constructor Detail |
---|
protected AbstractNodeLoader()
Method Detail |
---|
public Node createRootNode(DbControl dc, OverviewContext context, I rootItem)
NodeLoader
ChildNodeDirection.ALL
so that both forward and reverse
child nodes are loaded.
createRootNode
in interface NodeLoader<I>
dc
- The DbControl to use for database accesscontext
- The overview contextrootItem
- The root item
UnsupportedOperationException
public Node createForwardNode(DbControl dc, OverviewContext context, Node parentNode)
NodeLoader
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
.
createForwardNode
in interface NodeLoader<I>
dc
- The DbControl to use for database accesscontext
- The overview contextparentNode
- The parent node
UnsupportedOperationException
public Node createPropertyNode(DbControl dc, OverviewContext context, Node parentNode)
NodeLoader
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
.
createPropertyNode
in interface NodeLoader<I>
dc
- The DbControl to use for database accesscontext
- The overview contextparentNode
- The parent node
UnsupportedOperationException
public Node createReverseNode(DbControl dc, OverviewContext context, Node childNode)
NodeLoader
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
.
createReverseNode
in interface NodeLoader<I>
dc
- The DbControl to use for database accesscontext
- The overview contextchildNode
- The child node
UnsupportedOperationException
public boolean loadChildNodes(DbControl dc, OverviewContext context, Node node)
ChildNodeDirection
it will call loadForwardChildNodes(DbControl, OverviewContext, Node)
,
loadReverseChildNodes(DbControl, OverviewContext, Node)
and
loadPropertyChildNodes(DbControl, OverviewContext, Node)
as needed.
NOTE! If the given node is a folder-node, this method will iterate over the children in the folder and do the above for each one of them.
loadChildNodes
in interface NodeLoader<I>
dc
- The DbControl to use for database accesscontext
- The overview contextnode
- The node
protected boolean loadChildNodesOfItemNode(DbControl dc, OverviewContext context, Node node)
protected boolean loadChildNodesOfFolderNode(DbControl dc, OverviewContext context, Node node)
protected void loadForwardChildNodes(DbControl dc, OverviewContext context, Node node)
loadChildNodesOfItemNode(DbControl, OverviewContext, Node)
if the current node has a ChildNodeDirection.loadForward()
that returns true.
The default implementation does nothing. This method is intended to be implemented
by subclasses.
protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node node)
loadChildNodesOfItemNode(DbControl, OverviewContext, Node)
if the current node has a ChildNodeDirection.loadReverse()
that returns true.
The default implementation does nothing. This method is intended to be implemented
by subclasses.
protected void loadPropertyChildNodes(DbControl dc, OverviewContext context, Node node)
loadChildNodesOfItemNode(DbControl, OverviewContext, Node)
if the current node
has a ChildNodeDirection.loadProperty()
that returns true.
The default implementation does nothing. This method is intended to be implemented
by subclasses.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |