Pages

Monday, November 25, 2013

ADF Entity Object - Entity level and Transaction level method validations

Created a simple application to Explain Entity level and Transaction level method validations.

Entity Level Validation

Entity-level method validators are similar to attribute-level method validators, except that they have a broader scope: the entire entity rather than a single attribute.

When you create an Entity-Level Method validation, The method is added to the entity object's custom Java class.

Click the Create and Select Method check box and provide the method name.


Select the Validation Level as Execute at Entity Level and provide the Condition to execute this method.

in this case i selected a Triggering Attribute as "EmployeeClubMember".


Provide the Failure Message.

Then a method will be created with the name you provided in Impl Class.

Transaction Level Validation

Transaction Level validation is use full if you want to validate Multiple Rows data.

Transaction level (rather than entity level) means that the validation will be performed after all entity-level validation is performed. For this reason, it may be useful if you want to ensure that a validator is performed at the end of the process.

Creation is same as Entity level only in the Validation Execution tab we need to select "Defer Execution to Transaction Level" .


In this Example, we need to pick employees for Employee Club. 

Rules:
Managers are not allowed under Employee Club.
One employee is allowed under one manager.


Sample Code screen shot.

Employee SKING is a manager so he is not allowed to Employee Club..
Employee 104 and 105 under same Manager "103". under same manager Two employees are not allowed.



You can download the sample code.

2 comments: