Tuesday, November 3, 2015

Consume JSON based ADF REST Services in ADF 12.2.1 (with REST DataControl)

In ADF 12.2.1 the capabilities for handling with REST services has been greatly improved. You can now expose ADF BC (ViewObjects) as  REST service in JSON format.  On the other hand there are improvements in the REST DataControl.

In this blog post I am going to show how to consume this REST Service and create a basic ADF Table.

So here is a basic REST Service for employees

REST DataControl with JSON Support

From „New Gallery“ open the following wizard

The create web service data control wizard launches. Choose REST option.

Next you can decide whether you consume a REST service, that has been exposed through ADF BC Application Module or a generic REST service. The difference here is that the ADF based REST service exposes additional meta data that describes the structure and types of the return JSON structure. This makes it possible to automatically get a type-aware DataControl on REST/JSON service which is generically not the case. See next screenshot to get a feel of the feature of an ADF REST Service and this particular describe feature.

So lets add an ADF REST Connection

Important note: Do include the version name and resource name, but do not include any URL parameters.

Next it is possible to choose from Security Policies

Since in this example we do not use any security just skip this page.

Next you can choose to add all resources or specific one. in this case I have only one resource exposed

Click Next and Finish.

=> The DataControl will be created. Every attribute type is correctly derived from the rest metadata (ADF REST service specific).

(Interesting to note, that EmployeeId is not marked as the primary key. Although it is in the ADF BC ViewObject definition from which the service has been previously created. Well it is because of the REST nature of this Collection. Resources typically must not match every attribute of an ADF ViewObject. It could be a subset. Therefore the canonical attribute represents the primary key which is typically the URL to the canonical resource. In our case the canonical resource is the resource itself :))

Next steps are as easy as with any other DataControl. Just create an ADF table via drag and drop

Run the page.

Table is displayed. Filtering works BTW too. Nice.

Since we are consuming an ADF REST Service lets see if we can update a record. Therefore Drag and Drop the „Commit“ Operation from the Data Control. Create a button and name it „Save changes“. For a simple testcase we change the salary from initially 10000 to 5000. Press „Save changes"

Looking into the database you will notice the change

Pretty cool.


Removing the Filter results in an NullPointerException. Hhhm that is disappointing. Looks like nobody has tested this so far ;).

Refreshing the page the table keeps empty (Not data to display). Looks like a bug. It would not surprise me. Anyone feel free to file a SR to Oracle.

Sample applications

Provider: enpit.sample.adf1221.restprovider.zip
Consumer: enpit.sample.adf1221.restconsumer.zip

Further information

ADF 12.2.1 Developers Guide:

16.3.1 How to Expose Canonical Resources in the ADF REST Resource
22 Consuming RESTful Web Services Using the ADF REST Framework

Wednesday, October 28, 2015

Oracle JET is here - for JavaScript lovers

Oracle makes a big move towards client side HTML5 enterprise application development - based on a collection of proven open source JavaScript tools: Oracle JET - the JavaScript Extension Toolkit. After 3 years of active development and internal usage for its Cloud products at Open World 2015 it has been made publicly available.

To get a feel of an Oracle JET application check out the "WorkBetter" JET Demo:
 Oracle JET Demo Application

Oracle JET provides a rich set of Oracle JET UI components that you can use out of the box (based on Alta UI). The documentation contains code snippets which can be used to integrate the desired UI controls in your application. (If you are a business user (with a certain affinity and love for IT) you will be able to use Oracle JET components inside "Oracle Application Build Cloud Service" )
 Oracle JET UI Components

For data visualization it is almost the complete set you may know from ADF. This is pretty cool.

Oracle JET (Enterprise) Features

Comparing to other UI Toolkits it is great to see that important aspects of every enterprise application has been addressed.

  • Support for localization & internationalization
  • UI Components are implementing the latest WCAG 2.0 / WAI-ARIA accessibility guidelines
  • Theming support - Default is Alta UI
  • Security - Oracle JET API provides the oj.OAuth authorization plugin which supports the OAuth 2.0 open protocol

Oracle JET Technical Base

Obviously the core of Oracle JETs stack is based on HTML5 / JavaScript / CSS3. For certain aspects it uses proven JavaScript Libraries for Binding, Templating and Modularization.

How does it compare to ADF

Oracle ADF Faces - for Java developers looking for a set of JSF components implementing Alta UI
Oracle JET - for JavaScript developers looking for a set of components implementing Alta UI

In the Javascript ecosystem there are a lot of changes. If you do not want to deal with all of that ADF is the right choice. If you love Javascript and want to embrace every new JavaScript libraries then Oracle JET is for you.

Further Information on Oracle JET

I have put together most of the interesting things to get started on Oracle JET. BTW, For next year it is announced that it is going to be available open source on GitHub!

Oracle JET - Getting Started

Oracle JET Quickstart Basics

Oracle JET UI Controls Overview

Oracle JET Hands On Lab

Oracle JET Developers Guide

Oracle JET Community

Oracle JET Quick Demo on Youtube

Oracle Alta UI

Keep up to date with Oracle JET

Oracle JET YouTube Channel

Oracle JET on Twitter

Oracle JET on Google+