Tuesday, February 24, 2015

MAF 2.1 Alta Mobile UI - Running On iPad Device

I have installed MAF application (described and available for download here: MAF 2.1 Alta Mobile UI and Oracle Mobile Suite) on iPad device, iOS 8 and would like to share couple of tips and tricks about it. I was installing on iPhone/iPad previous MAF versions (it was called ADF Mobile) - ADF Mobile - Live on iPhone Device. It is always forth to read Oracle Developer guide for MAF - 27.4.2 How to Deploy an Application to an iOS-Powered Device.

You would need to get Apple Development Provisioning Profile (this costs around $100), in order to be able to install MAF application on iPad device for testing. Provisioning Profile creation process is streamlined in iOS 8 and is simple to follow. Here is the example of our Apple Development Provisioning Profile entry, this can be download and installed on Mac OS with one click:


Sample MAF application I'm going to deploy is connecting to the REST service. Make sure to set proper IP address for the REST connection entry in MAF. IP must point to the Service Bus service with published REST connection:


JDeveloper 12c is fetching Provisioning Profile information automatically. You only need to copy paste Common Name from iOS development certificate into Signing Identity field (created and registered during Provisioning Profile creation process):


Make sure to specify the same Application Bundle Id prefix as the one registered in Provisioning Profile. Documentation states you can test MAF application on iPhone/iPad device only in Debug mode, however this is not true - it works fine in Release mode as well:


Thats it with configuration. Choose to deploy MAF application into IPA distribution package:


IPA distribution package file must be generated in deploy folder. Double click on it and it will get installed into iTunes:


Open iPhone/iPad section in iTunes and go to the App category. You should see your new MAF application listed there. Click on Install button and then press Synch - this will install application into the device:


Application is successfully loaded and dashboard screen is displayed. Service Bus provides REST data to the MAF application running on the iPad, data is rendered in Tree Map graph (MAF component):


User could switch to Employees screen:


Alta UI look and feel - we could search for employees and browse through a list with shortcuts:


Switch to cards view, instead of default list view:


Select employee who is a manager:


Pie graph with compensation of managed employees is displayed:


List of managed employees is also present:


I have tested AirPlay and connected iPad with Mac. This is useful to display iPad screen on projector, when you want to demonstrate your app to the audience. AirPlay synchronisation works pretty well, without configuration headache (you may require additional utility application for this). You must enable mirroring on your iPad device:


We are getting iPad screen view on the Mac. This is pretty useful for the presentations and demos:

Monday, February 23, 2015

Red Samurai ADF Performance Audit Tool v 3.4 - ADF Task Flow Statistics with Oracle DMS Servlet Integration

We have integrated Red Samurai ADF Performance Audit Tool with Oracle DMS Spy Servlet. Integration is dynamic and doesn't require any extra configuration. It brings out of the box information about ADF Task Flow usage and performance. This means we are analysing from now on not only ADF BC performance data, but ADF Controller data also.

DMS Spy Servlet context is accessed in certain intervals and we are not only displaying DMS data, but storing it inside our audit tables. This allows to keep historical data and preserve it between WLS restarts - this is not possible with DMS Spy Servlet alone.

New tree map graph displays ADF Task Flow usage in the application - larger box, more frequently Task Flow is accessed:


Graph is clickable, user could select a box and detail data for the Task Flow will be displayed. We are displaying a number of Active/Maximum Active Task Flows over time. Average load time is logged and displayed - this allows to identify Task Flows with slow performance:


Here you can check information about previous v 3.3 version - Red Samurai ADF Performance Audit Tool v 3.3 - Audit Improvements.

Thursday, February 19, 2015

ADF BC Range Paging and REST Pagination

In this post I would like to explore and integrate two thing - ADF BC Range Paging and REST service pagination. It would inefficient to retrieve entire set of data in the REST service, ideally should be available option to specify number of rows and range number to fetch. ADF BC allows to query VO in Range Paging mode - SQL query will be constructed with row numbers, to query data in certain range of rows (this allows to fetch less data from DB). We could combine this with REST service and provide light interface to access data.

Here you can download sample application - RestADFBCApp.zip (compiled with ADF 12c). I'm translating ADF BC VO structure into HashMap, this allows to publish unified structure through REST, without creating a separate POJO object. There is a special generic method called toHashMap, it iterates over VO attributes and constructs a HashMap with attribute names and values:


Generic AM method accepts parameters for page number and range size. Here we enforce Range Paging mode for VO and using ADF BC API methods to scroll to the certain page and set the range size (number of rows to fetch). It is important to get results from default rowset, otherwise ADF BC will generate a separate default SQL query:


ViewController project contains a list of references to the REST and Jersey related libraries, these extra libraries are required to transform HashMap to the REST response:


Here is the REST method. I'm accessing ADF BC Application Module and invoking custom method, with range size and page number coming from the REST request. Result is a list of HashMaps - a set of VO rows:


Make sure there is Jersey servlet defined in web.xml, REST request will not work without it:


Here is the example, where I perform a request through REST for rangePage = 1 and rangeSize = 10. This means 10 rows from the first page of rows are fetched:


You should check SQL query in the log. REST request from above generates a special SQL with ROWNUM. This means we are retrieving less data from DB, only data we need to display in the current page:


Monday, February 9, 2015

MAF 2.1 Alta Mobile UI and Oracle Mobile Suite

This post is about Alta Mobile UI and MAF 2.1. I was using Oracle Work Better mobile application as a reference, along with Alta Mobile UI Design Guidelines. This is based on my previous posts about Oracle Mobile Suite and MAF 2.1 integration, read more here - Oracle Mobile Suite - Web Service Performance Optimisation with Result Caching. You could also use Alta UI 12c with regular ADF Web applications, check more here - Custom ADF Application with New ADF 12c Alta UI.

Sample application - MobileServiceBusApp_v5.zip (contains ADF BC SOAP Web Service, Oracle Mobile Suite SOAP to REST transformation and MAF 2.1 application with Alta Mobile UI) implements a dashboard. Component to visualise amounts and values comes out of the box with MAF (iPad view):


User could open a springboard and select Employees option in the sample application:


Here we can search for employees by first name/last name and bring results as a list:


Optionally user could switch to cards view, to display the same results in different way:


You could click on employee icon - this will load details screen and bring additional info:


Steven King is a manager, he manages Executive department and there are two team members reporting to him. Compensation graph can be displayed for team members:


A list of team members is displayed in the third tab:


There is MAF 2.1 Deck component in Employees search page, it allows to switch between a list and cards view:


Employee details page is rendered with a help of MAF 2.1 Deck component as well, along with Select Button component to display tab UI and navigate between Detail, Compensation and Team sections:


You could check how these pages are implemented in the sample app provided above.

Tuesday, February 3, 2015

Oracle Mobile Suite - Web Service Performance Optimisation with Result Caching

One of the main advantages of Oracle Mobile Suite - Service Bus and SOAP/REST web service transformation (more here - Oracle Mobile Suite Service Bus REST and ADF BC SOAP). In addition you will get very nice performance improvement, there is out of the box caching for Web Service resultset with Coherence. I'm going to demonstrate how it works, all out of the box - really simple.

You could define caching for external service (ADF BC SOAP web service in my case), just edit service definition. This is our business service running on WebLogic backend, where actual processing happens. Naturally we would like to eliminate duplicate calls and retrieve previous resultsets from cache stored in Service Bus layer:


Wizard allows to enable result caching by cache token expression. In my case, nameVar is a variable from ADF BC SOAP web service, findEmployees method. You could use a wizard to construct expression. On runtime it will cache resultsets for all the requests according to specified expression. Basically it will cache all invocations of findEmployees method and will track cached data by nameVar parameter value. You could specify cache expiration time, if data is updated more often, expiration time should be shorter. Expiration time even can be dynamic, taken from the request variable:


That't is - this was really simple. All Coherence complexity is hidden and you don't need to worry about it.

I will be running MAF application to perform a test. Here I'm searching by value - th:


If we would check WebLogic log, where ADF BC SOAP web service is deployed, we could see the SQL query was executed with nameVar=th (as per search request in MAF application screen):


Let's run a different query now, search for nameVar=ew:


Again repeat previous search with nameVar=th, there should be query executed on WebLogic server with ADF BC SOAP web service, result should be taken from cache stored in Service Bus (as directed per performance optimization tuning above):


Indeed there was no SQL query executed for nameVar=th this time, data was taken from cache - this is great performance optimisation:


Download sample application (it contains ADF BC SOAP web service, Service Bus and MAF implementations) - MobileServiceBusApp_v4.zip.

Saturday, January 31, 2015

MAF 2.1 - Debugger Improvements and Mobile REST Client

I was blogging previously about Oracle Mobile Suite and REST service transformation from ADF BC SOAP service. Today I'm going to blog the next step in the same series - MAF client consuming REST service exposed from Oracle Mobile Suite ESB. I'm going to highlight improvements in debugging process for MAF, provided with the latest 2.1 release. I had couple of challenges implementing and mapping programmatic MAF client for REST service, all these were solved and I would like to share the solution with you.

Previous posts on the same topic:

- Oracle Mobile Suite Service Bus REST and ADF BC SOAP

- How To Add New Operation in Oracle Mobile Suite Service Bus REST Service

Here you can download sample application implemented for today post (contains ADF BC SOAP, Mobile Suite Service Bus and MAF client apps) - MobileServiceBusApp_v3.zip.

High level view of the implemented use case - there are three parts. Service Bus is acting as a proxy to transform ADF BC SOAP service to light REST consumed by mobile REST client (implemented in MAF):


I would not recommend to use auto generated Data Control for REST service - I didn't had positive experience using it. You should invoke REST service from Java, using MAF helper classes (read - here). There must be REST connection defined and tested, later it can be accessed and used directly from Java. REST connection endpoint must include REST service URL (in my case, it by default points to getEmployeesListAll operation):


It is enough to define REST connection, now we can start using it.

Sample application implements REST helper class. Here actual REST call is made through MAF RestServiceAdapter class - see invokeRestService method. Public method invokeFind(requestURI) is supposed to be used to initiate search request. Content type is set to be JSON. Search parameter is always passed as a part of requestURI, therefore we are passing empty post data value:


MAF application contains Java class - ServiceHelper, this class is used to implement Data Control. Each time when search parameter is set, applyFilter method is invoked and it makes REST request. Response is received and with the help of MAF utility (highlighted) is transformed from String to the array of objects:


ServiceHelper class includes a set of variables required to perform successful REST request. Data collection object - employees of type EmployeeBO[] is defined here and later exposed through Data Control:


As you can see from above example of applyFilter method - response String is transformed to the array of objects. I'm using EmployeesList class for conversion. This class contains array of objects to parse from REST response. It is very important to have exactly the same name for array variable as your REST response result set name. In my example, this name is employees:


Finally there is class to represent response object - EmployeeBO. This class is a POJO with attribute definitions:


ServiceHelper class is exposed to Data Control - defined methods will be accessible from MAF bindings layer:


This is all about REST client in MAF implementation - I would say quite straightforward, when you are on the right path.

Let's have a few words about debugger in MAF 2.1. I would say I was positively impressed with debugger improvements. There is no need to do any extra configuration steps anymore, simply right click anywhere in Java class you are currently working on and choose Debug option - Debugger will start automatically and MAF application will be loaded in iOS simulator.

It works with all defaults, you could go and double check the settings in Run/Debug section of MAF project - Mobile Run Configuration window:


Right click and choose debug, don't forget to set a breakpoint:


Type any value to search in the sample MAF application - Employees form. You should see breakpoint is activated in JDEV (as it calls applyFilter method):


Debugger displays value we are searching for:


After conversion from response String to array of objects happens, we could inspect the collection and check if conversion happened correctly:


Response from REST is successfully displayed in MAF UI: