Saturday, September 8, 2012

Oracle ADF : Working with DOMAIN and Validation

DOMAIN is used as datatype for Oracle ADF business component entity attributes. It is good facility provided by this framework to implement our own datatype for special purpose attributes like Email , Phone , Employee Id which require specific pattern to be followed.

Let me give me an example to portray you the power of domain.

Let us create simple EO/VO for supplier table in FOD Schema.

1. Create Domain

image

2.Give Domain name and don’t select check box. Then keep everything default in all screens and click finish.

image

3. It will generate xml and java file and We have to override validate method to write the validation.

image

I wrote following simplest validation logic and threw the exception.

image

4. Associating the Domain with entity attribute in type Drop down.

image

5.Now run the app module tester and give the email without @ which will throw the exception.

image

This concept can be extended to include much complex business rules for particular filed.

No comments:

Post a Comment