Databases Reference
In-Depth Information
What just happened?
We have added a script validaion for the
Job
atribute. The script is writen to do the
following:
1. Assign the current value to the variable called
value
.
2. The trimmed value is saved in a variable called
trim
.
3. We are checking if the value of
trim
is equal to
MANAGER
.
4. If the trimmed value is equal to
MANAGER
, then raise a warning from the
property file for the resource bundle that says "
No Posiion available to
add more Managers
".
To add the warning message, you will have to select the
Failure Handling
tab and
click on the magnifying glass icon.
5. The ADF warning is displayed from the resource bundle, and in this case, there is
no need to add a failure-handling message as we are already displaying a warning
to the user.
6. The return statement
true
or
false
signifies whether the result for the expression
has passed or failed.
Have a go hero - try more features of Groovy expressions
You should try out more features of Groovy expressions to increase your proficiency in
wriing eicient scriping code and add declaraive validaion without having a separate
class for the Java API.
You may try the following exercise:
1. Try adding an atribute called
DeptName
to the
EmpEO
enity object and provide
the default value as
DepName-
along with the
Deptno
enity added at the end.
For example, if an employee belongs to department number 50, the
DeptName
atribute should default to
DepName-50
.
2. List down all the common methods between Java and Groovy expressions,
and note down how these methods differ.
Search WWH ::
Custom Search