Posts

Showing posts from September, 2010

ADF Region Interaction Functional Pattern - OTN Article

There is an excellent article in OTN on 'ADF Region Interaction'.
Please check it out - ADF Region Interaction Functional Pattern

Building a custom event dispatcher for Contextual Events

ADF lets you to create custom event dispatcher to override the default one to provide custom behaviors. In this post, I'm sharing a simple example built using a custom event dispatcher. Please refer this topic 28.7.6 How to Register a Custom Event Dispatcher in Fusion Developer's Guide to learn more about this topic.

A glance at the implementation

1. You can create your own event dispatcher (from scratch) by implementing oracle.adf.model.events.EventDispatcher. Alternatively, if you want to override specific behavior alone then consider sub classing oracle.adf.model.binding.events.EventDispatcherImpl or its base class - AbstractEventDispatcher.

2. Next step is to register the custom event dispatcher in the Databindings.cpx file
<?xml version="1.0" encoding="UTF-8" ?> <Application xmlns="http://xmlns.oracle.com/adfm/application" version="11.1.1.56.60" id="DataBindings" SeparateXMLFiles="false" Package=&quo…

Disabling dispatch of Contextual Events

You can turn off the event dispatch to regions (and child regions) having eventMap with 'producer region' as 'Any'(*) by setting DynamicEventSubscriptions="false" in the pageDefinition file
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.1.56.60" id="somePageDef" Package="view.pageDefs" DynamicEventSubscriptions="false">

Using bind variable for the SQL statements with IN clause

Image
Bind variable improves the performance of query execution by avoiding the repeated parsing of the SQLs (prepare once and execute multiple times). In this post, I'm discussing about the possibility of using bind variable for a ViewObject whose WHERE clause is formed using IN clause.

Obviously, you cannot directly bind a single value to an IN clause and expect it to be treated as many values. A common solution is to have a DB function which takes comma separated String as parameter and let this return a user defined object type. This post is also based on same 'age old' idea. The query generated using the custom db function(in_list_char) to support bind variable for IN clause may look like as shown below,
SELECT Departments.DEPARTMENT_ID, Departments.DEPARTMENT_NAME FROM DEPARTMENTS Departments WHERE ( ( Departments.DEPARTMENT_NAME IN (select * from TABLE (cast (in_list_char ( :CommaDelimitedDeptNames ) as ChartableType))A)) )
Generate custom where clause fragment for…

Excluding the class files from the war file

Image
Sharing a tip about 'deployment' profile configuration I learned recently. JDeveloper lets you to exclude the class files from the war file generated using the 'deploy' option.

How to do this?

1) Right-click on the web project, select 'Project Properties'
2) Select the 'Deployment' option on the left hand side of the dialog. Choose the deployment profile you are interested, click Edit.
3) Under 'File Groups -> WEB-INF/classes -> Filters' select the 'Files' tab. You can deselect the class you don't want to include. Alternatively you can select the 'Patters' tab to specify the pattern for inclusion.

That's it, job is done :)

Undoing changes using Middle Tier Savepoints

While building applications, sometimes you may need to enable undo/redo functionality for your pages. If you use ADF BC for implementing the business services, then one possibility is to leverage the 'Middle-Tier Savepoints' to rollback to a certain point within a transaction instead of rolling back the
entire transaction. Below shown APIs are your friends here.
ApplicationModuleImpl::passivateStateForUndo(java.lang.String id, byte[] clientData, int flags)
ApplicationModuleImpl::activateStateForUndo(java.lang.String id,int flags)

More details can be found in Fusion Developer's Guide - 40.9 Using State Management for Middle-Tier Savepoints. You may need to note down a couple of point here.
1. This approach saves only ADF Model state(in other words , this wouldn't help you to save navigation state/manged bean/memory scope scope variable)
2. Saved state(snapshot) do not survive past duration of transaction

Adding Save Points to a Task Flow

Please note that Oracle ADF provid…

<af:popup> inside <af:table>

Recently, I noticed a couple of issues reported saying that popup dialog is not getting displayed when used inside a table. There are some points you may need to take care while using <af:popup> inside <af:table>

Please keep the definition of <af:popup> outside of the <af:table> .This would ensure table refresh( in other words DOM replacement for table during PPR) doesn't cause any harm to your popup componentPlease don't leave the table rows in an inconsistent state while you iterate through the table rows from the managed bean. Please see this post for more details.

New ADF Book - Quick Start Guide to Oracle Fusion Development

A new book is available on ADF - Quick Start Guide to Fusion Development, authored by Grant Ronald [ Senior Group Manager Product Management - ADF ]
The goal of the book is to give developers/sales/support/pre-sales/managers/anyone! an accelerated hit of essential ADF knowledge without having to spend months going through thousands of pages of developer guides and on-line help.

Please check out this blog post from Grant to learn more about this book.

Annotate your ApplicationModule to persist complex objects during passivation

The ApplicationModule component is smart enough to automate the state management for your application. While ApplicationModule takes care of the state management for the ViewObjects and EntityObjects (pending transaction state) during the activation-passivation cycle, it doesn't really care about the custom business objects that you might have created during the service invocations. There may be some rare scenarios where you may need to passivate these variables to avoid the expensive instantiation each time. This blog post discusses a customized solution for the above scenario - a solution for passivating your custom business objects.

A couple of weeks back, Kavin Kumar - a colleague of mine - shared a solution (which has been used in their application) for persisting complex objects during the passivation of ApplicationModule. This post is inspired by this idea. So the credit goes to Kavin :)

Use Case Requirement

A specific business service methods defined in the ApplicationModu…

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.