Programmatic DVT charts in Oracle ADF

Source: GitHub

This article talks about programmatic approach of creating dvt components or charts, using Java objects, and more importantly, without ADF bindings. This is quite helpful when you deal with data which does not change often and can be pre-loaded into Java objects. The biggest advantage of this is of course, performance, since you do away with any database interaction.

The sample code has a table based on Department pojo. Each department object has a List of Employee pojo. On table row selection, I retrieve the list of employees, and I use this list to create the Object array required for each chart type.

There are a couple of key points to this approach:
1) Your Java data model should be prepared to provide all the required information to the chart.
2) You need to know the "Tabular Data" format for each graph.

My data-model consists of a Department object, having a list of Employee objects.

Each graph's tabular data format is an array of O…

Send mail using gmail from Oracle ADF

Source: GitHub

This article talks about using Google services (Gmail) to send email from an ADF application. I doubt that there would be a real-world use-case for this, but nonetheless, the email integration would be the major takeaway from this blog.

This does not use any ADF related package. Any Java application is good enough for this.

To start with, I have an ADF application, with just the ViewController project. I don't need any Model support for my sample project. The UI captures the required details.

However, before you start sending emails from your Google account, you need to allow "less secure apps" to access your Google account. Now this is not recommended, but try it out for once. Visit, scroll down till the end and set "Allow less secure apps: ON".

The emailing will be taken care of by javax.mail package. Let us break up the activities into the following sections:

Note: multiple recipients (to…

Custom (user-defined) GUI components in ADF

Source: 1) CustomComponent , 2) CustomComponentApp
A very less-used, yet powerful, feature of Oracle ADF is its ability to allow users to create custom (declarative) UI components. The steps to create such a re-usable component is a bit elaborate and clumsy, but the fruit of the hard-work is quite sweet!

This is going to be quite a large blog. So I will break this into 2 sections. However, just to get your attention, this is what we intend to achieve in the end:

Section 1 - Define the component Create an ADF application, with the default ViewController and Model projects. I have renamed ViewController to DeclarativeComponent in my case, and have removed the Model project. An alternate starting point would be to create an empty Java application and add a project, but I chose this path so as to ensure that all the required libraries get included automatically and save me the hard work!
Once the application structure is created, right click on the project and create a ne…

Advanced PL/SQL integration with ADF (new API)

JDev: Source: GitHub
Till ADF 11g, we have been integrating ADF with PL-SQL modules having user-defined types with "oracle.sql" packages. We have used oracle.sql.StructDescriptor and oracle.sql.ArrayDescriptor to create implementations of user-defined types on Oracle database.
Since the migration to 12c, we have been getting a warning that most of oracle.sql's APIs have been deprecated.

The new solution is to use java.sql.Struct (not STRUCT) and java.sql.Array (not ARRAY).
However, using the Array API has been made a bit tricky. Now we do not have the support of ArrayDescriptor to create a definition object for the user-defined type. Let us see how exactly we go about it.
This is the use case we will solve: 1) Call a packaged procedure with a user-defined type as IN parameter. 2) Modify the object and return as an OUT parameter of a user-defined type. 3) Intercept the out parameter in ADF and read the modified contents.
We will be using the default HR schema. …