Sunday, October 21, 2012

ADF BC : Validation Rule

Sometime we need to create rule that will be used in most of the entity objects like employee id pattern , salary range pattern and more.

I created simple rule to explain you how to create rule that can be applied to all the entities.

I have used employee table of HR schema and My rule is taking care that first name and last name is not entered same.

I create ADF BC object type Validation Rule and It has generated following java file that implements JboValidatorInterface interface.

I added code to validateValue , validate and validateEntityLevel.

image

validateEntityLevel make sure that validation is called during Entity Level Validation stage.

Now we need to associate this validation as Entity Validator.

In EO , I associated FirstName and LastName String variable I created with accessor in java files with Entity Object attribute value.

image

When I create Entity Row and give First Name and Last Name as same value it will throw exception not allowing me to save row.

No comments:

Post a Comment