public abstract class ERDQueryValidationDelegate extends Object
To disallow a query with no user inputs, create a rule like:
entity.name = 'Foo' => allowsEmptyQueryValue = "false" (BooleanAssignment)
To define a validation for a propertyKey, create a rule like:
entity.name = 'Foo' and propertyKey = 'bar' => allowsEmptyQueryValue = "false" (BooleanAssignment)
To define a minimum length validation for a (String) propertyKey, create a rule like:
entity.name = 'Foo' and propertyKey = 'bar' => minimumInputLength = "3" (Assignment)
Subclasses wishing to implement custom validation logic should implement the validateQueryValues(er.directtoweb.pages.ERD2WQueryPage)
method.
The implementation should catch validation exceptions and invoke
ERD2WPage.validationFailedWithException(Throwable, Object, String)
with any caught exceptions. To customize
behavior, while retaining the default checks, extend ERDQueryValidationDelegate.DefaultQueryValidationDelegate
to perform custom validations and then call validateQueryValues(er.directtoweb.pages.ERD2WQueryPage)
on the superclass.
Name | Description |
---|---|
displayPropertyKeys | displayPropertyKeys |
maximumInputLength | maximumInputLength |
minimumInputLength | minimumInputLength |
maximumInputValue | maximumInputValue |
minimumInputValue | minimumInputValue |
Modifier and Type | Class and Description |
---|---|
static class |
ERDQueryValidationDelegate.DefaultQueryValidationDelegate
A "default" implementation of a query validation delegate, which simply validates each key in the query page's
display group against validation definitions from the D2W rules.
|
static interface |
ERDQueryValidationDelegate.ErrorKeys |
static interface |
ERDQueryValidationDelegate.ValidationKeys |
Modifier and Type | Field and Description |
---|---|
protected com.webobjects.directtoweb.D2WContext |
d2wContext |
Constructor and Description |
---|
ERDQueryValidationDelegate() |
Modifier and Type | Method and Description |
---|---|
com.webobjects.directtoweb.D2WContext |
d2wContext()
Gets the D2WContext against which the validation definitions will be evaluated.
|
boolean |
hasValidationDefinitionForKey(String key)
Determines if the D2W context contains a validation definition for the provided validation key}.
|
protected String |
propertyKeyFromDisplayGroupKey(String key)
Gets the D2W property key corresponding to the display group key by matching the key with one in the D2W
context's
displayPropertyKeys . |
void |
validateNumericValueForKey(Number value,
String key)
Validates a string value, checking minimumInputValue and maximumInputValue.
|
void |
validateQuery(ERD2WQueryPage sender)
Validates the query inputs before executing the query.
|
abstract void |
validateQueryValues(ERD2WQueryPage sender)
Validates the query input values from the query page's display group.
|
void |
validateStringValueForKey(String value,
String key)
Validates a string value, checking minimumInputLength and maximumInputLength.
|
public void validateQuery(ERD2WQueryPage sender)
sender
- query page whose inputs to validatepublic abstract void validateQueryValues(ERD2WQueryPage sender)
sender
- query page whose inputs to validatepublic com.webobjects.directtoweb.D2WContext d2wContext()
protected String propertyKeyFromDisplayGroupKey(String key)
displayPropertyKeys
.key
- from the display grouppublic boolean hasValidationDefinitionForKey(String key)
key
- to checkpublic void validateStringValueForKey(String value, String key) throws NSValidation.ValidationException
value
- to validatekey
- of the property to validateNSValidation.ValidationException
- when the validation failspublic void validateNumericValueForKey(Number value, String key) throws NSValidation.ValidationException
value
- to validatekey
- of the property to validateNSValidation.ValidationException
- when the validation failsCopyright © 2002 – 2024 Project Wonder.