Friday, November 30, 2012

Oracle Cloud Control - ADF

Oracle Cloud Control is implemented with ADF - it looks really beautiful and functional. I prefer such simple and clean UI design:

Oracle Cloud provides DB and WebLogic services - next step I will try to deploy custom ADF application and will see how it works.

Active Data Registration Error in ADF (Some Bugs Never Die)

Some bugs never die. This is true for Active Data Registration error in ADF. Error happens after exporting to Excel or after uploading file and pressing button, tab, etc. as the next action after export or upload was completed. Same error happens when invoking print behavior - Issue with Show Printable Page Behavior in ADF 11g R2 ( This is reproduced across 11g R1 and 11g R2 releases, also with the latest JDeveloper 11g (

There are various workarounds for this issue - set Page Definition iterator ChangeEventPolicy=none or set ContentDelivery=immediate for the table, etc. There is no single workaround recipe - it all depends on ADF UI complexity.

Sample application -,  contains one task flow with the fragment:

Fragment contains two tabs, first one contains Employees table and Export (to Excel) button with standard ADF export to Excel operation. Second tab is empty, I will use it to switch after export operation is completed:

We export to Excel and press Second Tab - ADF returns active data registration error:

We can fix it by navigating to page definition, and changing ChangeEventPolicy=ppr:

To ChangeEventPolicy=none:

If the same bug will be reproduced in the next ADF release - I will repost it again.

Wednesday, November 28, 2012

Centralized Transaction Management for ADF Data Control

Did you ever had an idea to implement centralized Commit/Rollback management in ADF application. This would allow to save development time, no need to create Commit/Rollback operation in each page definition file - forget about this. You can manage transaction on ADF Data Control level and I will show you how with this sample application -

Sample application contains two Application Modules, we need to have two in order to test if both of them will be commited/rollbacked together through our centralized transaction management solution:

There is fragment template implemented to keep our global Save/Cancel button for Commit/Rollback:

Fragment template contains two regular buttons in the toolbar:

Each button is calling Action Listener method from managed bean:

Here is real main point of this post - Java code to execute generic Commit/Rollback action for every active Data Control. This code is iterating over active Data Controls and if transaction is dirty it performs Commit or Rollback:

This allows to skip Commit/Rollback operations definition in every single page definition file and saves  development time.

Here how it looks on UI - we display data from different Application Modules but there is only one Save button:

This button is forcing to commit all pending changes from centralized method:

If exception happens, we catch it and display to the user.

Monday, November 26, 2012

ADF Mobile - Live on iPhone Device

We are going to walk through the process of ADF Mobile application installation on iPhone device. I will use application from my previous post - ADF Mobile - Secured Web Service Access. Besides deployment process, I will describe how I'm testing on device application through my local wireless network. I would recommend first to go through very useful video tutorial from Oracle related to ADF Mobile deployment on iPhone device - video. Read section from developer guide - 16 Deploying ADF Mobile Applications.

Here you can download a set of sample applications (described in blog post above) I will use today -

If you want to deploy on iPhone device, first you should purchase Apple Developer program access. Once you will get access to Apple Developer program, go to iOS Provisioning Portal:

You should launch Development Provisioning Assistant from iOS Provisioning Portal - it helps to setup deployment environment literally in minutes:

You will generate development certificate on iOS Provisioning Portal:

Copy this certificate to your Apple machine and register it in Key Chain for authenticated user, it should appear under Certificates section. You will need this long certificate name a bit later - to copy it and save into JDeveloper preferences:

Register your iPhone device on iOS Provisioning Portal:

Last registration step - setup Application ID and Development Provisioning Profile (download it to your Apple machine). Application ID is very important thing - make sure to add your package name and put * at the end - this will allow to reuse the same Application ID for multiple applications (you will see it below):

There is Organizer utility from Apple, packaged into Xcode. This utility allows to manage your iPhone device deployment from single central place - open it from Xcode -> Organizer menu and manage applications, provisioning profiles, etc.:

Very important thing - you should get URL for Provisioning Profile from Organizer (select Reveal Profile in Finder). You can simply drag and drop Provisioning Profile downloaded from iOS Provisioning Portal into Organizer window. URL in JDeveloper preferences should point to Provisioning Profile imported into Organizer:

ADF Mobile application is packaged as *.ipa file - you can drag and drop this file directly into Organizer and it will be uploaded and installed automatically on iPhone device (installation process is pretty simple as you can see):

Provisioning Profile URL in JDeveloper should point to the file imported into Organizer. Certificate is a long name from Key Chain utility:

Very important: if you want to avoid error about missing Application ID in Provisioning Profile - be careful when setting Application Bundle Id in JDeveloper deployment profile for your application. This Id must start with the same package name as it is set in Provisioning Profile, it can be appended with application custom package (* replacement):

Same Id should be set in adfmf-application.xml file:

Deploy to *.ipa file by deploying to distribution package from JDeveloper:

When application is installed, you can test connection to the server side (secured Web Service in my case) on the local network. Make sure that ADF Mobile application contains local IP configuration in connections.xml file, verify your local network IP for development machine (ADF Mobile application should be able to access this IP):

Here you can see my phone screenshot with ADF Mobile application login screen:

Secured Web Service invocation:

Successful access on the server side:

Friday, November 23, 2012

ADF Mobile - Secured Web Service Access

I will dig today into secured Web Service access from ADF Mobile. There are good tutorials how to consume open Web Service in ADF Mobile, but in practice almost every Web Service exposed for the mobile must be secured - who wants to expose open Web Service on the public internet? ADF Mobile doesn't support Web Service Java Proxy, you have an option to use Data Control generated directly from the Web Service -  I will explain the steps how to configure such Data Control for secured Web Service access. Thanks to Joe Huang (ADF Mobile Product Manager) - he gave me very useful hints to finalize secured Web Service invocation from ADF Mobile.

In my next post - I will explain how to deploy and test the same application on real iPhone device.

I would recommend to read - 10.5 Accessing Secure Web Services, this is a good guide - but I will try to cover certain gaps. You can download sample application - This archive is based on previous blog sample application - ADF Mobile - Login Functionality and contains three applications:

1. ADFBasicAuthApp - typical ADF application with basic ADF security authentication enabled. This application is installed as authentication server.

2. ADFMobileSecuredApp - ADF Mobile application with deployment profile for iOS simulator. Implemented secured home page and configured with login page. Calls secured Web Service.

3. ADFSecuredService - ADF BC application enabled with Web Service from Application Module.

From this diagram you can understand all the relationships implemented in the sample application:

Access to ADF Mobile application is authenticated through WebLogic server security realm. Once initial authentication is completed - user is able to call secured Web Service. ADF Mobile injects user security information into Web Service header, security information is retrieved from security store constructed after login.

We should look now into the service part - where secured Web Service is implemented (ADFSecuredService application). Standard service interface is defined for Application Module and one custom method is exposed:

Custom method is not doing anything fancy, except that it prints success message:

How you can secure such Web Service? Just select implementation class in the structure window:

Locate OWSM Policies section in the Properties window and open property editor. There are different properties available, for this sample application I was using - oracle/wss_username_token_service_policy:

You can double check if security policy is assigned successfully for Web Service implementation class:

This is all with the service part, now we are going to switch to the ADF Mobile part (ADFMobileSecuredApp application). As I have said earlier, ADF Mobile doesn't support Java Web Service proxy, so we are going to use Web Service Data Control directly:

Once Data Control for Web Service is generated (I skip this part, because it is well documented anyway - just Google), you should select it in the Structure window, right click and choose - Define Web Service Security:

In the wizard, for your convenience - check option for Show only the compatible client policies for selection - this will filter only these security policies applied supported by the Web Service on server side:

Now we are approaching one of the most critical points in this post - connections.xml file configuration in ADF Mobile application:

This file defines two connections:

1. Authentication Server for Login
2. Secured Web Service

Both of these connections must point to the same adfCredentialStoreKey. There is a bug in current version, when you generated Web Service Data Control for ADF Mobile application - by default it is using different property name - credentialStoreKey. You should fix this property name manually to be adfCredentialStoreKey (check sample application). This is known issue - Enabling Credential Injection to Web Services (14726089).

Once again - adfCredentialStoreKey for authentication server:

Must be the same as for the secured Web Service:

Configuration is completed - now we can test it. Add button on ADF Mobile UI screen to invoke method from secured Web Service data control:

ADF Mobile is using the same bindings concept as regular ADF - action is defined in the page definition file, this action is responsible to call method from secured Web Service:

Run application on iPhone simulator directly from JDeveloper environment:

Few seconds and we are ready to login into ADF Mobile application:

Authentication is successful - press Test Web Service Secured Access button to invoke custom method from remote secured Web Service:

Check server log - method was invoked successfully:

Sunday, November 18, 2012

Check Box Support in ADF Tree Table Different Levels

Year ago I had a blog post about workaround to render check box in ADF tree table - ADF Tree - How to Autoselect/Deselect Checkbox. This was implemented with previous JDeveloper 11g R1 PS4 version. However, there is no need to have described workaround anymore, check box and ADF tree table combination works much better in JDeveloper 11g R2 version - Based on blog reader request, I will post today updated sample application -

Both entities - Regions and Countries have special attribute of Boolean type, this attribute will be rendered as check box in ADF UI tree table component. There is no need to have helper attribute as we had before. Regions entity:

Countries entity:

Once Regions check box is checked - all Countries are checked (and vice versa). We can control this from managed bean - listening for value change event in Regions and resetting Countries:

On ADF UI side, in order to be able to render proper tree table structure with check boxes - don't forget to set rendered expression, we want to render check box only for such rows, where check box value is not Null:

Take a look how it is displayed on UI. China is selected, from Asia group:

Select Asia check box - all countries from Asia will get selected automatically (thanks to managed bean method we have implemented above):

Uncheck Asia check box - all dependent check boxes are unchecked:

While Region check box is checked, you can uncheck/check Countries check box as well. This is one of the most typical use cases for check box support in ADF tree table.