Monday Mar 05, 2012

New ADF Insider Essentials - Basing a view object on multiple entities

One of the common requirements when building an application on relational database tables is the ability to incorporate attributes from different sources into a data view which is more representative of the application requirement, rather than the database schema. ADF Business Components provides a powerful feature which can be used, for example, when viewing Emp data, you would want to displayed Department Name from the Dept table rather than just DeptId, which is less intuitive to the end users.  To help understand the use case and how to implement it, we've just published this ADF Insider Essentials on YouTube which explains how you can do this.

Monday Aug 15, 2011

Using Groovy to read values from a different view object

We recently posted an ADF Insider Essentials that showed how to build an LOV switcher.  In this example, Frank Nimphius wrote a custom method into the PaymentTypeVOImpl which returns the string CASH or CREDIT depending on the lookup value passed in (1 or 2).  This method is then called from the Orders view object via a Groovy expression.

However, there is an even quicker way without even having to create a custom method.  To explain, I'm going to use the good old Employees and Jobs tables from the HR schema.  Lets assume, that when you create a new employee their default role is AC_MGR (account manager) and their default salary should be the minimun salary for an accout manager.  In this case, we'll actually read the minimum salary into the EmployeesVO.Salary field from the JobsVO.Min_Salary field.

1) First create default ADF BC based on Employees and Jobs

2) In the EmployeesVO add a view accessor to JobsVO (and call it JobsView).  This "links up" the EmployeesVO to the JobsVO

3) Set the default EmployeesVO.JobId to AC_MGR

4) Set the default EmployeesVO.Salary to JobsView.findByKey(key(JobId),1)[0].MinSalary

So what does this Groovy expression do?  It "walks" to the JobsVO using the JobsView accessor and then calls findByKey using the JobId.  This returns an array and since we know JobId is unique we can just get the first entry's MinSalary.



About

Tips, Tricks, Events and Information around Oracle JDeveloper, ADF, and Oracle Forms

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today