Friday, July 25, 2014

MDS Support for Mobile Application Framework (MAF) in JDeveloper 12c (12.1.3)

MAF framework in JDeveloper 12c (12.1.3) comes with MDS support. This means, we can customise mobile applications in similar way as we customise regular ADF Web applications. I'm going to explain and demonstrate with the sample application, how it works in MAF 2.0. You can read about it more in MAF 2.0 developer guide, Customizing MAF AMX Application Feature Artifacts.

Sample application, tested with iOS platform - MAFMobileLocalApp_v2.zip. Original version of this application brings Locations screen, where both City Name and Street Address are displayed:


We are going to customise original application with MDS, without changing source code directly. Customized application is based on two MDS tip layers - gold and silver level partners. Gold level partners are able to see State Name in addition to the Street Address:


While silver level partners are allowed to see only City Name:


To achieve MDS functionality behaviour for MAF application, you must define first MDS customisation class, this class must extend from standard MDS CustomizationClass and implement several methods. Important method is getName(), you must define MDS customisation name, the same name will be used for customisation (JDeveloper automatically reads this name during MAF application design time):


Customization class must be set in add-config.xml MDS section, in order to be registered for customisation use:


Once customisation class is registered, we can switch JDeveloper to the Customization Developer mode and start customizing application:


Make sure MDS layers are properly configured in CustomizationLayerValues.xml file. Customization layer must be set to the same name as you set in Customization class above. Layer values should specify different layers supported for customization:


I have defined two layers - gold and silver partnership. MDS layer can be selected for customisation, we start from Gold:


Locations page is updated to include State Name:


However, actual change is stored not in Location page, but in generated MDS file for Location page - it keeps delta for the changes made in customization mode. This file is generated under Gold Partnership profile folder:


State Name addition required to update Page Definition file for Locations, there is extra MDS file created with delta information for Locations Page Definition:


Next we can customize for Silver layer - change layer value:


Here we should keep only City Name and remove Street Address:


This change is reflected in MDS delta for Locations page, stored under Silver Partnership level:

Friday, July 18, 2014

Red Samurai ADF Performance Audit Tool v 3.2 - Large Fetch and Full Scan Audit Optimizations

Red Samurai ADF Performance Audit tool was updated with new features. Current update v 3.2 is focused on improvements for Large Fetch issues auditing, additionally we are able to track Full Scans (when user is fetching all rows and row count exceeds a threshold).

There are two additional threshold parameters introduced - WAT (Wait Activation Time) and WFT (Wait Fetch Time). These two are used to track long activation and fetch times in more accurate way. For simplified migration process from v 3.1, if no configuration is set in the database - default values are applied:


Large Fetch issue reports time it took to fetch rows, before it was reported only a number of rows fetched:


Audit tool knows how to track Full Scan - issue when user is fetching all rows and number of fetched rows exceeds Large Fetch threshold. This is useful, as it allows to understand specific cases, where we could optimise ADF code and potentially avoid fetching all rows:


Full Scan is reported together with all other issues, it is included to be a part of Performance Analysis graph:


Slow Query drill down was updated, to display VO instances with most recent slow query issues first (in red - number of issues in the recent 5 days):


Table with most recent Slow Query issues was redesigned to display issues in better ordered way. Today issues are displayed first, then issues from Yesterday, followed by Latest in 5 days and then All issues. Average time for each slow VO instance is calculated and displayed:


Daily Trend for VO instance was introduced in v 3.1, now tool also supports Monthly Trend - this allows to understand performance tuning impact better:


Large Fetch drill down was updated, it displays proportion of Large Fetch and Full Scan issues. List of VO instances reported with Large Fetch issues is redesigned in the similar way as for the Slow Query:


Today, Yesterday, Latest (5 days), and All issues are displayed. Average time is calculated and displayed for VO instance large fetch. Monthly Trend is calculated in the similar way as for the Slow Query.

Graphs displaying large number of days are configured with zooming - Daily Transactions and Logged Users graphs support zooming now:


User can zoom in data, this helps to analyse data points in specific days:

Thursday, July 17, 2014

ADF Mobile 12c (MAF) Support for Master-Detail Data Control

ADF 12c is shipped with renamed mobile platform framework - Oracle Mobile Application Framework (MAF). Previously this was named ADF Mobile. 12c MAF is based on ADF Mobile and provides additional functionality and improvements. Everyone familiar with ADF Mobile 11g, should get up to speed with 12c without issues. I would like to highlight one interesting improvement implemented in 12c MAF - out of the box support for Master-Detail relationship. In previous 11g release, master record key was not preserved across different pages - developer was forced to store selected key in memory, to call execute method through invoke action in the second page and finally to reset a key. There was an alternative solution, described by Steven Davelaar - ADF Mobile – Preserving the Current Row Across Pages. Approach described in Steven's blog seems to be integrated into 12c MAF, there is no need to manage selected Master key manually, framework does this for you.

Sample application - MAFMobileLocalApp.zip, is based on HR schema loaded into local SQLite database and implements 2 level Details. Top Master is a Region:


First Detail screen brings a list of all Countries, from selected Region:


Second Detail screen displays available Locations, from selected Country:


Sample application provides navigation springboard, now there is only one Task Flow available - Address (may be there will be more options in the future):


Overall, 12c MAF is a great step forward - improved performance, better and cleaner UI, new features. MDS Seeded Customizations are supported now for mobile applications implemented with 12c MAF.

Sample comes with HR schema structure and data:


HR structure and data is loaded to the local SQLite database on initial application startup:


SQLite database is a physical file and we are opening JDBC connection. This is a database for single user, one user will be using it - no concurrency:


I will describe below, how to create Master-Detail structure and generate Data Control. There is a special extension available for similar task - A-Team Mobile Persistence Extension for Oracle MAF. However, for this exercise I would like to do it myself.

Firstly we should start with a model. There is Master-Detail relationship between Regions and Countries. Region object included a list of Country objects:


Country object in turn includes a list of Location objects, this is 2nd dependency:


This is our basic model, nothing complex. Model needs to be populated with data, this can be done with SQL, as all our data is stored locally in SQLite DB. Region, Country and Location rows are retrieved using SQL, Master-Detail relationship is populated manually:


Master-Detail relationship would not work, if there would be no Primary Key defined for Master object. By default, key is not set, when Data Control is generated. We need to edit Data Control object explicitly:


Here we can set a Primary Key for the attribute:


Task Flow displays relationship between Regions -> Countries -> Locations, there must be Primary Key set at least for Regions and Countries:


Important rule to know, 12c MAF doesn't really remembers current row in Data Control - it rather searching for iterator name and retrieves current state. This means, iterators in different pages must have the same names, otherwise current row key will not be resolved (even for the same data model object).

As for example, Region fragment:


Is based on data retrieved from regionsIterator:


This means Country fragment, displaying detail data:


Must have reference to Master iterator with the same name, as it is created in the first page Region (regionsIterator):

Saturday, July 12, 2014

ADF 12c (12.1.3) Line Chart Overview Feature

ADF 12c (12.1.3) is shipped with completely rewritten DVT components, there are no graphs anymore - they are called charts now. But there are much more, besides only a name change. Previous DVT components are still running fine, but JDeveloper wizards are not supporting them anymore. You should check ADF 12c (12.1.3) developer guide for more details, in this post I will focus on line chart overview feature. You should keep in mind, new DVT chart components do not work well with Google Chrome v.35 browser (supposed to be fixed in Google Chrome v.36) - check JDeveloper 12c (12.1.3) release notes.

Sample application - ADF12DvtApp.zip, is based on Employees data and displays line chart for the employee salary, based on his job. Two additional lines are displayed for maximum and minimum job salaries:


Line chart is configured with zooming and overview support. User can change overview window and zoom into specific area:


This helps a lot to analyse charts with large number of data points on X axis. User can zoom into peaks and analyse data range:


One important hint about new DVT charts - components should stretch automatically. Keep in mind -parent component (surrounding DVT chart) should be stretchable. As you can see, I have set type = 'stretch' for panel box, surrounding line chart:


Previous DVT graphs had special binding elements in Page Definition, new DVT charts are using regular table bindings - nothing extra:


Line chart in the sample application is configured with zooming and scrolling (there are different modes available - live, on demand with delay):


Overview feature is quite simple to enable - it is enough to add DVT overview tag to the line chart, and it works:

Thursday, July 10, 2014

ADF 12c (12.1.3) New Feature - ADF Query Item Reordering and Custom Operators

There are quite many new features in ADF 12c (12.1.3). One of them - ADF Query item reordering on runtime, user can choose the order to display criteria items displayed in ADF Query. View Criteria wizard in JDeveloper is updated, besides Criteria UI Hints (as we had before), now developer have access to Item UI Hints (here you can set item visibility, multiple values selection and removable support). Important addition - new tab in the wizard to define and manage Custom Operators for View Criteria items (this was possible before directly in the source code, now we have a wizard).

Here you can see new View Criteria wizard in ADF 12c (12.1.3) with UI Hints tab for each criteria item. I have set First Name criteria item to be rendered only in Advanced mode, also with removable option:


Custom Operators tab allows to create new operator or update/remove existing one, very useful feature to manage criteria search options:


ADF Query UI remains unchanged (by the way, First Name is not rendered in basic mode as it should):


Go to advanced mode - First Name is rendered now. There is additional button - Reorder. New functionality in ADF Query 12c (12.1.3):


Reorder brings a popup with ADF Query items, user can move Email to be the first item:


ADF Query is updated with the change - Email item is the first:


Even after returning to basic mode - order remains. I believe this will be quite useful functionality, especially for large ADF Query blocks with many criteria items:


Download sample application - ADF12cQueryApp.zip.