|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.directtoweb.delegates.ERDQueryValidationDelegate
public abstract class ERDQueryValidationDelegate
A delegate class for validating user inputs before a query is executed. Validation rules are derived from the D2W context.
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.
D2W Keys | |
displayPropertyKeys | displayPropertyKeys |
maximumInputLength | maximumInputLength |
minimumInputLength | minimumInputLength |
maximumInputValue | maximumInputValue |
minimumInputValue | minimumInputValue |
Nested Class Summary | |
---|---|
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
|
Field Summary | |
---|---|
protected com.webobjects.directtoweb.D2WContext |
d2wContext
|
Constructor Summary | |
---|---|
ERDQueryValidationDelegate()
|
Method Summary | |
---|---|
com.webobjects.directtoweb.D2WContext |
d2wContext()
Gets the D2WContext against which the validation definitions will be evaluated. |
boolean |
hasValidationDefinitionForKey(java.lang.String key)
Determines if the D2W context contains a validation definition for the provided validation key . |
protected java.lang.String |
propertyKeyFromDisplayGroupKey(java.lang.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(java.lang.Number value,
java.lang.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(java.lang.String value,
java.lang.String key)
Validates a string value, checking minimumInputLength and maximumInputLength. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected com.webobjects.directtoweb.D2WContext d2wContext
Constructor Detail |
---|
public ERDQueryValidationDelegate()
Method Detail |
---|
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 java.lang.String propertyKeyFromDisplayGroupKey(java.lang.String key)
displayPropertyKeys
.
key
- from the display group
public boolean hasValidationDefinitionForKey(java.lang.String key)
validation key
.
key
- to check
public void validateStringValueForKey(java.lang.String value, java.lang.String key) throws com.webobjects.foundation.NSValidation.ValidationException
value
- to validatekey
- of the property to validate
NSValidation.ValidationException
- when the validation failspublic void validateNumericValueForKey(java.lang.Number value, java.lang.String key) throws com.webobjects.foundation.NSValidation.ValidationException
value
- to validatekey
- of the property to validate
NSValidation.ValidationException
- when the validation fails
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |