Tuesday, September 27, 2016

BPM Worklist API 12.2.1.1 and Custom ADF 12.2.1.1 Application

I have updated my sample app with BPM API usage in ADF application to 12.2.1.1. Originally this was developed with ADF/BPM 11.1.1.7 - Dynamic ADF Buttons Solution for Oracle BPM Outcomes. There are several changes in BPM libraries usage. I will describe it all step by step.

Download sample application - adfbpm12211.zip. This archive contains both BPM and ADF app. BPM process implements two roles - request holiday and approve holiday:


Main goal of such use case - we don't want to use out of the box Oracle Worklist app, but prefer to develop our own business logic and manage BPM process from custom ADF app through BPM API. It is important to initialize Workflow context one time during login, this can be heavy operation and we should not call it each time when BPM API is invoked:


I'm using authenticateOnBehalfOf method. This allows to use admin user as a proxy for business user connection. Once Workflow context is established, we can get BPM context to use it for BPM API calls, all this is done during login into ADF app:


Assigned tasks are fetched through Workflow context:


We can initiate new task through BPM API in our custom ADF app:


There is a way to generate buttons to control task actions dynamically. Buttons can be generated on top of task outcomes list obtained from BPM API:


Task action can be executed with payload info, this allows to pass correct info to the next step in the process:


Let's see how it works. User can start new BPM task from ADF:


When task is submitted to approval, manager is assigned task to approve or reject holiday request. Buttons are generated dynamically based on task outcomes:


To double check executed flow from BPM API in ADF we can review it in EM control:


ADF application must import BPM API JARs to be able to compile Java code. In ADF 12.2.1.1 it is enough to import BPM Services JARs:


There is no need to package these JARs into application archive, these should be referenced for compile time only:

Tuesday, September 20, 2016

Slides Available - End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF, and Oracle JET [CON2388]

I have completed my OOW'16 session [CON2388] today. For those of you who could not attend it, check slides online (I will post sample code later, read more about the session here):


Saturday, September 17, 2016

Dynamic Flying Dashboard UI in ADF 12.2.1.1

I took my old sample application implemented in 2010 - Dynamic Flying Dashboard UI Shell and upgraded it to recent ADF 12.2.1.1. It runs pretty well, without major changes - this proves ADF migration between releases can be smooth (well, not always in practice - but let's be positive).

I have recorded gif to give you an impression how it runs and how UI switch works in ADF UI panel dashboard component:


There are four blocks in the dashboard, user can remove each of the blocks or select predefined group of blocks:


It is possible to maximize selected block to occupy more space:


Some of the blocks can be minimized and only a subset of blocks will be displayed:


Such functionality is implemented with out of the box ADF UI components - af:panelStretchLayout, af:panelSplitter and af:panelDashboard. Depending on selection, block is minimized, displayed or maximized:


Toolbar items (minimize, maximize and restore) are implemented in the separate JSF container and reused in the main page:


Hopefully you will find such use case interesting and will have a chance to apply in the project. Download sample application - ADFIntegrationDashboard_v2.zip.

Thursday, September 8, 2016

Workaround for ADF 12.2.1.1 Match Media Behavior Tag

If you run ADF 12.2.1.1 application with adaptive UI implemented by af:matchMediaBehavior tag (ADF 12.2.1 Responsive UI Improvements), most likely you will face Null Pointer Exception in Match Media Behavior tag class. Apparently af:matchMediaBehavior tag expects default value to be set on UI component. If default value is not set explicitly, it fails to read it and generates exception (this was not the case in ADF 12.2.1).

This example contains three af:matchMediaBehavior tags, properties orientation and styleClass are not set on panel spitter by default:


This leads into Null Pointer exception on runtime:


To fix this, we can set default values for orientation and styleClass explicitly. Propety styleClass can be assigned with empty value, this helps:


UI is loaded this time:


UI is resized on narrow screen - panel splitter orientation is changed:


Download application with workaround for af:matchMediaBehavior - ADFResponsiveUIApp_v2.zip.

Wednesday, September 7, 2016

Speaking on Oracle OOW'16 - MCS, JET, ACS, JCS and MAF

With Oracle Open World'16 around the corner, I have prepared demo use case including Mobile Cloud Service (MCS), JavaScript Extension Toolkit (JET), Application Cloud Service (ACS) and Java Cloud Service (JCS). I will describe what Oracle Cloud offers to implement end-to-end enterprise solution.

This year I will be speaking on two sessions.

- End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF, and Oracle JET [CON2388]

Monday, Sep 19, 12:30 p.m. - 1:15 p.m. | Moscone West - 2012

I will be co-presenting and talking about Oracle JET Hybrid implementation:

- Building Enterprise-Grade Mobile Apps with Oracle JET and Cordova [CON5731]

Thursday, Sep 22, 12:00 p.m. - 12:45 p.m. | Moscone West - 2016

Demo use case will be based on JET application running on Application Container Cloud and integrated with Mobile Cloud Service (MCS) REST services:


There will be JET Hybrid application listening for MCS notifications:


You will learn how to process notifications:


Display and synch data from MCS in JET Hybrid application:


Functionality to be described during [CON2388] session:

MAF:

- Integration with MCS

JCS:

- ADF BC REST development and deployment
- Security implementation

ACS:

- JET application depoyment process with Node.JS application

JET:

- JET application implementation tips & tricks
- JET oAuth security integration with MCS
- JET and REST calls
- JET and MCS notifications

MCS:

- Custom API implementation tips & tricks
- Security configuration
- MCS DB API
- MCS Notifications API
- MCS Connector API to call ADF BC REST

Tuesday, August 30, 2016

Generic BigDecimal Formatter in ADF 12.2.1.1

I have implemented couple of improvements for BigDecimal formatter based on ADF 12.2.1.1. Originally formatter was implemented and described in this post - Handling Format for BigDecimal Numbers in ADF BC. New improvements: option to support trailing zeros and disabling number rounding.

1. Support for trailing zeros

If you type number 3000.10, BigDecimal type attribute will keep it as 3000.10. But in database it will be saved without trailing zero as 3000.1. This would lead to "Another user has changed the row" issue, as there will be mismatch between value in DB and value in ADF BC.

Try to enter 3000.10:


Save, change any other field and try to save again. You will get error:


Double check in DB, value is saved without trailing zero. Thats the reason for the error, data mismatch:


Solution is to parse entered value into BigDecimal without trailing zeros in generic formatter class:


2. Disabling number rounding

By default when you type 2500.209 (and if only 2 digits after dot are allowed):


This will be rounded to 2500.21:


While rounding can be useful, most of the time it will be confusing. There is a way to disable rounding by removing af:convertNumber tag for UI component. Formatting still will be applied through generic formatter class:


If user enters incorrect number, instead of rounding it - formatting error message will be displayed:


Download sample application - ADFFormattingApp_12211.zip.

Sunday, August 28, 2016

Oracle JET Hybrid Receiving Mobile Cloud Service Notification

Oracle JET Hybrid enabled with Cordova Push plugin can receive notifications sent from Oracle Mobile Cloud Service (MCS). You should read how to setup infrastructure in this article - Your first Push notification based Oracle JET Hybrid application!. I will focus on implementation steps and will provide working sample app for download.

Sample JET hybrid application provides login functionality. During login we register device ID with MCS service, this allows to receive notifications:


After login is completed, default dashboard page is displayed. At this point, application is ready to receive notification (even if application will be closed or mobile device screen is locked):


Notification from MCS can be sent programmatically from API implementation. I will show this in the next posts. For now we can use MCS UI to test if notification is working. Mobile Backend provides functionality to send notifications. I can target notification to specific user:


If mobile device registration was successful during login in JET Hybrid, MCS wil send notification and you should see confirmation message (if there will be error, this means registration from Oracle JET Hybrid was unsuccessful):


In few seconds you should see notification received and displayed in notifications screen:


Select notification and it will navigate directly to the app and pass notification message. This would allow to parse it do certain action in the app, for example refresh data, etc.:


To verify if registration with MCS was done correctly during login, you can check logs in Mobile Backend. There must be REST POST /register call logged, just after GET /login:


It would not work to send notification, if there is no Client defined in MCS Backend. You can read more about it from the article mentioned above. Make sure to specify all keys correctly, pointing to Google Cloud Messaging (if you are targeting for Android):


Let's take a look into implementation on JET Hybrid side. Login success callback invokes method to register device to receive push notifications from MCS:


Make sure Cordova Push plugin is installed into your app, otherwise PushNotification will be undefined. It gets registration ID from Google and makes another call to handshake with MCS:


I'm invoking wrapper method, which in turn have access to MCS SDK module in my JET app:


MCS SDK method registerForNotifications is invoked, where REST POST call is made to register device with MCS and allow to receive notifications:


Download sample application (this contains only JET implementation JS/HTML, you should copy it into root src folder of your JET hybrid app) - jet_mcs_notifications.zip.