public abstract class BasicItemNodeLoader<I extends BasicItem> extends AbstractNodeLoader<I>
BasicItem
:s.Modifier and Type | Field and Description |
---|---|
static boolean |
ALLOW_ROOT_NODE |
protected boolean |
allowAsRootNode |
private static boolean |
debug |
static boolean |
DENY_ROOT_NODE |
protected java.lang.Object |
factoryKey |
private static org.slf4j.Logger |
log |
protected NodeNameGenerator<I> |
nameGenerator |
Modifier | Constructor and Description |
---|---|
protected |
BasicItemNodeLoader(java.lang.Object factoryKey,
boolean allowAsRootNode,
NodeNameGenerator<I> nameGenerator)
Create a new node loader.
|
Modifier and Type | Method and Description |
---|---|
protected <S> Node |
createItemNode(NodeFactory<? super S> factory,
S item,
java.lang.Object cacheKey,
boolean denied,
Node parentNode,
ChildNodeDirection direction)
Create a new item node using the supplied node factory.
|
Node |
createRootNode(DbControl dc,
OverviewContext context,
I item)
Create a root node for the given item.
|
protected NodeFactory<I> |
getNodeFactory(DbControl dc,
OverviewContext context)
Get a node factory that can be used to create item nodes.
|
protected NodeFactory<I> |
getNodeFactory(DbControl dc,
OverviewContext context,
NodeValidator<? super I> validator,
NodeNameGenerator<? super I> nameGenerator)
Get a node factory that can be used to create item nodes using
a non-default name generator and validator.
|
protected NodeLoader<? extends BasicItem> |
getNodeLoader(OverviewContext context,
java.lang.Object key)
Get a node loader for a specific item type using the current context's
node loader factory.
|
protected NodeLoaderFactory<BasicItem,java.lang.Object> |
getNodeLoaderFactory(OverviewContext context)
Get the node loader factory used by the current context.
|
protected NodeNameGenerator<I> |
getNodeNameGenerator()
Get the name generator that is used by this loader.
|
protected NodeValidator<I> |
getNodeValidator(OverviewContext context)
Get the default node validator for nodes of this type.
|
protected NodeValidatorFactory<BasicItem,java.lang.Object> |
getNodeValidatorFactory(OverviewContext context)
Get the node validator factory used by the current context.
|
protected void |
postValidateFolder(NodeFactory<I> nf,
Node folderNode,
Node parentNode,
boolean createMissingNode) |
createForwardNode, createPropertyNode, createReverseNode, loadChildNodes, loadChildNodesOfFolderNode, loadChildNodesOfItemNode, loadForwardChildNodes, loadPropertyChildNodes, loadReverseChildNodes
private static final org.slf4j.Logger log
private static final boolean debug
public static final boolean ALLOW_ROOT_NODE
public static final boolean DENY_ROOT_NODE
protected final java.lang.Object factoryKey
protected final boolean allowAsRootNode
protected final NodeNameGenerator<I extends BasicItem> nameGenerator
protected BasicItemNodeLoader(java.lang.Object factoryKey, boolean allowAsRootNode, NodeNameGenerator<I> nameGenerator)
factoryKey
- The key to use when looking up a NodeValidator
with NodeValidatorFactory.createNodeValidator(Object)
allowAsRootNode
- If FALSE, the createRootNode(DbControl, OverviewContext, BasicItem)
method
throws an execptionnameGenerator
- A name generator implementation that know how to
create name and title for nodespublic 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 extends BasicItem>
createRootNode
in class AbstractNodeLoader<I extends BasicItem>
dc
- The DbControl to use for database accesscontext
- The overview contextitem
- The root itemprotected <S> Node createItemNode(NodeFactory<? super S> factory, S item, java.lang.Object cacheKey, boolean denied, Node parentNode, ChildNodeDirection direction)
denied==true
the node will be created with NodeFactory.createDeniedNode(Node)
. If
item==null
the node will be created with
NodeFactory.createMissingNode(Node)
. Otherwise the node is created with
NodeFactory.createNode(BasicItem, Object, Node, ChildNodeDirection)
factory
- The node factory to useitem
- The item that is contained by the node (can be null)cacheKey
- Optional key for cache lookup. If not null and an
entry is found in the cache, the entire sub-tree is duplicated
to avoid re-loading the same items againdenied
- TRUE if the logged in user was denied access to the itemparentNode
- The parent nodedirection
- The direction for loading childrenprotected void postValidateFolder(NodeFactory<I> nf, Node folderNode, Node parentNode, boolean createMissingNode)
protected NodeLoaderFactory<BasicItem,java.lang.Object> getNodeLoaderFactory(OverviewContext context)
context
- The current contextOverviewContext.getNodeLoaderFactory()
protected NodeLoader<? extends BasicItem> getNodeLoader(OverviewContext context, java.lang.Object key)
context
- The current contextkey
- The item type that the factory should create a node loader forOverviewContext.getNodeLoaderFactory()
protected NodeValidatorFactory<BasicItem,java.lang.Object> getNodeValidatorFactory(OverviewContext context)
context
- The current contextOverviewContext.getNodeValidatorFactory()
protected NodeValidator<I> getNodeValidator(OverviewContext context)
context.getNodeValidatorFactory().createNodeValidator(factoryKey)
context
- The current overview contextprotected NodeFactory<I> getNodeFactory(DbControl dc, OverviewContext context)
getNodeValidator(OverviewContext)
and the name generator as provided in the constructor.dc
- A DbControl that can be used for database accesscontext
- The current overview contextgetNodeFactory(DbControl, OverviewContext, NodeValidator, NodeNameGenerator)
protected NodeFactory<I> getNodeFactory(DbControl dc, OverviewContext context, NodeValidator<? super I> validator, NodeNameGenerator<? super I> nameGenerator)
dc
- A DbControl that can be used for database accesscontext
- The current overview contextvalidator
- A node validator, or null if no validation is requirednameGenerator
- A name generatorgetNodeFactory(DbControl, OverviewContext)
protected NodeNameGenerator<I> getNodeNameGenerator()