Tuesday, July 23, 2013

ADF BC 12c New Feature - Row Finder

One of the new ADF BC features in ADF 12c - Row Finder. Row Finder acts as a helper for View Criteria to pass bind variable values and call query functionality. Important technical detail - instead of changing original rowset displayed on ADF UI, Row Finder creates and returns new rowset for results. This allows to search and get results with the same VO instance in parallel to the data displayed on ADF UI, without affecting original rowset accessed through bindings. At the moment it is possible to invoke Row Finder only programmatically through ADF BC API.

Here you can download sample application where Row Finder is implemented - RowFinderApp.zip.

When implementing Row Finder, firstly you need to define View Criteria. Here is View Criteria from sample application - filtering by First Name:

Once View Criteria is in place, you can go and define Row Finder (you must have View Criteria defined first). Set mapping between Bind Variables included into View Criteria and Attributes from where value is supposed to be supplied on runtime:

Later when invoking Row Finder through ADF BC API, we will need to set Attribute List with Attribute name and value pair.

There is custom method created in VO implementation class, this is where we call Row Finder:

Here is Row Finder invocation API example. Row Finder is invoked through execute(AttributeList, VO) method. We need to supply value for attribute name defined in Row Finder wizard previously. I'm getting value from current row. As you can see - Row Finder creates and returns another row iterator, without affecting original rowset of current VO instance. Basically it call new SQL query:

Custom method returns value - number of rows matching First Name from current row and is referenced from ADF bindings:

Later we display number of filtered rows in the popup on ADF UI. Here you can see example for 'David' - 3 rows located:

There are 9 rows for 'D':

The best of all - displayed rowset is not affected, we can move to another record and see that it comes from original rowset - 'Bruce':

No comments: