Thursday, December 29, 2016

NetBeans Git Client for JET Versioning and Oracle Developer Cloud Service

I should say I'm happy with how NetBeans Git client works. It offers good performance and resolves conflicts pretty well.

It shows a list of pending changes and also changes colour for changed file name:


Changes can be committed into local repository through informative wizard:


File changes are displayed in very clear way, easy to understand them:


All local changes can be pushed to Oracle Developer Cloud Service Git (or other repository):


Select a branch where to push your work:


Notification about recent update is displayed in Developer Cloud Service console:


We can track changes, do merge requests and merge into trunk in Developer Cloud Service:

Tuesday, December 27, 2016

ADF BC REST 12.2.1.2 Custom Method JDeveloper Workaround

Some of you who would try to implement custom method with ADF BC REST may face JDeveloper 12.2.1.2 wizard issue. JDeveloper 12.2.1.2 wizard is refusing to register ADF BC REST custom method, but it works perfectly on ADF runtime. Seems to be JDeveloper 12.2.1.1 - 12.2.1.2 bug. There is a workaround to modify REST service configuration manually and include custom method binding.

Sample application (available on GitHub - jetcrud). This sample implements custom method in VO implementation class - testCall:


Method is exposed through client interface:


Now if you go to REST service definition and try to enable this method to be included into REST interface - JDeveloper will report error:


Something wrong happens in RSTCustomMethodTab class:


Workaround - add method call into REST service definition manually. I recommend to do it outside of JDeveloper, as it hangs. Change definition in external editor. This is the example for custom method entry:


a

If you take a look into JDeveloper wizard for REST definition, it still shows method unchecked. But you can ignore it:


To execute custom method through REST call, make sure to use POST and specify method name along with parameters in REST request body:


Make sure not to forget to provide action Content-Type:


Check section for more info - 22.13.5 Executing a Custom Action.

Monday, December 26, 2016

ADF REST Framework Version 2 (and later) - 12.2.1.2

While building our new Oracle Cloud application with ADF BC REST and JET, I have discovered not announced feature in ADF BC REST 12.2.1.2. Starting from 12.2.1.2 ADF BC REST offers runtime versions. This is configurable in adf-config.xml file or could be provided through REST request header. ADF 12.2.1.2 supports version 1, 2 and 3. Version 2 offers better query support, while version 3 provides better response for hierarchical data - 16.5.2 What You May Need to Know About Versioning the ADF REST Framework.

You can specify version in adf-config.xml, as per documentation:


Version 2 offers more advanced support for data query. Besides query by example from version 1, we could use advanced query syntax - 22.5.4 Filtering a Resource Collection with a Query Parameter. For example, like operator wasn't supported in version 1:


It is supported in version 2. I could specify version 2 directly in REST request header as in example below:


Download ADF BC REST sample from GitHub repository - jetcrud.

Oracle JDeveloper (SOA and BPM) 12c (12.2.1.2.0) - Download Temporarily Not Available

If you try to download JDeveloper (as well as SOA Suite or BPM Suite) from OTN - you will see a message on OTN download section - "This page is temporarily not available we'll be back soon".

You should not worry, as per Shay Shmeltzer answer on OTN Forum - "We discovered an issue with the installer - we are working to fix this. Once we have the updated installer we'll update the forum and the pages." Read more here.

There is solution - if you need urgently to download JDeveloper, go to Oracle Software Delivery Cloud and download from there.

Wednesday, December 21, 2016

Skip LOV Validation for ADF BC Bulk Insert

This post is about ADF BC LOV. I will describe how you could optimize bulk insert of new rows into VO, when some of the attributes are assigned with LOVs. By default ADF would validate new row attribute value through LOV (LOV Validation and Programmatic Row Insert Performance) for each new row. This will lead to bad performance, especially if you insert a set of new rows programmatically - there will be multiple SQL queries executed to check if LOV attribute value exists.

My colleague found a way to bypass LOV validation when new rows are created programmatically by calling ADF BC API createAndInitRow instead of createRow.

Sample application - LOVValidationBulkInsertApp.zip is developed with LOV for JobId attribute:


We should see first how it works to insert row with LOV attribute by calling createRow ADF BC API:


With SQL log enabled, you should see SQL query executed for LOV, when custom method from above is called:


Now change createRow method to createAndInitRow, to see the difference:


This time no LOV SQL query (for Job Id attribute) executed during new row creation:

Saturday, December 17, 2016

JET Application - Generate with Yeoman - Debug in NetBeans

Let's take a look today how to debug JET application (tested with JET 2.2.0) which is initially generated with Yeoman. We could debug in NetBeans, but by default application generated with Yeoman is not runnable in NetBeans, we need to add manually some config files - I will describe how. Also note - JET application created with NetBeans can't be directly served with grunt from command line, it also would require manual changes in the config. It would be nice if Oracle would make JET applications generated with Yeoman automatically runnable in NetBeans and vice versa.

I would recommend to read Geertjan post on similar topic - Avoiding Hiccups in Building Oracle JET Applications. My point is different though - I describe how to run application generated with Yeoman in NetBeans without using grunt command, to be able to use NetBeans debugger for sources in src folder.

I will go step by step through the process (first I would recommend to go through JET Getting Started):

1. JET application creation with Yeoman and build with Grunt
2. Manual configuration to be able to open such application in NetBeans
3. JET CSS config to be able to run such application in NetBeans

1. JET application creation with Yeoman and build with Grunt

Run command: yo oraclejet basicjetapp --template=basic. This creates simple JET application with one module:


Scripts and various modules are being generated. JET content can be located under src folder - generated application structure:


This is the most simple JET application possible, based on basic template. I have added chart into main page (I'm using Atom text editor to edit JavaScript):


Supporting variables for the chart are created in Application Controller module:


Application Controller module is included into JET main module, where bindings are applied based on Application Controller module and JET context is initialized:


You can build minified JET structure ready for deployment with Grunt command build:release. Navigate to application root folder and run it from there: grunt build:release:


This will produce web folder (name can be changed) with JET minified content:


We could run JET application with Grunt using server:release command: grunt serve:release:


JET application is running:


2. Manual configuration to be able to open such application in NetBeans

---UPDATE 2016-12-27---

You can open JET application generated with Yeoman in NetBeans and after Run - it will display Project Properties window:


Change Start File to point to src folder:


Now you should be able to run JET application in NetBeans, make sure to fix CSS, refer to point 3.

By default NetBeans assigns oraclejet-app name, you can change it:


Same steps can be done manually by editing nbproject folder files, described below.

---END UPDATE---

To debug JET application generated with Yeoman we would need to open it in NetBeans. Unfortunately this is not available by default. NetBeans doesn't recognize JET project and shows disabled icon:


We need to copy manually NetBeans nbproject folder from any other JET application created with NetBeans into our application root folder:


Change project.xml file and update project name property:


Update web context root in project.properties file:


Update application paths in private.xml file:


After these changes, NetBeans can recognize JET application and it can be opened:


JET application generated with Yeoman is successfully opened in NetBeans:


But there is issue when trying to run application in NetBeans - it can't find JET Alta UI CSS. JET is running, but with ugly look:


3. JET CSS config to be able to run such application in NetBeans

JET application generated with Yeoman points to CSS location which doesnt exist in folder structure:


After we run Grunt command grunt build:release it automatically updates CSS location. This is why it works with grunt serve:release:


Things are a bit different for JET application created with NetBeans. JET application created with NetBeans indeed contains JET Alta UI CSS in the folder originally referenced by JET application created with Yeoman:


I copied this folder into JET application generated with Yeoman:


This time JET application runs and displays as it should in NetBeans:


Don't forget to remove duplicate (we need it only to run/debug in NetBeans) JET Alta UI CSS files folder from release if you run grunt serve:release:


Download sample JET application from GitHub directory - basicjetapp.

Saturday, December 10, 2016

Early ADF Model Update with Process Updates Method

This use case specifically useful for ADF UI value change listener. If there is business logic to be invoked when field value is changed, we can can call ADF BC custom method from assigned value change listener. However new value is not yet propagated down to ADF BC model - we would need to pass it as parameter to custom method. What if want to have new value to be available in ADF BC model without passing new value from value change listener as parameter? This is possible if we call processUpdates method in value change listener, before calling custom ADF BC method.

In my example - ADFProcessUpdatesApp.zip, I have created sample method testCall in VO Row implementation class. This method is accessing salary attribute value from current row. I'm going to call this method through bindings from value change listener and lets see what it will print out:


Let's use value change listener with custom method call without calling processUpdates initially:


Change salary attribute value to call value change listener:


Custom ADF BC method is invoked from value change listener and it prints value before change:


How to get new value in ADF BC custom method, without passing it as parameter from value change listener? Call processUpdates on UI component, before calling custom method in value change listener:


Change value once again:


This time new value is visible in ADF BC custom method instantly, when value change listener is invoked: