1 Introduction to ADF Model

This chapter provides a brief overview of data controls and binding data from business services to user interfaces in Oracle ADF applications. It includes information on types of data controls and then using those data controls to create databound UI components.

This chapter includes the following sections:

For definitions of unfamiliar terms found in this and other books, see the Glossary.

About ADF Model

You can use data controls and ADF bindings to bind user interfaces to business services without extensive coding. Data Controls include operations and collections that are exposed as data control UI objects, whereas, the declarative bindings access data from data collections to invoke its operations.

ADF Model is a declarative data binding facility that enables a unified approach to binding user interfaces to business services without requiring code. ADF Model implements two concepts that enable the decoupling of the user interface technology from the business service implementation: data controls and declarative ADF bindings. Figure 1-1 shows how the ADF Model fits within the ADF application architecture.

Figure 1-1 ADF Architecture with ADF Model

Description of Figure 1-1 follows
Description of "Figure 1-1 ADF Architecture with ADF Model"

Data controls abstract the implementation technology of a business service by using standard metadata interfaces to describe the service's operations and data collections, including information about the properties, methods, and types involved. These operations and collections are exposed as data control objects that developers and UI designers can use to create databound UI components, largely without having to consider the type of underlying business service.

Declarative bindings abstract the details of accessing data from data collections in a data control and of invoking its operations. There are three basic categories of declarative binding objects:

  • Value bindings: Used by UI components that display data. Value bindings range from the most basic variety that work with a simple text field to more sophisticated list and tree bindings that support the additional needs of list, table, and tree UI controls.

  • Action bindings: Used by UI components like hyperlinks or buttons to invoke built-in or custom operations on data collections or a data control without writing code.

  • Executable bindings: Included in executable bindings are iterator bindings, which simplify the building of user interfaces that allow scrolling and paging through collections of data and drilling-down from summary to detail information. Executable bindings also include bindings that allow searching and nesting a series of pages within another page, as well as bindings that cause operations to occur immediately.

At runtime, the ADF Model layer reads the information describing the data controls and bindings from the appropriate XML files and then implements the two-way connection between the user interface and the business service.

To use the ADF Model layer to bind data, you need to create a data control for your services. The data control will then appear as a tree hierarchy in the Data Controls panel where each subnode in the tree represents an element such as a collection, operation, method or attribute. You then create databound components by dragging and dropping those subnodes onto the visual editor for a web page or other user interface component. When you drag a subnode from a data control to a page, JDeveloper automatically creates the metadata that describes the bindings from the page to the services.

For example, in an application that uses an EJB session facade, developers can create data controls for the facade. Developers can then use the representation of the data control displayed in JDeveloper's Data Controls panel (as shown in Figure 1-2) to create UI components that are automatically bound to the session facade.

The group of bindings supporting the UI components on a page are described in a page-specific XML file called the page definition file. The ADF Model layer uses this file at runtime to instantiate the page's bindings. These bindings are held in a request-scoped map called the binding container.

In a JSF application, the binding container is accessible during each page request using the EL expression #{bindings}. This expression always evaluates to the binding container for the current page.

The following example shows the code used for binding a checkbox in a form to the orderFilled attribute of the OrdersSessionEJBLocal data control.

<af:selectBooleanCheckbox value="#{bindings.orderFilled.inputValue}"
                   label="#{bindings.orderFilled.label}"
                   shortDesc="#{bindings.orderFilled.hints.tooltip}" id="sbc1"/>

Data Control Types

ADF supports broad variety of business service technologies, such as EJBs, beans, web services, and URL. You can customize the business components based on the bean or adapter.

There are various data control implementations and they can be divided into these categories:

  • ADF Business Components application modules

    In an application that uses ADF Business Components, a data control is automatically created when you create an application module, and it contains all the functionality of the application module.

    To use ADF Business Components application modules, see Implementing Business Services with Application Modules in Developing Fusion Web Applications with Oracle Application Development Framework.

  • Data controls that both extend the adapter data control framework ("adapter data controls")

    These include the data controls for EJBs, beans, web services (SOAP-based and RESTful), and URLs, which are covered in this guide.

  • Custom data controls based on the bean data control type

  • Custom data controls based on the adapter data control framework that do not extend the bean data control

  • Custom data controls that do not extend the adapter data control framework

    This category primarily consists of data controls that were developed before the adapter framework was developed.

This guide will primarily focus on creating and using adapter data controls, though much of the information also applies to ADF Business Components data controls.

Data Controls Not Covered By This Guide

You will not find information in this guide for data controls that are not based on business services, or data controls based on JMX, and data controls based on JavaBeans.

The following are some of the types of data controls that are not covered in this guide:

  • Placeholder data controls, which are empty data controls used to help design databound pages for users who do not yet have concrete business services to work with. After you design databound components with the placeholder data control and the business services have been provided, you can rebind the components to those business services. To design a page using data controls, see Designing a Page Using Placeholder Data Controls in Developing Fusion Web Applications with Oracle Application Development Framework.

  • JMX data controls, which enable you to create a data control based on Java Management Extension (JMX) MBeans.

  • JavaBean data controls, which are not to be confused with bean data control. The JavaBean data control is a data control type that was developed before the adapter data control framework. It is missing many of the key features that have since been built into bean data controls, such as support for queryable collections.

  • Other data controls within the broader Fusion Middleware stack, such as BAM data controls.

What You May Need to Know About Non-Adapter Framework Data Controls

The new data controls is based on the adapter data control framework that includes lots of useful features. Therefore, migrate the legacy data controls to the new adapter data control framework to use these features.

If you are working with legacy data controls, you might want to consider migrating to new data controls based on the adapter data control framework. This framework incorporates a number of useful features, such as validation rules and list of value objects. You can use the adapter framework to create a new data control type from scratch, or you can extend one of the existing data control types, such as the bean data control type.