public abstract class BasicNodeValidator<I> extends java.lang.Object implements NodeValidator<I>
Modifier and Type | Field and Description |
---|---|
private Validator |
ruleDenied |
private Validator |
ruleMissing |
Constructor and Description |
---|
BasicNodeValidator(Validator ruleMissing,
Validator ruleDenied)
Creates a new validator.
|
Modifier and Type | Method and Description |
---|---|
protected Fix |
getDeniedItemFix(DbControl dc,
Node node,
Node parentNode)
Subclasses should override this method if they have a suggessted fix
for an access denied problem.
|
protected abstract Fix |
getMissingItemFix(DbControl dc,
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.
|
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 failurepublic 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 itempublic 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 itempublic 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 itempublic 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(DbControl dc, Node parentNode)
new Fix("Add item to parent", parentNode.getItem())