Tuesday, August 30, 2011

Oracle Open World 2011 Sessions and Activities

This year even more busy OOW'11 is approaching for me - abstracts are accepted for 3 Oracle Develop sessions and will be presenting on:
  • Texas A&M University System Architecture: Oracle ADF, Oracle WebCenter Portal and Content (ID: 2923)  Texas A&M University System and Red Samurai Consulting technical session about Oracle ADF, WebCenter and UCM integration into one production system. My colleague from Texas A&M University System will explain and demo production Oracle Fusion system.
  • Oracle Business Intelligence/Oracle ADF Integration Using the Action Framework (ID: 4862) Joined session with Mark Rittman, from Rittman Mead Consulting. We will explain how Oracle BI integrates with Oracle Fusion and ADF technologies
  • Oracle ADF Enterprise Methodology Group: A+-Quality Oracle ADF Code (ID: 32481) ADF Community is growing and getting stronger with every year, time to talk about ADF Code Quality and not only about Quantity :)



Will be attending Oracle ACE Directors briefing and Oracle WebCenter Partner Advisory Board in Redwood Shores right before OOW.

I'm looking forward to catch up with all friends and colleagues, see you soon in San Francisco !

Sunday, August 28, 2011

Difference Between Fetched Row Count and Just Row Count

While implementing various validation rules in ADF BC, we can call two methods to get number of rows for specific entity - getFetchedRowCount() and getRowCount(). What's the difference between these two and what you should keep in mind? In case if Master-Detail screen is separated into two pages or two fragments - detail entity will be populated and data will be fetched only after this entity will be directly accessed. This means that getFetchedRowCount() returns count for rows already loaded into memory. In contrary, getRowCount() loads rows into memory (if there are no rows loaded) and then returns row count. Both of these methods are good and useful in specific use cases. ADF developer should understand the difference to avoid unexpected behavior.

Download sample application - ADFMasterDetailImpl.zip. This example implements simple Master-Detail relationship between Departments and Employees:


Master-Detail splits into two parts on UI as well, one page for Departments and another for Employees:


During our experiment, we will load only Master page with Departments data and invoke remove() operation. Inside remove() operation, we can implement validation rule to check if any child record exist for current Master record we are deleting. Let's say we are using getFetchedRowCount() method for this:


Keep in mind, Detail screen is not opened yet - only Master screen records are loaded into memory. Invoke remove() operation by clicking Delete button:


There are no records fetched yet for detail, so it looks like there are no Detail records for current Master:


Now we execute getRowCount(), this method will return real count - not from memory:


After getRowCount(), again is executed getFetchedRowCount() method.

We have learned - first there are no records loaded, we are executing getRowCount() it populates records into memory. After that, getFetchedRowCount() returns correct number of rows as well:


Hopefully this helps to understand better specific difference between two methods for row count.

Friday, August 26, 2011

ADF Enterprise Methodology Group (EMG) Sunday during OOW

The ADF Enterprise Methodology Group (EMG) presents a complete day of ADF developer topics on Sunday October 2nd. Action will take place - (Moscone West - room 2000). See you there !

Agenda:

- 09:00 - Sten E. Vesterli
  Session 32460 - Starting an Enterprise Oracle ADF Project
- 10:15 - Frank Nimphius & Maiko Rocha
   Session 32480 - Learn Oracle ADF Task Flows in Only 60 Minutes
- 11:30 - Andrejus Baranovskis
   Session 32481 - A+-Quality Oracle ADF Code
- 12:45 - Wilfred van der Deijl
   Session 32500 - Transitioning from Oracle Forms to Oracle ADF
- 14:00 - Steven Davelaar
   Session 32501 - Empower Multitasking with an Oracle ADF UI Powerhouse
- 15:15 - Lucas Jellema
   Session 32502 - Gold Nuggets in Oracle ADF Faces

Wednesday, August 24, 2011

Proactively Controlling ADF Query Execution with Estimated Row Count

In ADF BC we can configure how many rows VO should return, however in the background it still will execute entire SQL statement without attaching rownum < X to it. We can prevent this by overriding executeQueryForCollection method and checking estimated row count, before invoking actual SQL statement:


As you can see, if estimated row count is higher than expected limit - we are throwing our custom JboException. This exception is handled in overriden DCErrorHandler class and reported nicely to the user:


You can declare your custom DCErrorHandler class through DataBindings:


VO contains View Criteria, where we are checking for Salary attribute to be > X. Criteria attributes are set to be selectively required as well, to prevent blank searches:


Blank searches will be restricted:


If user enters such criteria, which will bring result set exceeding predefined limit, application will terminate SQL execution and show warning message to the user:


In case if search criteria brings less results than predefined limit, SQL is completed successfully:


Download sample application - ADFProactiveQueryPerformance.zip

Sunday, August 14, 2011

Further Customizing WebCenter PS3/PS4 RSS Task Flow - RSS Items List

I have received request from blog reader, based on my previous blog post - Extending WebCenter 11g PS3/PS4 ADF Task Flows - RSS Example. Standard WebCenter PS3/PS4 RSS task flow is missing one very important property - number of RSS items to be rendered in the list. Request was about how to add such property and extend existing RSS task flow.

Download sample application, it extends WebCenter RSS task flow through seeded MDS customizations and provides ability to specify number of RSS items to be rendered - EnterprisePortalApp_v6.zip.

There is no option to add new RSS task flow parameter with seeded MDS customization, so we should follow different approach. What we can do is to append RSS feed URL with number of RSS items we want to render. I will describe below, how to customize standard WebCenter RSS task flow, in order to be able to append this property to RSS feed URL. For example, if we want to render 3 items, we will append ?rss=3:


For 7 items, append ?rss=7:


For 10 items, append ?rss=10 and so on:


Two RSS feeds are rendered, using extended WebCenter RSS task flow, different number of RSS items (3 and 7 as it was defined above):


Another RSS view, with 10 items as defined above:


How we can extend WebCenter RSS task flow? For basic steps and JDeveloper configuration, follow this blog. Once you understand basic steps, we can move forward. Let's define managed bean in request scope, it will act as RSS helper bean and will be used to parse RSS feed URL:


This bean defines two methods. GetRSSFeedLocation() method is to parse RSS feed URL and remove all custom parameters - otherwise original WebCenter RSS task flow functionality will not work. GetRSSItemsNum() method is to retrieve number of RSS items to be shown:


Once we have our custom methods in place, as per previous blog post - ensure that seeded MDS customizations are enabled:


Switch to Customization Developer mode, we will modify WebCenter RSS library:


Make sure site level customization context is enabled:


First customization we should apply is for RSS link:


Make sure that RSS destination is set to point to RSS feed location retrieved from our RSS helper bean:


In order to control how many items we want to show in RSS list, we should change original RSS task flow implementation and switch af:table component with af:iterator:


Make sure that Rows property for af:iterator point to our RSS helper bean method - it will parse RSS feed URL added parameters and return how many RSS items should be shown:


Page definition for RSS viewer, contains method which constructs RSS items list. RSS feed location URL must be changed here as well to point to custom RSS helper bean:


In order to review applied customizations, you can go to ADF Library Customization package and expand it:


You will see applied customization for page definition file of RSS viewer, RSS list construction method:


RSS viewer UI customizations are stored in MDS as well - table switch with iterator:


RSS link customization, to retrieve RSS feed URL from custom RSS helper bean:


Wednesday, August 10, 2011

How to Control Long SQL Execution Time in ADF BC with VO Timeout

Who likes, when ADF screen hangs on long running SQL query? I guess no one, so today I will describe how to take control on long running SQL queries and bring ADF screen back to life. ADF BC allows to set VO query execution timeout, we can apply this approach to limit SQL query execution time and make it predictable.

We need to simulate long running query, for this purpose I have created PL/SQL function with conditionally infinite loop. Based on function parameter, if parameter value is greater than 0, loop is terminated. This function is simulating both cases - long and fast running queries:


PL/SQL function code, you can find it inside sample application, Model project. In order to run sample application (ADFSQLTimeoutSample.zip) you can compile given PL/SQL function inside HR schema:


We can define new transient attribute on VO level to invoke PL/SQL function (Query Expression) with infinite loop and slow down entire VO query:


VO query statement to be executed:


PL/SQL function accepts input parameter, this parameter is initialized from View Criteria bind variable, but for default VO query execution we need to make it to be required - so SQL query will not fail, when running with empty bind variable:


Because bind variable is marked as Required, it will appear in the UI, so let's set Display Hint = Hide:


We have View Criteria, it will be used to execute search operation and assign bind variable value (Salary):


Thats almost it about VO, AM contains one custom method, this method will be used to set VO query execution timeout limit:


VO query timeout execution limit is set for VO instance, by calling setQueryTimeOut(milliseconds) method:


It is important to catch SQL exception inside executeQueryForCollection method, defined inside VO implementation class. If we don't catch exception inside this method, once timeout will happen - UI will be broken. Exception will be handled by code and reported by JboException that will be rendered in UI:


On controller layer, bounded ADF task flow should invoke default Method Call, it will set query timeout for certain VO instance (as described above):


Sample application is set with maximum VO query execution time to be 6 seconds (6000 milliseconds = 6 seconds * 1000). This means, if query will be running longer than 6 seconds, it will be terminated and control will return back to the user.

Here I'm doing a test now, search is done without specifying value for bind variable (Salary), this means PL/SQL procedure will enter infinite loop. However, because query execution timeout is defined for 6 seconds, it will stop and inform user about terminated long running query:


Provide value for Salary field, we will not enter into infinite loop and results will be returned:


With results rendered, lets try again to execute infinite loop. Again long running query will be terminated nicely:


Let's do a search again, including Salary value - results are returned:


If we would not use query timeout, it would run forever (or at least as long, as it needs to run) and consume all server resources: