H Data Controls in Oracle ADF Fusion Web Applications

This appendix describes the various types of data controls available for Oracle ADF Fusion Web Applications. It also presents a brief comparison of how data access features are implemented for each type of data control.

H.1 Introduction to Data Controls

A data control is essentially a bridge that makes data from a source available to the user interface in an ADF Fusion Web Application. You can use the objects in the data control to create databound user interface components.

The most commonly used types of data controls include the following:

ADF Business Components Data Control

This type of data control is generated by JDeveloper when you create an application module in your ADF Business Components application.

A JMX data control obtains the structure of the JMX MBeans from an MBean Server.

You can create a JMX data control from the New Gallery. Expand the Business Tier node, select Data Controls, choose JMX Data Control, and click OK. For more information about creating a JMX data control, see the online help for the Create JMX Data Control wizard.

Before you can create a JMX data control, you must first have a JMX connection. For more information about JMX connections, see the online help for the Create JMX Connection dialog.

A placeholder data control is a special type of data control that doesn't require a traditional data structure. As the name implies, it is a placeholder that can be used during UI development, and then replaced with the real data control when it becomes available.

You can create a Placeholder data control from the New Gallery. Expand the Business Tier node, select Data Controls, choose Placeholder Data Control, and click OK.

H.2 Data Control Feature Implementation Comparison

The type of data control that you choose to use will impact how you implement data access features. Table H-1 provides a comparison of how you implement some commonly used data access features for each type of data control.

Table H-1 Comparison of Feature Implementation in Data Controls

ADF Business Components data control

JavaBean
data control

EJB
data control

Web Services data control

URL Service data control

JMX data control

Placeholder data control

af:Query

declarative

declarative

declarative

implemented programmatically

not available

not available

not available

af:quickQuery

declarative

declarative

declarative

implemented programmatically

not available

not available

not available

af:inputComboListOfValues

declarative

declarative

declarative

implemented programmatically

not available

not available

declarative

af:Calendar

declarative

implemented programmatically

implemented programmatically

implemented programmatically

not available

not available

not available

af:Media

declarative

implemented programmatically

implemented programmatically

implemented programmatically

not available

not available

not available

The features that are listed in the table as "implemented programmatically" can be implemented using the necessary Java classes required to implement a business model that can be used by the specific data-entry component. For more information, refer to the Javadoc for the appropriate classes.

H.3 Data Control Objects

In the Data Controls panel, each data control object is represented by an icon. Table H-2 describes what each icon represents, where it appears in the Data Controls panel hierarchy, and what components it can be used to create.

You can design a databound user interface by dragging an item from the Data Controls panel and dropping it on a page as a specific UI component.

The objects described in Table H-2 are applicable to the JavaBean data control, the EJB data control, the JMX data control, the URL Service data control, unless otherwise noted. For information about the data control objects available in the other types of data controls, refer to the documentation for desired type of data control as listed in Section H.1, "Introduction to Data Controls"

Represents a data control. You cannot use the data control itself to create UI components, but you can use the child objects listed under the data control. There may be more than one data control, each representing a logical grouping of data functions.

Typically, there is one data control for a given source (bean, EJB, or URL). However, you may have additional data controls that were created for other types of objects (for example, application modules or web services).

Serves as a container for the other objects. Not used to create anything.

Create Method

Represents a built-in method that creates a new instance of an object in a data collection using the new Java constructor call. Create method icons are located in a node named after the data collection to which they belong. These data collection nodes are located in the Constructors node under the data control. The Attributes node, which appears as a child under a create method, contains all the attributes of the data collection. If the collection contains an attribute from another collection (called a foreign key in relational databases), that attribute is represented by an accessor return icon. In this case, the accessor returns a single object.

This object is not available in a URL Service data control. Because the URL Service data control is not updateable, there is no instance of an object that can be created.

This object is not available in the JMX data control.

Creation forms.

Method

Represents a custom method on the data control that may accept parameters, perform some action or business logic, and return data or data collections. If the method is a get method of a map and returns a data collection, a method return icon appears as a child under it. If a method requires a parameter, a folder appears under the method, which lists the required parameters.

The URL Service data control exposes only one method loadData() which retrieves the contents of the URL.

UI actions such as buttons or links.

Method Return

Represents a data collection that is returned by a custom method. A method return appears as a child under the method that returns it. The objects that appear as children under a method return may be attributes of the collection, accessor returns that represent collections related to the parent collection, other methods that perform actions related to the parent collection, and operations that can be performed on the parent collection.

Forms, tables, trees, and range navigation components.

Accessor Return

Represents an object returned by a bean-style accessor method on the business service. An accessor method is used when the objects returned are JavaBeans. Accessor returns appear as children under method returns, other accessor returns, or in the Attributes node under built-in create methods. Accessor returns are objects that are related to the current object in the parent collection. This relationship is usually based on a common unique attribute in both objects. For example, if a method returns a collection of users, an accessor return that is a child of that collection might be a collection of service requests that are assigned to a particular user. In ADF, the relationship between parent and child collections is called a master-detail relationship. For more information about master-detail objects, see Chapter 24, "Displaying Master-Detail Data.".

Accessor returns can be either collections or single objects. For example, if a method returns a collection of service requests, one accessor return under that method might be a collection of service history details for the current service request, while another accessor return might be a single user assigned to the current service request. By default, when data controls are created from session beans over POJOs, the names of accessors that return collections end in Collection (for example, OrderCollection). The UI components available from the Data Controls panel context menu differ depending on whether the accessor return is a collection or a single object.

The children under an accessor return may be attributes of the collection or object, other accessor returns, custom methods that return a value from the collection or object, and operations that can be performed on the collection or object. The accessor returns under a built-in create method are always a single object and never have any children.

For single objects: Forms, master-detail widgets, and selection lists.

For single objects under a constructor: selection lists only.

Attribute

Represents a discrete data element in an object. Attributes appear as children under method returns or accessor returns.

Label, text field, and selection list components.

Operation

Represents a built-in data control operation that performs actions on the parent object. If an operation requires a parameter, a folder appears under the method, which lists the required parameters. Data control operations are located in an Operations node under method returns or accessor returns and under the root data control node. The operations that are children of a particular method or accessor return operate on that return object only, while operations under the data control node operate on all the objects represented by the data control.

Because the URL Service data control is not updateable, only retrieval and navigation operations are available.

UI actions such as buttons or links.

Parameter

Represents a parameter value that is declared by the method or operation under which it appears. Parameters appear in a folder under a method or operation.

The parameter for a URL Service data control is the parameter that a user passes in the URL. These show up as a parameters to the loadData() method when the URL Service data control is created. For example, say you create a data control to the URL http://www.example.org?id=##param##. On the Data Controls panel, you would see that the loadData() method has one parameter with the name param. The value supplied to this parameter is substituted in the URL when the invocation occurs.