ERDQueryValidationDelegate Class Reference

Inherited by ERDQueryValidationDelegate.DefaultQueryValidationDelegate.

Collaboration diagram for ERDQueryValidationDelegate:

Collaboration graph
[legend]

List of all members.

Classes

class  DefaultQueryValidationDelegate
interface  ErrorKeys
interface  ValidationKeys

Public Member Functions

D2WContext d2wContext ()
boolean hasValidationDefinitionForKey (String key)
void validateNumericValueForKey (Number value, String key) throws NSValidation.ValidationException
void validateQuery (ERD2WQueryPage sender)
abstract void validateQueryValues (ERD2WQueryPage sender)
void validateStringValueForKey (String value, String key) throws NSValidation.ValidationException

Protected Member Functions

String propertyKeyFromDisplayGroupKey (String key)

Protected Attributes

D2WContext d2wContext


Detailed Description

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 method. The implementation should catch validation exceptions and invoke er.directtoweb.pages.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 on the superclass.

Author:
Travis Cripps displayPropertyKeys maximumInputLength minimumInputLength maximumInputValue minimumInputValue

Member Function Documentation

D2WContext d2wContext (  ) 

Gets the D2WContext against which the validation definitions will be evaluated. from

Returns:
the D2WContext

boolean hasValidationDefinitionForKey ( String  key  ) 

Determines if the D2W context contains a validation definition for the provided {

See also:
ValidationKeys validation key}.
Parameters:
key to check
Returns:
true if a validation definition for the given key exists

String propertyKeyFromDisplayGroupKey ( String  key  )  [protected]

Gets the D2W property key corresponding to the display group key by matching the key with one in the D2W context's displayPropertyKeys.

Parameters:
key from the display group
Returns:
the corresponding D2W key, or the original key if not found

void validateNumericValueForKey ( Number  value,
String  key 
) throws NSValidation.ValidationException

Validates a string value, checking minimumInputValue and maximumInputValue.

Parameters:
value to validate
key of the property to validate
Exceptions:
NSValidation.ValidationException when the validation fails

void validateQuery ( ERD2WQueryPage  sender  ) 

Validates the query inputs before executing the query.

Parameters:
sender query page whose inputs to validate

abstract void validateQueryValues ( ERD2WQueryPage  sender  )  [pure virtual]

Validates the query input values from the query page's display group.

Parameters:
sender query page whose inputs to validate

Implemented in ERDQueryValidationDelegate.DefaultQueryValidationDelegate.

void validateStringValueForKey ( String  value,
String  key 
) throws NSValidation.ValidationException

Validates a string value, checking minimumInputLength and maximumInputLength.

Parameters:
value to validate
key of the property to validate
Exceptions:
NSValidation.ValidationException when the validation fails


Member Data Documentation

D2WContext d2wContext [protected]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:53 2012 for Project Wonder by  doxygen 1.5.8