ADF 12c Bug – Unable to Display Gantt Chart With Subtasks 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.

Environment

JDeveloper: 12.1.2.0.0 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:
    Notice 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.

    4.1. Define the Attribute like the below screenshot

    4.2. Define the Subtasks like the below screenshot

    4.3. Define the Appearance like the below screenshot

    4.4. Run your Page and examine the result

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

Workaround

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.

Conclusion

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

Creating an ADF Login Page Without Having Any Java Code Using Login Proxy

Prologue

There are so many questions in oracle forums asking how to redirect the user to the page he requested before authentication.

The official documentation in the “Create Login Page” section has changed since 11.1.1.5 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.

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

Steps

  1. Create an ADF Fusion Web application
  2. Enable Security normally using with login.html and error.htm
    0
  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
    0.5
  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.
    8
  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
    Web.xml
  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.
    faces-config
  11. Run the application and see the magic happens. Try to open test1 first and test2 to see that it is being redirected the right way.

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:

 

Starting a SOA Processes by Opening the Light on Your Living Room! Part-1

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.

Requirements

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!

 

/*
PHOTO RESISTOR

  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.

  LED:

    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
  Serial.begin(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:

  analogWrite(ledPin,lightLevel);

  // And then we can send this lightLevel to The Host Computer
  // Notice that it'll be from 0 to 255
  Serial.println(lightLevel);
}

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 < low)   
  {     
           low = lightLevel;   
  }   
  // We also initialized "high" to be 0. We'll save anything   
  // we read that's higher than that:  
    
  if (lightLevel > 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

Starting a SOA Processes by Opening the Light on Your Living Room! Part-0

Intro

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.

Part-0

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!

Hardware

  • 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

Software

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

How!!!

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!!!

Huh!!!

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!-)

Mdlwr Is Back, With Performance and New Articles

I’ve been so busy working with multiple projects in Saudi Arabia and Egypt, and I also joined infoMENTUM in United Kingdom, but now I’m back and I have loads and loads of articles to write.

Also as some of you may know posterous is closing up their service, so I’ve transferred the blog to octopress so some of the comments may be lost in the process, apologies to the people who commented on my previous threads.

So stay tunes :)

The Ultimate Guide for Beautiful Skinning in ADF and WebCenter - Using SASS

ADF & SASS

Prologue:

Long time no posts, I’ve been busy coding in the last couple of months, and as the life always do, I really didn’t have much time writting posts, instead I was busy rocking ADF and WebCenter projects.

The Problem:

As all of you ADFers know, skinning in ADF has been pain in the butt, and as Skinning and style is a crucial part for any ADF application, there has to be some way in order to make this work easier.

Read on →

Using Groovy to Retrieve Current Logged in User Name

 

One tip I found Useful, and I didn’t find enough resources talking about it, is how to populate a value of Entity Attribute or Binding Value with the current logged in user using Groovy

 

Simply use this: 

adf.context.securityContext.getUserPrincipal().getName()

Piece of cake :)

JDeveloper Git Extension v1.0.0.1

I started to develop an extension for JDeveloper to be able to connect to Git Versioning System, and so far I had a short success to clone Git Repository to Existing JDeveloper Project (read the article from here)

 

Now I’ve moved a step further, Now with the extension you can create a new application, with a project name as you wish, and copy the files from repository into your created application.

Read on →

@JDeveloper #Git Plugin

So I love git, and I Love GitHub and since I use them both, and I use JDeveloper I though of developing a plugin for JDeveloper to integrate with Git and GitHub eventually

Read on →

Creating Utilities to Manipulate Users in #Weblogic Using #JMX and #MBeans

INTRO

First I’d like to apologies for the big absent on my side as I was very busy traveling to KSA for a new freelancing Client, but anyway I hope this article make you forgive me :)

Weblogic is a great Application Server, and the one you can count on for your heavy industrial deployment, load balancing, high availability and clustering.

Not only that but it comes with a great scripting tool WLST and the standardization of accessing its MBeans through JMX

There were an old school approach which would allow you to access MBeans through Weblogic APIs itself like so

Read on →