Simple Entity Object validation using Groovy in ADF

Home/ADF/Simple Entity Object validation using Groovy in ADF

Simple Entity Object Validation using Groovy in ADF

In my previous post, I have explained how to add a declarative way of applying validation on entity object attribute. In this section, I’ve explained the same using Groovy expression.

For this demo, I have applied validation on Salary field in the Employee table. The validator checks the salary, if it exceeds 10000 it throws error> let’s begin Entity Object Validation V using Groovy

 

Pre-Requisite

JDeveloper 12.1.3

HR Schema (Ships with Oracle database)

Employee EO Object (Click here for the instruction to create Employee EO)

 

Entity Object Validation  using Groovy Example: 

Double click on the Employee EO Object >> Select Attribute >> Click Salary >> Click Validation Rules >> Click the + icon

 

051016_0512_SimpleEntit1 Simple Entity Object validation using Groovy in ADF

 

The Rule Definition dialogue will open on the screen. Select the Type as expression and add Groovy expression in the Rule Definition tab as shown below. In ADF Groovy expression, newValue refers the value the user has just input and oldValue refer the value before it was changed.

Here the newValue refers to the salary attribute. It is telling, if the user inputs Salary greater than 10000, then the validation error occurs and through the error message.

 

051016_0512_SimpleEntit2 Simple Entity Object validation using Groovy in ADF

 

Now add the error Message. Click on the Failure Handling tab >> Add an error message in the Message String column as shown below >> Click Ok

 

051016_0512_SimpleEntit3 Simple Entity Object validation using Groovy in ADF

 

Test the EmployeeEO

Right click on the AppModule.xml >> Click Run

 

051016_0512_SimpleEntit4 Simple Entity Object validation using Groovy in ADF

 

The AppModule wizard appears on the screen. Double click on the EmployeeEO object and input salary more than 10000 and commit it. It will throw validation error message “The value must be greater than 10000.”

 

051016_0512_SimpleEntit5 Simple Entity Object validation using Groovy in ADF

pgn Simple Entity Object validation using Groovy in ADF

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
pgn Simple Entity Object validation using Groovy in ADF
By | 2017-06-11T15:40:34+00:00 May 10th, 2016|Categories: ADF|Tags: , , , |0 Comments
Like us on Facebook.
Connect!