|
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> net.sf.basedb.util.overview.loader.BasicItemNodeLoader<I>
public abstract class BasicItemNodeLoader<I extends BasicItem>
Abstract class that is useful for all node loaders that works
with BasicItem
:s.
Field Summary | |
---|---|
static boolean |
ALLOW_ROOT_NODE
|
protected boolean |
allowAsRootNode
|
private static boolean |
debug
|
static boolean |
DENY_ROOT_NODE
|
protected Object |
factoryKey
|
private static Logger |
log
|
protected NodeNameGenerator<I> |
nameGenerator
|
Constructor Summary | |
---|---|
protected |
BasicItemNodeLoader(Object factoryKey,
boolean allowAsRootNode,
NodeNameGenerator<I> nameGenerator)
Create a new node loader. |
Method Summary | |
---|---|
protected Node |
createItemNode(NodeFactory<I> factory,
I item,
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<I> validator,
NodeNameGenerator<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,
Object key)
Get a node loader for a specific item type using the current context's node loader factory. |
protected NodeLoaderFactory<BasicItem,Object> |
getNodeLoaderFactory(OverviewContext context)
Get the node loader factory used by the current context. |
protected NodeValidator<I> |
getNodeValidator(OverviewContext context)
Get the default node validator for nodes of this type. |
protected NodeValidatorFactory<BasicItem,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)
|
Methods inherited from class net.sf.basedb.util.overview.loader.AbstractNodeLoader |
---|
createForwardNode, createPropertyNode, createReverseNode, loadChildNodes, loadChildNodesOfFolderNode, loadChildNodesOfItemNode, loadForwardChildNodes, loadPropertyChildNodes, loadReverseChildNodes |
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
public static final boolean ALLOW_ROOT_NODE
public static final boolean DENY_ROOT_NODE
protected final Object factoryKey
protected final boolean allowAsRootNode
protected final NodeNameGenerator<I extends BasicItem> nameGenerator
Constructor Detail |
---|
protected BasicItemNodeLoader(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 nodesMethod Detail |
---|
public 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 item
protected Node createItemNode(NodeFactory<I> factory, I item, 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,Object> getNodeLoaderFactory(OverviewContext context)
context
- The current contextOverviewContext.getNodeLoaderFactory()
protected NodeLoader<? extends BasicItem> getNodeLoader(OverviewContext context, Object key)
context
- The current contextkey
- The item type that the factory should create a node loader for
OverviewContext.getNodeLoaderFactory()
protected NodeValidatorFactory<BasicItem,Object> getNodeValidatorFactory(OverviewContext context)
context
- The current contextOverviewContext.getNodeValidatorFactory()
protected NodeValidator<I> getNodeValidator(OverviewContext context)
context.getNodeValidatorFactory().createNodeValidator(factoryKey)
context
- The current overview context
protected 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 context
getNodeFactory(DbControl, OverviewContext, NodeValidator, NodeNameGenerator)
protected NodeFactory<I> getNodeFactory(DbControl dc, OverviewContext context, NodeValidator<I> validator, NodeNameGenerator<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 generator
getNodeFactory(DbControl, OverviewContext)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |