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. …

Pass custom objects across ADF taskflows (by value or reference)

JDev: Source: GitHub
We usually pass along parameters of native data types across ADF task-flow calls. We set up input and output parameters for the source and target task-flows, and we access the variables from the pageFlowScope map.
Absolutely nothing wrong with this approach.
But how about a scenario where we process and populate a POJO variable from the source task-flow, and expect a POJO variable on the target task-flow to be populated via a declarative route?
The Parameters section of a bounded task-flow allows you to set a specific property on its managed bean to which the object being passed across will be assigned.
While passing along an object across task-flows, ADF lets you choose whether you want to pass the object by value or by reference. Let us examine the difference between the two approaches.

This is what we want to achieve: Initialize an Employee variable (employeeInTarget) in the source task-flow and pass this variable as input to a target task-flow. Thi…