📜 ⬆️ ⬇️

Oracle ADF (Application Development Framework)

Not so long ago, I met a Java framework created by Oracle. I was surprised that there was no information about him on Habré, so I decided to write a short review article.

Introduction


When I was just starting to know this miracle (although, to be frank, for me it is still like a little devil in a snuffbox), the very first pdf pleased me with the following picture.


As can be seen from the architecture, ADF is a MVC framework for developing both web applications, mobile and desktop. Since I was involved only in the web part, unfortunately I cannot tell about mobile and desktop.

And so, what do we have in our hands, using ADF, as a web framework.
')
As a UI layer, there are JSF pages. ADF Faces, in turn, provides a set of ready-made UI components.

The global controller for JSF is Faces Servlet, but in essence, the processing of events with UI components occurs in managed beans. ADF Controller refers to task flows. These are special components, declaratively describing the sequence of actions to perform any task.

ADF Binding together with Data Controls is a layer containing business logic, providing a single interface, which in turn allows you to not think about what external source is used.

Also in the ADF provides users with the ability to customize the presentation level, the result of which can be saved for the duration of the session, or using Metadata Services in a special repository (in the database or on the file system)

IDE


JDeveloper is required to work with ADF. You can tell a lot about him, so I’ll just leave a screen with the image of this “combine”.


Now consider the components of ADF in more detail.

View


Many will probably think what is special here: “These are just jspx pages.” And they will be right. The only thing I want to add is that the ADF provides a large number of ready-made UI components. From standard buttons and pop-up modal windows to data visualization components.

A couple of examples:

Text output, button, richText


Calendar card


Charts



Controller


A component called task flow was added to the ADF controller layer.

ADF Task flows provide modular application separation. For example, instead of using a single large JSF space in an application, you can break it up into reusable components, which are called task flow.

Each task flow is a graph in which vertices called activities are some simple logical operations, such as displaying a page, executing a method, or calling another task flow, and the control flow can be either unconditional or on some events.

Task flows are divided into two types:

The unbounded task flow has many entry points, so it can be called anywhere in the application and has no input parameters.

Small example

This is what the task flow diagram in the JDeveloper IDE looks like. This diagram says that anywhere in the application, when the “hello” event is generated, the user is redirected to the hello page, and the bounded task flow makeOrder is invoked by the checkout event.

A bounded task flow always has only one entry point and can contain input parameters.

Example makeOrder task flow


The green circle is the entry point and the gray is the exit point.

In this task flow, we can declaratively define and break the procedure for creating an order, into sub-tasks. For example, first the user gets to orderPage, from which he can return to the place where the task flow is called or go to the payment page. The “pay” event is generated on the payment page, as a result of which the managed bean method payForOrder is triggered. Next, in checkPayment the payment operation is checked, after which the user is transferred either to a page with congratulations on the perfect order, or to a page with the reason for the failure of the order. As a result, it returns to the call point of the task flow.

The standard combination of work with task flows is usually one unbounded and many bounded task flows.

I really wanted to write about task flows as much as possible, but this topic requires a separate article, so for the introduction, perhaps, we can limit it to this.

Model


Data Controls - a layer of abstractions for working with a business model, which can be:

Thanks to Data Controls, there is a single interface for working with the sources listed above, and thanks to ADF Bindings we can associate UI components directly with them.

Everything is better known by example. Suppose there is a web service that has only one method that returns a list of strings (for example, for example, gadgets).

@WebService(...), @BindingType(...) public class HabraService { public List<String> getGadgets() { List<String> gadgets = new ArrayList<String>( Arrays.asList("smartphone", "laptop", "tablet", "PC", "iPod") ); return gadgets; } } 

In JDeveloper, you can get Data Control for this web service via wsdl.


Having transferred the bright red “Return” element using drag-n-drop, you can get a form on the jspx page in which you can view the list of received gadgets.



If you look at the page description (a separate xml file), you can see the created ADF Bindings for it.


If you carefully compare Bindings and Data Control, you can see that the necessary operations have been added to Bindings (green gears), the getGadgets method, and one single item attribute. All of them refer to the created iterator, which in turn refers to Data Control. In this case, Iterator will contain a collection of strings returned from the getGadgets method.

The presence of elements in Bindings allows, using EL expressions, to apply them to UI components.

For example, the ADF component af: outputText can show the name of the gadget
 <af:outputText value="#{bindings.item.inputValue}" id="ot1"/> 

And the "Last" button to perform the operation of displaying the last gadget.
 <af:commandButton actionListener="#{bindings.Last.execute}" text="Last" disabled="#{!bindings.Last.enabled}" partialSubmit="true" id="cb4"/> 


Instead of conclusion


I wanted to write a lot, but, approaching different aspects, I realized that each of the components requires its own separate article. Do not judge too harshly, this is my second article on our cozy Habré. Hope you enjoyed it. And if the topic is interesting for you, then I will continue to write separate and more detailed articles.

Source: https://habr.com/ru/post/172123/


All Articles