public abstract class AbstractNodeLoader<I> extends Object implements NodeLoader<I>
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.Modifier and Type | Field and Description |
---|---|
private static boolean |
debug |
private static org.slf4j.Logger |
log |
Modifier | Constructor and Description |
---|---|
protected |
AbstractNodeLoader() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 itemUnsupportedOperationException
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 nodeUnsupportedOperationException
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 nodeUnsupportedOperationException
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 nodeUnsupportedOperationException
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 nodeprotected 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.