Interface NodeValidator<I>
-
- All Known Subinterfaces:
NodeValidatorAction<I>
- All Known Implementing Classes:
AnnotationValidator
,AnyToAnyValidator
,ArrayBatchValidator
,ArrayDesignValidator
,ArraySlideValidator
,BasicNodeValidator
,BioPlateValidator
,BioSourceValidator
,DataFileValidator
,DerivedBioAssayValidator
,ExperimentalFactorValidator
,ExperimentValidator
,ExtensionNodeValidator
,ExtractValidator
,FileValidator
,HardwareValidator
,KitValidator
,NameableNodeValidator
,NullNodeValidator
,PhysicalBioAssayValidator
,PlatformValidator
,ProtocolParameterValidator
,ProtocolValidator
,RawBioAssayValidator
,SampleValidator
,SoftwareValidator
,TagValidator
public interface NodeValidator<I>
A node validator is responsible for checking the "validity" of a node. The rules that are checked is varying from node to node depending on what type of item it represents. Two common "errors" are missing items and that a user is denied access to an item. Since this means that there is no item to validate there are special methods for those two cases.The validation of a node is part of the node creation and happens in one of the
NodeFactory.createMissingNode(Node)
,NodeFactory.createDeniedNode(Node)
orNodeFactory.createNode(net.sf.basedb.core.BasicItem, Object, Node, ChildNodeDirection)
methods. The validation takes place in two steps. The first step calls one of the three pre methods:preMissingItem(DbControl, OverviewContext, Node)
preDeniedItem(DbControl, OverviewContext, Node)
preValidate(DbControl, OverviewContext, Object, Node)
false
no new node is created and further processing is stopped. The second step happens after the node has been created and calls one of the three post methods:postMissingItem(DbControl, OverviewContext, Node, Node)
postDeniedItem(DbControl, OverviewContext, Node, Node)
postValidate(DbControl, OverviewContext, Node, Node)
The last step is to validate a complete folder. This can't happen from the
NodeFactory
since it only deals with individual nodes. It is the responsibility of aNodeLoader
to callpostValidateFolder(DbControl, OverviewContext, Node, Node)
after it has finished loading a folder node. NOTE! This should be called even if the folder node is null, or if the folder doesn't contain any children (some validators may want to report on missing items!)Validations failures should be registered with the current context using
OverviewContext.createFailure(Validator, Node, String, Fix...)
.- Version:
- 2.10
- Author:
- Nicklas
- Last modified
- $Date: 2011-10-21 13:15:41 +0200 (fr, 21 okt 2011) $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
postDeniedItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Validate an item that the current user doen't have access to after a node has been created for it.void
postMissingItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Validate a missing item after a node has been created for it.void
postValidate(DbControl dc, OverviewContext context, Node node, Node parentNode)
Validate an existing item after a node has been created for it.void
postValidateFolder(DbControl dc, OverviewContext context, Node folderNode, Node parentNode)
Validate a folder node after all child (item-type) nodes has been added to the folder.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)
Validate a missing item before creating a node for it.boolean
preValidate(DbControl dc, OverviewContext context, I item, Node parentNode)
Validate an existing item before creating a node for it.
-
-
-
Method Detail
-
preMissingItem
boolean preMissingItem(DbControl dc, OverviewContext context, Node parentNode)
Validate a missing item before creating a node for it. This usually means creating a missing itemFailure
for the parent node and registering it with the context.- 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
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.- 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
boolean preValidate(DbControl dc, OverviewContext context, I item, Node parentNode)
Validate an existing item before creating a node for it.- 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
void postMissingItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Validate a missing item after a node has been created for it.- 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
void postDeniedItem(DbControl dc, OverviewContext context, Node node, Node parentNode)
Validate an item that the current user doen't have access to after a node has been created for it.- 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
void postValidate(DbControl dc, OverviewContext context, Node node, Node parentNode)
Validate an existing item after a node has been created for it.- 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
void postValidateFolder(DbControl dc, OverviewContext context, Node folderNode, Node parentNode)
Validate a folder node after all child (item-type) nodes has been added to the folder. This method must be called by node loaders in all cases were it is theoretically possible that a folder node can be created. Some validators may, for example, check on missing items!- 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)
-
-