public class NullNodeLoader<I> extends Object implements NodeLoader<I>
NodeLoaderFactory
implementations
that wish to handle missing node loaders in the NodeLoaderFactory.createNodeLoader(Object)
method differently. Normally this should
result in an ItemNotFoundException
, but an alternative approach may
be to return this loader which will effectively make an end-point in the
node tree. This node loader can't be used for root nodes and will throw
an UnsupportedOperationException
if createRootNode(DbControl, OverviewContext, Object)
is called.Constructor and Description |
---|
NullNodeLoader() |
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 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.
|
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 nodepublic 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 nodepublic 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 nodepublic Node createRootNode(DbControl dc, OverviewContext context, I item)
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 contextitem
- The root itemUnsupportedOperationException
- Alwayspublic boolean loadChildNodes(DbControl dc, OverviewContext context, Node node)
NodeLoader
Node.getChildNodeDirection()
of the node.loadChildNodes
in interface NodeLoader<I>
dc
- The DbControl to use for database accesscontext
- The overview contextnode
- The node