|
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.validator.BasicNodeValidator<I>
public abstract class BasicNodeValidator<I>
A simple node validation implementation that takes care of missing and denied access to items. This implementation will create child nodes for items that we are denied access to but not to missing items. Missing items are reported as failures to the parent node. Denied access are reported as failures to the node representing the item.
Field Summary | |
---|---|
private Validator |
ruleDenied
|
private Validator |
ruleMissing
|
Constructor Summary | |
---|---|
BasicNodeValidator(Validator ruleMissing,
Validator ruleDenied)
Creates a new validator. |
Method Summary | |
---|---|
protected Fix |
getDeniedItemFix(Node node,
Node parentNode)
Subclasses should override this method if they have a suggessted fix for an access denied problem. |
protected abstract Fix |
getMissingItemFix(Node parentNode)
Subclasses should override this method if they have a suggessted fix for a missing item problem. |
void |
postDeniedItem(DbControl dc,
OverviewContext context,
Node node,
Node parentNode)
Submits the ruleDenied validator to the context as a failure
unless it is null. |
void |
postMissingItem(DbControl dc,
OverviewContext context,
Node node,
Node parentNode)
Do nothing. |
void |
postValidate(DbControl dc,
OverviewContext context,
Node node,
Node parentNode)
Do nothing. |
void |
postValidateFolder(DbControl dc,
OverviewContext context,
Node folderNode,
Node parentNode)
Do nothing. |
boolean |
preDeniedItem(DbControl dc,
OverviewContext context,
Node parentNode)
Validate an item that the current user doen't have access to before creating a node for it. |
boolean |
preMissingItem(DbControl dc,
OverviewContext context,
Node parentNode)
Submits the ruleMissing validator to the context as a failure
unless it is null. |
boolean |
preValidate(DbControl dc,
OverviewContext context,
I item,
Node parentNode)
Subclasses should override this method if the need more validation for an existing and accessible item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Validator ruleMissing
private Validator ruleDenied
Constructor Detail |
---|
public BasicNodeValidator(Validator ruleMissing, Validator ruleDenied)
ruleMissing
- The validation rule that is broken if an item is missing,
or null to not report missing items as a failureruleDenied
- The validation rule that is broken if we are denied access
to an item, or null to not report this as a failureMethod Detail |
---|
public boolean preMissingItem(DbControl dc, OverviewContext context, Node parentNode)
ruleMissing
validator to the context as a failure
unless it is null.
preMissingItem
in interface NodeValidator<I>
dc
- A DbControl to use if the validation needs to access the databasecontext
- The current overview contextparentNode
- The parent node that is missing the item
public boolean preDeniedItem(DbControl dc, OverviewContext context, Node parentNode)
NodeValidator
preDeniedItem
in interface NodeValidator<I>
dc
- A DbControl to use if the validation needs to access the databasecontext
- The current overview contextparentNode
- The parent node that is linked with the item
public boolean preValidate(DbControl dc, OverviewContext context, I item, Node parentNode)
preValidate
in interface NodeValidator<I>
dc
- A DbControl to use if the validation needs to access the databasecontext
- The current overview contextitem
- The item to validateparentNode
- The parent node that is linked with the item
public void postMissingItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
postMissingItem
in interface NodeValidator<I>
dc
- A DbControl to use if the validation needs to access the databasecontext
- The current overview contextnode
- The node object that represents the missing itemparentNode
- The parent node that is missing the itempublic void postDeniedItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
ruleDenied
validator to the context as a failure
unless it is null.
postDeniedItem
in interface NodeValidator<I>
dc
- A DbControl to use if the validation needs to access the databasecontext
- The current overview contextnode
- The node object that represents the unaccessible itemparentNode
- The parent node that is linked with the itempublic void postValidate(DbControl dc, OverviewContext context, Node node, Node parentNode)
postValidate
in interface NodeValidator<I>
dc
- A DbControl to use if the validation needs to access the databasecontext
- The current overview contextnode
- The node object that represents itemparentNode
- The parent node that is linked with the itempublic void postValidateFolder(DbControl dc, OverviewContext context, Node folderNode, Node parentNode)
postValidateFolder
in interface NodeValidator<I>
dc
- A DbControl to use for database accesscontext
- The current overview contextfolderNode
- The folder node, or null if no folder has been createdparentNode
- The parent node (never null)protected abstract Fix getMissingItemFix(Node parentNode)
new Fix("Add item to parent", parentNode.getItem())
protected Fix getDeniedItemFix(Node node, Node parentNode)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |