Oracle Help for the Web
Contents
Index
Search
Glossary
View Topic
Oracle ADF Developer's Guide For Forms/4GL Developers
Contents
Part I Getting Started with Oracle ADF Applications
1
Introduction to Oracle ADF Applications
Introduction to Oracle ADF
Framework Architecture and Supported Technologies
View Layer Technologies Supported
Controller Layer Technologies Supported
Business Services Technologies Supported by ADF Model
Recommended Technologies for Enterprise 4GL Developers
Declarative Development with Oracle ADF and JavaServer Faces
Declarative Data Access and Validation with ADF Business Components
Declarative User Interface Design and Page Navigation with JavaServer Faces
Declarative User Interface Design with JSF
Declarative Page Navigation with JSF
Declarative Data Binding with Oracle ADF Model Layer
Simple, Event-Driven Approach to Add Custom Logic
Simple-to-Handle Events in the Controller Layer
Simple-to-Handle Events in the Business Service Layer
Simple to Globally Extend Basic Framework Functionality
Highlights of Additional ADF Features
Comprehensive JDeveloper Design-Time Support
Sophisticated AJAX-Style Web Pages Without Coding
Centralized, Metadata-Driven Functionality
Generation of Complete Web Tier Using Oracle JHeadstart
2
Overview of Development Process with Oracle ADF and JSF
Introduction to the Development Process
Creating an Application Workspace to Hold Your Files
Thinking About the Use Case and Page Flow
Designing the Database Schema
Creating a Layer of Business Domain Objects for Tables
Dragging and Dropping to Reverse-Engineer Entity Objects for Tables
Adding Business Validation Rules to Your Entity Object
Defining UI Control Hints for Your Entity Objects
Building the Business Service to Handle the Use Case
Creating a Application Module to Manage Technicians
Creating View Objects to Query Appropriate Data for the Use Case
Using View Objects in the Application Module's Data Model
Testing Your Service
The Data Control for Your Application Module Enables Data Binding
Dragging and Dropping Data to Create a New JSF Page
Examining the Binding Metadata Files Involved
Understanding How Components Reference Bindings via EL
Configuring Binding Properties If Needed
Understanding How Bindings Are Created at Runtime
Making the Display More Data-Driven
Hiding and Showing Groups of Components Based on Binding Properties
Toggling Between Alternative Sets of Components Based on Binding Properties
Adding the Edit Page and Finishing the Use Case
Adding Another View Object to the Data Model
Creating the Edit Page
Synchronizing the Search and Edit Page
Controlling Whether Data Appears Initially
Running the Final Result
Considering How Much Code Was Involved
3
Oracle ADF Service Request Demo Overview
Introduction to the Oracle ADF Service Request Demo
Requirements for Oracle ADF Service Request Application
Overview of the Schema
Setting Up the Oracle ADF Service Request Demo
Downloading and Installing the Oracle ADF Service Request Application
Installing the Oracle ADF Service Request Schema
Creating the Oracle JDeveloper Database Connection
Running the Oracle ADF Service Request Demo in JDeveloper
Running the Oracle ADF Service Request Demo Unit Tests in JDeveloper
Quick Tour of the Oracle ADF Service Request Demo
Customer Logs In and Reviews Existing Service Requests
Customer Creates a Service Request
Manager Logs In and Assigns a Service Request
Manager Views Reports and Updates Technician Skills
Technician Logs In and Updates a Service Request
Part II Building Your Business Services
4
Overview of ADF Business Components
Prescriptive Approach and Reusable Code for Business Services
What are ADF Business Components and What Can They Do?
Relating ADF Business Components to Familiar 4GL Tools
Familiar Concepts for Oracle Forms Developers
Familiar Concepts for PeopleTools Developers
Familiar Concepts for SiebelTools Developers
Familiar Functionality for ADO.NET Developers
Overview of ADF Business Components Implementation Architecture
Based on Standard Java and XML
Works with Any Application Server or Database
Implements All of the J2EE Design Patterns You Need
Components are Organized into Packages
Architecture of the Base ADF Business Components Layer
Components Are Metadata-Driven With Optional Custom Java Code
Example of an XML-Only Component
Example of a Component with Custom Java Class
Recommendations for Configuring ADF Business Components Design Time Preferences
Recommendation for Initially Disabling Custom Java Generation
Recommendation for Disabling Use of Package XML File
Basic Datatypes
Generic Versus Strongly-Typed APIs
Client-Accessible Components Can Have Custom Interfaces
Framework Client Interfaces for Components
Custom Client Interfaces for Components
Understanding the Active Data Model
What is an Active Data Model?
Examples of the Active Data Model In Action
Active Data Model Allows You to Eliminate Most Client-Side Code
Overview of ADF Business Components Design Time Facilities
Choosing a Connection, SQL Flavor, and Type Map
Creating New Components Using Wizards
Quick-Creating New Components Using the Context Menu
Editing Components Using the Component Editor
Visualizing, Creating, and Editing Components Using UML Diagrams
Testing Application Modules Using the Business Components Browser
Refactoring Components
5
Querying Data Using View Objects
Introduction to View Objects
Creating a Simple, Read-Only View Object
How to Create a Read-Only View Object
What Happens When You Create a Read-Only View Object
What You May Need to Know About View Objects
Editing an Existing View Object Definition
Working with Queries That Include SQL Expressions
Controlling the Length, Precision, and Scale of View Object Attributes
Using a View Object in an Application Module's Data Model
How to Create an Application Module
Understanding the Difference Between View Object Components and View Object Instances
What Happens When You Create an Application Module
What You May Need to Know About Application Modules
Editing an Application Module's Runtime Configuration Properties
Defining Attribute Control Hints
How to Add Attribute Control Hints
What Happens When You Add Attribute Control Hints
What You May Need to Know About Message Bundles
Testing View Objects Using the Business Components Browser
How to Test a View Object Using the Business Components Browser
What Happens When You Use the Business Components Browser
What You May Need to Know About the Business Components Browser
Customizing Configuration Options for the Current Run
Enabling ADF Business Components Debug Diagnostics
Working Programmatically with View Object Query Results
Common Methods for Working with the View Object's Default RowSet
Counting the Number of Rows in a RowSet
How to Create a Command-Line Java Test Client
What Happens When You Run a Test Client Program
What You May Need to Know About Running a Test Client
Filtering Results Using Query-By-Example View Criteria
How to Use View Criteria to Filter View Object Results
What Happens When You Use View Criteria to Filter View Object Results
What You May Need to Know About Query-By-Example Criteria
Use Attribute Names in View Criteria, Column Names in WHERE Clause
Testing View Criteria in the Business Component Browser
Altering Compound Search Conditions Using Multiple View Criteria Rows
Searching for a Row Whose Attribute Value is NULL Value
Searching Case-Insensitively
Clearing View Criteria in Effect
Applying View Criteria Causes Query to be Re-parsed
Using Named Bind Variables
Adding a Named Bind Variable
What Happens When You Add Named Bind Variables
What You May Need to Know About Named Bind Variables
Errors Related to Bind Variables
Bind Variables Default to NULL If No Default Supplied
Setting Existing Bind Variable Values at Runtime
Adding a Named Bind Variable at Runtime
Understanding the Default Use of Inline Views for Read-Only Queries
Working with Master/Detail Data
How to Create a Read-Only View Object Joining Tables
Using the Query Builder to Simplify Creating Joins
Testing the Join View
How to Create Master/Detail Hierarchies Using View Links
What Happens When You Create Master/Detail Hierarchies Using View Links
What You May Need to Know About View Links
View Link Accessor Attributes Return a RowSet
How to Access a Detail Collection Using the View Link Accessor
How to Enable Active Master/Detail Coordination in the Data Model
Generating Custom Java Classes for a View Object
How To Generate Custom Classes
Generating Bind Variable Accessors
Generating View Row Attribute Accessors
Exposing View Row Accessors to Clients
Configuring Default Java Generation Preferences
What Happens When You Generate Custom Classes
Seeing and Navigating to Custom Java Files
What You May Need to Know About Custom Classes
About the Framework Base Classes for a View Object
You Can Safely Add Code to the Custom Component File
Attribute Indexes and InvokeAccessor Generated Code
6
Creating a Business Domain Layer Using Entity Objects
Introduction to Entity Objects
Creating Entity Objects and Associations
How to Create Entity Objects and Associations from Existing Tables
What Happens When You Create Entity Objects and Associations from Existing Tables
What Happens When a Table Has No Primary Key
Creating Entity Objects Using the Create Entity Wizard
Creating an Entity Object for a Synonym or View
Editing an Existing Entity Object or Association
Creating Database Tables from Entity Objects
Using Database Key Constraints for an Association
Synchronizing an Entity with Changes to Its Database Table
What You May Need to Know About Creating Entities
Creating and Configuring Associations
How to Create an Association
Changing Entity Association Accessor Names
Renaming and Moving Associations to a Different Package
What Happens When You Create an Association
What You May Need to Know About Composition Associations
Creating an Entity Diagram for Your Business Layer
How to Create an Entity Diagram
Publishing the Business Entity Diagram
What Happens When You Create an Entity Diagram
What You May Need to Know About Creating Entities On a Diagram
UML Diagram is Actively Synchronized with Business Components
UML Diagram Adds Extra Metadata to XML Component Descriptors
Defining Attribute Control Hints
How to Add Attribute Control Hints
What Happens When You Add Attribute Control Hints
Internationalizing the Date Format
Configuring Declarative Runtime Behavior
How To Configure Declarative Runtime Behavior
What Happens When You Configure Declarative Runtime Behavior
About the Declarative Entity Object Features
Legal Database and Java Data types for an Entity Object Attribute
Indicating Datatype Length, Precision, and Scale
Controlling the Updatability of an Attribute
Making an Attribute Mandatory
Defining the Primary Key for the Entity
Defining a Static Default Value
Synchronization with Trigger-Assigned Values
Trigger-Assigned Primary Key Values from a Database Sequence
Lost Update Protection
History Attributes
Setting the Discriminator Attribute for Entity Object Inheritance Hierarchies
Understanding and Configuring Composition Behavior
Using Declarative Validation Rules
How to Add a Validation Rule
What Happens When You Add a Validation Rule
What You May Need to Know About Validation Rules
Understanding the Built-in Entity-Level Validators
Understanding the Built-in Attribute-Level Validators
Caveat About the List Validator
Working Programmatically with Entity Objects and Associations
Finding an Entity Object by Primary Key
Accessing an Associated Entity Using the Accessor Attribute
Updating or Removing an Existing Entity Row
Creating a New Entity Row
Testing Using a Static Main Method
Generating Custom Java Classes for an Entity Object
How To Generate Custom Classes
Choosing to Generate Entity Attribute Accessors
What Happens When You Generate Custom Classes
Seeing and Navigating to Custom Java Files
What You May Need to Know About Custom Java Classes
About the Framework Base Classes for an Entity Object
You Can Safely Add Code to the Custom Component File
Configuring Default Java Generation Preferences
Attribute Indexes and InvokeAccessor Generated Code
Programmatic Example for Comparison Using Custom Entity Classes
Adding Transient and Calculated Attributes to an Entity Object
How to Add a Transient Attribute
What Happens When You Add Transient Attribute
Adding Java Code in the Entity Class to Perform Calculation
7
Building an Updatable Data Model With Entity-Based View Objects
Introduction to Entity-Based View Objects
Creating an Entity-Based View Object
How to Create an Entity-Based View Object
Creating a View Object Having All Attributes of an Entity Object
What Happens When You Create an Entity-Based View Object
Editing an Existing Entity-Based View Object Definition
What You May Need to Know About View Objects
View Object Attributes Inherit Properties from Underlying Entity Object Attributes
Including Reference Entities in Join View Objects
How to Include Reference Entities in a View Object
Adding Additional Reference Entity Usages to the View Object
Selecting Additional Attributes from Reference Entity Usages
Renaming Attributes from Reference Entity Usages
Removing Unnecessary Key Attributes from Reference Entity Usages
Hiding the Primary Key Attributes from Reference Entity Usages
What Happens When You Reference Entities in a View Object
What You May Need to Know About Join View Objects
Showing View Objects in a Business Components Diagram
Modify Default Join Clause to Be Outer Join When Appropriate
Creating an Association-Based View Link
How to Create an Association-Based View Link
What Happens When You Create an Association-Based View Link
Testing Entity-Based View Objects Interactively
Overview of Business Component Browser Functionality for an Updatable Data Model
Adding View Object Instances to the Data Model
How to Test Entity-Based View Objects Interactively
What Happens When You Test Entity-Based View Objects Interactively
Simulating End-User Interaction with Your Application Module Data Model
Testing Master/Detail Coordination
Testing UI Control Hints
Testing View Objects That Reference Entity Usages
Testing Business Domain Layer Validation
Testing Alternate Language Message Bundles and Control Hints
Testing Row Creation and Default Value Generation
Testing New Detail Rows Have Correct Foreign Keys
Adding Calculated and Transient Attributes to an Entity-Based View Object
How to Add a SQL-Calculated Attribute
What Happens When You Add a SQL-Calculated Attribute
How to Add a Transient Attribute
Adding an Entity-Mapped Transient Attribute to a View Object
What Happens When You Add a Transient Attribute
Adding Java Code in the View Row Class to Perform Calculation
What You May Need to Know About Transient Attributes
Understanding How View Objects and Entity Objects Cooperate at Runtime
Each View Row or Entity Row Has a Related Key
What Role Does the Entity Cache Play in the Transaction
Metadata Ties Together Cleanly Separated Roles of Data Source and Data Sink
What Happens When a View Object Executes Its Query
What Happens When You Modify a View Row Attribute
What Happens When You Change a Foreign Key Attribute
What Happens When You Re-query Data
Unmodified Attributes in Entity Cache are Refreshed During Re-query
Modified Attributes in Entity Cache are Left Intact During Re-query
Overlapping Subsets of Attributes are Merged During Re-query
What Happens When You Commit the Transaction
Interactively Testing Multiuser Scenarios
Working Programmatically with Entity-Based View Objects
Example of Iterating Master/Detail/Detail Hierarchy
Example of Finding a Row and Updating a Foreign Key Value
Example of Creating a New Service Request
Example of Retrieving the Row Key Identifying a Row
Summary of Difference Between Entity-Based View Objects and Read-Only View Objects
Runtime Features Unique to Entity-Based View Objects
View Objects with No Entity Usage Are Read-Only
What You May Need to Know About Enabling View Object Key Management for Read-Only View Objects
8
Implementing Business Services with Application Modules
Introduction to Application Modules
Creating an Application Module
Creating an Application Module
What Happens When You Create an Application Module
Editing an Existing Application Module
Configuring Your Application Module Database Connection
Using a JDBC URL Connection Type
Using a JDBC Datasource Connection Type
Managing Your Application Module's Runtime Configurations
What You Might Need to Know About Application Module Connections
The Business Components Browser Requires a JDBC URL Connection
Testing the SRService Application Module in the Business Components Browser
Adding a Custom Service Method
How to Generate a Custom Class for an Application Module
What Happens When You Generate a Custom Class for an Application Module
What You May Need to Know About Default Code Generation
Debugging the Application Module Using the Business Components Tester
How to Add a Custom Service Method to an Application Module
Publishing Custom Service Methods to Clients
How to Publish Custom Service Methods to Clients
What Happens When You Publish Custom Service Methods to Clients
How to Generate Client Interfaces for View Objects and View Rows
What You May Need to Know About Method Signatures on the Client Interface
What You May Need to Know About Passing Information from the Data Model
Working Programmatically with an Application Module's Client Interface
How to Work Programmatically with an Application Module's Client Interface
What Happens When You Work with an Application Module's Client Interface
How to Access an Application Module Client Interface
How to Access an Application Module Client Interface in a JSF Web Application
How to Access an Application Module Client Interface in a JSP/Struts Web Application
How to Access an Application Module Client Interface in an ADF Swing Application
Overriding Built-in Framework Methods
How to Override a Built-in Framework Method
What Happens When You Override a Built-in Framework Method
How to Override prepareSession() to Set Up an Application Module for a New User Session
Creating an Application Module Diagram for Your Business Service
How to Create an Application Module Diagram
What Happens When You Create an Application Module Diagram
What You May Need to Know About Application Module Diagrams
Using the Diagram for Editing the Application Module
Controlling Display Options
Filtering Method Names
Show Related Objects and Implementation Files
Publishing the Application Module Diagram
Testing the Application Module From the Diagram
Supporting Multipage Units of Work
Overview of Application Module Pooling and State Management
Experimenting with State Management in the Business Components Browser
Deciding on the Granularity of Application Modules
Use Cases Assist in Planning Your Application Modules
Application Modules Are Designed to Support Assembly
Root Application Modules Versus Nested Application Module Usages
9
Implementing Programmatic Business Rules in Entity Objects
Introduction to Programmatic Business Rules
Understanding the Validation Cycle
Types of Entity Object Validation Rules
Attribute-Level Validation Rules
Entity-Level Validation Rules
Understanding Commit Processing and Validation
Avoiding Infinite Validation Cycles
What Happens When Validations Fail
Understanding Entity Objects Row States
Using Method Validators
How to Create an Attribute-Level Method Validation
What Happens When You Create an Attribute-Level Method Validator
How to Create an Entity-Level Method Validator
What Happens When You Create an Entity-Level Method Validator
What You Might Need To Know About Translating Validation Rule Error Messages
What You May Need to Know About Referencing the Invalid Value in an Attribute-Level Validation Error Message
Assigning Programmatically-Derived Attribute Values
Defaulting Values for New Rows at Create Time
Choosing Between create() and initDefaults() Methods
Eagerly Defaulting an Attribute Value from a Database Sequence
Assigning Derived Values Before Saving
Assigning Derived Values When an Attribute Value is Set
Undoing Pending Changes to an Entity Using the Refresh Method
Controlling What Happens to New Rows During a Refresh
Cascading Refresh to Composed Children Entity Rows
Using View Objects for Validation
Creating View Objects at Runtime for Validation
Implementing an Efficient Existence Check
Validating Conditions Related to All Entities of a Given Type
How to Access Related Entity Rows Using Association Accessors
How to Reference Information About the Authenticated User
Referencing Role Information About the Authenticated User
Referencing the Name of the Authenticated User
How to Access Original Attribute Values
How to Store Information About the Current User Session
How to Access the Current Date and Time
How to Send Notifications Upon a Successful Commit
How to Conditionally Prevent an Entity Row from Being Removed
How to Implement Conditional Updatability for Attributes
Additional Resources
10
Overview of Application Module Data Binding
Overview of Data Controls and Declarative Bindings
Data Controls Abstract the Implementation Technology of a Business Service
Bindings Connect UI Controls to Data Collections and Operations
Understanding the Application Module Data Control
How an Application Module Appears in the Data Control Palette
Overview of the SRService Application Module
How to Change the Data Control Name Before You Begin Building Pages
How the Data Model and Service Methods Appear in the Data Control Palette
How to Change View Instance Names Before You Begin Building Pages
How Transaction Control Operations Appear in the Data Control Palette
How View Objects Appear in the Data Control Palette
Built-in Operations for View Object Data Collections
How Nested Application Modules Appear in the Data Control Palette
How to Add a Create Button on a Page
What Happens When You Drop a Create Button on a Web Page
What Happens When You Drop a Create Operation Onto a Swing Panel
When to Use CreateInsert Instead of Create
What You May Need to Know About Create and CreateInsert
Application Module Databinding Tips and Techniques
How to Create a Record Status Display
How to Work with Named View Object Bind Variables
How to Use Find Mode to Implement Query-by-Example
How to Customize the ADF Page Lifecycle to Work Programmatically with Bindings
Globally Customizing the ADF Page Lifecycle
Customizing the Page Lifecycle for a Single Page
Using Custom ADF Page Lifecycle to Invoke an onPageLoad Backing Bean Method
How to Use Refresh Correctly for InvokeAction and Iterator Bindings
Correctly Configuring the Refresh Property of Iterator Bindings
Refreshing an Iterator Binding Does Not Forcibly Re-Execute Query
Correctly Configuring Refresh Property of InvokeAction Executables
Understanding the Difference Between setCurrentRowWithKey and setCurrentRowWithKeyValue
Understanding Bundled Exception Mode
Overview of How SRDemo Pages Use the SRService
The SRList Page
Overview of Data Binding in the SRList Page
Business Service Notes for the SRList Page
The SRMain Page
Overview of Data Binding in the SRMain Page
Business Service Notes for the SRMain Page
The SREdit Page
Overview of Data Binding in the SREdit Page
Business Service Notes for the SREdit Page
The SRSearch Page
Overview of Data Binding in the SRSearch Page
Business Service Notes for the SRSearch Page
The SRStaffSearch Page
Overview of Data Binding in the SRStaffSearch Page
Business Service Notes for the SRStaffSearch Page
The SRManage Page
Overview of Data Binding in the SRManage Page
Business Service Notes for the SRManage Page
The SRSkills Page
Overview of Data Binding in the SRSkills Page
Business Service Notes for the SRSkills Page
The SRCreate Page
Overview of Data Binding in the SRCreate Page
Business Service Notes for the SRCreate Page
The SRConfirmCreate Page
Overview of Data Binding in the SRConfirmCreate Page
Business Service Notes for the SRCreate Page
Part III Building Your Web Interface
11
Getting Started with ADF Faces
Introduction to ADF Faces
Setting Up a Workspace and Project
What Happens When You Use an Application Template to Create a Workspace
Starter web.xml File
Starter faces-config.xml File
What You May Need to Know About the ViewController Project
What You May Need to Know About Multiple JSF Configuration Files
Creating a Web Page
How to Add a JSF Page
What Happens When You Create a JSF Page
What You May Need to Know About Using the JSF Navigation Diagram
What You May Need to Know About ADF Faces Dependencies and Libraries
Laying Out a Web Page
How to Add UI Components to a JSF Page
What Happens When You First Insert an ADF Faces Component
More About the web.xml File
More About the faces-config.xml File
Starter adf-faces-config.xml File
What You May Need to Know About Creating JSF Pages
Editing in the Structure Window
Displaying Errors
Using the PanelPage Component
PanelPage Facets
Page Body Contents
Creating and Using a Backing Bean for a Web Page
How to Create and Configure a Backing Bean
What Happens When You Create and Configure a Backing Bean
How to Use a Backing Bean in a JSF Page
How to Use the Automatic Component Binding Feature
What Happens When You Use Automatic Component Binding in JDeveloper
What You May Need to Know About Backing Beans and Managed Beans
Using ADF Data Controls and Backing Beans
Best Practices for ADF Faces
12
Displaying Data on a Page
Introduction to Displaying Data on a Page
Using the Data Control Palette
How to Understand the Items on the Data Control Palette
How to Use the Data Control Palette
What Happens When You Use the Data Control Palette
What Happens at Runtime
Working with the DataBindings.cpx File
How to Create a DataBindings.cpx File
What Happens When You Create a DataBindings.cpx File
Configuring the ADF Binding Filter
How to Configure the ADF Binding Filter
What Happens When You Configure an ADF Binding Filter
What Happens at Runtime
Working with Page Definition Files
How to Create a Page Definition File
What Happens When You Create a Page Definition File
Binding Objects Defined in the parameters Element