Skip navigation.

Andrejus Baranovski

Syndicate content
Blog about Oracle technology
Updated: 11 hours 27 min ago

Standard ADF BC Passivation/Activation for Transient View Object

Tue, 2014-08-05 15:20
If you want to implement transient View Object in ADF BC, you must make sure it will be passivation/activation ready, otherwise you may loose data. There are several ways how to achieve passivation/activation for such View Objects - override passivation/activation lifecycle and handle transient View Object rows programmatically or reinitialise transient View Object rows from Application Module prepareSession method. There is one more solution, I'm going to describe it in this post. It is based on dummy SQL based View Object, designed to to store transient attribute values.

Sample application - ADFTransientVOPassivationApp.zip, implements SQL based View Object with transient attributes. Instead of creating completely programmatic View Object, I have created SQL based with single Id attribute based on SQL expression and added transient attributes. This Id attribute is actually never used, it is there just for only reason - to simulate SQL based View Object. As a key attribute is selected one of the transient attributes:


SQL query doesn't fetch any rows, I'm using it only for a single reason - to simulate SQL based View Object. ADF BC knows how to passivate/activate SQL based View Objects automatically, so I'm going to use this feature and force passivation/activation for all transient attributes created for the same View Object:


Just make sure to select Passivate Including All Transient Values option, this will ensure all transient attributes will be passivates/activated automatically, without any coding intervention:


I'm going to test sample application with AM pooling off, this would simulate passivation/activation behaviour for each request:


On ADF UI side, I'm going to implement a table. To be able to enter rows successfully, for such SQL based View Object with transient attributes, I must enable ChangeEventPolicy = ppr option in Page Definition for the iterator:


Input components must be set with AutoSubmit = true option:


On runtime, when I enter rows, all data gets passivated - you can see this from the log. Three rows are entered, data for all attributes gets passivated/activated automatically:

Handling Rollback Operation for ADF Input Components with Immediate Property

Sun, 2014-08-03 02:44
One of my colleagues is implementing advanced dynamic ADF BC/ADF UI functionality. To force validation to be invoked properly, he must use ADF UI input components set with Immediate=true property. This allows to keep validation messages always displayed, even if user navigates to edit another dynamic ADF UI input attribute, until form is submitted or canceled. However, as by JSF design - usage of input components with Immediate=true, blocks execution of command components, if there are validation errors available. This means - user can't use Cancel button to reset the form with validation errors, until he would fix these errors manually. However, there is a potential solution - we could use ADF subform component to isolate input components, with a combination of ADF View reload to refresh rendered UI.

Sample application - ADFAttributeImmediateApp.zip, implements  basic ADF Panel Form Layout with a set of input components. Each of these input components is set with Immediate=true property:


Let's say there is validation error on the screen for input text component with Immediate=true property:


Try to press Cancel button - no action will happen, it will continue complaining about validation error:


This is how it supposed to be - by default, Cancel button will not be invoked, because Immediate=true validation from input component would block it. We could improve it and adjust for our specific scenario to make sure Cancel button will be invoked, even with validation errors on the screen. We should surround input components with ADF subform component, this allows to isolate from Cancel command:


Cancel button must stay out of ADF subform, this will make it possible to invoke Cancel action listener method, even with immediate input components available on the same screen (but surrounded with ADF subform):


Action Listener for Cancel button gets invoked and reset happens now, no matter if there is validation error for input component with Immediate=true:


There is one extra bit - even with Rollback operation executed, UI would stay unsynchronised and keep displaying validation message until next submit. It requires to force ADF view refresh - you should recreate ADF view programmatically from the same method, where you are invoking Rollback operation:

Oracle BPM 12c Installation Improvements and Issues with Mac

Sat, 2014-07-26 10:13
Oracle BPM 12c is improved with a great installation process - simplified and stable. You only need to download single installation package, run a wizard and after several clicks it gets installed. All required products are installed for you out of the box, no extra configuration is needed - JDeveloper, BPM/SOA extensions, BPM/SOA schemas in Java DB. Developer can focus on his development tasks, no need to spend days to install and configure development environment. You should read official guide - Quick Start for Oracle Business Process Management Suite.

Installer works on Mac OS platform, you can install entire Oracle BPM 12c infrastructure and run domain. However, it fails to open Human Task wizard, while running JDEV on Mac OS. I have developed extremely basic Oracle BPM 12c sample application, to test Human Task wizard with JDeveloper installed on Oracle Enterprise Linux and on Mac OS - BpmApplication.zip.

It works fine to load Human Task wizard with JDeveloper 12c installed on Linux:


The same Human Task fails to open with JDeveloper 12c installed on Mac OS. There is Null Pointer exception generated, thrown from JDeveloper IDE class:


Messages in JDeveloper log for this exception:


Probably you should not use Oracle BPM 12c for development on Mac OS, rather use Linux or Windows platforms. This is a bit pity, but on other hand JDeveloper extensions (except ADF Mobile) always had issues running on Mac OS. It should be no difference, but it seems like development on Linux or Windows with JDeveloper is more stable.

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

Fri, 2014-07-25 06:27
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:

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

Fri, 2014-07-18 10:05
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:

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

Thu, 2014-07-17 14:15
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):

ADF 12c (12.1.3) Line Chart Overview Feature

Sat, 2014-07-12 10:51
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:

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

Thu, 2014-07-10 01:21
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.

ADF BC 12c New Feature - Entity-Level Triggers

Tue, 2014-07-08 08:13
We have triggers support in ADF 12c! Powerful new feature is available - Entity-Level triggers. Previously it was often confusing if certain use case belongs to validation rule, or it is more generic business logic. Everything was implemented as part of validation rule in the EO. ADF 12c provides cleaner approach by supporting option of Entity-Level triggers, along with regular validation rules. Validation logic can be implemented as part of validation rule, non-validation (but still dependent on data management lifecycle) logic can be implemented as part of new Entity-Level trigger.

ADF 12c EO wizard offers new section - Entity-Level Triggers. Here you can define different triggers, for example - before update, before commit, after insert, before delete, etc.:


This means, you can inject any custom code to be invoked by the framework, during certain event from ADF BC lifecycle.

Wizard allows to select trigger type and define Groovy expression, here you can call any custom method from EO Impl class. However, there is one trick related to expression execution in untrusted mode - I will describe it below (thanks for a hint to Steve Muench):


Custom method is defined in EO Impl class, you can see it here:


If you simply define a trigger and try to test it, you will get an error about not permitted method call:


Trigger expression by default is running in untrusted mode, this means your custom method must be annotated with @AllowUntrustedScriptAccess. If you don't want to annotate, you could change trust mode to trusted for the expression. By default trust mode is set to be untrusted:


Change it to trusted mode:


Trigger should work just fine now. Try to change data and save:


There are two triggers defined - before update and before commit. Both of these triggers are invoked successfully, as you can see from the printed log (right before update and before commit):


Download sample application - ADF12cApp.zip.