Sunday, December 30, 2012

After Commit Call for Centralized Transaction Management

With this post I would like to update sample application from my previous post on this topic - Centralized Transaction Management for ADF Data Control. This previous post was about how to call global commit/rollback operations applied for ADF Data Control, without declaring Commit and Rollback in each and every page definition file. Centralized Commit and Rollback operations are created in fragment template, this allows to reuse the same buttons across different fragments. There is one bit we can use to extend centralized transaction management concept - custom method invocation after successful commit. Based on use case requirements, we may need to invoke iterator refresh after commit, etc.

Updated sample application - GlobalTransactionControlApp_v2.zip, implements after commit call. User is changing data and commits transaction with Save button:


Separate method with after commit logic is invoked, this time it just prints static text:


I will describe implementation steps below. Firstly we should provide our custom after commit method name into fragment template - where transaction is commited. For this purpose you can define new attribute for page template definition:


You can look into provided sample application and find there afterCommit attribute defined, we will pass our custom method name through this attribute:


Now take a look into global commit method itself. Two additional lines were added - retrieve custom after commit method name from page template attribute and invoke it as method expression using JSF API:


Method expression construction method is standard, it constructs method expression for any method signature returning void and without input arguments - this is important, otherwise you will need to update invokeMethodExpression method code to support return and argument types. When method expression is constructed, it invokes referenced method:


We move now to consumer part and open fragment, based on our template - depsEmplsView.jsff:


Select af:pageTemplate tag and open Properties window - you should see our custom afterCommit property included into template properties. Provide custom method name, including backing bean name (no need to specify expression brackets, these will be added automatically):


Make sure such bean is defined in the ADF task flow:


Take a look into method invoked after comment signature - no return value and no arguments:

4 comments:

Unknown said...

Hi Andrejus,

you say in your post "We can review ADF performance for deployed apps - AM and ADF Task Flow usage". Is the ADF Performance View showing you the right values?

I have tried on an ADF App with 1x AM and 2xBTFs fragment based but the Java Service Cloud Control always shows 0 AM and 0 TFs as described here: http://multikoop.blogspot.de/2012/12/managing-adf-applications-with-oracle.html

I am curious about your experience. Thanks!

Happy New Year and Greetings from Germany!

Andrej Baranovskij said...

Hi Andreas,

Yes, same for me. In my case I just wanted to say, such views are available. This is true - no performance statistics data reported for AM and Task Flows.

Probably this is a bug or trial limitation...

Happy New Year ! :)

Andrejus

Unknown said...

Thanks for confirming, Andrejus.

BTW: My first comment corresponds to the following post: http://andrejusb.blogspot.de/2012/12/my-adf-sample-apps-live-in-oracle-java.html

Somehow I took the wrong comment button. Feel free to rearrange/recite/delete/move/whatever possible.

Sorry for the overhead;)

Andrej Baranovskij said...

Hi Andreas,

Never mind - I will leave it here :) Enjoy weekend !

Andrejus