Groovy is a java-like scripting language which runs inside the jvm.
In ADF, groovy enables us to do a good number of features such as:
In ADF, groovy enables us to do a good number of features such as:
1. Values for transient attributes(EO/VO)
2. Aggregate functions on attributes
3. Validation rules on attributes
2. Aggregate functions on attributes
3. Validation rules on attributes
Transient Attribute:
Create a transient attribute in EO/VO and in the default value section enter a groovy expression.
Create a transient attribute in EO/VO and in the default value section enter a groovy expression.
When we run the AM, the Department Name appears for each employee row.
Aggregate Functions:
We can apply aggregate function to an attribute of the same object or any object which is linked with an accessor.
Different functions are: count, Sum, min, max, etc.
Create a transient attribute on employee VO. In the default value secion, enter a groovy expression as shown below.
When we run the AM, we can see the number of employees in the department.
Validation rules:
In case of attribute validation, we can enter a groovy condition.
As depicted below, we can select an attribute(say salary) and click on validation rule. Lets enter a condition (newValue<500000).
When we run the AM to test and we provide a salary higher than 500000, it will throw and error.
We can also use accessor to retrieve department name. We can restrict the salary for employees in department1 only.
/**We will add other usages of ADF Groovy in this space**/
ليست هناك تعليقات:
إرسال تعليق