Академический Документы
Профессиональный Документы
Культура Документы
Objectives
After completing this lesson, you should be able to do the following: Describe the scope and role of the binding files Define Application Development Framework (ADF) Model binding types Define ADF Model executables and how to use them Manage data-bound components with the page definition file Bind data by using Expression Language (EL)
5-2
Agenda
Defining ADF Model binding Describing the scope and role of the binding files Managing data-bound components with the page definition file Data control and Business Components (BC)
5-3
5-4
Struts
JSF/ADF Controller
Controller
Model
Toplink
Business Services
Data Services
Relational Data XML Data
Legacy Data
Packaged Apps
5-5
5-7
5-8
5-9
5 - 10
Data bindings
Data controls
Business Services
5 - 11
Text binding
<af:inputText value= #{bindings.Ename.inputValue}> <af:commandButton action=#{bindings.Commit}> <af:selectItems items= #{bindings.Deptno.items}> <af:table value= #{bindings.DeptView. collectionModel}>
Table binding
5 - 12
viewId browse.jspx
BindingContext DataBindings.cpx
PageDefinition browsePageDef.xml
List binding
Table binding
#{bindings.DeptView}
5 - 13
Agenda
Defining ADF Model binding Describing the scope and role of the binding files Managing data-bound components with the page definition file Data control and Business Components (BC)
5 - 14
DataBindings.cpx File
Provides the metadata from which the Oracle ADF binding objects are created at run time Uses XML syntax Specifies:
<pageMap> <dataControlUsages> <pageDefinitionUsages>
5 - 15
5 - 16
5 - 17
Agenda
Defining ADF Model binding Describing the scope and role of the binding files Managing data-bound components with the page definition file Data control and Business Components (BC)
5 - 18
PageDef.xml File
The key data binding artifact: Is accessible through the visual editors context menu or the link on its Bindings tab Describes the service usage of a particular page, panel, or region XML file content: Default location controlled by the ADFm Settings > PageDef subpackage project property Run-time location determined by the DataBindings.cpx file (see <context-param> CpxFileName in web.xml) Three sections (in order of interest, and not appearance): 1. Bindings 2. Executables 3. Parameters
5 - 19
5 - 20
Bindings Sections
The data is accessed via the bindings object on the HTTP request, conventionally via EL: #{bindings.ProdId}
#{bindings} provides access to everything that is defined in the Binding Container or page definition. Individual bindings (such as Table Bindings):
Are objects Have attributes other than value Are accessible using EL
Example: #{bindings.Products.rangesize}
5 - 21
5 - 22
Boolean attribute binding: Convert between any underlying database type (0 or 1, true or false, yes or no, and so on) and a primitive Boolean object.
<af:selectBooleanCheckbox value=#{bindings.ContactableFlag.inputValue}/>
5 - 23
5 - 24
5 - 25
5 - 26
setCurrentRowWithKeyValue:
The rowKey parameter is the literal key value for a single-attribute key. For example, 1001 is used to find the order number 1001.
5 - 27
5 - 28
// create a new row for the view object Row newRow = yourViewObject.createRow(); // mark the row as being "initialized", but not yet new newRow.setNewRowState(Row.STATUS_INITIALIZED);
5 - 29
5 - 30
The Refresh property: Executes when in the life cycle RefreshCondition and RefreshAfter: Whether to execute
Example:
RefreshCondition= "${(CartBean.cartId != null || orderBean.status == OPEN}"
Note: Pay attention to side effects. Double invocation when bindings are based on a method iterator implicitly invoke the method.
5 - 31
Leveraging Iterators
Working with multiple row sets and row set iterators: Use View Object as the default row set. Create secondary row sets based on the same VO. Create multiple row sets for different bind variable values.
The following methods are available:
createRowSet()
closeRowSetIterator()
5 - 33
5 - 34
Agenda
Defining ADF Model binding Describing the scope and role of the binding files Managing data-bound components with the page definition file Data control and Business Components (BC)
5 - 35
View Object instances in the active data model Custom method in the client interface Method arguments Data controls created from Java classes (beans)
5 - 36
5 - 37
5 - 38
7
1 2 3 9 5 4 8 6
5 - 39
Summary
In this lesson, you should have learned how to: Describe the scope and role of the binding files Define ADF Model binding types Define ADF Model executables and how to use them Manage data-bound components with the page definition file Bind data using EL
5 - 40
5 - 41