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
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
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.
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
Test the EmployeeEO
Right click on the AppModule.xml >> Click Run
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.”
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 🙂
Latest posts by Govind (see all)
- Primavera Error: The database is not setup to use the authentication mode selected: WebSSO:LDAP - June 22, 2017
- Primavera P6 professional Login alert box:The database has not been configured to run background jobs. To correct this error contact your system administrator - June 22, 2017
- How to integrate Oracle BI Publisher and LDAP in WebLogic server - June 21, 2017