Databases Reference
In-Depth Information
The Custom validation rule
ADF comes with default declaraive validaion rules that are used in the
Business Rule
secion
of an enity object. In most business cases, we would like to have our own validaion rule to
be applied to business objects. ADF allows users to create a custom validaion rule by going to
Business Tier
|
ADF Business Components
|
Validaion Rule
|
New Gallery
. The
validate()
method is used to raise an excepion based on the business condiion. The validaion will be
displayed in the
Business Rule
secion of an enity object.
The following is a sample validaion code:
public boolean validateValue(Object value) {
return true;
}
public void validate(JboValidatorContext ctx) {
if (!validateValue(ctx.getNewValue())) {
throw new ValidationException(
"com.empdirectory.model.view.BasicValidationRule
validation failed");
}
}
The following screenshot shows the
Create Validaion Rule Class
pane:
Search WWH ::
Custom Search