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:

1.1 About ADF Model

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 bindings. Figure 1-1 shows how the elements of ADF Model fit within an application architecture.

Figure 1-1 ADF Architecture with ADF Model

ADF architecture with ADF Model binding and data controls

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.

Figure 1-2 Data Controls Panel

OrdersSessionEJBLocal data control and its children

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.

Example 1-1 shows the code used for binding a checkbox in a form to the orderFilled attribute of the OrdersSessionEJBLocal data control.

Example 1-1 Binding Code for a Checkbox in a JSF Web Page

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

1.2 Data Control Types

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.

    For a complete guide to using 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.

1.3 Data Controls Not Covered By This Guide

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. For more information, 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.

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

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.