Class ExtensionNodeValidator<I>
- java.lang.Object
-
- net.sf.basedb.util.overview.validator.ExtensionNodeValidator<I>
-
- All Implemented Interfaces:
NodeValidator<I>
public class ExtensionNodeValidator<I> extends Object implements NodeValidator<I>
Wrapper for node validators that hooks into the extension system when validating nodes. The parent (or core) validator is always invoked first, then the extension system is queried for additional validators. Methods that return a value return the result from the last call (unless nothing else is specified).- Since:
- 3.2
- Author:
- Nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private Object
key
private NodeValidator<I>
parent
private List<NodeValidatorAction<I>>
xtValidators
-
Constructor Summary
Constructors Constructor Description ExtensionNodeValidator(NodeValidator<I> parent, Object key)
Wrap the given parent node validator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Iterable<NodeValidatorAction<I>>
getValidators(DbControl dc)
void
postDeniedItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.void
postMissingItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.void
postValidate(DbControl dc, OverviewContext context, Node node, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.void
postValidateFolder(DbControl dc, OverviewContext context, Node folderNode, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.boolean
preDeniedItem(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.boolean
preMissingItem(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.boolean
preValidate(DbControl dc, OverviewContext context, I item, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.String
toString()
-
-
-
Field Detail
-
parent
private final NodeValidator<I> parent
-
key
private final Object key
-
xtValidators
private List<NodeValidatorAction<I>> xtValidators
-
-
Constructor Detail
-
ExtensionNodeValidator
public ExtensionNodeValidator(NodeValidator<I> parent, Object key)
Wrap the given parent node validator.
-
-
Method Detail
-
preMissingItem
public boolean preMissingItem(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions. The result from the last call is returned.- Specified by:
preMissingItem
in interfaceNodeValidator<I>
- Parameters:
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- Returns:
- TRUE if a node should be created, FALSE if not
-
preDeniedItem
public boolean preDeniedItem(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions. The result from the last call is returned.- Specified by:
preDeniedItem
in interfaceNodeValidator<I>
- Parameters:
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- Returns:
- TRUE if a node should be created, FALSE if not
-
preValidate
public boolean preValidate(DbControl dc, OverviewContext context, I item, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions. The result from the last call is returned.- Specified by:
preValidate
in interfaceNodeValidator<I>
- Parameters:
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- Returns:
- TRUE if a node should be created, FALSE if not
-
postMissingItem
public void postMissingItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.- Specified by:
postMissingItem
in interfaceNodeValidator<I>
- Parameters:
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 item
-
postDeniedItem
public void postDeniedItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.- Specified by:
postDeniedItem
in interfaceNodeValidator<I>
- Parameters:
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 item
-
postValidate
public void postValidate(DbControl dc, OverviewContext context, Node node, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.- Specified by:
postValidate
in interfaceNodeValidator<I>
- Parameters:
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 item
-
postValidateFolder
public void postValidateFolder(DbControl dc, OverviewContext context, Node folderNode, Node parentNode)
Call the same method on the parent validator and then on all extension validator actions.- Specified by:
postValidateFolder
in interfaceNodeValidator<I>
- Parameters:
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)
-
getValidators
private Iterable<NodeValidatorAction<I>> getValidators(DbControl dc)
-
-