Andrejus Baranovski

Subscribe to Andrejus Baranovski feed
Blog about Oracle technology
Updated: 9 hours 41 min ago

ADF New Feature - Masonry Layout Custom Size Dashboard

Sat, 2016-11-26 13:44
ADF and respectively comes with improvement for Masonry Layout component. Now we can define custom sizes for tiles - 9.4.1 How to Use a masonryLayout Component. This helps to define larger tiles and organize dashboard layout in more accurate way.

I have uploaded working demo app on GitHub, you can download it directly from repository or browse through the code - ADFAltaApp. I will be using this app for ADF Bindings webinar - Live Webinar - Master Class - ADF Bindings Explained.

To access Masonry Layout dashboard with custom tile sizes, go to Employees section and open Profile tab. You should see such dashboard layout (one tile 2x4, one tile 4x2 and two tiles 2x2). All four tiles are defined with custom size:

Masonry Layout is responsive out of the box. On narrow screen tiles will be re-arranged automatically:

Custom tiles for Masonry Layout are defined through CSS. You should create custom style class and set it for Masonry Layout component. I have define custom style class - RedSamuraiDashboard:

Each tile group with custom size must be defined in CSS separately. Width and hight should be proportional. If you define 250px for size 2, this means size for 4 must be 500px:

Masonry Layout tiles are assigned with style class which defines size:

You could have ADF region inside tile, it renders perfectly well:

Oracle JET CRUD - Search and Edit Form - Part I

Sat, 2016-11-19 03:36
I'm going to post a series of articles about CRUD functionality (on top of ADF BC) implementation in JET. I already had a couple of posts about JET CRUD implementation, this new series will bring improved and simplified structure for JET code implementation.

Today I will start with explanation and example how to pass selected object ID from search screen into edit screen. I have uploaded complete sample (with ADF BC and JET) into GitHub repository. Download ready to be run code or browse it directly from GitHub repository.

There are two essential parts to understand, when you implement search/edit form.

1. How to get selected object ID

I have implemented read-only table where user could select a record and navigate to edit form. JET table is enhanced with template. Each row renders edit action link. When this link is pressed, it calls our custom editCustomer function and also it sends across a key value from selected row (EmployeeId):

Inside editCustomer function we can access key parameter value and store it into JET router (this will make it accessible from another JET module, where we navigate for editing - editCustomer):

2. How to use selected object ID for edit

Edit module contains initialize function. It gets invoked automatically, each time we navigate to edit screen. Inside this function we can can access and retrieve parameter value stored in JET router. It can be used to fetch data model for editing:

This is how it looks like. User can select a row in JET table (enabled with pagination) and click on edit action:

Edit module will be loaded and data will be fetched for editing by key passed through JET router:

Live Webinar - Master Class - ADF Bindings Explained

Tue, 2016-11-15 10:09
I will be running free online webinar on Wed, Dec 7, 2016 7:00 PM - 9:00 PM CET. Everyone who wants to learn more about ADF Bindings is welcome to join !

Registration URL:
Webinar ID: 806-309-947


Master Class - ADF Bindings Explained (Andrejus Baranovskis, Oracle ACE Director)


This 2 hours long webinar is targeted for ADF beginners with main goal to explain ADF bindings concept and its usage to the full potential. ADF Bindings is one of the most complex parts to learn in ADF, every ADF developer should understand how ADF bindings work. Goal is to have interactive session, participants could ask questions and get answers live. This live event is completely free - join it on December 7th at 7:00 PM CET (Central European Time) (which is respectively 12:00 PM New York and 10:00 AM San Francisco on December 7th).

In order to join live webinar, you need to complete registration form on GoToWebinar. Number of participants is limited, don't wait - register now.

Topics to be covered: 

1. ADF Bindings overview. Why ADF Bindings are required and how they are useful
2. Drill down into ADF Bindings. Explanation how binding object is executed from UI fragment down to Page Definition
3. ADF Binding types explanation. Information about different bindings generated, when using JDeveloper wizards. What happens with ADF Bindings, when using LOV, table, ADF Query, Task Flow wizards.
4. Declarative ADF binding access with expressions
5. Programmatic ADF binding access from managed beans
6. ADF binding sharing and access from ADF Task Flows. How to create binding layer for Task Flow method call or router activities.
7. Best practices for ADF Bindings
8. Your questions

ADF LOV Auto Suggest Functionality

Thu, 2016-11-10 10:34
ADF Faces LOV component can be easily enabled with auto suggest functionality. This is really powerful feature and should save time for user to search for required list values.

Auto suggest can be configured to be invoked only when certain number of characters is entered. I have configured Job ID list to trigger auto suggest, when two or more characters are entered. No auto suggest with single character:

Two or more characters entered - auto suggest displays filtered LOV values. What is nice about it - it automatically shows all these attributes included into LOV list:

In the background ADF BC executes SQL with bind variable from auto suggest:

LOV is defined on attribute in standard way, nothing special here:

To enable auto suggest behaviour, enough to drag and drop ADF af:autoSuggestBehavior tag into ADF Faces LOV component. Point suggestItems property to LOV binding suggestItems expression. Number of characters when to start auto suggest search is configure through minChars property:

Download sample application -

Oracle JET Composite Component and ADF BC REST

Thu, 2016-11-03 11:28
I decided to implement sample app for JET composite component. This is powerful thing, it allows to build pretty much any UIs with HTML - package as components and reuse in the apps. Not only UI - JET composite component gets data as any other standard JET component. This allows to build your own components for forms, tables, various widgets. It allows to simplify code complexity, you could hide frequently used code into JET components and use component with parameters only on the page.

My sample is based on example from Geertjan Wielenga blog - Minimal Oracle JET Composite Component and I show how to supply data from ADF BC REST to be displayed in JET composite component. Read more about JET composite components in JET Cookbook - Composite Components. Sample is implemented with latest JET distribution 2.2.0 (it didn't work for me with 2.1.0 - JET app was blocked, after composite component was displayed) -

Composite component from sample app renders a list of customers including last and first names:

To attach composite component to JET project, you need to copy (or just implement inside existing project) package into the project. Composite component resides in simple folder structure and is based on HTML implementation, metadata JSON file and JavaScript loader file:

HTML implementation for this sample is simple, renders two text entries (binded to properties, so we could provide dynamic values in the consumer later) with different heading. You can implement here pretty much anything supported by HTML:

Metadata JSON file contains description for properties referenced in HTML UI implementation:

JavaScript loader is a central registry where HTML implementation is mapped with metadata:

Composite component is consumed in customer module. To consume it, make sure to add required references into module define block - highlighted:

On HTML side of customer module, composite component is rendered in the loop - for each entry from the array fetched from ADF BC REST service. We provide array elements as values for composite component attributes:

Data is fetched from ADF BC REST service by executing fetch operation on top of JET collection and then processing results into observable array (each entry is displayed by composite component on the UI):

ADF Regions and Shared Data Control Bindings Use Case

Thu, 2016-10-27 10:02
While teaching ADF trainings and talking to ADF developers, often I can see people think about ADF bindings as about some mistery and try to avoid using full potential of ADF Data Control. I would like to give simple, but practical example in this post, which describes how to use ADF bindings and access these bindings across different ADF regions.

This diagram shows how sample application ( is implemented:

There are two regions (task flows), both are configured with Shared Data Control (means they will share same AM instance). Employees region could change current row. From Jobs region we can access bindings updated in Employees (Email attribute in this case).

Two regions are rendered side by side. I can move to different row in Employees and press button Set Current. This will set displayed row as current:

Current row in Employees region is set through custom method:

Button in Jobs region - Show Employee displays Email value from Employees region. Such functionality can be important, when you need to implement data exchange functionality between regions. Simply rely on ADF bindings in Shared Data Control - this would work:

Main page contains both regions:

Email field value is set in Employees region, through ADF bindings:

Binding attribute for Email is defined in Page Definition and attached to Data Control:

Make sure TF is set to default Shared transaction, otherwise changes in the ADF bindings values will not be visible outside of current task flow/region:

Email attribute is referenced through the binding in Jobs region:

You must include Email attribute binding into Jobs region page definition. Its value will be automatically set to the one from Employees region:

Hopefully this will explain how powerful ADF bindings are.

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: