|
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.node.NodeFactory<I>
public class NodeFactory<I extends BasicItem>
A node factory is responsible for creating item-type nodes.
The primary function of a node factory is to interface with
a NodeValidator
to actually decide if a node should
be created or not for a given item (which may be missing or
the current user may be denied access).
Another function is to interface with the current
OverviewContext
and it's optional NodeCache
so that we don't have to use resources for re-loading a deep
sub-tree starting with an item that has already been loaded
in another branch of the tree.
Field Summary | |
---|---|
private OverviewContext |
context
|
private DbControl |
dc
|
private static boolean |
debug
|
private static Logger |
log
|
private NodeNameGenerator<? super I> |
nameGenerator
|
private NodeValidator<? super I> |
validator
|
Constructor Summary | |
---|---|
NodeFactory(DbControl dc,
OverviewContext context,
NodeValidator<? super I> validator,
NodeNameGenerator<? super I> nameGenerator)
Create a node factory. |
Method Summary | |
---|---|
protected void |
cacheNewNode(Object cacheKey,
Node node,
ChildNodeDirection direction)
Store a node in the node cache if the current overview context supports caching. |
protected Node |
cloneCachedNode(Object cacheKey,
Node parentNode,
ChildNodeDirection direction)
Clones a cached node if the current context supports caching and another node with the given cache key already exists. |
Node |
createDeniedNode(Node parentNode)
Create a node representing an item that the logged in user is denied to access. |
Node |
createMissingNode(Node parentNode)
Create a node representing a missing item. |
Node |
createNode(I item,
Object cacheKey,
Node parentNode,
ChildNodeDirection direction)
Create a node representing an existing item. |
private Node |
createNode(I item,
String name,
String title,
Object cacheKey,
Node parentNode,
ChildNodeDirection direction)
|
NodeValidator<? super I> |
getNodeValidator()
Get the node validator that is used by this factory. |
void |
postValidateFolder(Node folderNode,
Node parentNode)
|
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
private DbControl dc
private OverviewContext context
private NodeValidator<? super I extends BasicItem> validator
private NodeNameGenerator<? super I extends BasicItem> nameGenerator
Constructor Detail |
---|
public NodeFactory(DbControl dc, OverviewContext context, NodeValidator<? super I> validator, NodeNameGenerator<? super I> nameGenerator)
dc
- A DbControl to use if database access is neededcontext
- The current overview contextvalidator
- An optional validatornameGenerator
- A name generator to use for node name and title
generationMethod Detail |
---|
public NodeValidator<? super I> getNodeValidator()
public Node createMissingNode(Node parentNode)
NodeValidator.preMissingItem(DbControl, OverviewContext, Node)
method returns TRUE.
parentNode
- The parent node
public Node createDeniedNode(Node parentNode)
NodeValidator.preDeniedItem(DbControl, OverviewContext, Node)
method returns TRUE.
parentNode
- The parent node
public Node createNode(I item, Object cacheKey, Node parentNode, ChildNodeDirection direction)
NodeValidator.preValidate(DbControl, OverviewContext, Object, Node)
method returns TRUE.
item
- The item to attach to the nodecacheKey
- An optional cache keyparentNode
- The parent nodedirection
- The direction to use when loading the node's children
private Node createNode(I item, String name, String title, Object cacheKey, Node parentNode, ChildNodeDirection direction)
protected Node cloneCachedNode(Object cacheKey, Node parentNode, ChildNodeDirection direction)
DirectionalCacheKey
since the loading
direction will affect the children of a node.
cacheKey
- The cache key to use for node lookupparentNode
- The node that should be the parent of the
cloned nodedirection
- The direction we are loading child nodes in
OverviewContext.getNodeCache()
protected void cacheNewNode(Object cacheKey, Node node, ChildNodeDirection direction)
cacheKey
- The cache keynode
- The node to storedirection
- The direction we are loading child nodes inOverviewContext.getNodeCache()
public void postValidateFolder(Node folderNode, Node parentNode)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |