Andrejus Baranovski

Subscribe to Andrejus Baranovski feed
Blog about Oracle technology
Updated: 12 hours 10 min ago

Oracle JET Example - Implementing Editable Collection Table

Tue, 2016-10-18 13:09
Oracle JET allows to implement inline editable tables. User can double click row or press Enter to switch to edit mode. Use Esc to switch back to readonly mode. With F2 can toggle between editable and readonly. Check it yourself in JET cookbook Editable Collection Table to see how it works.

I have followed instructions from the cookbook and implemented editable JET table on top of ADF BC REST service. Row with key 201 is switched to edit mode:

When we exit edit mode, event is handled in JavaScript and changed row is printed to the log. Here we can collect all changed rows into array and submit to the server all at once or we can fire individual REST calls per each changed row - depends on implementation:

To handle row edit, table must be set with editMode: 'rowEdit' property:

Row template property must be defined to render different HTML elements in readonly and editable modes. This property can be initialized dinamically with different template name retrieved from function:

Based on row edit mode, function returns template name:

Readonly template renders output texts, editable template renders input texts:

Changed row data is logged by ojbeforeroweditend listener function:

Download sample application -

JDeveloper Bug and Workaround - Wrong Instance Name for Method Action Binding

Sat, 2016-10-15 10:34
After upgrade to JDeveloper I have noticed issue related to Method Action binding instance name. This is not ADF bug, but JDeveloper bug. JDeveloper sets incorrect name for Method Action binding instance name.

If you are going to create custom method in VO/AM and expose it through interface to be called in bindings layer - there will be similar error as below on runtime:

Source of this error is in the method binding definition:

Go to page definition source view and you will find instance name highlighted with warning. JDeveloper is able to recognize invalid expression, but still it generates it. ADF runtime quality is improved, but can't say the same about JDeveloper IDE. Oracle focus is on Cloud, but still there is a lot to do to improve development tools quality:

Expression must be replaced manually to correct one (the one previous JDeveloper version used to generate) - data.DataControlName.VOInstanceName:

With correct expression for instance name, custom method is invoked correctly without error:

Download sample application -

Oracle JET and ADF BC REST Security Integration Approach

Thu, 2016-10-06 10:20
I have promised to atendee of my OOW'16 session (Building Enterprise-Grade Mobile Apps with Oracle JET and Cordova [CON5731]) to post a blog about ADF BC REST security and integration with Oracle JET. This post is to demonstrate how we could reuse cookie ID generated by ADF BC REST Web session for REST requests from JET.

First thing first, here you can download source code - This archive contains ADF BC REST application and JET source code (you need to copy it into your local JET application).

Take a look first into JET login form. This is where we collect username/password and call login function. One important detail - invalidComponentTracker, this allows to report required validation error, when user hits login button with empty username or password:

Here is the login function in JET. If there are no validation errors, it executes POST against ADF BC REST service custom method. In response we could return user info, preferences, etc. This is the only one request where we are using username/password. Key point of this request is to get JSESSIONID from ADF BC REST server, so we could use it for subsequent requests, without sending username/password again. This is similar concept to ADF Faces, it is also using JSESSIONID to track web user and HTTP session on the server. If login is successful, we are reading custom parameter from response with JSESSIONID value. JET router is updated to render different menu structure after login:

Custom response parameter is populated on the server in Filter class. On authentication request this parameter is set once:

ADF BC REST application is enabled with standard ADF Security:

This is how it works. Login form in JET:

Login is successful with redsam/welcome1 user. Two tabs are rendered - Home and People. Home tab displays chart with employees:

We should dive deeper and check what happens with REST communication. POST method in response gets custom parameter with JSESSIONID value, if authentication is successful based on Authorization header parameter:

Chart data in Home tab is retrieved through GET method and this method is not using Authorization header anymore. It calls REST method using JSESSIONID in URL. JESSIONID must be before URL parameters:

Home tab is implemented with JET chart component:

JSESSIONID is included into REST call URL through getURL method, which is referenced by JET collection:

People tab implements table with pagination support:

Same approach is applied in People tab. JSESSIONID is appended into URL through getURL method, before URL parameters:

People UI with paginated table in JET:

REST request URL contains JSESSIONID:

BPM Worklist API and Custom ADF Application

Tue, 2016-09-27 12:57
I have updated my sample app with BPM API usage in ADF application to Originally this was developed with ADF/BPM - 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 - 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 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:

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

Mon, 2016-09-19 17:03
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):

Dynamic Flying Dashboard UI in ADF

Fri, 2016-09-16 23:43
I took my old sample application implemented in 2010 - Dynamic Flying Dashboard UI Shell and upgraded it to recent ADF 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 -

Workaround for ADF Match Media Behavior Tag

Thu, 2016-09-08 15:00
If you run ADF 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 -

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

Wed, 2016-09-07 13:08
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:


- Integration with MCS


- ADF BC REST development and deployment
- Security implementation


- JET application depoyment process with Node.JS application


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


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

Generic BigDecimal Formatter in ADF

Tue, 2016-08-30 11:39
I have implemented couple of improvements for BigDecimal formatter based on ADF 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 -

Oracle JET Hybrid Receiving Mobile Cloud Service Notification

Sun, 2016-08-28 01:50
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) -

Oracle JET and Mobile Cloud Service Authentication with OAuth

Sat, 2016-08-20 04:58
I will describe with practical example, how to authenticate against MCS in Oracle JET using OAuth. This is based on sample app from my previous post - Oracle JET and Application Container Cloud (with MCS Integration) (download sample app from there). It would be useful to read through MCS documentation - Authenticating with OAuth in Individual REST Calls.

Oracle JET sample application provides login form:

If login is successful, REST call is done and MCS returns data:

In order to authenticate using OAuth, we need to use Application Key defined in MCS Mobile Backend:

Go to Mobile Backend settings screen and note down OAuth property values for Client ID and Client Secret. We are going to use these values in JET application, to initialize OAuth authentication:

There is one test user defined in Mobile Backend - redsam. We can use these user to login from JET over OAuth:

MCS offers to download SDK Java Script code, we could use it in JET application, to authenticate against MCS service through OAuth, Basic or Facebook login. Download SDK from getting started page:

I'm using mcs.js from MCS SDK, you could find helper method in this class - it executes REST POST to authenticate through OAuth and gets temporary access token in return. This token can be used for subsequent requests in the same session:

There is one more wrapper JS file - mbe.js. Here you define mobile backend connection keys. Authentication type is specified as oAuth:

Make sure to add mcs.js module into main.js paths:

Key point - mbe.authenticate() method (call it from JET module, make sure to reference mbe module in require block). Provide username/password and callbacks for login success and login failure:

In login success callback, I'm reading temporary token and passing it through header Authorization : Bearer. This token can be used for REST requests to MCS:

UI component is displayed when authentication is successful:

Oracle JET and Application Container Cloud (with MCS Integration)

Tue, 2016-08-16 13:44
I have deployed JET application with Mobile Cloud Service (MCS) integration into Oracle Application Container Cloud service. It works perfectly well, you can try to access it yourself (until my trial cloud account expires on 15th of August) by URL:

Follow excellent blog article written by Lucas Jellema on details how to deploy JET into Application Container Cloud - Deploying an Oracle JET application to Application Container Cloud and running on Node.js.

First step is to generate empty Node.js application, you can do this from command line (install Node.js and express generator before):

express RSJETNodeJSApp

Navigate into generated application folder and add dependencies using npm:

npm install

Node.js application is created and you could run it by:

npm start

You could test JET app locally with the same command, as soon as you add JET content into Node.js app.

Once you access deployed JET application by URL: You should get into Home tab, where static chart data is rendered (no integration with MCS yet):

I did a test to check how same screen looks on mobile device. JET renders perfectly, template is adjusted, as well as chart itself:

Go to People tab, this is where integration with MCS is done. I have implemented oAuth security authentication in JET, against MCS service (I will describe it in the next post). You can login with redsam/Wel_come1 user:

Same login screeen is rendered on mobile device nicely:

Once login is successful, JET app executes REST call to MCS endpoint and fetches data (originally returned by ADF BC REST service deployed on Java Cloud and accessed by MCS Connector):

Mobile device view doesn't dissapoint again, same page UI looks great:

JET implementation code is copied into Node.js structure public folder. You can open app in NetBeans, this would simplify editing:

I have deployed this app to Application Container Cloud by creating zip archive (make sure to create manifest.json file). Don't include root folder into archive, include application folders/files directly. Deployment is straightforward, create new Node.js application in Application Container Cloud:

Upload archive, give application name and wait few minutes to initialize. All done:

Here you can download complete example of Node.js app with JET content (and all libraries) I was using to deploy to Application Container Cloud -

Oracle JET Hybrid - Calling Oracle Mobile Cloud REST

Sun, 2016-08-14 13:59
Oracle JET allows to build mobile hybrid apps, based on Cordova and deploy to Android or iOS platform. Read more about it here - Go Mobile with Oracle JET As Easy As 1 2 3. In my previous post I have described how to call REST endpoint running on Oracle MCS from JET - Calling Mobile Cloud REST Service from Oracle JET. Its time to demonstrate the same from JET hybrid app, running on my Android phone.

Here is the screen capture of JET hybrid app running on Android device and displaying data fetched from MCS REST endpoint:

To test data re-fetch, I have updated one record directly through MCS endpoint tester UI, using REST PATCH:

In mobile app, I navigated outside Customers screen and back - data is re-fetched, chart is changed:

What is great about JET hybrid, you could use identical code for JET rendered on the Web and JET rendered on mobile device. You could copy paste the same code between Web and mobile hybrid implementations. Here is example from sample app, where chart and list are displayed:

JET model points to MCS endpoint and defines data collection, same as it would be done for JET rendered on the Web:

Data is fetched in special method - handleActivated. This method is invoked automatically when View Model becomes active (user opens it from the menu). This is quite handy, to have such entry points in the app:

Download sample app code -, where I have packaged Java Script and HTML examples. You should copy it into application with JET libraries to run.

To build JET hybrid app use:

grunt build:dev --platform=android

To deploy to Android device use:

grunt serve --platform=android --destination=device

Read more about how to create JET hybrid app here - Go Mobile with Oracle JET As Easy As 1 2 3.

Calling Mobile Cloud REST Service from Oracle JET

Wed, 2016-08-10 09:51
Let's take a look how we can consume REST service exposed from Mobile Cloud Service (MCS). I will show how you could display data coming from MCS endpoint in Oracle JET. I will be using simple scenario in this post, based on HTTP Basic authentication method offered by MCS. In my next post I plan to review more advanced authentication described in this article - Hybrid Mobile Apps: Using the Mobile Cloud Service JavaScript SDK with Oracle JET.

JET application (download release package with sample code - renders bar chart with data retrieved from MCS endpoint returning information about employees:

Once data is retrieved, I can see invocation statistics logged and reported in MCS dashboard. Calls are executed successfully:

To call MCS service from Oracle JET, we need to pass to extra headers - Authorization and Oracle-Mobile-Backend-ID. Values for both headers can be obtained from MCS dashboard. Go to Mobile Backend and navigate to Settings section. You will find required info under HTTP Basic section:

To bypass CORS issue, you can specify Security_AllowOrigin property in MCS (you need to be admin for this). Read more about it in MCS Developer Guide - Environment Policies and Their Values.  Download property file to your local environment, change it and upload back:

For test purposes, I have specified Security_AllowOrigin=allow:

Oracle JET application JS module is pointing to REST URL handled by MCS:

Fetch operation is configured to pass two headers specific to MCS - this will allow to complete REST request and get response:

NetBeans tool Network Monitor displays request headers (both MCS headers are included):

If request is successful, you should see data returned in the response:

Oracle MCS with ADF BC REST Connector

Mon, 2016-08-01 14:17
We already learned how to deploy and access ADF BC REST services from Oracle Java Cloud - ADF BC REST Running Live in Oracle Java Cloud. It's time to see how ADF BC REST can be consumed by Oracle Mobile Cloud Service (MCS). In my point of view, key benefit of MCS is ability to simplify Web Service access for mobile clients, by aggregating these Web Services from different sources and simplifying them. I will try to describe it in very structure way, how to define MCS interface based on ADF BC REST.

Let's start from the top - MCS Web Service interface visible to mobile clients. I have defined four endpoints in MCS, based on ADF BC REST service - list of employees, new employee, employee by ID and update employee. As you can see from MCS tester, implementation details are hidden from the user and you would not know there is ADF BC REST is working in the background.


Create new record. Data is supplied through Body:

You should see newly created record data in the response:


Update existing record by ID. If value is invalid, ADF BC REST returns validation message:

When we fix value and try to update again, attribute value is changed:


This can be used to fetch resource by key:


Returns a list of resources

At this point you should be familiar with implemented endpoints. Next I will describe how REST Connector, Custom API and Mobile Backend are configured in MCS.

REST Connector

Connector is defined to point to ADF BC REST service deployed on Oracle Java Cloud. We need connector in order to be able to call external Web Service. Connector is named as EmployeesList:

ADF BC REST service is protected by ADF Security. For this reason there is one rule defined to provide authorization header for REST requests:

Custom API

This is a proxy between connector calling external Web Service and service exposed to mobile client. Here we define available endpoints and implement calls to connectors or other MCS services (storage, notifications, etc.) through Node.js:

Endpoints for REST service are defined here, same ones as described above in MCS tester. We have /employees and /employees/{employeeId} endpoints:

Endpoint /employees is suppose to return a list of employees, without specifying a key or to execute POST to create new employee. GET method is defined to return list of employees:

POST method is defined for /employees and is supposed to create new employee:

GET method for /employees/{employeeid} is supposed to return employee by ID:

PATCH method for /employees/{employeeid} is supposed to update attributes for given employee:

Next important thing in custom API is implementation. This is the place where Node.js transformation between Web Service connector and MCS interface is defined. It can't be edited directly in the cloud, you should download JavaScript package to your environment and edit there. Upload it back when done. Download implementation for my sample app -

Let's check implementation. This is the structure of implementation archive. JavaScript file employees.js contains implementation for MCS endpoint interaction with REST connector. JSON file package.json provides metadata for the implementation:

Endpoint GET method is implemented to call EmployeeList connector and to retrieve Employees resource (by calling GET). ADF BC REST supports onlyData=true parameter to return data only, we can pass it through HTTP parameters. Callback for successful result transfers data from REST connector to MCS:

GET by ID is implemented in similar way. Only difference - we add EmployeeId to Employees resource, this constructs REST URL Employees/100:

PATCH is a bit more complex. It needs to set Employee ID, pass request body (with JSON String including attributes to update) and specify ADF BC REST supported Content-Type. This makes it easy for mobile consumer, no need to worry about such things as Content-Type, etc. There is also option to log data, it could be useful for debugging purposes:

POST is pretty much similar to PATCH, it calls post method through connector:

Read more about Connector API in developer guide - Calling Connector APIs from Custom Code.

You must explicitly register Connector to be accessible from API implementation, this is done in package.json:

Mobile Backend

I will show how to read debug messages logged in Mobile Backend, when testing endpoints defined by Custom API. We execute PATCH:

All operations are executed through Mobile Backend, this is the place where we can check statistics and see the flow of REST calls and other actions:

These five actions where invoked during PATCH. You can see payload body content printed, this is done from Custom API implementation function:

ADF BC REST Running Live in Oracle Java Cloud

Wed, 2016-07-27 04:22
It passed almost two years since my previous post about Oracle Java Cloud and ADF - End-To-End ADF Cloud Deployment Process. There is huge improvement in Oracle Cloud, great progress done in these two years by Oracle. Access and management of Oracle Cloud environment is so smooth now, it is even hard to say you are working with your own on premise servers or cloud machines. This is great, I'm impressed - well done Oracle.

I have implemented ADF BC REST application with JDEV and deployed it to Java Cloud. You can access REST service yourself from this URL: (username: redsam, password: welcome1).

I can monitor deployed application with ADF BC REST through Enterprise Manager in the Cloud. ADF BC REST request/response is going through Oracle RESTServlet, this is visible in the statistics:

There are no changes required to ADF application to be deployed to the Cloud. Simply make sure to provide correct datasource name, to be able to load data from Database Cloud. I have created jdbc/HrDS data source in Java Cloud, to point to Database Cloud. Using the same data source for AM configuration, this AM will be responsible to return data from ADF BC for REST requests:

Database Cloud offers public IP, it can be used to access DB from outside. If you want to reference DB schema from data source created in Java Cloud, instead of using public IP you should use DB instance name (example: RedSamuraiDB) and service name for pluggable DB created in Database Cloud (example: PDB1.ltredsamurai.oraclecloud.internal):

ADF applications deployed on Java Cloud will be fetching data from Database Cloud through data source.

Make sure to define WAR deployment profile for ADF application and specify context root:

ADF application should contain EAR deployment profile, which will reference WAR profile:

Uncheck "Auto Generate and Synchronize WebLogic JDBC Descriptors During Deployment" option in Application Properties (we don't need to deploy internal JDBC connection to Cloud):

Oracle Cloud offers services control dashboard. Here we can monitor active services, create new ones or stop existing ones. There is a list of options how to manage Java Cloud instance. Since my ADF BC REST application is enabled with ADF Security, I could go to WebLogic Server Console and create test user directly in DefaultAuthenticator:

Test user can be created exactly in the same way as on WebLogic running on-premise:

You can deploy ADF app on Oracle Cloud through EAR, using Enterprise Manager (don't forget to activate changes and start application). Application status can be reviewed from deployments list:

Try to access ADF BC REST service and enter redsam/welcome1 for login:

You should see JSON format data in response from ADF BC REST:

Download sample ADF BC REST application, the one I was using to deploy to Java Cloud -

Serving Oracle JET Application from WebLogic

Sun, 2016-07-24 03:43
Oracle JET application can be served from WebLogic as static content (HTML/JavaScript), JET code will be downloaded and executed on the client. Read more about packaging and deploying JET applications in developer guide - Packaging and Deploying Web Applications.

Here is demo JET application served on WebLogic server, port 7101. JET index.html page is referenced through application context root, registered on WebLogic during deployment of static content:

Required steps:

1. Generate JET application from basic template (use sudo on Mac OS):

yo oraclejet RSJETDemoApp --template=basic

2. Navigate to JET application folder and run grunt command to generate minified JET app structure under release folder:

grunt build:release

3. In order to serve JET as static content from WebLogic, we need to add WEB-INF folder and web.xml file. This will allow to deploy it as application to WebLogic. Create web.xml file with empty structure:

4. Final structure should look like this, web.xml and WEB-INF folder inside release:

5. Go to WebLogic Console and in deployment screen navigate to folder location, where release is located:

6. As for any other Web application deployment, choose Install this deployment as an application:

7. Provide application name and specify deployment accessible for the folder location:

8. Deployment should be completed without errors:

There is no other job for the server as to transfer HTML and JavaScript to the client. Code is running on the client.

Workaround for ADF BC REST Custom Method Configuration

Sun, 2016-07-17 13:34
This post is based on JDEV, it seems like there is issue with ADF BC REST custom method definition in this release. I'm glad it is not runtime issue, but related to design time JDEV wizard incorrect functionality. I will explain how to bypass it, when you want to expose custom REST method in

Sample application ( implements custom method, exposed through ADF BC REST - calculateEmployees. This method is created in VO Implementation class and it accepts two parameters - firstName and lastName. Method works correctly, I can execute it through POST, by passing predefined payload with method name and parameters (read more in developer guide - 22.12.5 Executing a Custom Action):

Make sure not to forget to specify Content-Type, otherwise POST request to ADF BC REST will fail:

Let's see custom method implementation and where workaround is required. Custom method is using View Criteria to filter VO and return estimated row count. All fine here:

Method should be exposed through VO client interface:

We should generate custo method binding registry in REST resource custom methods section (client interface). In JDEV 12.2.1 this works by clicking checkbox for Enable, but in JDEV the same throws error (can't enable custom method to be called through REST):

Luckily there is a workaround. We can define method binding manually, go to source mode in REST resource definition dialog and add methodAction for custom method. You can replace method name, ID, instance name, etc. REST resource definition looks very similar to page definition file we are using to define bindings available for ADF Faces. ADF BC REST interface seems to be designed on common principles with ADF bindings, at least from definition point of view:

ADF BC REST Authentication with JSESSIONID Cookie

Tue, 2016-07-12 09:46
I have described how to apply ADF Security for ADF BC REST in my previous post - Oracle JET and ADF BC REST Basic Authentication. I will show how you can authenticate on first request and for the next requests rely on JSESSIONID cookie from the first request. This is useful for mobile clients and JET, there is no need to keep user credentials during requests (enough to keep cookie), as this is sensitive data.

Let's see how it works. In the first request we must authenticate. We are going to use basic authentication with GET operation and provide user credentials:

Request is authenticated and data is returned:

Along with data, extra information is returned with response - cookie and header. Cookie JSESSIONID value identifies authenticated session context. We can use this value for the next requests, this way server would assume us as trusted and would not ask to authenticate again (similar principle as in ADF web). Copy cookie value:

Now you can close and open Postman, to guarantee nothing is shared from previous request. Remove authentication header and add new header variable called Cookie. Value must be set as JSESSIONID=Cookie Value. Execute GET operation:

If session associated to this cookie is still active on the server, you will get response data, as it would be expected (no need to provide user credentials again):

ADF BC REST sample application - is protected by ADF Security with authentication and authorization:

REST servlet is mapped with appropriate security constraint in web.xml:

ADF Improved Support for Programmatic View Object

Sat, 2016-07-09 13:15
ADF brings improved support for programmatic VO creation. Such VO's are handy, when we want to base VO on alternative data source, such as PL/SQL ref cursor. In ADF developer don't need to worry which framework methods to override, now it is enough to extend from Programmatic View Object Implementation class. This is special framework helper class, designed for programmatic VO support. See example below.

Sample application ( is based on one regular VO, which renders employees table. Programmatic VO renders data for tag cloud component, located below table:

Steps to create programmatic VO are much more simple in ADF Select data source option to be Programmatic in VO creation wizard:

JDEV will create VO with Java implementation classes, extended from ProgrammaticViewObjectImpl class and ProgrammaticViewRowImpl class. These classes will take care for special lifecycle required for programmatic VO behavior. See extends part:

Generated class contains getScrollableData extended method. This is the place to supply data collection for the VO. In my example, I'm creating ArrayList (VO rows) of HashMap's (one HashMap, represents row data of attribute/value pair). Attributes are populated with values and collection is returned back to the framework to manage it. Method is being called automatically by the framework. There are other methods available, to retrieve row by key, etc.:

New framework class allows to work with programmatic VO's easier and leverage framework features. I would expect it would provide better support for programmatic VO data filtering.

VO data is accessed on UI through regular binding expressions:

Initialized by ADF bindings layer: