Friday, November 30, 2012

Win A free copy of the 'Oracle ADF Real World Developer’s Guide', just by commenting!

Win A free copy of the 'Oracle ADF Real World Developer’s Guide', just by commenting!

Hello all,

UPDATE: the competition is over and the winners are announced here:

Thank You all for your participation.

Packt publishing, kindly asked me to conduct a giveaway contest for the book!

Just to remind you that I was one of the Technical Reviewers of that book.
you can find the link here
So, it is with great pleasure to conduct the following giveaway contest!

For the contest Packt Publishing has two copies of Oracle ADF Real World Developer’s Guide to be given away to two lucky winners.

How you can win:

To win your copy of this book, all you need to do is come up with a comment below highlighting the reason "why you would like to win this book”.

Please note: Winners residing only in the USA and Europe would get a chance to win print copies. Others would be provided with eBook copies.

Duration of the contest and selection of winners:

The contest is valid for 14 days, and is open to everyone. 

The end date is 14 of December Midnight UK timezone (UTC +0).

Winners will be selected on the basis of their comment posted.

works with Oracle as a Principal Solutions Architect for the Oracle Application Development Framework.
This book is suitable for ADF developers who are looking forward to build healthy and better performing applications using Oracle ADF. A book filled with step-by-step instructions and real-time examples with illustrations, diagrams, and tips that help developers learn the visual and declarative programming model offered by ADF.

Using this book, readers will learn to get started with building business services using ADF business components, validate business data in different layers of an application and understand the use of EJB and web services in an ADF application.

Make your best comment!!!

Monday, November 19, 2012

create a new row when there are no Records in View Object. ADF BC


This is a quick post to show a way of creating a new row when there no records retrieved from a query in a view object.

in other words,
we want to create a record every time the view object does not return any data..

you can download the example from the following repository:

In this example, we are going to have a master detail association between Countries and Locations.
This is from the HR schema.

So, in this case, we want to navigate through Countries and see the locations of every country.
In case there is no location for a country, we want to create a record and have it ready for data entry.

This solution is quite simple.

all we have to do is override the executeQueryForCollection method in the Locations View Object.

As you can see, we check if there is not any row in the view object, right after the queryExecution.
we choose to check if the first() method returns null. Of course there are other ways to achieve the same thing. It really depends on the case.

if the vo has no rows, we create a new row, insert it and make it current.

And thats it. as simple as it gets.

you can download the example from the following repository:



Sunday, November 18, 2012

Oracle ADF Mobile: adfmf-application.xml and adfmf-feature.xml Part 2 (final)


This is the second and final part of this topic. We will try to answer some more questions regarding those file descriptors. This is going to be a brief post since a detailed explanation was made in the part1.



You can download the sample application from the following GitHub Repository:


You can find part 1 here.

Okay lets clear out some additional stuff in order to be ready to go to more advanced stuff.

-Can we have pages that are not included in the adfmf-feature.xml ? Something like references?

We can indeed! Features are the pages that will be viewed in the springBoard(if enabled) and the navigationBar. So in simple words, your features are the content that you will be able to navigate to from your springboard and your navigationBar. Something like a reference point..

-Can we have more than one pages in one adfmf-feature.xml ?
Yes of course we can. Each page (html, AMX, remote url) in the adfmf-feature.xml file represents a feature. That feature can be controlled from the adfmf-application.xml regarding visibility and device access.

-When are we going to talk about AMX pages??
In the next ADF Mobile post. These posts were more to get acquainted with those files. Since we now know what we are talking about. We will continue to more interesting stuff. One thing at a time.

There are still features not mentioned in these posts, but I think it would be better if we saw them on a request basis, when there will be a need.

The example application in the repository, covers all those questions mentioned.

You can download the sample application from the following GitHub Repository:



Friday, November 16, 2012

CSV files with ADF CSVParser Example.

Hi all,

This is a small example on how to use a CSVParser which comes along with ADF.


We are going to create a small example using a csv file.

The project can be found in the following repository:

We are going to use a simple csv file and we are going to upload it, parse it and create rows in the corresponding view object.

with the use of CSVParser, things are a bit more easy. Just follow the screens below and you will understand why.
First, we have to create a project.. We will work on a simple project based on HR Schema.
We will the af:inputFile component for this example. In the value Change Listener we write the following:

as you can see above, the parse calls the createRow method through the bindings. it is not the default adf operation.  it is a custom method:

and then we expose it to the client interface.

add it in the bindings as a method action.

 place the appropriate partial Triggers from and have the inputfile autoSubmit true and here it is!
in the below screen shot

Aaaand that is it! Simple isnt?

The project can be found in the following repository:



Saturday, November 10, 2012

The code will go to GitHub

This is to let you know that gradually, the existing code and sample applications will be available on GitHub and more specifically on the following repository.
All previous uploaded applications will remain on google code.

You will find several clients out there to get the code.

My client of choice is SourceTree.


Oracle ADF Mobile: adfmf-application.xml and adfmf-feature.xml Part 1


In this article we will try to understand the meaning of those file descriptors.
This is the first part of this article regarding those file descriptors. We are going to have a very simple approach on things..



-When are they created?

Those files are created when you create a new ADF Mobile application. (see Hello World Post)
Also check the following link (official Oracle Documentation ):

According to the above documentation (content extracted from there):

Creating an application results in the generation of the adfmf-application.xml file, which enables you to configure the mobile application and also the adfmf-features.xml file, which you use to add, remove, or edit the application features embedded within the mobile application.

hmmm... What do we get out of it? Is it clear what file is what?

We have both files generated when creating the application. Thats clear so far.

-Can we have more than one of those configuration files?

According to the following section of the documentation (content extracted from the below link) :

An ADF Mobile application can have one or more view controller-type projects, each of which describes a set of features in an adfmf-feature.xml file. As described in Chapter 4, "Getting Started with ADF Mobile Application Development," ADF Mobile provides you with the adfmf-application.xml configuration file for the mobile application itself, and the adfmf-feature.xml file, which you use to define the content of the application. While you can manually change these files, ADF Mobile provides two overview editors that enable you to build these files declaratively.


The adfmf-application.xml configuration file enables you to set the basic configuration of the ADF Mobile application by designating its display name, a unique application ID (to prevent naming collisions) and also by selecting the application features that will display on the application springboard (the equivalent of a home page on a smartphone). Further, this file enables you to create the user preferences pages for the mobile application.

Sorry what? We can have more than one ViewController type projects?
yep! Which means that we can have more than one adfmf-feature.xml files.

Lets do it then!!!!!!!!!!!!!!!!!! ( I actually typed all those !!!! one by one... Lets start a cult... the ! cult!. (exclamation mark cult.. sounds wicket.. doesnt it? )) ( I even placed the parenthesis correct!! wow imagine something like : " correct exclamation mark exclamation mark exclamation mark)

Lets create an ADF Mobile application with more than one ViewController type projects!
(If you dont remember how to start with and ADF Mobile application check the beginning of this  article)

In this example we will have 3 ViewController projects: ViewController, ViewController2 and ViewController3
The result of that creation is the following:

Ok, as we can see we have tree different adfmf-feature.xml files for each ViewController.
Lets create an html page in each ViewController:

in this post, names are going to be dull. There is something retro in this kind of naming.
The pages will be:


The result will be the following:

Each page will have an output text.. something to recognisable.

What have we done so far?
Nothing really.. we just created three html pages....
In order to show those pages in the application. we have to add them as features in the corresponding ViewController project.

NOTE: in each addition, make sure that the ids are unique. Keep the other values as default.

After all that is done, we will have the following:

What we have here?
We have created a feature for every html page in each ViewController. Each adfmf-feature.xml file is added as a feature reference in the adfmf-application.xml file.
Lets have a look:

As you can see, adfmf-application.xml has three entries. One for each feature. This was automatically done because we had the checkbox checked two screens ago ("add a corresponding feautre reference to adfmf-application.xml")

So what have we done so far?
Why dont we deploy to see for ourselves!!??

First we have to create a deployment profile for the iOS platform

Lets deploy to simulator now:

As you can see, each feature is displayed as a part of the navigationBar.. Yes that thing at the bottom of the screen is the navigationBar

-Can we remove the navigation Bar? Or at least can we control which feature is going to be displayed??


This is configured in the adfmf-application.xml file descriptor. With simple declarative development!

So, with those two checkBoxes we control the NavigationBar.
And yes, you can configure which feature will be shown in your navigationBar!

-uhm.. Excuse me, sorry! You
-Yes you.. no not you, the guy next to you.
- there is only a dog next to me..
-The other side next to you...
-Be specific please..
-On your right
-It is still the dog..
-.... On your left please
-Who?? mee???
-YESS!!! you!
-what? how can I help you?

-What is spring board?
-Spring Board is the so called first wave of your astonishing application! Is the first screen your users will see!
Since it is that important.. you can choose how it can look like.. The below screen shows the default springBar

And the configuration is done in , you guessed it right!!! in the adfmf-application.xml

So what have we learned until now??

adfmf-application.xml is the file descriptor that holds the general behaviour of the application.

adfmf-feature.xml is the file descriptor that holds a feature that is going to be injected in the application.

We can have as many features as we want since it is not mandatory to be part of the application.

In simple words (literally)

1) Create your application (we are going to see more in the near future)
2) Create the feature
3) Add your pages( html etc..)
4) Include the feature in the adfmf-application.xml descriptor in order to be part of the application.

Well thats it for now. Another article is already on its way! We are going to try and answer all questions that might come up and hopefully we will have a better understanding


Saturday, November 3, 2012

Oracle ADF Mobile World! Hello!

ADF Mobile,
As you probably already know..

ADF Mobile is here!

Here are some links that will make you feel at home..

Home page of ADF Mobile:

How to setup your JDeveloper:

Developer's Guide

Some sales stuff

And of course, the samples!! Samples are good. We need samples! Samples are goooood

Additional references

That is all we need for now..

This post is about mobile.. (daaaaaawn of the dead).. obviously..
So lets get started.

This post does not aim to replace any of the official documentation.

First we have to setup our JDeveloper ( for the ADF mobile development
(everything in this post is well documented in the above links.. this is just for reference flavour and colour)

  1. You have to install the plugin for ADF Mobile development. This is fairly easy. Just go to updates of your JDeveloper and update it through the updates process.
  2. After you have downloaded and installed the plugin, you have to restart. So, restart.
  3. Then, you have to load the extension. That is easy as well, just go to tools-preferences-ADF mobile and press "Load Extension"
  4. After that you have to select the platform you want to develop on. This sample uses iOS. You have to install Xcode to get it working on your Mac. In case you noticed. There is a strange behaviour in the preferences of ADF Mobile. If you select iOS and then select ADF Mobile and platforms back again, you will have the Android platform selected...  (see video here). The good thing is that it does not loose your paths. For those of you that dont have the simulator path set by default. The hint below the input text is quite good. Just follow the path and in your mac and you will be fine. Dont forget, you have to install Xcode first!!
  5. ADF Mobile Platforms on JDeveloper's Preferences
  6. OK, we have that working now! (We will see if that strange behaviour is going to affect us in the process). What else is there? Oh yes. the Sample application!!!!
But wait?? I have some questions first! What is going on with the DB? Do we needs Web Services?? Do we have to bake a cake first?

is there anything else that we have to do prior to develop a very simple ADF mobile application??

yes of course. There are lots of things to do before making a very first ADF mobile application..
Why dont we understand the architecture first? (see references).
Why dont we bake a cake and cook a meal first?
Why dont we make up excuses in order to postpone the inevitable? 

The world went mobile!!!

Lets get mobile then! 
Lets start coding and we will get the rest in time. There are lots to learn indeed. But lets make small steps.

No! I would like to learn the bigger picture now! I want to know what is going on.. I want to know how to talk the language.

Alright.. It sounds like you want to know everything about snowboarding without even trying to see if you can simply balance and slide...

ADF mobile Architecture

(image from official documentation)

Nice isn't it? do you feel better now? You like it dont you? Do you get the bigger picture now?
By the way, do you have any questions?? I am sure you do. In fact we all do! But perhaps it would be a lot better if we see everything in slow motion and with small examples in a series of posts. At least that is my intention. Small and Simple for starters.

One interesting thing to notice here, apart the others, is the use of PhoneGap. As you can see in the above image, The Web View contains all  the types of Views (Server HTML HTML5 etc..) and PhoneGap covers the gap between those views and the Devices..
For more information about PhoneGap

The above link will give you enough answers to get the picture for now.
Another very important thing is that with every ADF Mobile application, there is a small JVM included!

The following content is extracted from the official documentation:
  • Java runtime powered by an embedded Java VM bundled with each application.
ADF Mobile's model-view-controller stack resides on a mobile device and represents reimplementation of ADF's model-view-controller layers. UI metadata is rendered to native components on device and is bound to the model through the ADF Model.

You see that every application is powered by an embedded JVM !! And you can use that in your iPhone!!!

Without going to many details. The last thing that we note here is the Local Data.

The following content is extracted from the official documentation:

Local Data refers to data stores that reside on the device. In ADF Mobile, these are implemented as encrypted SQLite databases. Create Retrieve Update Delete (CRUD) operations are supported to this local data store through the Java layer, using JDBC-based APIs.

So in all: we will be using phoneGap, JVM and embedded encrypted SQLite databases!!

Which means that we can create applications that can store data in the local DB..

I think this brief introduction gives the basic idea of ADF Mobile.

On with the Coding!!

Where were we? Oh yes! nowhere.. we just setup our environment.

Wait! do we need a database for this sample application?
No we don't.
This is going to be fairly simple.

So what do we do?
Lets go bowling!

Shut the front door!!!
We are doing this.
Just create a new application from JDeveloper

New ADF Mobile application

Just follow the wizards from then and eventually you will get the following:

New ADF Mobile Application created.

Sorry what??

What is that:
 What is adfmf-features.xml

That is the adfmf-feature.xml file.  This file is to configure the features of your application. We wont be needing this for now. But I am sure that some of you will want to search it a bit more. So here is the documentation:

The following content is extracted from the above link:

The adfmf-feature.xml file enables you to configure the actual mobile application features that are referenced by the  element in the corresponding adfmf-application.xml file.

So basically, what is says is, that adfmf-feature.xml is the configuration file of all the features your application might have. All those features are stored in the adfmf-application.xml file.

That file is located in the descriptors section in JDeveloper. see image below:

ADF Mobile Application Resources section

So, adfmf-application.xml holds the features of your application and adfmf-features.xml configures it.
Additional resource on the adfmf-application.xml and adfmf-features.xml in a more basic level.

More on that later on.

An additional interesting thing, is that we already have a DataControl generated!

List of all operations and methods from the Auto Generated Data Control

What is that DataControl about?
That dataControl handles the operations on your device

The following content is extracted from the above link

After you complete an ADF Mobile application project, JDeveloper adds application-level and project-level artifacts, JDeveloper creates the DeviceFeatures data control. The PhoneGap Java API is abstracted through this data control, thus enabling the application features implemented as ADF Mobile AMX to access various services embedded on the device. JDeveloper also creates the ApplicationFeatures data control, which enables you to build a springboard page. By dragging and dropping the operations provided by the DeviceFeatures data control into an ADF Mobile AMX page (which is described in Section 9.5, "Using the DeviceFeatures Data Control"), you add functions to manage the user contacts stored on the device, create and send both e-mail and SMS text messages, ascertain the location of the device, use the device's camera, and retrieve images stored in the device's file system.

That autogenerated  DeviceFeatures DataControl is there to help us access various services that are embedded on the device. The ApplicationFeatures DataControl is a different story and we will talk about it in later posts.

Ok. Lets try to create a simple page.

In order to create a page, just right click on the ViewController and create a new html page.
lets say HelloWorld.html
The result will be something like the following:

Empty page created and shown in JDeveloper

Write some text:

Some text on the page.

Are we there yet??
Are we there yet?
lets go bowling then!
What else is there?
Well, we need a feature!!
Remember adfmf-features.xml file? great! go there! and add a new feature. place the name you want and make sure it is selected. Since this will be a local html page. we have to set it up as such. So in the properties of the feature, make sure that the type is html

New Application feature

Since this is going to be a local page, we have to provide the path.

Wizard that locates the HelloWorld html page

thats it!

All we have to do is to package it as an iOS application and test it with the simulator.
This is not a simple right click and run.

We have to create a deployment profile.. Since we want to run this with the iphone simulator.. we have to create the deployment profile..
So, right click on the Application and select deploy--- new deployment profile.

Press ok.

Then, make sure that the settings are correct for your simulator: I had to manually set them.

Click ok and the deployment profile is ready.

In order to test the application, right click on the application and select the profile you created previously and deploy it. This will start your iOS Simulator and you will be able to find your application

ADF mobile Application deployed on iOS simulator

if you click on the application you will see our page!

And that is it!

Once we understand how it works. one step at a time. it is fairly easy to remember.
This is the beginning!



Related Posts Plugin for WordPress, Blogger...