All things about Life, Oracle Middleware and Technology

Book cover

June 3, 2014
by Amr Gawish

Win a free copy of Oracle ADF Faces Cookbook #adffacescookbook

Oracle ADF Faces Cookbook

As of 28th of March 2014 my first book was published by Packt Publishing. The book contains over 80 recipes that aims to get you started with Oracle ADF Faces 12c by providing common recipes of what you would usually be doing using ADF Faces. It also has some advanced topics to cover things like styling, application responsiveness and performance tuning.

I’m offering you a chance to win a Free Copy of Packt’s Oracle ADF Faces Cookbook!!

That’s right, I’m pleased to announce that Packt is organizing a giveaway especially for you. All you need to do is just comment below the post and share your post on Social Media to have a chance of winning a free copy of Oracle ADF Faces Cookbook. Two lucky winners stand a chance to win a copy of the book. Keep reading to find out how you can be one of the Lucky One.

What would you expect from the book

  • Get to know what’s new in the latest version of ADF Faces 12c
  • Master ADF Skinning to rapidly create exceptional user experiences
  • Create scalable, reactive applications using ADF Faces
  • Get to know common recipes of how to start with ADF Faces 12c

How to Enter?

  1. Post your expectations from this book in comments section below.
  2. Share this article on Twitter / Facebook or Google+.

You could be one of the 2 lucky participants to win the copy.


The contest will close on 18 June 2014. Winners will be contacted by email, so be sure to use your real email address when you comment!


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.

November 18, 2013
by Amr Gawish

ADF 12c bug – Nesting pivot table under Panel Springboard

Bug description

Nesting pivot table under Spring board give you the below screenshot and the pivot is not displaying, while if you put it under any other Layout it works fine.


Chrome Browser
Windows 7

How to generate it

1- Create an application with HR Database and Create a default View for Employees Table
2- Create a JSF Page and add a spring board into it
3- Create a showDetailItem and add Icon if you want
4- Drag and Drop the EmployeesView as a Pivot Table
5- Run the Page


I couldn’t find any workarounds to that problem other than removing the pivot from Springboard!


Until there is a fix, be careful not to have any pivot tables under Springboard, you can keep track of the ticket opened at ADF EMG jira.

November 7, 2013
by Amr Gawish
1 Comment

ADF 12c bug – Unable to display Gantt chart with SubViews correctly in ADF 12c

Description of the Problem

I faced a weird bug in ADF 12c recently that caused the Gantt chart not to be displayed correctly, and by correctly I mean that the Gantt chart is displaying but without some properties that changes how it looks, for instance the chart doesn’t display Task Types (“Normal”, “Summary” or “Milestone”) correctly, it also doesn’t display % complete nor Critical, even though you specified everything the right way.



OS: Win 7

JDK: 1.7_45

How to generate the same problem

  1. In order to generate this problem, let’s start with a small Table structure like the following:1Notice that there is a recursive relationship using the PARENT_TASK_ID field.You can use This script to generate the Table with some dummy data.
  2. Next we need to create a small model with this table, so just use the Business Components from Table to generate The Entity Object, association, View Object, View Link and the Application Module.If you’ve done everything right, you should end up with something similar to the below screenshot


  3. Add another attribute inside the Tasks View Object and call it CriticalBool with type Boolean with the following expression
    Critical == 'true'


  4. Now it’s time for the Drag and Drop, Create a JSF page and Drag and Drop Task View 1 as Project Gantt chart.
    • Define the Attribute like the below screenshot


    • Define the Subtasks like the below screenshot


    • Define the Appearance like the below screenshot


    • Run your Page and examine the result


    Strangely if you follow the same steps with JDeveloper you will find a different end result



If you didn’t use Subtasks view you will not face this problem, but you will end up with a Flat Design, but if you can live with that, this problem should not bother you in the first place.


Another workaround suggested by @chriscmuir is to replace the SubTasks node with the following

<nodeDefinition type=”SubTasks” DefName=”model.GanttProjectView“>
<Item Value=”TaskId” type=”taskId”/>
<Item Value=”StartDate” type=”startTime”/>
<Item Value=”TaskType” type=”taskType”/>
<Item Value=”EndDate” type=”endTime”/>


This might need to be fixed in the next releases, but till then you can keep your eyes on it at the ADF EMG Jira.

Edit: Oracle is now investigating the issue and  it can be tracked by bug 17799712.

November 5, 2013
by Amr Gawish

Using xquery with OSB to retrieve clean URL parameters

Oracle OSB Logo

A small trick in order to expose a RESTful service that can have clean URLs like the following format


In order to do that you can use the following function in your xQuery transformation

declare function xf:test($relativeUrl as xs:string)
     as element(ns0:relativeUrlParams) {
                 for $name at $i in fn:tokenize($relativeUrl,"/")[position() mod 2 eq 1] , $value at $j in fn:tokenize($relativeUrl,"/")[position() mod 2 eq 0]
                 where $i=$j
                         <name>{ $name }</name>
                         <value>{ $value }</value>
declare variable $relativeUrl as xs:string external;

And that’s it, you will receive something like the following:

<ex:relativeUrlParams xmlns:ex="http://www.example.com/RelativeUrlParams/">


October 15, 2013
by Amr Gawish

Creating an ADF Login page without having any java code using Login proxy


There are so many questions in oracle forums asking how to redirect users to the page requested after authentication.

The official documentation in the “Create Login Page” section has changed since to always redirect to welcome page since the old way is not recommended anymore (See line 14 & 15 in the java code of the Managed Bean).

In this post I’ll give you an alternative way to  authenticate users without using any java code and redirect the user to the requested page after authentication by using additional page called LoginProxy.

This post was inspired by Mauro Flores

In this blog post I use JDeveloper but at the end you can find a version that is compatible with and above.


  1. Create an ADF Fusion Web application
  2. Enable Security normally using with login.html and error.htm
  3. Create 2 Test pages (test1.jsf and test2.jsf)
  4. Create Page Definitions for test1.jsf and test2.jsf
  5. Edit Security to add authenticated-role to test1.jsf and test2.jsf
  6. Create login.jsf page normally and use #{requestScope.username} and #{requestScope.password} for your inputText username and passwords. Also don’t forget to make partial submit as false because in 12c it is true by default.
  7. Create a loginProxy.jsf page like the below screenshot. Notice the javascript function which execute the form action on page load. Also notice the fail safe for users who don’t have javascript to be redirected to the normal login.html page.

    12c example

    12c example

    11R1 Example

    11R1 Example

  8. Change the web.xml security login page to point to /faces/login.jsf instead of login.html
  9. Open faces-config.xml file
  10. Create the below diagram by adding login.jsf and loginProxy.jsf with a navigation rule of login between both.
  11. Run the application and test test1 and test2 pages.
    Login Page

    Login Page

    After Login

    After Login

Additional Information

This example has been tested against Chrome, Firefox and IE9 and worked without a problem.

You might argue it’s not very secure since I’m having a page in the middle that expose the username and the password, but then that’s why I have the refresh metatag to prevent it.

Example application

You can download the example application from the following links:


September 30, 2013
by Amr Gawish

Developing Web Applications with Oracle ADF Essentials Review

Book Cover


Recently a new book has been published by PACKT with the title Developing Web Applications with Oracle ADF Essentials.

This book I had the pleasure to be one of the technical reviewers, which was great experience to review a book which authored by someone like Sten E.Vesterli.

The book discussing how can embrace ADF methodology of focusing on business model without sacrificing the benefits of having open-source stack in the mix, in the book Sten has greatly explained how can you develop a free ADF application inside your open-source stack.

Who this book for?

  • JSF developers who understand JSF and want to start with ADF learning.
  • Developers who are interested in knowing ADF but don’t want to disregard the open-source stack they already established.
  • ADF Developers who wants to understand how to create Free ADF applications.
  • Developers who are intrigued by ADF and don’t want to pay.
  • Developers who don’t have time to waste and want to focus on the business in hand without paying for big license.

Who this book is not for?

  • Developers who don’t understand JEE.
  • Developers who want to leverge ADF Security.


In the end, this is a great book for value, and if you are seriously thinking about adapting ADF with your other open-source stack, this book is definitely a must have.

You can go ahead and buy the book from here or from amazon.


September 14, 2013
by Amr Gawish

2 reasons why I think Pebble is better than Galaxy Gear

Galaxy Gear and Pebble

I’m not not going to talk about the obvious reasons like battery life or compatibility with other phones or perhaps water resistant, I’ll be talking about the less obvious reasons or practical reasons why I think Pebble is better than Galaxy Gear

1. Pebble is a watch with a phone connectivity, Gear is a phone with watch faces!

Pebble is a watch, and what a watch does is telling time, and that is the main purpose of a watch and a watch should be able to tell time whenever and wherever you are, Pebble does that pretty well by providing watch faces, but also if you navigated away from watch faces into other screens you will always find a the time on the top , that’s because telling time is the main most important feature of a watch, however in Samsung Galaxy Gear that is not true.

Gear seems to have watch faces as well but when you start navigating or getting the camera or seeing your photos it become less watch and more like a phone, now some people might fight that useful, but it’s not great to be away from knowing time and not even by a gesture away!

I want to be able if someone asked me about the time to look at my watch and tell it in 2 seconds, if I’m in camera mode and someone asked me about the time I’d have to cancel what I’m doing and go back to watch mode, or tell him/her I don’t know, or the best yet is to grab my phone from my pocket and tell him the time in which I’ll defy the whole purpose of having a smart watch in the first place!!!

2. Touch screen on your rest, think again!

I don’t know about you, but I often touch my watch, when I’m thinking, while I’m driving, while I’m sleeping, when I wake up, and they are all a perfect swipe and/or touch gestures!
I wouldn’t like it if I woke up and checked my watch to find out that I’m in a factory reset screen by accident!

Unless Samsung has discovered a really clever way to lock the screen to specific screen or not take the not-intended touch/swipes I don’t think it’ll fit anyone who actually uses the watch, that’s why I prefer the whole old button style actions!


Saying that I’m not saying that Samsung Galaxy Gear is a bad piece of equipment, and I know that there are some cool features in Galaxy Gear, but these 2 reasons might be less obvious and less important to anyone and yet it’s what define a durable smart watch in my opinion.

September 1, 2013
by Amr Gawish

How to enable the new ADF UI in WebCenter Content reference

Since it took me a while to find how to do it, I thought maybe I can share it with everybody, there is actual oracle documentation reference of how to do it step by step in here you can follow it, and Enjoy the ADF UI for WebCenter Content :)

PS: If you are using WebCenter Portal you should NOT do these steps, because in the steps you enable FoldersFramework and Folder_g won’t work which is essential if you are using WebCenter Portal.

June 11, 2013
by Amr Gawish

Starting a SOA processes by opening the light on your living room! Part-1 The Sketch

Following the previous post, this part is telling you how to start your little project, and what you should do.

In this part I’m focusing on the Hardware part, most importantly the Arduino part, How to make your sketch and create your circuit successfully.


In order for you to start you the following:

  • Hardware1 (Required)

    • ArduinoUno (You can have any Arduino board, but this tutorial shows the example on Arduino Uno)
    • Breadboard (for wiring everything together)
    • Miniature photocell (The Light detector, the component that will tell us when the lights is on or off)
    • 1  10k Ohm resistor (This will be hooked with the miniature photocell -My photocell is basically a resistor in disguise, in order for Arduino to interact with it, I have to make a divider in which I have to provide the same resistance in the other part of the circuit (will explain soon), so if you have a larger miniature photocell resistance this resistor should match it!)
    • 5 Jumper wires
    • USB Cable for programming the Arduino and giving a power source
  • Hardware (Optional) -just to be sure from hardware point of view that everything is right!-

    • 1 330 Ohm resistor
    • 1 Yellow Led (or your choice of color)
    • 1 Jumper wire
  • Software

    • Arduino IDE (Very simple to install, follow your OS steps in here


The Sketch

Follow the following sketch from the screenshot

Light Sensor Sketch


PS: You don’t have to follow the Jumper’s colors, but it’s a good practice to stick to the colors not to do things wrong!


The Code

The code is self explanatory and it’s very simple, what it said is when you see change from the photo resistor, if there is no lights in the living room make the led shine, else make the Led dimmed!


  Use a photoresistor (light sensor) to control the brightness
  of a LED.
Hardware connections:
  Photo resistor:
    Connect one side of the photoresistor to 5 Volts (5V).
    Connect the other side of the photoresistor to ANALOG pin 0.
    Connect a 10K resistor between ANALOG pin 0 and GND.
    This creates a voltage divider, with the photoresistor one
    of the two resistors. The output of the voltage divider
    (connected to A0) will vary with the light level.
    Connect the positive side (long leg) of the LED to
    digital pin 9. (To vary the brightness, this pin must
    support PWM, which is indicated by "~" or "PWM" on the
    Arduino itself.)
    Connect the negative side of the LED (short leg) to a
    330 Ohm resistor.
    Connect the other side of the resistor to GND.
// We'll create constants to name the pins we're using.
// This will make it easier to follow the code below.
const int sensorPin = 0;
const int ledPin = 9;
// We'll also set up some global variables for the light level:
int lightLevel, high = 0, low = 1023;
void setup()
  // We'll set up the LED pin to be an output.
  // (We don't need to do anything special to use the analog input.)
  pinMode(ledPin, OUTPUT);
  //We'll also start sending signal to the host Computer on port 9600
void loop()
  // We'll use the analogRead() function to measure the voltage 
  // coming from the photoresistor-resistor pair. This number can 
  // range between 0 (0 Volts) and 1023 (5 Volts), but this circuit 
  // will have a smaller range between dark and light.
  lightLevel = analogRead(sensorPin);
  // We now want to use this number to control the brightness of
  // the LED. But we have a problem: the analogRead() function
  // returns values between 0 and 1023, and the analogWrite()
  // function wants values from 0 to 255.
  // The circuit we made won't have a range all the way from
  // 0 to 5 Volts. It will be a smaller range, such as 300 
  // (dark) to 800 (light).
  // If we just pass this number directly to map(), the LED will
  // change brightness, but it will never be completely off or
  // completely on.
  autoTune();  // have the Arduino do the work for us!
  // The above functions will alter lightLevel to be cover the
  // range from full-on to full-off. Now we can adjust the
  // brightness of the LED:
  // And then we can send this lightLevel to The Host Computer
  // Notice that it'll be from 0 to 255
void autoTune()
  // As we mentioned above, the light-sensing circuit we built
  // won't have a range all the way from 0 to 1023. It will likely
  // be more like 300 (dark) to 800 (light).
  // In this function, the Arduino will keep track of the highest
  // and lowest values that we're reading from analogRead().
  // If you look at the top of the sketch, you'll see that we've
  // initialized "low" to be 1023. We'll save anything we read
  // that's lower than that:
  if (lightLevel &lt; low)   {     low = lightLevel;   }   // We also initialized "high" to be 0. We'll save anything   // we read that's higher than that:      if (lightLevel &gt; high)
    high = lightLevel;
  // Once we have the highest and lowest values, we can stick them
  // directly into the map() function. No manual tweaking needed!
  // One trick we'll do is to add a small offset to low and high,
  // to ensure that the LED is fully-off and fully-on at the limits
  // (otherwise it might flicker a little bit).
  lightLevel = map(lightLevel, low+30, high-30, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);
  // Now we'll return to the main loop(), and send lightLevel
  // to the LED.


Running the code on Arduino

Now you are able to run this on Arduino, select your serial port and click on upload from you Arduino IDE.

Now try to cover the Photo resistor to see the LED flashing and dimming, pretty fun huh!

Next part is to get the data from Arduino and start the SOA Process, stay tuned.




1: You can download all these hardware as a training bundle from SparkFun

May 20, 2013
by Amr Gawish
1 Comment

Starting a SOA processes by opening the light on your living room! Part-0


One thing is amazing about the SOA suite, and specifically a composite application, is the ability to start the processes by event or triggers.

Triggers like creating a file system in a specific folder, or a new JMS message in a queue, or a new record in a database or even a new mail message in a specific mailbox.

But why stopping at this stage, why not to use the internet of things to start integrate with the real world!!!

Things like starting the process once person switched on or off the light in the living room or even start the process when someone enters the room, or even more better when the room tempreture increases above certain level.
The ability to integrate this kind of amazing cool features and make use of this inside the SOA suite specifically and oracle middleware at general is amazing, and here the sky is only the beginning.


In this part I won’t talk about how to do it just yet, I’ll talk about what components do you need in order to be able to do it and how to be able to imagine the whole idea.

What will you need!


  • Arduino board
  • Breadboard
  • Miniature photocell
  • 1 10k Ohm resistor
  • 1 330 Ohm resistor (optional)
  • 6 jumper wires (1 of them are optional)
  • 1 Yellow LED (optional)
  • USB Cable from the Arduino to your computer


  • Arduino IDE
  • Python
  • PySerial library in Python
  • JDeveloper
  • SOA Suite


Well, that’s the fun part, it’s not really hard.

First you have to assemble a sketch on Arduino in order to capture when the lights is off or on inside a room (using the photocell) and other stuff from the hardware section.

Next we will program that sketch to send this signal using the USB cable to the host machine (That’s your PC or Mac!)

Then we will listen to this from python by using pyserial -We can use java but java requires a lot harder configuration than python, so I went with python-

Make python create a filesystem inside a specific folder that SOA process can listen to.

Make SOA listen to this filesystem.

and VOALA!!!


Let’s slow down, in the next following articles I’ll show exactly how to do it in a great details, so if you didn’t get what I wrote above, don’t worry it’ll be greatly explained in the next following articles.

But for the sake of this article, I’ll show you the Arduino board that will make this trigger works!

Isn’t it beautiful!

Well, see you in next posts (not too far in the future -I hope!-)