SlideShare a Scribd company logo
14
Most read
Download free Oracle ADF Training materials and resources (Tutorial)
Deepak Bhagat’s Oracle ADF Blogs
1
Overview of Fusion Middleware and ADF
Lesson Agenda
Fusion Middleware (FMW) architecture
MVC architecture
ADF MVC and application architecture
ADF technology stack
Functionalities of ADF
Challenges Faced when Building J2EE Applications
Overview, Features and Key Benefits of ADF
Advantages of ADF over J2EE
Business Benefits of ADF Over Other Frameworks
IT System Runtime Architecture
Orchestration Human interaction
Policy evaluation
Monitoring
Rules
Engine Assign
Task
Task
Complete
Human
Workflow
Service
BPEL Process,
Events, Alerts
results
facts
Business
Activity
Monitoring
Fusion Service Bus / XML Transformation
.Net Apps Legacy Apps
CRM
ERP
Fusion Applications (ADF)
Relational Data/
Apps Schema
Data Hub Legacy Data
ADF BC Services Services
Services
Common business logic &
data across multiple
instances and applications
Centralized & reliable messaging
across infrastructure
Combine re-usable services to
meet changing requirements
Centralized & secure data
access across all applications
Separate data persistence
from business logic
Fusion Middleware (FMW) Architecture
Cloud Application
Foundation
Client-Server Architecture
Server
Relational Data Legacy Data
Data
Services
Oracle Forms Swing Office
EJB POJO
Toplink Hibernate Tuxedo
Client
PowerBuilder
Visual Basic
Model View Controller (MVC) Architecture
Model
View
Controller
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
JSF JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet
BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
JSF/OAFwk
ADF BC
Server
MVC & Application Architecture
Metadata
Services
JDeveloper
Model (JSR227)
View
Controller
Business Services
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
ADF Faces
JSF/ADFc/Taskflow
ADF Model
ADF
BC
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
ViewController/
User Interface
Project
Model/ Service
Project
Model
Presentation
Layer
v
m
bc
BAM
BPL
JSF
ADF Training Breakup
Application Development Framework (ADF)
Fusion Middleware and It’s Architecture (Lesson 1)
ADF Integrated Development Environment –JDeveloper (Lesson 2)
ADF Business Component functionalities (Lesson 4 to 9 & 22)
ADF Faces functionalities (Lesson 10 to 21)
ADF Advance Topics (Lesson 3 and 23 to 34)
Functionalities of ADF Business Components
 Building Business Services with ADF Business Components (L4)
 Persisting Data using Entity Objects (Lesson 5)
 Querying Data using View Objects (Lesson 6)
 Exposing Business Services and managing transaction through
Application Module (Lesson 7)
Master – Detail Data Model
 Declaratively Customizing Business Services (Lesson 8)
Custom Fields
 Validating Business Services (Lesson 9)
 Programmatically Customizing Business Services (Lesson 22)
Functionalities of ADF Faces
 200+ featured Rich UI Components
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management (L 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (Lesson 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax support)
(Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search Capability
(Lesson 19)
 Transaction Management (Lesson 20)
 ADF Model support (Lesson 21)
ADF Faces Functionality: ADF Faces Components
 Layout Components: (L 12)
 Headers, Layout, Grouping, Spacing, etc..
 Navigation Control Components: (L14)
 Button, Link, Train, Navigation, etc..
 Menu and Toolbar explorer-type
containers: (L 14)
 Menu, Toolbar, Toolbox, etc..
 Secondary Windows Layout: (L 14)
 Popup, Dialog, Window, etc.
 Text and Selection Components: (L18)
 Output, Input, LOV, etc..
 Data Views: (L 18)
 Table, Tree, List, Carousel, Calendar, etc.
 Advance Data Visualisation
Components (L 18)
 Chart, Graph, Gauge, NBox, Pivot Table,
Map, Gantt, Timeline, Hierarchy Viewer,
Sunburst, Diagram, etc..
 Data Query Components (L 19)
 Query and Quick Query
Definition Examples
Component Type
UI Page
Service / Operation
Business Rule
Business Event
Business Object
Organized data made visible to a user. May be part of a
task flow or accessed as a standalone Lesson Summary
of data. Implemented using JSF, Portlets, AJAX etc..
Functions, procedures, and legacy transactions which
represent the operations of the business.
Implemented using ADF BC EO/VO and SDO/WS.
Policies that represent the key decisions of a business.
Rules are centralized using metadata services as part of
data validation or processing.
Event of significance to an organization that is used to
communicate information to other systems.
Implemented using ESB.
Logical data model of the information stored in a
business. Defines the enterprise service object definition
used for integration and services.
Enter Company Information page;
Opportunity Lesson Summary page
Calculate Tax Service; Invoice Service
“Offer 10% discount if Status = Gold”
“Purchase Order Created”; “Inventory
Threshold Reached”
Customer; Opportunity; Order entity;
Invoice
Business
Process
A series of steps in a directed graph that represent the
workings of an enterprise. Implemented using BPEL and
Human Workflow components.
Quote-to-Order Process; Defect
Management Process
Task Flow A series of pages organized in a directed graph that
represent steps to be performed by a single individual in
one sitting. Implemented using ADF.
Enter Opportunity Task Flow; Create
New Contact Task Flow
Fusion Middleware Concepts
Challenges Faced when Building J2EE Applications
 Building J2EE applications can be complex
 Development time can be extensive
 Choosing and implementing appropriate design patterns can be
overwhelming
 “Do it yourself” applications often repeat existing application code
 A large portion of “do it yourself” code is dedicated to common
tasks
 The more code you write, the greater the chance of errors
 An application framework is needed
Overview of ADF
Industry Standard-Base
Is an end-to-end J2EE framework that is extensible
Enables developers to focus on the application, not the low-level
infrastructure
Creates reusable and maintainable code (Enhanced Reusability)
Uses metadata, simplifying the basic task of wiring user interfaces to
services
Implements J2EE best practices and design patterns, including MVC
(abstracts J2EE complexity)
Choice of technology
Overview of ADF cont. …
Increase Productivity & Ease-of-use
Provides declarative and visual development with JDeveloper
Less coding, more reuse
Reduce learning curve & resource issues
XML Metadata
Difference between Features and Functionality
The meanings are similar, but with different nuances.
"function" is used to describe a capability something has.
"feature" is used to refer to a particular function that's special
or notable in some way.
For example:
"A car uses a motor to function." "One of the functions of a car is the
ignition.“
"This car has many safety features." "This car features anti-lock brakes
and air bags."
Features of ADF
Integrated and pluggable Model-View-Controller framework
implementation
Declarative Business Services with ADF Business Components
Rich web based interfaces
Multi-channel client support
Mobile device development
Declarative application customization
Declarative end-to-end integrated security
Designed to
Work Together
Integrated
Features of ADF cont.…
Caching
Integration with other Oracle ADF technologies, such as Web
Services, WebCenter, EJB, SOA, BI, Cloud, PLSQL, etc..
Widely available documentation and support
Platform independent
Excellent development environment (JDeveloper tool)
Extensive IDEs Support (Eclipse, etc.)
Free Option – Oracle ADF Essentials
Key Benefits of ADF
Speeds up application development
Protects from technology shifts
Increase reusability across applications
Create open and standard based applications
Standards-Based
Architecture
Open
Advantages of ADF over J2EE
Category Struts / Spring Framework Oracle ADF Framework
Framework Action-based Component-based
Source code Developer has to write source code for all
the UI components
Built-in UI components and Rich look & feel
Database
connection
Developer has to explicitly write Data base
connectivity code to retrieve connection
Built-in configuration of database
connectivity, no explicit retrieval required
SQL Statements Developer has to write SQL statements and
execute them
Declarative approach builds the required
SQL statements
Transactions Developer has to take care of Transaction
management
Transactions are managed by the
framework
Advantages of ADF over J2EE cont.…
Page
navigation
Page navigations are based on the config XML
files which should be taken care of by the
Developer
Controller takes care of page navigations
when declaratively given
Validations Each validation should be written in validation
logic specific methods and each validation
error should be managed separately and
navigated to respective error pages
Sophisticated validation hookups provided by
ADF at various levels: UI level, AM Level, and
Entity Level; developer can decide the right
place of validation for a scenario
Security User has to design and develop a user login UI
page
Declarative approach to security enables the
developers to provide security at various
levels: to pages, regions, tabs, sections,
components
Development
time
To build a normal CRUD operation module,
developers take 3 days on an average
To build a normal CRUD operation module,
developers need 10 minutes on an average,
having proper AM, EO, VO configured
Advantages of ADF over J2EE cont.…
Category Struts / Spring Framework Oracle ADF Framework
Authentication Developer has to verify
username and password against
the data source provided
Though it is not a direct feature of ADF, WebLogic
provides various ways to authentication to which an ADF
application can easily couple with SQL Authentication,
SAML Authentication, LDAP Authentication, etc..
Wizard Developers find hardly any
wizards to help in building
framework features
ADF is all about wizards and when users make proper use
of these wizards they make the application work for the
business requirements—and ADF provides all the source
code
Servers Framework can make use of
web application servers like
Apache tomcat, WebSphere,
JBoss etc..
Built-in WebLogic server configurations make deployment
much easier
Competition
Microsoft
ADF allows us to compete head-to-head on the development
productivity with MSFT
IBM
Different tools, not integrated
No common framework
Spring and other OSS frameworks
No productive tooling
Benefits of ADF Over Other Frameworks
 End-to-End solution: an integrated solution for every J2EE layer
 Development Environment: visual and declarative approach
 Platform Independence: any J2EE compliant server and SQL-92 DB
 Technology Choice: supports multiple technologies for each layer
 Technology Commitment: develop rich we and cloud application
 Metadata-Driven:
 Declarative Customization:
 Enhanced Reusability: task flow, template, libraries, fragment, etc.
Lesson Summary
IT system runtime architecture
FMW, MVC, ADF MVCS and application architecture
ADF technology stack
Challenges Faced when Building J2EE Applications
Overview, Features, Functionalities and Key Benefits
Advantages of ADF over J2EE
Business Benefits of ADF
2
Understanding Development Tool: JDeveloper
Lesson Agenda
Overview of JDeveloper
Confusing Terminologies and Abbreviations
Create an ADF Application, Projects and DB Connections
Explore JDeveloper and examine Application Artifacts
Explore and Work with Windows of JDeveloper
Use Help Centre and Refactor JDeveloper Artifacts
Setup Integrated Development Environment (IDE) preferences
Advantages of JDeveloper
Overview of Development Tool: JDeveloper
Code and Develop
J2EE Applications
Analysis and Design
Applications
Deploy and Manage
Secure and
Maintain
Develop DBMS
Schemas
Integrate, Orchestrate and
develop Business Process
Team Development
and Versioning
Profile, Debug, Test,
Tune and Optimize
JDeveloper
General ADF
JDev Project Name for Fusion
Application
Business Service/ Service ADF Business Component Model
Model-View-Controller ADF Faces / ADFm-ADFv-ADFc / ADF
Model-View-Controller / ADF UI
ViewController
Confusing Terminologies
Confusing Terminology “View”
Database View
ADF Business Component’s View Objects
ViewController project
View as page or page fragment
View Scopes
View layer in MVC
Abbreviations
AM- Appln Module
AS- Association
BC- Business
Component
BS-Business Service
DB- Database
DO- Domain Object
Dept- Department
EO- Entity Object
Emp- Employee
Loc- Location
MAF- Mobile Appln
Framework
MVC- Model view
Controller
VC- View Controller
VL- View Link
VO- View Object
WC- WebCenter
WS- Web Service
Launching JDeveloper
 To launch JDeveloper:
 Select Start > All Programs > Oracle >
Oracle Home > Oracle JDeveloper Studio >
Oracle JDeveloper Studio
 Starting from the command line or a
shortcut pointing to jdev.exe in the
 <JDev Home>jdevbin
directory
 You can specify flags:
 For the user directory:
 -J-Dide.user.dir=<path>
 For editor windows:
-noreopen
Selecting Developer Role
Select a developer role, when you
launch JDeveloper.
Development Environment (IDE) Preferences
Access the
Preferences window
by selecting Tools >
Preferences
Windows in JDeveloper
JDeveloper features that facilitate ease of application development include
following windows:
 Applications
 Data Control Panel
 Database
 Structure
 Editors (code or visual)
 Log and Debugger
 Components
 Resources (IDE and Application)
 Properties
 Other Windows
Windows Sample
Applications Window
Has expandable, minimizable
panels to display:
Projects
Application resources
Data controls
Recently opened files
Database Window
The Database Navigator:
Shows both IDE and application connections
Enables you to:
 Create, Manage and Delete
connections
 Open SQL Worksheet
 View database elements
 Filter the display
Structure Window
A hierarchical tree view of the selected document, object or source
code
The ability to:
 View in different ways
 Navigate
(go to the source)
Editors
Log Window
 Displays JDeveloper messages: such as logging and compilation
 Has one or more tabs: a Messages tab and additional tabs
depending on what is occurring
 Has context menu to clear, wrap, save output, search, etc..
 Displays standard output (such as System.out.println() messages)
Components Window
Display the components available to
drag to visual editor
Search for components
Display the favorites and recently used
components
Display components in icon or list view
Resources Window
Contains two types of resources:
Catalogs
Connections
Provides single searchable
 view of and access to
 many types of resources
Facilitates sharing resources among
developers
Toolbar: Create/Import or Search
Properties Window
Other Windows
Work with Windows
Following actions can performed with windows:
Close / Open
Maximize / Restore
Float / Dock
Split / Unsplit
Resize
Reposition
Requirement to Build an Application
To build an application in JDeveloper, you need to define:
An application
One or more projects
A database connection, if required by application
Use of other connection, resource and features as required
Create New ADF Application
2
3
1 1 1 1
Use Application Overview Page
The Application Overview page shows details about the application’s:
 Java Files
 Page Flows
 Managed Beans
 Web Tier
 Business Components
 Binding Files
 Offline Database
It enables you to:
 Create new objects
 Delete objects
 Edit objects
The Application Overview Checklist
 The Applications Overview Checklist is designed to guide users
through typical steps in building and application.
Create New Project
Create Database Connections
 Two types:
 IDE:
 Available to be added to any application
 Create in Database Navigator or Resource
Palette
 To add to an application, drag to Application
Resources or to an application in Database
Navigator
 Application:
 Owned by a specific application
 Create in Database Navigator or Application
Resources
Refactoring in JDeveloper
Rename objects, such as
associations and view links
Move objects or packages to a
different package
Change all references
throughout the application
Advantages of JDeveloper
 Single stack for all Apps development
Portal (WC), BPEL, BI & Wireless Development
Service-Oriented Development
Event-Driven Development
 Productivity With Choice - Supports choice of
Development platforms (OS)
Data sources
Application servers
Development approaches
(MDA / declarative / hand-coding)
Technology stacks
Advantages of JDeveloper cont.…
 Standard, Open and Extensible
Support industry standards
Integrate Open Source Utilities
Open Extension API (JSR 198)
 Better productivity
Declarative and Visual
Full development lifecycle
One tool for Java, Web Services, XML, DB and more
 Modeling
UML, Database visual design, Java Class modeler, etc.
DB Development
Support for additional schema objects (create, update,
visualize and generate…)
Support for views (visualize with relationships to tables)
Object types, PL/SQL packages, procedures, functions
Sequences, synonyms, expression based indexes
System Defined Types: SDO_Geometry, XMLTypes…
Foreign database support for DB2, Informix, MySQL, SQL
Server and Sybase
Visual reconcile tool for the generation of scripts
Integrated Development Environment
Design
Business
Processes
Design Routing
Rules
Build &
Assemble Service
Components
Set Up Facts &
Dimensions for
BAM
Design Event
Flows (CEP)
Design
Business Rules
Design
Page
Flows
Drag & Drop
Page Regions
Drag & Drop
Portlets
Drag & Drop
DHTML
Components
Design
Page
Templates
Configure
Customization &
Personalisation
MEP Support
Integration with
ADE
Activity Guide
Control
Flexfields &
Save For Later
Controls
Seed Data
UI and Extraction
Database Schema
Development
UI Development SOA/EDA Development Apps Development
JDeveloper 12c – Declarative Model Driven Development
Lesson Summary
Overview of JDeveloper
Confusing Terminologies and Abbreviations
Create an ADF Application, Projects and DB Connections
Explore JDeveloper and examine Application Artifacts
Explore and Work with Windows of JDeveloper
Use Help Centre and Refactor JDeveloper Artifacts
Setup Integrated Development Environment (IDE) preferences
Advantages of JDeveloper
3
Modeling the Database Schema
Lesson Agenda
Exploring HR System ER Diagram
Examining Training Lab Application
Create an offline Database Diagram
Add new offline DB Schema objects
PLSQL Integration
JOBS
P N JOB_ID VARCHAR2 (10 BYTE)
N JOB_TITLE VARCHAR2 (35 BYTE)
MIN_SALARY NUMBER (6)
MAX_SALARY NUMBER (6)
REGIONS
P N REGION_ID NUMBER (4)
N REGION_NAME VARCHAR2 (30 BYTE)
0..1
0..*
1..*
0..1
0..*
0..1
0..*
EMP_MANAGER_FK
JHIST_JOB_FK
DEPT_LOC_FK
LOC_C_ID_FK
COUNTR_REG_FK
HR System ER Diagram
COUNTRIES
P N COUNTRY_ID CHAR (2 BYTE)
COUNTRY_NAME VARCHAR2 (40 BYTE)
F REGION_ID NUMBER
0..1
EMP_JOB_FK
1 1..*
LOCATIONS
P N LOCATION_ID NUMBER (4)
STREET_ADDRESS VARCHAR2 (40 BYTE)
POSTAL_CODE VARCHAR2 (12 BYTE)
CITY VARCHAR2 (30 BYTE)
STATE_PROVINCE VARCHAR2 (25 BYTE)
F COUNTRY_ID CHAR (2 BYTE)
1
0..*
0..*
0..1
JHIST_DEPT_FK
0..1
0..*
DEPARTMENTS
P N DEPARTMENT_ID NUMBER (4)
N DEPARTMENT_NAME VARCHAR2 (30 BYTE)
F MANAGER_ID NUMBER (6)
F LOCATION_ID NUMBER (4)
DEPT_MGR_FK
0..1
0..*
EMPLOYEES
P N EMPLOYEE_ID NUMBER (6)
FIRST_NAME VARCHAR2 (20 BYTE)
N LAST_NAME VARCHAR2 (25 BYTE)
U N EMAIL VARCHAR2 (25 BYTE)
PHONE_NUMBER VARCHAR2 (20 BYTE)
N HIRE_DATE DATE
F N JOB_ID VARCHAR2 (10 BYTE)
SALARY NUMBER (8,2)
COMMISSION_PCT NUMBER (2,2)
F MANAGER_ID NUMBER (6)
F DEPARTMENT_ID NUMBER (4)
F GENDER_ID NUMBER (10)
EMP_DEPT_FK
1
JHIST_EMP_FK
1..*
JOB_HISTORY
P F N EMPLOYEE_ID NUMBER (6)
P N START_DATE DATE
N END_DATE DATE
F N JOB_ID VARCHAR2 (10 BYTE)
F DEPARTMENT_ID NUMBER (4)
GENDERS
P N GENDER_ID NUMBER (10)
GENDER_NAME VARCHAR2 (20 BYTE)
0..1
0..*
EMPLOYEES_GENDERS_FK1
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
Oracle ADF Tutorial
ADF Business Rules in PL/SQL
Typical Environment
Background environment:
A PL/SQL package that encapsulates insert, update, and delete
access to an underlying table
A companion database view for read access
Controlling Entity Posting Order to Avoid
Constraint Violations
Performing DML on more than one entity object can present
problems.
 Because of database (DB) constraints, the order in which the
operations are performed is important.
 Primary key values must be inserted before foreign key references
to avoid DB violation.
 When you commit a transaction, entity object changes are
processed in chronological order.
 When you insert a new Employee row and then an associated
new Department row, the new employee fails at the database
level due to the EMP_DEPT_FK foreign key constraint.
Lesson Summary
Exploring HR System ER Diagram
Examining Training Lab Application
Create an offline Database Diagram
Add new offline DB Schema objects
PLSQL Integration
4
Building Business Service with
Default ADF Business Components
Lesson Agenda
Describe tech-stack of ADF Business Components (BC)
Understand types of Objects of ADF BC
Functionality of ADF BC
Creating and examining ADF BC
Examining Configuration Files of ADF BC
Test ADF BC using ADF Model Tester
Overview of ADF BC
Exposing ADF BC as Business Service
Tech-stack of ADF
Metadata
Services
JDeveloper
Model (JSR227)
View
Controller
Business Services
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
ADF Faces
JSF/ADFc/Taskflow
ADF Model
ADF
BC
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
ViewController/
User Interface
Project
Model/ Service
Project
Presentation
Layer
v
m
bc
BAM
BPL
JSF
Tech-stack of ADF Business Components (BC)
Model (JSR227)
View
Controller
Business Services
Data Services
JSF/ADFc/Taskflow
ADFm Model
ADF BC
Services
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB Session
Beans Web Services
POJO
Toplink Queries
Toplink Mapping
EJB Finders
Java Classes
EJB Entity Beans
Web / Wireless Rich Client / Desktop
Relational Data XML Data Legacy Data Packaged Apps
JDBC
ADF BC
View Object
ADF BC Entity
Object
Business Services &
Service Data Objects
Data Query
Business Objects
Data Persistence
Business Objects
Metadata
Services
JDeveloper
ADF Faces JSF
DepartmentEO
EmpDeptFkAS
EmployeeEO
DepartmentVO
EmployeeVO
Employee
SummaryVO
Types of Objects of ADF BC
DepartmentEO
DepartmentVO
EmployeeVO
Employee
SummaryVO
EmployeeBy
EmailVO
Department1 Employee3
Employee2
Employee
Summary1
EmployeeBy
Email1
applyManagerVO
Criteria()
Business
Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
EmpDeptFkAS
EmpDeptFkVL
View Objects
and View Links
Entity Objects
and Associations
EmployeeEO
Department2
ADF
Business
Components
Business
Domain
Components
Data
Model
Components
Data Model
XML
Java
XML
Java
XML
Java
Nested AM
Row Set Iterator
Service
Layer
Types of Objects of ADF BC cont.…
 Types of Objects of ADF Business Components (BC)
 Business Domain Components
 Entity Object (Data Persistence Business Object)
 Java
 PL/SQL
 Association
 Data Model Components
 View Object (Data
Query Business Object)
 Read only
 Updateable
 View Link
 Application Module
 Business Service
 Service Data Object
Functionality of ADF BC
Reading / Retrieving data
Caching data
Writing / Persisting data
Managing relationships
Managing transactions
Building a ADF BC
The basic steps to create a Business Components model are:
Create a connection to a database
Create an application workspace
Create Entity objects based on database tables
Create View objects to support a client application
Create an Application module to publish data access methods
Test the Business Components
Configuration Files of ADF BC
bc4j.xcfg
<ModelProjectName>.jpx
adf-config.xml (.adfMTA_INF - application)
Create Default ADF BC
You can create ADF Business
Components by:
Creating a business components
diagram
Using the wizards
Generated Artifacts of HRSystem ADF BC
JOBS
P N JOB_ID VARCHAR2 (10 BYTE)
N JOB_TITLE VARCHAR2 (35 BYTE)
MIN_SALARY NUMBER (6)
MAX_SALARY NUMBER (6)
REGIONS
P N REGION_ID NUMBER (4)
N REGION_NAME VARCHAR2 (30 BYTE)
0..1
0..*
1..*
0..1
0..*
0..1
0..*
EMP_MANAGER_FK
JHIST_JOB_FK
DEPT_LOC_FK
LOC_C_ID_FK
COUNTR_REG_FK
HR System ER Diagram
COUNTRIES
P N COUNTRY_ID CHAR (2 BYTE)
COUNTRY_NAME VARCHAR2 (40 BYTE)
F REGION_ID NUMBER
0..1
EMP_JOB_FK
1 1..*
LOCATIONS
P N LOCATION_ID NUMBER (4)
STREET_ADDRESS VARCHAR2 (40 BYTE)
POSTAL_CODE VARCHAR2 (12 BYTE)
CITY VARCHAR2 (30 BYTE)
STATE_PROVINCE VARCHAR2 (25 BYTE)
F COUNTRY_ID CHAR (2 BYTE)
1
0..*
0..*
0..1
JHIST_DEPT_FK
0..1
0..*
DEPARTMENTS
P N DEPARTMENT_ID NUMBER (4)
N DEPARTMENT_NAME VARCHAR2 (30 BYTE)
F MANAGER_ID NUMBER (6)
F LOCATION_ID NUMBER (4)
DEPT_MGR_FK
0..1
0..*
EMPLOYEES
P N EMPLOYEE_ID NUMBER (6)
FIRST_NAME VARCHAR2 (20 BYTE)
N LAST_NAME VARCHAR2 (25 BYTE)
U N EMAIL VARCHAR2 (25 BYTE)
PHONE_NUMBER VARCHAR2 (20 BYTE)
N HIRE_DATE DATE
F N JOB_ID VARCHAR2 (10 BYTE)
SALARY NUMBER (8,2)
COMMISSION_PCT NUMBER (2,2)
F MANAGER_ID NUMBER (6)
F DEPARTMENT_ID NUMBER (4)
EMP_DEPT_FK
1
JHIST_EMP_FK
1..*
JOB_HISTORY
P F N EMPLOYEE_ID NUMBER (6)
P N START_DATE DATE
N END_DATE DATE
F N JOB_ID VARCHAR2 (10 BYTE)
F DEPARTMENT_ID NUMBER (4)
Diagram of HRSystem Business Service
Object Instance of HRSystem Business Service
Testing ADF BC with ADF Model Tester
Overview of ADF BC
 Maps to a data source, such as database and defines reusable
logical and persistable objects (in Java & XML)
 Provides data interaction and business logic execution,
implemented in xml meta data (not code)
 Enable wizard-based or visual development
 Declarative business rules & validation
 Predefined Java methods for any events
 JDeveloper generates these Java objects
 No need to write any JDBC code
Bridging the Gap by ADF BC
SQL
Tables, rows
Primary keys
Foreign keys
Transactions
GB, TB
•Java
•Classes, instances
•Memory references
•Associations & Links
•Shared heap
•100s of MB
Order of Execution of ADF BC
DB
Entity Object
View Object
Application Module
Order of
execution
DB
Implementation Architecture of ADF BC
Provides metadata-driven components with optional Java code
Is based on standard Java and XML
Implements popular design patterns
Organizes components into packages
Provides prebuilt code in two main packages:
oracle.jbo
oracle.jbo.server
Works with any application server or database
Exposing Business Service
ADF Business Service:
Abstracts service implementation from clients:
ADF BC, EJB, Web services, TopLink, Java classes
ADF Faces, JSP, mobile
Provides declarative data binding:
Implements JSR 227
Uses Expression Language (EL)
Separates view from business service
Creates data control from application module
ADF BC as Business Service
Java
(Co-Located Mode)
UDDI
LDAP
JAAS
JDBC
JAX-R
Database Schema
Business Objects
Application Module
Logical Data Model
Entity Objects
Business Object Instances
View Objects
Security
and
Identity
Management
Identity
Mgmt.
JAAS
Business
Service
Repository
WSIL
WSDL, XSD
Design Time
Publish
Events &
Services
Business Events
Java, XML
(Batch Mode)
SSO
RBAC
Table Table
Table
Physical Data Model
Business Services
Service Data Objects
Services – Data Access Patterns
 Data Access Patterns
 Local Services
 ADF BC application modules
 Bound into user interfaces
 Called from other ADF BC AM's
 Local Services - Remote Data Sources
 ADF BC application modules
 Shared AM, VO & EO logic
 Remote services can back data
 Remote Services
 ADF BC application modules running remotely
 Third-party services
 Web Service and SDO interfaces
Local Services
Desktop
AM 1
JSR
227
AM 2
DB
Middle Tier
VO1 EO1
Java
• Bind to UI using JSR 227
• Written using standard ADF BC Java APIs
• Accessed from other AM's using ADF BC Java API
• Accessed from third-party clients using WS & SDO
Data Tier
VO2 EO2
S
D
O
Third-Party
WS
Local Services - Remote Data
Desktop
AM 1
AM 2
Middle Tier
VO1 EO1
Java
• Bind to UI using JSR 227; Third-party using WS & SDO
• Written & accessed using standard ADF BC Java APIs
• VO/EO data 'switchable' from native to remote service
• All AM, VO & EO code, logic, caching, etc.. reusable
• Must know ahead of time that data source is 'remotable'
VO2 EO2
Third-Party
Data Tier
WS/FSB
WS
JSR
227
S
D
O
Remote Services
Desktop
AM 1
JSR
227
AM 2
Middle Tier
VO1 EO1
• Remote service can be remote AM or third-party
• Same programming model for both (WS using SDO)
• No shared code when switching from AM to third-party
• Must know ahead of time that service is 'remotable‘
• Annotate and abstract WS calls using ESB
VO2 EO2
S
D
O
Third-Party
DB
Data Tier
SDO
S
D
O
WS/ESB
WS
WS
Class Diagram of ADF BC Objects
Exposing the Application Module to the User
Interface
Oracle ADF Model:
 Abstracts service implementation
from clients:
EJB, WS, ADF BC, TopLink, Java classes
JSP, mobile
 Provides declarative data binding:
Implements JSR 227
Uses Expression Language (EL)
Separates view from Business Service
Creates data control from AM
Lesson Summary
Architecture of ADF BC
Types of Objects – EO, AS, VO, VL & AM
Functionality
Creating and examining
Configuration Files
Test ADF BC using ADF Model Tester
Exposing ADF BC as Business Service
5
Persisting Data using Entity Objects
Lesson Agenda
Describe tech-stack of Entity Objects (EO)
Explain data persistence mechanism of entity objects
Describe entity object attribute mapping
Overview and features of Entity Objects
Create and Examine EO from DB tables, views or synonyms
Examine Attribute Settings
Synchronize an EO with table structure changes
Entity associations and types
Tech-stack of Entity Object (EO)
ADF Business Components
DepartmentEO
Business Services
Relational Data /
App Schema
EmployeeEO
EmpDeptFkAS
Entity Objects
and Associations
Business Domain
Components
Persisting Data using Entity Objects
 Entity Objects - Persist Data
EmployeeEO
Salary Range Should Between
0 to 99999
Entity
objects
Attributes
Validation
Rule
EmployeeId
FirstName
LastName
Salary
EMPLOYEES table in database
EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ...
App Schema
Entity Object Attribute Mapping
Every table column maps to an entity object attribute
EMPLOYEES table in database
EmployeeId
FirstName
LastName
Salary
…
EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ...
EmployeeEO in ADF BC
App Schema
Ingredients of an Entity Object
Overview of Entity Object
“Entity object definitions” correspond to database tables
Entity object definitions are templates for “entity object
instances,” which correspond to table rows
Java Based
Performs insert/updates automatically
PL/SQL Based
All DML operations are PL/SQL procedures
We need to provide implementations for insert/update/delete
functions
Features of Entity Object
Fundamental Java object which interacts with the database
Represents a single row of a database table or other data
source
Contain attributes representing the database columns
Encapsulate attribute level and entity level validation logic
Can contain custom business methods
Handle database caching
Creating EO from Tables, Views or Synonyms
When an entity object is created, JDeveloper:
 Interrogates the data dictionary for information
 Infers primary key, or creates one from RowID
 Creates implicit validators for database constraints
 Creates the XML component definition file (<EO_name>.xml)
 Creates optional Java files if selected, such as entity object class
<EO_name>Impl.java
 Generates associations based on foreign keys, if applicable
(<Association_name>FkAS.xml)
Examining Attribute Settings
Attributes
Type
Properties
 Updatable, mandatory, etc..
Control Hints
 Label, Tooltip Text, Format
Mask, etc..
Examine Attribute Settings cont.…
Name: A valid Java identifier
Description: Description of the attribute for documentation
Type: A Java data type
Property Set: Named property set to apply to attribute. A
property set is a version of an existing domain that is XML-only
(no Java) and does not enforce a data type
Polymorphic Discriminator: To identify the attribute as a
discriminator column for polymorphic entity objects
Subtype Value: Discriminator value for the subtype
Examine Attribute Settings cont.…
Effective Date: Effective date properties for the attribute. These
options are available only if the attribute type is Date. (used for
a point of time snapshot to answer such questions as what an
employee’s salary was on January 30, 2004.)
Start Date: Start attribute of an effective dated entity object
End Date: End attribute of an effective dated entity object
Sequence Flag: Stores a flag indicating the most recent change in the
sequence for an effective dated entity object
Sequence: Stores a sequence of changes for an effective dated entity
object
Examine Attribute Settings cont.…
 Updatable: The view attribute setting is based on the entity
attribute setting and can made more restrictive
Always: Makes an attribute updatable
While New: Makes an attribute updatable before an entity is first posted
Never: Makes an attribute read-only
 Persistent/ Transient: Attribute is persistent to be used in
generating a table; or transient
 Mandatory: Selected by default for columns with NOT NULL
constraints
Examine Attribute Settings cont.…
 Primary Key: Selected by default for columns with PRIMARY KEY
constraints
 Queryable: Attribute can occur in the WHERE clause of a view
object (selected by default except for LOBs)
 Precision Rule: Validator is applied by the framework at runtime to
enforce the maximum precision and scale of the data type. If
selected, the validation is performed by the entity. If not selected,
the validation is not performed by the entity and may result in
invalid precision/scale errors from the database when the
transaction is committed
Examine Attribute Settings cont.…
Refresh on Insert: Retrieves value from the DB after an insert
Refresh on Update: Retrieves value from the DB after an
update
Change Indicator: Indicates, if the column is a change indicator,
such as a timestamp, to be used to indicate that a row has
been changed by another transaction or can be locked. If no
columns are specified as change indicators, ADF BC does a
column-by-column comparison
Examine Attribute Settings cont.…
 Track Change History: To log changes to the database, only if
 implemented authorization using JAAS/JAZN,
 the selected attribute is persistent,
 not selected Primary Key, Mandatory or Discriminator, and
 the attribute is Char, Character, String, Date, Timestamp or Number
 The following types of history column are available:
 created on: To use the column to log the date on which the row was first created. The attribute type must be
Date or Timestamp
 modified on: To use the column to log the date on which the row was last modified. The attribute type must be
Date or Timestamp
 created by: To use the column to log the user who created the row. The attribute type must be Char, Character,
or String
 modified by: To use the column to log the user who last modified the row. The attribute type must be Char,
Character, or String
 version number: To use this column to log the number of times the row has been changed. The attribute type
must be Number
Examine Attribute Settings cont.…
 Column Name: Maps to the name of the table column
 Column Type: Maps to the SQL type of the table column
 Default Value: This value is not propagated from the default value, if any, in
the database table
 a Literal
 an Expression or
 SQL (only for transient attribute): Based on SQL expression
 Refresh Expression Value: Displayed for transient attributes only. Groovy
expression is used to set the condition
 Generate Unique Constraint: Generates a UNIQUE constraint and defines
the attribute to be unique. For example, every employee have a unique
email id
Examine Attribute Settings cont.…
Sequence Name: The sequence name shown on the Sequence
tab is applicable only at design time when you use the Create
Database Tables feature. The sequence indicated here will be
created along with the table on which the entity object is
based. This field is not available for all attribute types
Start At: Integer value you want the sequence to start at, the
default value is 1. This field is not available for all attribute
types
Synchronizing an EO with Table Structure Changes
Generate Database Tables from EO
Right-click package and select Create Database Objects.
In the Create Database Objects dialog box, select objects to
create.
Entity Association Types
 Association (non-dependent)
Entities are related but not completely dependent
Either end of the association can exist without the other
Either can be deleted without deleting the other
 Composition (dependent)
Destination entity is completely dependent on source entity
Source entity owns destination entity
No destination entity can be created without the owning entity existing first
Source entity cannot be deleted without deleting all its associated
destination entities
JobEO EmployeeEO
DepartmentEO
LocationEO
0..1
1
M
*
D
M
*
D
EmpJobFkAS
DeptLocFkAS
Features of Entity Associations
Consist of a master (source) and a detail (destination) entity
Defines a relation between the two entities
Enable access to data in related entity objects
May be based on database constraints
May be independent of database constraints
Are used in defining validations and LOV metadata
Source (Master) Destination (Details)
Association
DepartmentEO EmployeeEO
*
EmpDeptFkAS
Properties of Composition Association
Lesson Summary
Architecture of Entity Objects (EO)
Describe EO
Functionalities of EO
Create and Examine EO from DB tables, views or synonyms
Examine Attribute Settings
Synchronize an EO with table structure changes
Entity associations and types
6
Querying Data using View Objects
Lesson Agenda
Describe Tech-stack of View Objects (VO)
Understand types of VOs
Overview of VO
Explain the features of VO
Link two VOs to create master-detail view objects
Create various types of View Objects and Links
Tech Stack of VO: Flow
ADF
Business
Components
DepartmentEO
DepartmentVO
EmployeeVO
Employee
SummaryVO
EmployeeBy
EmailVO
Department1 Employee3
Employee
Summary1
EmployeeBy
Email1
applyManagerVO
Criteria()
Business
Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
EmpDeptFkAS
EmpDeptFkVL
View Objects
and View Links
Entity Objects
and Associations
EmployeeEO
Data Model
Business
Domain
Components
Data
Model
Components
XML
Java
XML
Java
XML
Java
Nested AM
Row Set Iterator
Employee2
EmpDeptFkVL1
Tech Stack of VO: Data
EmployeeVO
EmployeeEO
EmployeeId
FirstName
LastName
Salary
Entity object
EmployeeId
FirstName
LastName
Salary
EMPLOYEES table in database
EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ...
App Schema
101 Steven
EmpId First Nam
King
Last Nam
85000
Salary
Steven King
First Name Last Name
Updatable View Object
Select first_name,
last_name from
employees where
email = :p_email
EmployeeByEmailVO
Read-only View object
Read-only User Interface
Updatable User Interface
Ingredients of a View Object
Types of VOs
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Types of VOs: SQL Query
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Read Only VO based on SQL Query: Overview
ADF Business Components
EmployeeByEmailVO
EmployeeByEmail1
Business Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
SQL Query Read
Only View
Object
Read Only VO based on SQL Query: Data
View Object
Select first_name,
last_name from
employees where
email = :p_email
EmployeeByEmailVO
Steven King
FirstName LastName
EMPLOYEES table in database
EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ...
App Schema
Read-only User Interface
Read Only VO based on SQL Query: Mapping
Every query column maps to a view object attribute
Those attributes are visible to the application
EmployeeId
LastName
DepartmentId
DepartmentName
SQL query view object
from multiple tables
Read Only VO based on SQL Query: Features
 Read-only access to data
 Based on SQL query, one or more tables
 Have only SQL-Only attributes
 Can contain transient (calculated) attributes
 Provides a row set
Client can scroll through this rowset but cannot make any changes to it
 Normally used to populate LOVs, pop lists etc.
 Cannot perform insert/update operations on the data
 Do not use entity objects at all
 But much faster
Types of VOs: Updatable VO (Single Entity)
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Updatable VO based on Single EO: Overview
ADF Business Components
EmployeeVO
Employee2
Business Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
Entity Based
Updatable View
Object
EmployeeEO
Entity Object
Updatable VO based on Single EO: Data
View Object
EmployeeVO
EmployeeEO
EmployeeId
FirstName
LastName
Salary
Entity Object
EmployeeId
FirstName
LastName
Salary
EMPLOYEES table in database
EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ...
App Schema
101 Steven
EmpId First Nam
King
Last Nam
85000
Salary
Updatable User Interface
Updatable VO based on Single EO: Retrieving Data
 The view object queries the database directly
 Data retrieved by the query is saved to the Entity Object’s cache. (View
Object instead of caching data themselves, stores in Entity Object
instances.)
 Nonpersistent attributes are stored and retrieved from the view object’s
cache
Database
View object
instance
Data
Data
Data
Data
rows
Data
Data
Data
View
rows
SQL query
Data
Data
Data
Entity object
instances
Data retrieval
Entity object
View object
12*salary (transient)
1
2
3
Updatable VO based on Single EO: Updating Data
 The view object updates the entity object’s cache
 The entity object instances write back (commits) to the database
 Entity object definitions can specify validation rules
Database
View object
instance
Data
Data
Data
Data
rows
Data
Data
Data
View
rows
Data
Data
Data
Entity object
instances
DML
Commit
Types of VOs: Join VO (Multiple Entities)
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Join VO based on Multiple EO: Overview
EmployeeSummaryVO
EmployeeSummary1
Business Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
Multiple Entity
Based Join View
Object
EmployeeEO Entity Objects
Referenced
or
Updatable
DepartmentEO
ADF Business Components
Types of VOs: Referenced Entity
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Referenced
(Read-only)
EmpDeptFkAS
Join VO based on Referenced EO: Overview
View object
DepartmentEO
EmployeeEO
EmployeeId
FirstName
LastName
Entity objects
EMPLOYEES
EMPLOYEE_ID FIRST_NAME LAST_NAME
DEPARTMENTS
DEPARTMENT_ID DEPARTMENT_NAME
DepartmentId
DepartmentName
EmployeeSummaryVO
EmployeeId
FirstName
DepartmentId
DepartmentName
Relational Data /
App Schema
LastName
101 Steven
Emp Id First Nam
King
Last Nam
10
Dpt Id
IT_PROG
Dpt Name
1
M
*
D
Join VO based on Referenced EO: Setting
Join VO based on Referenced EO: Features
Join View Object includes reference entity object
Reference Entity is most commonly used way to get
information from other entity for display purpose
Reference entity is displayed in read-only mode
Types of VOs: Updatable Entities
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Relational Data /
App Schema
Join VO based on Updatable EO: Overview
View object
DepartmentEO EmployeeEO
EmployeeId
FirstName
LastName
EMPLOYEES
EMPLOYEE_ID FIRST_NAME LAST_NAME
DEPARTMENTS
DEPARTMENT_ID DEPARTMENT_NAME
DepartmentId
DepartmentName
EmployeeListVO
EmployeeId
FirstName
DepartmentId
DepartmentName
LastName
101 Steven King
Last Nam
10
Dpt Id
IT_PROG
Dpt Name
Updatable
Updatable
Emp Id Emp Nam
Entity objects
EmpDeptFkAS
1
M
*
D
Join VO based on Updatable EO: Settings
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EmployeeDetailVO
Entity Objects
encapsulate
business logic for
related tables in
the database.
Join VO based on Updatable EO
VOs use SQL to Project, Join, Filter, and
Sort business data as appropriate for a
given task at hand.
A VO comprises a SQL statement and some
metadata which indicates how columns in
the SELECT list map to Entity Object
attributes. The developer has complete
control over the content of the SQL for
hand-tuning or adding complex sub-selects
as needed.
DEPT
DEPTNO DNAME LOC
SELECT D.DEPTNO,
D.DNAME,
E.ENAME,
E.SAL,
E.EMPNO
FROM DEPT D, EMP E
WHERE D.DEPTNO = E.DEPTNO
ORDER BY E.SAL DESC
EmployeeDetailVO
Dept
DeptNo
DName
Loc
Emp
EmpNo
EName
HireDate
Sal
DeptNo
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
Join VO based on Updatable EO
Unlike other “pure object” approaches,
VOs know that the database is the best at
efficiently processing queries. Rather
than adding extra object layers between
the query and the database, a VO sends its
SQL statement directly to the database.
SELECT D.DEPTNO,
D.DNAME,
E.ENAME,
E.SAL,
E.EMPNO
FROM DEPT D, EMP E
WHERE D.DEPTNO = E.DEPTNO
ORDER BY E.SAL DESC
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
DeptNo
DName
Loc
Emp
EmpNo
EName
HireDate
Sal
DeptNo
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO
10 ACCOUNTING KING 5000 7839 16
20 RESEARCH FORD 3000 7902 16
20 RESEARCH SCOTT 3000 7788 15
20 RESEARCH JONES 2975 7566 17
30 SALES BLAKE 2850 7698 17
10 ACCOUNTING CLARK 2450 7782 17
30 SALES ALLEN 1600 7499 17
10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
After the database has returned the query
results, the View Object partitions the attributes
in the database result set into Entity Object-
specific row caches based on the View Object’s
EO “wiring” metadata.
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO
10 ACCOUNTING KING 5000 7839 16
20 RESEARCH FORD 3000 7902 16
20 RESEARCH SCOTT 3000 7788 15
20 RESEARCH JONES 2975 7566 17
30 SALES BLAKE 2850 7698 17
10 ACCOUNTING CLARK 2450 7782 17
30 SALES ALLEN 1600 7499 17
10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Attributes calculated in the query are
cached in the VO’s row cache. Any EO
attributes are “pointed to” by the VO row
cache and referenced from their
respective EO row cache.
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO
10 ACCOUNTING KING 5000 7839 16
20 RESEARCH FORD 3000 7902 16
20 RESEARCH SCOTT 3000 7788 15
20 RESEARCH JONES 2975 7566 17
30 SALES BLAKE 2850 7698 17
10 ACCOUNTING CLARK 2450 7782 17
30 SALES ALLEN 1600 7499 17
10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Again, unlike “pure object”
approaches, only the attributes
retrieved in the query are cached.
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
When a client program, applet, or
browser page attempts to change
the value of the Sal attribute in
the View Object...
setSal(3456)
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The View Object delegates the
request to the appropriate Entity
Object in the cache.
setSal(3456)
setSal(3456)?
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
Dept
Deptno
Dname
Loc
Emp
Empno
Ename
Hiredate
Sal
Deptno
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Entity Object attribute-level
validation logic on “Sal” is fired to
see if this change in Salary is
permitted.
setSal(3456)
setSal(3456)?
?
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The validation logic on the Entity
Object for its “Sal” attribute
contains code which references the
Emp EO’s HireDate attribute to
calculate if the employee was hired
after January 1st, 1990 to enforce a
business rule. The “Sal” validation
code does this with a call to
getHiredate().
When an attempt is made to access
an EO attribute which is not in the
EO cache, the remainder of the EO’s
attributes are “faulted” in from the
database by PK or ROWID.
setSal(3456)
setSal(3456)?
Dept
Emp
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
This “partial fetch” optimization
means that if a user browses
hundreds of rows, and only
changes one, significant memory
savings can be had for not caching
all attributes for all rows.
setSal(3456)
setSal(3456)?
Dept
Emp
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788 09-DEC-9220
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
If validation succeeds, the value is
allowed to be set on the EO cache,
provided the row can be locked.
setSal(3456)
setSal(3456)?
Dept
Emp
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The Entity Object automatically
locks its corresponding row in the
database with appropriate DML.
View Objects can support
optimistic locking as well.
setSal(3456)?
Dept
Emp
KING 5000 7839
FORD 3000 7902
SCOTT 3000 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
setSal(3456);
20 7788 3000
SELECT
FOR UPDATE
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Since the lock can be acquired, the
valid Sal attribute is set to 3456
as requested by the client.
Note that the change is not yet in
the database -- only in the EO
cache so far.
setSal(3456)?
Dept
Emp
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782
ALLEN 1600 7499
setSal(3456);
20 7788 3000
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The client browses to another
employee “CLARK” and changes
his salary to 8765 through the
user interface...
Dept
Emp
setSal(8765);
20 7788 3000
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782 09-JUN-91 10
ALLEN 1600 7499
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
A validation error in the Emp EO
causes the setSal() to fail.
For example, perhaps Emp.Sal has
been defined to only allow salaries
greater than 8000 if the employee
is a Vice President or higher.
Dept
Emp
20 7788 3000
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782 09-JUN-91 10
ALLEN 1600 7499
Error!
Salary exceeds
the limit.
Try Again...
setSal(8765)
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The client resubmits CLARK’s
salary change to 7499 through the
user interface...
Dept
Emp
20 7788 3000
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782 09-JUN-91 10
ALLEN 1600 7499
setSal(7499);
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Validation succeeds this time, and
the value is allowed to be set on
the EO cache, provided the row
can be locked.
Dept
Emp
20 7788 3000
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 2450 7782 09-JUN-91 10
ALLEN 1600 7499
setSal(7499);
setSal(7499)?
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
CLARK’s row in the EMP table is
locked appropriately, and the Sal
is set in the cache to 7499.
Dept
Emp
20 7788 3000
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 7499 7782 09-JUN-91 10
ALLEN 1600 7499
setSal(7499);
setSal(7499)?
SELECT
FOR UPDATE
7782 2450
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The end-user clicks on a button to
Save her changes in the UI. The
client program requests a Commit
on the current JBO Session.
Dept
Emp
20 7788 3000
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 7499 7782 09-JUN-91 10
ALLEN 1600 7499
setSal(7499)?
7782 2450
Commit()
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Any new, updated, or deleted
rows in the EO caches
communicate their changes to the
database. No client-written code
is required in the Entity Objects or
View Objects to achieve this
database interaction.
Dept
Emp
20 7788 3456
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 7499 7782 09-JUN-91 10
ALLEN 1600 7499
7782 8765
Commit()
UPDATE
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
Finally, the database COMMIT
ends the transaction.
Dept
Emp
20 7788 3456
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 7499 7782 09-JUN-91 10
ALLEN 1600 7499
7782 8765
Commit()
COMMIT
Join VO based on Updatable EO
DEPT
DEPTNO DNAME LOC
EMP
EMPNO ENAME HIREDATE SAL DEPTNO
EmployeeDetailVO 10 ACCOUNTING
20 RESEARCH
30 SALES
Dept EO Cache
Emp EO Cache
16
16
15
17
17
17
17
VO
Cache
The client is happy.
The application developer is
happy.
Dept
Emp
20 7788 3456
KING 5000 7839
FORD 3000 7902
SCOTT 3456 7788 09-DEC-92 20
JONES 2975 7566
BLAKE 2850 7698
CLARK 7499 7782 09-JUN-91 10
ALLEN 1600 7499
7782 7499
Internationalization of Business Services
When an application is
internationalized, the UI
displays text based on a
user’s browser settings
 To use resource bundles for
translatable strings you can:
 Create one bundle per file or
project
 Translate and append _<locale>
to the file name
 Configure the UI
Types of VOs: Static List
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 22)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Read Only VO based on Static List
Static List Read
Only View Object
Overview of VO
“View object definitions” contain SQL queries and act as
templates for “view object instances”
Retrieve data from the database
Manage caches of data
Features of VO
 Enable you to have a view of data that is specific to one part of
your application
 Encapsulates database queries
 Can be based on a SQL statement, static values, any number of
entity objects or populated programmatically
 Are used for joining, filtering, projecting and sorting business data
 Provides an iterator through which one can browse through all the
rows
 Handle view object cache
 Provides access to associated entity objects if any
Examining Attribute Settings
Can be based on
EO attribute
Select statement
Transient (e.g.
calculations)
Can define default
values
Based on literal values
Expressions
Examine Attribute Settings
 Name: Name of the attribute. By default it is based on the entity
attribute name. A dropdown displays the list of attributes defined
by the base entity object. Selecting an entity object attribute from
the dropdown remaps the view object attribute to the selected
entity object attribute and therefore changes more than just the
attribute name. Remapping a view object attribute using this
dropdown may be useful for making temporary changes while
testing the application, but otherwise has little value at application
design time. It is a valid Java identifier.
 Description: Description of the attribute for documentation
Examine Attribute Settings cont.…
 Type: Attribute's data type. This is not modifiable here. If you want
to change the type, you must do so in the entity object
 Property Set: Property sets are named collections of properties or
hints that can be used by attributes and bindings
 Polymorphic Discriminator: Select if this is a discriminator column
for a polymorphic view object. The attribute you select
distinguishes which view row interface to use
Subtype Value: a value that matches the attribute value for which you
expect the base view object's view row interface to be used. For example,
in a PersonList view object, you would mark the PersonTypeCode attribute
as the discriminator attribute and supply a default subtype value of person
Examine Attribute Settings cont.…
 Effective Date: Displays the setting from the entity object attribute
if effective date is enabled
Start Date / End Date: Indicates whether the attribute is the Start or End
attribute of an effective dated entity object
Sequence Flag: Is mapped to a column or SQL
Sequence: Is mapped to a column or SQL
 Updatable: The view attribute setting is based on the entity
attribute setting and can made more restrictive
Always: Makes an attribute updatable
While New: Makes an attribute updatable before an entity is first posted
Never: Makes an attribute read-only
Examine Attribute Settings cont.…
 Persistent: Attribute is persistent to be used in generating a table
 Transient: Attribute is persistent to be used in generating a table
 Mandatory: Selected by default for columns with NOT NULL
constraints
 Primary Key: Selected by default for columns with PRIMARY KEY
constraints
 Queryable: Attribute can occur in the WHERE clause of a view
object (selected by default except for LOBs)
Examine Attribute Settings cont.…
 Precision Rule: Used as a precision rule
 Refresh on Insert: The entity object inserts a new row in the
database, the entity object retrieves the value of this attribute from
the corresponding database field
 Refresh on Update: The entity object posts changes to an existing
database row, the entity object retrieves the value of the attribute
from the corresponding database field
 Change Indicator: Indicates, column is a change indicator such as a
timestamp. ADF BC will use change indicators to determine
whether a row has already been changed by another transaction or
can be locked. If no columns
Examine Attribute Settings cont.…
 Track Change History: To log changes to the database, only if
 implemented authorization using JAAS/JAZN,
 the selected attribute is persistent,
 not selected Primary Key, Mandatory or Discriminator, and
 the attribute is Char, Character, String, Date, Timestamp or Number
 The following types of history column are available:
 created on: To use the column to log the date on which the row was first created. The attribute type must be
Date or Timestamp
 modified on: To use the column to log the date on which the row was last modified. The attribute type must be
Date or Timestamp
 created by: To use the column to log the user who created the row. The attribute type must be Char, Character,
or String
 modified by: To use the column to log the user who last modified the row. The attribute type must be Char,
Character, or String
 version number: To use this column to log the number of times the row has been changed. The attribute type
must be Number
Examine Attribute Settings cont.…
 Column Name: Maps to the name of the table column
 Column Type: Maps to the SQL type of the table column
 Generate Unique Constraint: Generates a UNIQUE constraint and defines
the attribute to be unique. For example, every employee have a unique
email id
 Sequence Name: The sequence name shown on the Sequence tab is
applicable only at design time when you use the Create Database Tables
feature. The sequence indicated here will be created along with the table
on which the entity object is based. This field is not available for all
attribute types
 Start At: Integer value you want the sequence to start at, the default value
is 1. This field is not available for all attribute types
Types of VOs: Master Detail VOs (View Link)
 Read Only VO (No Entity)
Static List (JDev demo)
SQL Query
Programmatic (Lesson 9)
 Updatable VO (Single Entity)
 Join VO (Multiple Entities)
Referenced Entity (JDev demo)
Updateable Entities (slides demo)
 Master Detail VOs (View Link)
Master-Detail VO based on Link: Overview
EmployeeVO
Department1
Business
Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
EmployeeEO Entity Object
DepartmentEO
Employee3
DepartmentVO
EmpDeptFkAS
EmpDeptFkVL
EmpDeptFkVL1
View Objects
and View Links
and Associations
ADF
Business
Components
Data Model
Master-Detail VO based on Link: Mapping
 View link definitions have “Source” and “Destination” attributes
 These attributes specify the master-detail relationship
Just like foreign key attributes specify a foreign key relationship
 A view link definition works like an additional WHERE clause
applied to the detail
SELECT E.EMPLOYEE_ID,
E.LAST_NAME
FROM EMPLOYEES E
EmployeeVO
(Master)
SELECT D.DEPARTMENT_ID,
D.DEPARTMENT_NAME,
D.MANAGER_ID
FROM DEPARTMENTS D
DepartmentVO
(Detail)
WHERE D.MANAGER_ID =
:1
Destination attribute
Source attribute
Master-Detail VO based on Link: Example
Master-Detail VO based on Link: Features
Defines a relation between two VOs
View link definitions relate a pair of view object
definitions
View link definitions specify master/detail
relationships between the SQL queries
Allows you to link master VO with detail VO
using a foreign key
Based on Association or a declarative join
relationship between two VOs
Comparing Join VOs with View Links (VL)
Join view queries:
Contain all attributes from main and referenced entities in a single row
Use a WHERE clause to relate a key from the main table with a foreign
key in referenced tables
View link (VL) queries:
Use a bind variable to relate detail records to key for selected master
record
Append WHERE clause with bind variable to the base SQL query for
the source or destination view object
Test VOs with ADF Model Tester
Lesson Summary
Architecture of VO
Types of VOs
Describe VO
Functionalities of VO
Link two VOs to create master-detail view objects
Create various types of View Objects and Links as Hands-on
Lab practices
7
Exposing Business Service through
Application Module
Lesson Agenda
Describe tech-stack
Overview of AM
Explain features of AM
Explain Data Model
Describe the role of the ADF
Model
Create a Nested AM
Explain how AM can manage:
ADF BC Transaction
Nested Application Module
Shared Application Module
Application Module Pooling
Handling Application State
Tech-stack of Application Module (AM)
DepartmentEO
DepartmentVO EmployeeVO
Employee
SummaryVO
EmployeeBy
EmailVO
Department1 Employee3
Employee2
Employee
Summary1
EmployeeBy
Email1
applyManagerVO
Criteria()
Business
Services
Relational Data / App Schema
Application Module
HRSystemAM
with View Object
Instances
EmpDeptFkAS
EmpDeptFkVL
View Objects
and View Links
Entity Objects
and Associations
EmployeeEO
Department2
EmpDeptFkVL1
ADF
Business
Components
Data Model
Business
Domain
Components
Data
Model
Components
XML
Java
XML
Java
XML
Java
Nested AM
Ingredients of an AM
Overview of AM
 Represents a logical unit of work related to an end-
user task
 Encapsulates the active data model and business
service methods for that task
 It is the top-level container that contains view
objects, view links, etc..
 Represents a DB session and is associated with a
dedicated JDBC connection
 It can be nested under another AM
 Root AM and all the nested AMs share the same
transaction and same JDBC connection and root AM
holds them
Features of AM
 Represents the data model that the client uses
 Keeps track of all changes that affect data in the database
 Provides transactional context for the application
 Has one connection to the database
 Enables you to gather data customized to a client interface so that data can
be retrieved in one network round-trip
 Can be easily reused in business logic tiers of other applications
 Provides remotely accessible methods to implement application module
behavior
 Can contain other application modules, called nested application modules
 Is deployable in multiple configurations / platforms without code changes
AM Instances
Each instance (user) of the
application will get its own
application module instance
The application module instance
contains view object instances
View object instances use entity
object instances to write
The Data Model
The view object instances in an
application module instance are
joined in master-detail relationships
by “view link instances”
The resulting tree is called the “data
model”
Master Detail Relationships allows
to view data from related tables at
same time
Simple Data Model
Instance of
EmployeeVO
Instance of
DepartmentVO
Instance of DeptMgrLink
SELECT E.EMPLOYEE_ID,
E.LAST_NAME
FROM EMPLOYEES E
SELECT D.DEPARTMENT_ID,
D.DEPARTMENT_NAME,
D.MANAGER_ID
FROM DEPARTMENTS D
WHERE D.MANAGER_ID =
:current_employee_id
Complex Data Model
Master
Instance of
EmployeeVO
Detail
Instance of
DepartmentVO
Detail
Instance of
EmployeeVO
Independent
Instance of
DepartmentVO
Using Data Model
Managing ADF BC Transaction by AM
 Application modules:
Handle transaction and concurrency support
Use a single database connection
Provide transaction context for updates, deletes, and inserts for all view
objects in the application module, so all are committed or rolled back at
once
 For nested application modules, the outermost application module
provides the transaction context for the others
 No coding is required unless you want to modify the default
behavior
Nested Application Module
Root AM provides transaction context, DB connection, and a
single set of entity caches
It combines VOs and service methods
Example-2 Example-3
Example-1
Nested Application Module cont.…
UI UI UI PG3 UI
Root AM
Controller
Model
View
Business
Service
AM Instances
Nested AM
Nested AM: Architecture of Root AM
Shared Application Module
 Shared AMs provide a reusable data service
 They allow requests from multiple sessions to share a single
application module instance
 Any user session is able to access the same view instances
contained in the shared AM
 Shared AMs can be “application scoped” or “session scoped”
 It is specified sharing in the Project Properties dialog box
Application Module Pooling
Enables users to share application modules
Manages application state
Provides the same instance or one with an identical state when
requested by an application with managed state
Available
Referenced: I’d like to be used by User2
Unavailable: I’m busy right now!
HRSystem Application Module Pool
Application Module Pooling
Handling Application State
Handling Application State cont.…
AM passivation saves transaction state in an XML document
stored in database
AM activation retrieves saved transaction state
Passivation and activation are performed automatically when
needed
Saved
state
Passivation Activation
Application Module State Management
Exposing Business Services with ADF Model
Metadata
Services
JDeveloper
Model (JSR227)
View
Controller
Business Services
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
ADF Faces
JSF/ADFc/Taskflow
ADF Model /Binding Context /Data Binding
ADF
BC
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
ViewController/
User Interface
Project
Model/ Service
Project
Presentation
Layer
v
m
bc
BAM
BPL
JSF
Estimating the Size of an AM
Is it better to have one big application module or several little
ones?
An application module is a logical unit of work
Let use cases drive application module decisions:
Can be grouped by domain business objects involved
Grouped by the user-oriented view of business data required
Consider the possibility of reuse of the application module
Consider service or transaction flow
Create an Application Module
In the New Gallery Business Tier, select ADF Business
Components > Application Module to invoke the Create
Application Module Wizard.
Specify a name for
 the application module and identify the
 package where it should belong.
Define the data model
 for the application module by selecting
 view objects from a tree of available view objects.
Lesson Summary
Architecture of AM
Describe application modules
Explain functionalities of AM
Explain Data Model
Describe the role of the ADF
Model
Create a Nested AM
Explain how AM can manage:
ADF BC Transaction
Nested Application Module
Shared Application Module
Application Module Pooling
Handling Application State
8
Declaratively Customizing Business Services
Lesson Agenda
How and where to use Groovy expressions
Describe how to declaratively change data behavior
Declaratively modifying entity objects, view objects and
application modules
Declaratively projecting, sorting and selecting data
Restricting rows using where clause, parameterized where
clause and structured where clause (ViewCriteria)
Create view accessors and LOVs
Introducing Groovy
 Is a Java-like scripting language that is dynamically compiled and
evaluated at run time
 Enables to use declarative expressions, instead of writing Java code,
for the following types of values in the ADF BC data model:
Bind variables
Calculated attributes
Attribute default values
View criteria
View accessor bind variables
Validation
Validation message token binding
Using Groovy Syntax - Example
Java Groovy Expression
((Number)getAttribute("Sal")
.multiply(new Number(0.10))
Sal * 0.10
((Date)getAttribute("PromotionDate"))
.compareTo((Date)getAttribute("HireDate")) > 0
PromotionDate > HireDate
isEmployee() employee
getEmployee() employee
getEmpNo(int n) source.emp(5)
checkEmployeeName() source.checkEmployeeName()
checkEmployeeNo(int n) source.checkEmployeeNo(5)
Using Groovy Syntax - Example
 getAttribute("Sal"): Fetch the Sal attribute.
 (Date)getAttribute("HireDate"): Casts HireDate attribute value
to Date.
 new TimeStamp(System.currentTimeMillis()): Creates new
Timestamp object from the current system time in long.
 newValue: Gets new value for the attribute in the attribute-level validator.
 oldValue: Gets old value for the attribute in the attribute-level validator.
 source: Refer to the current entity object.
 rowSetAttr.sum(), rowSetAttr.count(),rowSetAttr.min(),
rowSetAttr.max(), rowSetAttr.avg(): You can call the aggregate
function on the ADF RowSet object. RowSet is a collection of rows returned
through an association accessor.
Using Groovy Syntax in ADF
Reserved name adf gets objects from the framework:
 adf.context: To reference the ADFContext object
 adf.object: To reference the object on which the expression is being
applied
 adf.error: In validation rules, to access the error handler that allows
the validation expression to generate exceptions (adf.error.raise)
or warnings (adf.error.warn)
 adf.currentDate: To reference the current date with time truncated
 adf.currentDateTime: To reference the current date and time
References for Groovy
 Groovy Language, guides, examples: http://groovy.codehaus.org
 ‘…BATDocs-TrainingReferenceL08-BAT Introduction to Groovy.pdf’
 http://www.oracle.com/technetwork/developer-tools/jdev/introduction-to-groovy-128837.pdf
Internationalization of Business Services
When an application is internationalized, the UI
displays text based on a user’s browser settings
 To use resource bundles for
translatable strings you can:
 Create one bundle per file or project
 Translate and append
_<locale> to the file name
 Configure the UI
Editing Entity Objects
Editors provide access to business component properties:
EO Editor Property Inspector
Customizing EO’s Default Behavior
Declaratively customize EO’s default behavior:
Customize attribute control hints:
Example: HireDate – Simple Date
Alternate key entity constraints
Synchronize columns with trigger-assigned values
Validate user input (Lesson 8 - Validation)
Customizing EO’s Default Behavior
Declaratively customize EO’s default behavior:
Customize attribute control hints (JDev):
Example: HireDate – Simple Date
Alternate key entity constraints
Synchronize columns with trigger-assigned values
Validate user input (Lesson 8 - Validation)
Customize Attribute Control Hints
Customizing EO’s Default Behavior
Declaratively customize EO’s default behavior:
Customize attribute control hints (JDev):
Example: HireDate – Simple Date
Alternate key entity constraints
Synchronize columns with trigger-assigned values
Validate user input (Lesson 8 - Validation)
Alternate Key Entity Constraints
 Used for efficient uniqueness checks
 Used for direct row lookups with findByKey()
 Different from primary keys or unique keys
Customizing EO’s Default Behavior
Declaratively customize EO’s default behavior:
Customize attribute control hints (JDev):
Example: HireDate – Simple Date
Alternate key entity constraints
Synchronize columns with trigger-assigned values
Validate user input (Lesson 8 - Validation)
Synchronizing Columns with Trigger-Assigned Values
 To synchronize when a database trigger
updates a column, use Refresh On
Update or Refresh On Insert
 To use a database sequence to
generate a primary key:
Set data type of attribute to DBSequence
Updatable is While New
Refresh On Insert is selected automatically
Provide Sequence Name and Start at
Editing View Objects
Customizing VO’s Default Behavior
 Define attribute control hints: Eg. HireDate – Simple Date, AnnualSalary -- Width
 Perform calculations: Add transient attribute: Eg. AnnualSalary – 12*salary
 Projection: Restrict the columns retrieved by a query:
 Eg. select FIRST_NAME, LAST_NAME from employees (EmpSqlQueryVO)
 Sorting: reorder of queried rows using ORDER BY clause:
 Eg. select * from employees ORDER BY LAST_NAME (EmpSqlQueryVO)
 Selection: Restrict the rows retrieved by a query:
 Where clause: Eg. select * from employees WHERE email = ‘SKING’
 Parameterized where clause: Eg. select * from employees WHERE email = :p_email
 It uses bind variable. Sample EmployeeByEmailVO.
 Structured/ Named where clause (ViewCriteria)
 Parameterized structured/ named where clause: Eg. p_email -- EmpSqlQueryVOCriteria
 Define a list of values (LOV): Eg. EmployeeSummaryVO-JobId -- JobVVO
Defining View Object Control Hints
Same as for entity objects
Overrides EO control hint settings; use in cases such as:
The same data must be displayed differently in different views
OR
The VO uses the same attribute twice as in a recursive relationship
Can also be used for transient attributes defined at the VO
level
Perform Calculations
Projecting and Reordering
Use the Attributes tab of the editor to delete or reorder
attributes.
Query changes to reflect the new SELECT clause.
Sorting the Order of Queried Rows
To change the order, perform the following steps:
1. Click the Query tab of the view object editor.
2. Click Edit in the Query section of the panel.
3. Click Edit in the Edit Query dialog box.
4. In the Order By dialog box, select the columns
for sorting the rows retrieved by the query.
Selection: Using Structured/Named Where Clause:
View Criteria
Defines complex query criteria at design time
Specifies the execution mode
View Criteria: Example
None, one or more of
View Criteria may be applied
Selection: Role of View Criteria in Search
View criteria can be created and saved as named definitions
Named view criteria definitions appear under Named Criteria
node in the Data Controls panel
Defining View Accessors (LOV)
View accessors are used for
validation and LOVs
You create them on the View
Accessors page of EO or VO
editor
Using List of Values
Are defined on view object attributes (JobId)
Use view accessors as a data source:
For attributes mapped to an entity object attribute:
 Use the view accessor that is used by the entity object attribute’s Key Exists
validator
 Extend the view accessor at the view object level for UI hints or bind
expressions if required (JobVVO)
For transient attributes, defined as a new view accessor
Retaining and Reusing a
View Link Accessor Row Set
 Enables caching of the view link accessor
RowSet object
 Avoids overhead of creating new detail
RowSet objects
 May be advisable when the application
makes numerous calls to the same view
link accessor attributes
 Can be implemented declaratively in the
Tuning section of the General tab for the
view object that is the source for the
view link
Customizing AM’s Default Behavior
The Application Module editor has the following tabs:
 General: Set tuning parameters and define custom properties
 Data Model: Refine the data model
 Java: Create Java classes and expose methods to the client interface
 Web Service: Enable Web Service support
 Configurations: Create or modify sets of configuration parameters
Application Module Pool Parameters
You control the pool with the parameters:
initpoolsize: The initial number of instances
Poolmaxavailablesize: Maximum inactive instances
Poolminavailablesize: Minimum inactive instances
Poolmaxinactiveage: Maximum time an instance can be
inactive before being flagged for removal
poolmonitorsleepinterval: Amount of time between high-water
triggers
Modifying the Locking Behavior of an AM
Default locking behavior is optimistic
optimistic locking is recommended for Web applications
Change configuration: Set jbo.locking.mode to
optimistic or pessimistic
Lesson Summary
How and where to use Groovy expressions
Explain how to declaratively change data behavior
Declaratively modify entity objects, view objects and
application modules
Declaratively Projecting, Sorting and Selecting data
Restricting rows using where clause, parameterized where
clause and structured where clause (VC)
Create view accessors and LOVs
9
Validating Business Services
Lesson Agenda
Use the declarative validation options
Categories & Subcategories of Validations in BC
Triggering validation execution
Failure handling
Using Groovy expressions in validation
Validation Options for ADF Applications
Categories of validations
User Interface – (Lesson 16)
Business Services (ADF BC)
Database (PL/SQL)
Managing of validations
Model (JSR227)
View
Relational Database
Data
Services
Business Service
Categories of Validations in ADF BC
Categories of validations:
 User interface
 Business services (ADF BC)
Single Attribute
 Use Case: Validate Item Id
 Triggered when attributes are set
Cross Attribute (Entity Level
Validations)
 Use Case: Validate Status and Sub-
status Combination
 Triggered because of page submit and
before a transaction is committed
Transaction Level
 Use Case: Create an expense with a set
of expense lines. Sum of the expense
lines should not cross a threshold value
 Executed only once for all entities in
the transaction of the same type,
rather than once per entity.
Cross Entity – Uncommon scenario
 Use Case: Before closing SR, validate if
its tasks are closed.
 Unrelated entities refer each other
during the validation phase
 Database (PL/SQL)
Categories of Validations in ADF BC
Categories of validations:
User interface
Business services (ADF BC)
Declarative Validation: Built-in Rules
Declarative Validation: Custom Rules
Programmatic Validation: Global Rules
Domains: Prevalidated Custom Datatypes
Database (PL/SQL)
Categories & Subcategories of Validations in BC
 Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute
level, but pertain to an EO attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute
level, to validate the EO or the
attribute:
 Script Expression validator
 Declarative Validation: Custom
Rules
 Method validator
 Programmatic Validation: Global
Rules
 Domains: Pre-validated Custom
Datatypes
Declarative Validation: Built-in Rules
 Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an EO attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO or the attribute:
 Script Expression validator
 Declarative Validation: Custom Rules
 Method validator
 Programmatic Validation: Global Rules
 Domains: Pre-validated Custom Datatypes
Attribute vs Entity level Validator
Declarative validation enforces both entity- and attribute-level validation,
depending on where the rules are defined
 Attribute level Validation:
 Attribute-level validation rules are enforced when the user changes the value of the
related attribute
 Limitations: Binding does not happen at the view accessor level
 Entity level Validation:
 Entity-level validation rules are enforced when a user tries to commit pending changes or
navigates between rows
 If the validity of one attribute is dependent on one/more other attributes, then best
practices indicates that you should enforce this rule using entity validation, not attribute
validation
 Entity object validators are triggered whenever the entity, as a whole, is dirty
Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an EO
attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO
or the attribute:
 Script Expression validator
Declarative Validation: Built-in Rules:
Collection Validator
 Use case: Total salary of all employees
 Performs validation based on aggregate
functions (sum, average or count of an attribute
value) over all rows in a table
 Is defined at the entity level
 To define a Collection validator, specify:
 Operation: sum, average, count, min, or max
 Accessor: association defined for the entity
 Attribute: on which operation performed
 Operator: not equals, less than, greater than, etc..
 Compare With: litral, query, attribute or expression
 Enter Literal Value (if using a literal)
Declarative Validation: Built-in Rules:
Unique Key Validator
 Use case: Employee Id/ Email/
Phone Number is Unique
 Ensures that the attribute always
has a unique value if present is
defined at the entity level
 Ensures that primary key values are
always unique
 Can also be used for alternate keys
 Upon failure, throws
TooManyObjectsException
Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an
EO attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO
or the attribute:
 Script Expression validator
Declarative Validation: Built-in Rules:
Compare Validator
Use case: Hire Date to be less than or
equal to Current Date
Compares an attribute to a value
To define a Compare validator, specify:
Attribute (if entity level)
Operator
Compare With
Declarative Validation: Built-in Rules:
Key Exists Validator
Ensure that a key value exists
Checks cache first
Key Exists Validator: Entity Vs View Accessor
Use Case:
Validate Employees and Departments
Validate Jobs
Validation Target Type:
Entity: If the two tables are related and there exists a association
between the two
View Accessor: Tables are not related or the result set comes from a
query
Declarative Validation: Built-in Rules:
Length Validator
Use case: The phone number field is not
less than 10 characters
Compares the character or byte length of an
attribute to the specified value
To define a Length validator, specify:
Attribute (if EO level)
Operator
Comparison Type
Declarative Validation: Built-in Rules:
List Validator
Use case: Validate JobId
Compares an attribute against a list of values
Ensures that value is in (or not in) a list
defined by:
Literal Values
Query Result
View Object Attribute
View Accessor Attribute
List Validator:
Query Result vs View Object vs View Accessor
 Query Result vs View Object vs View Accessor
 Use Cases:
 Validate DepartmentId
 Validate Jobs
 List Type:
 Query Result
 Cannot have bind variables and dynamic VO is created based on SQL (Performance issue)
 View Object
 Cannot have bind variables
 View objects are designed to be reused in any application. They should not be based on a query filtering
criterion. Doing so would prevent them from being reused in other application modules and end up with
creating multiple VO.
 View Accessor - Recommended
 Declarative representation of VOs that are available for validation purpose in the EO layer
 Can specify View Criteria, Bind Variables
List Validator vs Key Exists Validator
 Use Case:
Validate Jobs (List Validator)
Validate EmployeeByEmail (Key Exists Validator)
 Validation Rule Type:
List Validator should be used typically when
 The query results are small as the results are cached
 There are no bind variables in the query
 Query does not have to be executed again in the same transaction
Key Exists Validator List should be used typically when
 The query uses a bind value in the query and hence needs to be executed every time as
needed
 The bind value is required in the query as otherwise the result set maybe quite large
Declarative Validation: Built-in Rules:
Range Validator
Use case: Salary range should be between
0 to 99999
Compares an attribute to a range of values
To define a Length validator, specify:
Attribute: Although you can define at the entity
or attribute level, the Range validator pertains
to an attribute
Operator: Between or Not Between
Range: Minimum and maximum values
Declarative Validation: Built-in Rules:
Regular Expression Validator
 Use Case: Validate email address, URL value
 The expression validator is similar to the method
validator, except that the code is written in Groovy
expression language
 Capable of calling another java method with in
Groovy expression
 To define Regular Expression validator, specify:
 Attribute
 Operator
 Predefined Expressions
 Enter Regular Expression
 Expression Qualifiers
Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an EO
attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO
or the attribute:
 Script Expression validator
Declarative Validation: Built-in Rules:
Script Expression Validator
To define a Groovy expression:
Omit braces {}
Use newValue for new value of current attribute
Write code to return true or false and/or call
adf.error.raise or adf.error.warn
Can use aggregate functions on RowSet
Can use ternary operator
Click Test to check syntax
Declarative Validation: Custom Rules
 Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an EO attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO or the attribute:
 Script Expression validator
 Declarative Validation: Custom Rules
 Method Validator
 Programmatic Validation: Global Rules
 Domains: Pre-validated Custom Datatypes
Declarative Validation: Custom Rules:
Method Validator
 Use Case: Validate HireDate
 Extend declarative rules for entities or attributes
 Call Java methods in your entity object (not in a
separate class as a global rule is)
 Are called automatically during validation cycle
 Custom entity method with signature
 "boolean validateXXX()"
 Should be used only if declarative approach is not
available
 Used to implement complex validations and for
derivations
 Must:
 Be defined as public  Return a boolean value  Be named like validateXXX()
Programmatic Validation: Global Rules
 Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an EO attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO or the attribute:
 Script Expression validator
 Declarative Validation: Custom Rules
 Method validator
 Programmatic Validation: Global Rules
 Domains: Pre-validated Custom Datatypes
Programmatic Validation: Global Rules
Custom global validation rules are available to assign
declaratively to any business components by using the
following steps:
Create a Java class that implements the
JboValidatorInterface interface in the
oracle.jbo.rules package
Modify the code for the validation rule
Assign the rule to a business component object
Global Validation Rule: Creating Java Class
 Use Case:
Total Salary of all employees in a department
Global Validation Rule:
Examining the Generated Skeleton Code
public class CompareDates implements JboValidatorInterface {
private String description = "Returns true if date1 is not after date2";
public CompareDates() {
}
public boolean validateValue(Object value) {
// Todo: write code to validate
return true; // return validated result
}
public void validate(JboValidatorContext ctx) {
if (!validateValue(ctx.getNewValue())) {
throw new ValidationException("model.CompareDates validation failed");
}
}
public String getDescription() { return description;
}
public void setDescription(String str) {
description = str;
}
}
Global Validation Rule: Modifying the Code
public class CompareDates implements JboValidatorInterface {
private String description = "Return true if date1 is not after date2";
private String earlierDateAttrName = "";
private String laterDateAttrName = "";
public void validate(JboValidatorContext ctx) {
if (validatorAttachedAtEntityLevel(ctx)){
EntityImpl eo = (EntityImpl)ctx.getSource();
Date earlierDate = (Date)eo.getAttribute(getEarlierDateAttrName());
Date laterDate = (Date)eo.getAttribute(getLaterDateAttrName());
if (!validateValue(earlierDate,laterDate)) {
throw new ValidationException("model.CompareDates validation failed");
}
}
else {
throw new RuntimeException("Rule must be at entity level");
}
}
private boolean validateValue(Date earlierDate, Date laterDate) {
return (earlierDate == null) || (laterDate == null) || (earlierDate.compareTo(laterDate) <= 0);
}
private boolean validatorAttachedAtEntityLevel(JboValidatorContext ctx) {
return ctx.getOldValue() instanceof EntityImpl;
}
}
1
3
4
2
Domains: Pre-validated Custom Datatypes
 Declarative Validation: Built-in Rules
 Defined only at the entity level:
 Collection validator
 Unique key validator
 Defined at the entity or attribute level, but pertain to an EO attribute:
 Compare validator
 Key Exists validator
 Length validator
 List validator
 Range validator
 Regular Expression validator
 Defined at the entity or attribute level, to validate the EO or the attribute:
 Script Expression validator
 Declarative Validation: Custom Rules
 Method validator
 Programmatic Validation: Global Rules
 Domains: Pre-validated Custom Datatypes
Domains: Creating Custom-Validated Datatypes
 Domains are Java classes that extend the basic data types (String, Number,
Date, and so on)
 You can create your own data types that encapsulate specific validation
rules
 Use domains for more complex validation:
 Format of a phone number
 Validity of a URL
 Validity of an email address
 Checksum of digits of a credit card number
 Validation is done by the domain constructor
 Domain is not bound to a particular entity or attribute
Domains: Steps
 Create the domain
 Add validation code to the validate() method in the domain’s
Java file
 Edit an entity and change the type of an attribute to the domain
URL Domain appears
in the list of types.
Domains: Code Validation
 The validate() method is called by the domain’s constructor:
(mData is a private String variable containing the string to be
validated.)
 Example: URLDomain verifies that an attribute is a valid URL
protected void validate() {
try {
// Make sure the user entered a valid URL java.net.URL u = new
java.net.URL(mData);
}
catch (java.net.MalformedURLException e){
throw new oracle.jbo.domain.DomainValidationException ("Invalid
URL"); }
}
}
Triggering Validation Execution
 The Validation Execution tab enables you
to specify:
When validation should occur
The conditions governing validation
execution
Which attributes trigger validation
Entity validation Rule
Attribute validation Rule
Specifying Validation Order
 Changed attributes are validated when
they lose focus
 Changed entities are validated at
commit time
 In compositions, child entities are
validated before parent entities
 You can control execution order of
validation within attributes or an entity
 You can specify validation at the
transaction level for some validators
Failure Handling
Use the Failure Handling tab on the
Validation Rule page of the entity
object editor or attribute editor to:
Specify error message failure severity
Insert Groovy variables into error
messages
Click Select Text Resource to store error
messages as translatable strings
Failure Handling: Error Message Failure Severity
There are two failure severity levels for error messages:
Error
Informational Warning
Failure Handling:
Storing Error Message as Translatable Strings
1
2
Failure Handling: Groovy Support
Use Groovy expressions in validation error messages:
You indicate a variable by surrounding a name with braces {}
Message tokens are added automatically
You provide message token expressions:
source.hints.
<attr>.label for labels
<attr> for values
Groovy Expressions for Validation
 Groovy Expression Type Validation
 In addition to the existing Groovy
debugging support within JDeveloper,
developers can now ensure the quality of
their groovy expressions with type
checking that occurs, by default, during
project compilation
 You use the Script Expression validator or
Compare validator when using Groovy for
validation
Key Guidelines for Using Validation
 Validate both in UI and Server Layers to serve multiple channels
(Web Services)
 Reuse VO for Validation and LOV
 Groovy Expressions: Java-like scripting code stored in the XML
definition of an entity object
Do not use for complex validations
Code completion not available
 Adding code in ValidateEntity Method
Avoid if possible
Extra care should be taken by the developer to bundle exceptions.
Framework takes care of it for declarative validations
Lesson Summary
Use the declarative validation options
Categories & Subcategories of Validations in BC
Triggering validation execution
Failure handling
Using Groovy expressions in validation
10
Introducing User Interface Technologies
Lesson Agenda
 Evolution of web tier from HTML, Servlets, JSPs to JSF
 Overview of Java Server Faces and it’s architecture
 Discuss JSF UI components
 Understand navigation using JSF Controller
 Describe the purpose of managed and backing beans
 Explain the JSF life cycle
 Introduce how ADF Faces augments the JSF
 Overview of ADF Faces rich functionalities
 Overview of ADF Faces rich components
Evolution of J2EE Web UIs
Enabling the World Wide Web with HTML and HTTP
Using Java as a language for web development
Describing Servlets
Describing Java Server Pages (JSP)
Evolution of J2EE Web Tier
Comparing JSF against traditional JSP
The Web (WWW) with HTML
HTML: A markup language for defining Web pages
HTTP: A stateless request/response protocol for serving Web
content, such as HTML pages
Web
server
Browser client
HTTP
request
HTTP
response
HTML document
HTML files
Web Development
Web server Application server
Presentation
Servlets,
JSP pages (JSPs),
JavaServer Faces (JSF)
Enterprise JavaBeans (EJB),
CORBA
Client Data
Business
logic
Servlets
Servlets:
Are written in Java
Extend the Web server
Can be used to provide:
 Back-end functionality
 User interface Web
server
Browser client
request
HTTP
response
HTML document
HTML files Other
Request
type?
Web
container
Servlet
Java Server Pages (JSP)
JSP:
Combines HTML and JSP tags
Is saved as .jsp or .jspx
Is compiled to a servlet on the first request
Is recompiled only when changed on the server
Enables servlet functionality with less programming
Evolution of J2EE Web Tier
Each is built on the previous layer
Progressive levels of abstraction
Higher level programming
Servlets JSP JSF
A simple JSP using JSF tag library
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<body bgcolor="white">
<f:view>
<h:form id="helloform">
<h2>What is your name?</h2>
<h:inputText id="username" value="#{UserNameBean.userName}"
validator="#{UserNameBean.validate}"/>
<h:commandButton id="submit" action="success" value="Submit"/>
</h:form>
</f:view>
Applications
Pages
UI Components
Markup
Java
Http Requests
Ease of Development
Lower Level
JSF vs. Traditional JSP
Product
UI
Events
Developer
JSF
JSP
Overview of Java Server Faces and ADF Faces
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components (L11-L18)
 Navigation using ADF Controller (L13)
 Managed and Backing Bean (L15)
 Life Cycle and Helper Objects (L16)
Features
Overview of Java Server Faces (JSF)
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Tech-Stack of JSF
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Tech-Stack of ADF
Metadata
Services
JDeveloper
Model (JSR227)
View
Controller
Business Services
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
ADF Faces
JSF/ADFc/Taskflow
ADF Model /Binding Context /Data Binding
ADF
BC
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
ViewController/
User Interface
Project
Model/ Service
Project
Model
Presentation
Layer
v
m
bc
BAM
BPL
JSF
Skins
Render Kits
UI Component
Tree
1. UI Component is rendered
through Renderer class
2. Expression Language Value
Binding is used to access managed
bean also know as a "backing
bean"
3. Managed bean accesses J2EE
persistence layer
faces-config.xml
trinidad.xml
1. EL accesses “bindings”
object to value bind UI
components
2. ADF “bindings” object is set
through ADF Filter in web.xml
3. Bindings object accesses
ADF Binding container, which
then accesses DataControl
4. Business Services provide
access to various data sources
ADF Model /Binding Context /Data Binding
Tech-Stack of View Layer
View
Controller
Business
Services
ADF Faces Components
ADF “binding” object
ADF BC
JSF Components
Struts
Swing Component
ADFdi
EJB POJO
Toplink Portlet BI
XML
Web Rich Client / Desktop
Relational Data XML Data Legacy Data Packaged Apps
ADF Binding Container / ADF Bindings
ADF Data Controls
Data
Services
Wireless Industrial
Faces Servlet / Front Controller ITS
XML XML Swing L&F
HTML Renderer WML Renderer Telnet Swing Renderer
SVG
ADF Faces
Model
(JSR227)
Metadata
Services
JDeveloper
Managed Bean
ADF Faces
Expr. Language
J2EE Persistence
JSF
Page
Skins
Render Kits
UI Component
Tree
1. UI Component is rendered
through Renderer class
2. Expression Language Value
Binding is used to access managed
bean also know as a "backing
bean"
3. Managed bean accesses J2EE
persistence layer
faces-config.xml
trinidad.xml
Tech-Stack of JSF
View
Controller
JSF UI Components Tree
EJB POJO
Toplink Portlet BI
XML
Web
Relational Data XML Data Legacy Data Packaged Apps
Data
Services
Wireless
Faces Servlet / Front Controller
XML XML
HTML Renderer
WML Renderer SVG
Model
(JSR227)
Metadata
Services
Managed Bean
Expr. Language
J2EE Persistence
JSF
Page
1. JSF UI Components
2. Navigation / JSF Controller
3. Managed and Backing Beans
4. Life Cycle and Helper Objects
Functionalities of JSF
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
JSF Functionalities: Overview
Navigation
UI Component View
Renderer
Backing bean
Validator
Converter
Message
Action method
EventListener
Event
Model objects
generates
selects
executes
specialized
outcome
contains
updates
generates
generates
generates
verifies
value
consumes
manipulates
displays
translates value Contained in
JSF Functionality: JSF Components
 Java Server Faces (JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
Are basic building blocks of a JSF application
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
 Features
 ADF Faces (extends JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
 Features
Components: Tag Libraries
 Java Server Faces (JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
Are basic building blocks of a JSF application
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
 Features
 ADF Faces (extends JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
 Features
Components: Tag Libraries
Server-side component tag libraries:
Encapsulated in base UI Component tag
libraries
 Core – For application tasks
 Validation, Datatype conversion
 HTML – For rendering basic HTML
 Input fields, menus, tables button
Can be invoked directly or in JSP using
these tag libraries
 Example: UIInput can be invoked in a JSP with
<h:inputText ..>
Components: Tag Libraries cont.…
Can represent simple to complex User Interface components ranging
from a button or input field to a complete page
Provide functionality, definition or behavior
Can be nested
Use helper objects: validators, converters, listeners/events
Can be associated to Model data objects through Value Binding
Are extendable
Developers can create new, custom components
Components: Render Kits
 Java Server Faces (JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
Are basic building blocks of a JSF application
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
 Features
 ADF Faces (extends JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
 Features
Components: Renderer Kits
 Renderer kits:
Library of Renderers
Basic HTML RenderKit is part of the specification (reference
implementation)
Enable the same component to be rendered differently depending on the
client
Components: Renderers
 Java Server Faces (JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
Are basic building blocks of a JSF application
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
 Features
 ADF Faces (extends JSF):
 Tech-Stack / Architecture
 Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
 Features
Components: Renderers
 Renderers:
Converts components to and from a
specific markup language
Display UI components in a technology
understood by the output device
Display in different forms based on
invocation
 Example: UIOutput -> text label, date label..
When an item has focus, its highlighting
looks different depending on the client
Components: Renderers
JSF Multiple Renderers
Option buttons: When an item has focus, its highlighting looks
different depending on the client
JSF Functionality: Navigation using JSF Controller
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Navigation: Traditional
In traditional navigation, a button or hyperlink is hard coded to navigate to a
specific page:
 Hard-coded button navigation
<body>
<form action="myNewPage.html">
<button type="button"/>
</form>
 Hard-coded hyper link navigation
<body>
<a href="http://myNewPage.html"> Go To My New Page</a>
</body>
Navigation: Overview
 Java Server Faces uses its own controller for page navigation
NavigationHandler evaluates navigation case and routes to new page
Supports page forward and page re-directs
 Navigation Cases
Basic Navigation
 Based on static string outcome
 Based on dynamic outcome
Navigation as the result of an action
 Navigation cases can be defined based on the method returning the outcome string
 Navigation rules are defined in the faces-config.xml, that
govern page flow
myNewPage
firstPage.jsp myNewPage.jsp
success
firstPage
Button
Navigation: Example
A command UI component can be bound to an action:
<h:button action="#{mybean.navAction}"/>
 mybean: The logical name of a managed bean (MyBean.java) with an
action method, navAction(), which returns a string
firstPage
Button
JSF Functionaly: Managed Beans
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
JSF Functionality: Managed Beans
 Managed Beans:
 Facilitate the UI logic of the
application
 Kind of like Struts Form beans and Actions
combined
 Encapsulates business logic, data and
properties of components
 Hold presentation and controller logic
 Store state
 example: authenticated user information
 Execute Java routines when, for
example, a user clicks a button
 Define handler for Event Listeners
 Add any code needed by UI
 Are optionally created or used
 Backing beans:
Are a specialized type of managed beans
that:
 contain accessors for UI components
 Have a one-to-one relationship with a
page
 Note: ADF BC applications define
business logic mainly in the model
layer, not the UI layer
JSF Functionality: JSF Life Cycle
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
A basic JSF application consists of:
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Product code
(state management, events,
etc..)
JSP LIFECYCLE
JSP - Formal Phases
Servlet
URL parsing
Client / Browser/ Wireless
Render
JSP Response
The root component
broadcast events to
execute action listener
and action methods
JSF Life Cycle: Phases
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
Component Tree
restored or created
~ Submitted form values stored
in component.
~ Component values converted
Component values validated
~ Component values bound to
backing bean properties
~ Component can update model
Component Tree is
created from backing
bean properties
JSF Life Cycle: Overview
Life Cycle and Helper Objects:
 Request processing is managed by FacesServlet, which creates the
FacesContext object
 When a client makes a request for the page, the life cycle starts
 During the life cycle, JSF implementation builds the view (tree of UI
components) while considering the state saved from the previous postback
 When the client performs a postback of the page, JSF implementation
must perform life-cycle steps:
 Conversion
 Validation
Features of JSF
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Features of JSF
Is a server-side, component based UI technology, (not markup
and abstracts away from HTML)
Is a standard J2EE Web UI framework
Simple yet fully extendable
provided by any vendor
Supports automatic event and state handling
Simplifies Web development
Insulates the application developer from UI implementations
Declarative definition—more robust and extensible
Features of JSF cont.…
Choice of UI technology
Scale up (rich clients)
Scale down (mobile devices)
Has a diverse client base (not just HTML)
Clear separation of presentation and behavior
Supports existing views and controllers
Designed to be leveraged by tools
Overview of Java Server Faces and ADF Faces
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Key Characteristics of Rich Web UIs
Rich Web UIs include the following characteristics:
Increased responsiveness over traditional Web applications
Asynchronous communication with the server
Behaviors not available in HTML alone
Overview of ADF Faces
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Tech-Stack of ADF Faces
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Tech-Stack of ADF
Metadata
Services
JDeveloper
Model (JSR227)
View
Controller
Business Services
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
ADF Faces
JSF/ADFc/Taskflow
ADF Model /Binding Context /Data Binding
ADF
BC
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
ViewController/
User Interface
Project
Model/ Service
Project
Model
Presentation
Layer
v
m
bc
BAM
BPL
JSF
Skins
Render Kits
UI Component
Tree
1. UI Component is rendered
through Renderer class
2. Expression Language Value
Binding is used to access managed
bean also know as a "backing
bean"
3. Managed bean accesses J2EE
persistence layer
faces-config.xml
trinidad.xml
1. EL accesses “bindings”
object to value bind UI
components
2. ADF “bindings” object is set
through ADF Filter in web.xml
3. Bindings object accesses
ADF Binding container, which
then accesses DataControl
4. Business Services provide
access to various data sources
ADF Model /Binding Context /Data Binding
Tech-Stack of View Layer
View
Controller
Business
Services
ADF Faces Components
ADF “binding” object
ADF BC
JSF Components
Struts
Swing Component
ADFdi
EJB POJO
Toplink Portlet BI
XML
Web Rich Client / Desktop
Relational Data XML Data Legacy Data Packaged Apps
ADF Binding Container / ADF Bindings
ADF Data Controls
Data
Services
Wireless Industrial
Faces Servlet / Front Controller ITS
XML XML Swing L&F
HTML Renderer WML Renderer Telnet Swing Renderer
SVG
ADF Faces
Model
(JSR227)
Metadata
Services
JDeveloper
Managed Bean
ADF Faces
Expr. Language
J2EE Persistence
JSF
Page
Skins
Render Kits
UI Component
Tree
1. UI Component is rendered
through Renderer class
2. Expression Language Value
Binding is used to access managed
bean also know as a "backing
bean"
3. Managed bean accesses J2EE
persistence layer
faces-config.xml
trinidad.xml
Tech-Stack of JSF
View
Controller
JSF UI Components Tree
EJB POJO
Toplink Portlet BI
XML
Web
Relational Data XML Data Legacy Data Packaged Apps
Data
Services
Wireless
Faces Servlet / Front Controller
XML XML
HTML Renderer WML Renderer SVG
Model
(JSR227)
Metadata
Services
Managed Bean
Expr. Language
J2EE Persistence
JSF
Page
1. JSF UI Components
2. Navigation / JSF Controller
3. Managed and Backing Beans
4. Life Cycle and Helper Objects
Skins
Render Kits
UI Component
Tree
1. UI Component is rendered
through Renderer class
2. Expression Language Value
Binding is used to access managed
bean also know as a "backing
bean"
3. Managed bean accesses J2EE
persistence layer
faces-config.xml
trinidad.xml
1. EL accesses “bindings”
object to value bind UI
components
2. ADF “bindings” object is set
through ADF Filter in web.xml
3. Bindings object accesses
ADF Binding container, which
then accesses DataControl
4. Business Services provide
access to various data sources
ADF Model /Binding Context /Data Binding
Tech-Stack of ADF Faces
View
Controller
Business
Services
ADF Faces Components
ADF “binding” object
ADF BC
JSF Components
Web
Relational Data XML Data Legacy Data Packaged Apps
ADF Binding Container / ADF Bindings
ADF Data Controls
Data
Services
Wireless
Faces Servlet / Front Controller
XML XML
HTML Renderer WML Renderer SVG
Model
(JSR227)
Metadata
Services
JDeveloper
Managed Bean
ADF Faces
Expr. Language
J2EE Persistence
JSF
Page
Functionalities of ADF Faces
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Functionalities of ADF Faces
 200+ featured Rich UI Components
(Lessons 12, 14, 18 and 19)
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management (L 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (Lesson 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax support)
(Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Validators & Converters
 Drag and Drop Data Binding (L 18)
 Advance Databound Search Capability
(Lesson 19)
 Transaction Management (Lesson 20)
 ADF Model support out-of-the-box
(Lesson 21)
ADF Faces Functionality: ADF Faces Components
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
ADF Faces Functionality: ADF Faces Components
 Layout Components: (L 12)
 Headers, Layout, Grouping, Spacing, etc..
 Navigation Control Components: (L14)
 Button, Link, Train, Navigation, etc..
 Menu and Toolbar explorer-type
containers: (L 14)
 Menu, Toolbar, Toolbox, etc..
 Secondary Windows Layout: (L 14)
 Popup, Dialog, Window, etc.
 Text and Selection Components: (L18)
 Output, Input, LOV, etc..
 Data Views: (L 18)
 Table, Tree, List, Carousel, Calendar, etc.
 Advance Data Visualization
Components (L 18)
 Chart, Graph, Gauge, NBox, Pivot Table,
Map, Gantt, Timeline, Hierarchy Viewer,
Sunburst, Diagram, etc..
 Data Query Components (L 19)
 Query and Quick Query
ADF Faces components generally fall into the following categories:
ADF Faces Components cont.…
 Layout Components: (Lesson 12)
 Core Structure and Page Management Components
 Document, Form, Inline Frame, Template and Facet Definition
 Interactive Containers (Show/Hide Capabilities) and Headers Components
 Panel Accordion, Panel Tabbed, Panel Drawer, Panel Springboard, Panel Box, Panel Header, Show
Detail Header, Show Detail and Show Detail Item
 Page Layout Containers
 Panel Grid, Panel Stretch Layout, Panel Splitter Layout, Masonry Layout, Panel Border Layout, Panel
Form Layout, Panel Dashboard and Panel Collection
 Grouping Containers
 Panel Group Layout and Group
 Spacing Components
 Spacer and Separator
 Miscellaneous Containers
 Deck, Decorative Box, Panel List, Grid Cell and Grid Row
ADF Faces Components cont.…
Navigation Control Components: (Lesson 14)
Button, Link, Breadcrumb, Navigation Pane, Navigation Item, XML
Menu Model and Train
Menu and Toolbar explorer-type containers: (Lesson 14)
Menu Bar, Menu, Menu Item, Toolbar and Toolbox
Secondary Windows Layout: (Lesson 14)
Popup, Dialog, Panel Window and Note Window
ADF Faces Components cont.…
 Text and Selection Components: (Lesson 18)
 Output Components
 Output Text, Message, Image, Icon, Media, Progress Indicator, Status Indicator and Carousel
 Input Components
 Input Text, Input Number, Form, Rich Text Editor, File Upload, Color Chooser, Date Chooser and
Code Editor
 Selection
 Boolean selection: Select Boolean Checkbox, Select Boolean Radio
 Single Selection: Select One Radio, Select One Listbox, Select One Choice
 Multiple Selection: Select Many Checkbox, Select Many Listbox, Select Many Choice, Select Many
Shuttle, Select Order Shuttle, Slider (range)
 List-of-Values (LOV) Components
 Input List of Value and Input Combobox List of Value
ADF Faces Components cont.…
 Data Views: (Lesson 18)
Collection-Based Components
 Table, Tree, Tree Table, List View and Carousel
Specialty Display Components
 Calendar Component
 Advance Data Visualization Components: (Lesson 18)
Graph, Chart, Gauge, NBox, Pivot Table, Pivot Filter Bar, Geographic Map,
Thematic Map, Gantt Chart, Timeline, Hierarchy Viewer, Tree Map, Sunburst
and Diagram
 Data Query Components: (Lesson 19)
Query and Quick Query
ADF Faces Rich Components Demo
ADF Faces Rich Client (UI Components) Demo:
https://docs.oracle.com/middleware/1221/adf/develop-faces/GUID-
EE22FD96-2723-4F07-95A9-04931E42C365.htm
ADF Functionality: Navigation using ADF Controller
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
ADF Functionality: Navigation using ADF Controller
 Is built on top of the JSF navigation model
 Handles page flow
 Promotes page reuse through abstraction
 Increases flexibility and manageability
 Is the place for code execution, such as programmatic
interaction with the model and business service
 Supports application tasks
 Input validation
 State management
 Security
 Declarative transaction control
 Provides declarative Back button control
ADF Faces Functionality: ADF Life Cycle
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean (Lesson 16)
 Life Cycle and Helper Objects
Features
The root component
broadcast events to
execute action listener
and action methods
JSF Life Cycle: Phases
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
Component Tree
restored or created
~ Submitted form values stored
in component.
~ Component values converted
Component values validated
~ Component values bound to
backing bean properties
~ Component can update model
Component Tree is
created from backing
bean properties
ADF Faces Functionality: ADF Life Cycle Phases
JSF and ADF Life Cycle Phases
JSF Phases ADF Phases Events
Restore View JSF Restore View before(JSF Restore View)
after(JSF Restore View)
Init Context
before(Init Context)
after(Init Context)
Prepare Model before, after
Apply Request Values JSF Apply Request Values before, after
Process Validations JSF Process Validations before, after
Update Model Values JSF Update Model Values before, after
Validate Model Updates before, after
Invoke Application JSF Invoke Application before, after
Metadata Commit before, after
Render Response JSF Render Response before, after
Only after navigation
Init Context
before, after
Only after navigation
Prepare Model
before, after
Prepare Render before, after
Features of ADF Faces
 Java Server Faces (JSF):
Tech-Stack / Architecture
Functionalities / Concepts (4)
 JSF UI Components
 Server-side component Tag Libraries
 Render Kits
 Renderers
 Navigation using JSF Controller
 Managed and Backing Beans
 Life Cycle and Helper Objects
Features
 ADF Faces (extends JSF):
Tech-Stack / Architecture
Functionalities / Concepts (23+)
 ADF Rich UI Components
 Navigation using ADF Controller
 Managed and Backing Bean
 Life Cycle and Helper Objects
Features
Features of ADF Faces
 Built to the Java Server Faces (JSF) 2.0 and later specification
 Integrated declarative development with Oracle JDeveloper
 Integration with other Oracle ADF technologies
 Server-side Push and Streaming (Active Data Service)
 User-driven Personalization
 Limited need for developers to write JavaScript
 Supports AJAX, SVG, Flash, and Custom Components
 Runtime Drag and Drop
 Caching
 Help and Hints
Lesson Summary
 Evolution of web tier from HTML, Servlets, JSPs to JSF
 Overview of Java Server Faces and it’s architecture
 Discuss JSF UI components
 Understand navigation
 Describe the purpose of managed and backing beans
 Explain the JSF life cycle
 Introduce how ADF Faces augments the JSF
 Overview of ADF Faces rich functionalities
 Overview of ADF Faces rich components
Functionalities of ADF Faces
(Reference for Lessons 11 to 21)
 200+ featured Rich UI Components
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management (L 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (Lesson 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax support)
(Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search Capability
(Lesson 19)
 Transaction Management (Lesson 20)
 ADF Model support (Lesson 21)
ADF Faces Functionality: ADF Faces Components
(Reference for Lessons 12, 14, 18 & 19)
 Layout Components: (L 12)
 Headers, Layout, Grouping, Spacing, etc..
 Navigation Control Components: (L14)
 Button, Link, Train, Navigation, etc..
 Menu and Toolbar explorer-type
containers: (L 14)
 Menu, Toolbar, Toolbox, etc..
 Secondary Windows Layout: (L 14)
 Popup, Dialog, Window, etc.
 Text and Selection Components: (L18)
 Output, Input, LOV, etc..
 Data Views: (L 18)
 Table, Tree, List, Carousel, Calendar, etc.
 Advance Data Visualization
Components (L 18)
 Chart, Graph, Gauge, NBox, Pivot Table,
Map, Gantt, Timeline, Hierarchy Viewer,
Sunburst, Diagram, etc..
 Data Query Components (L 19)
 Query and Quick Query
11
Getting Started with Rich User Interface
Lesson Agenda
Examine configuration files
Internationalizing the User Interface
Changing look and feel using ADF Faces skins
Ways to add components to the page
Use of facets
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (Lesson 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax support)
(Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (Lesson 20)
 ADF Model support (Lesson 21)
Internationalization of an Application
Internationalization is the support for multiple locales
Localization is the process in which support for a specific locale
is added
ADF Faces components provide automatic translation (into
more than 30 languages)
Resource Bundles
 Resource bundles are simple properties files that contain the translatable
strings used in an application
 Translation strings can be parameterized to dynamically include strings like
exceptions or counter
 You do not need to load the base resource bundle on each page of your
application
hrdemo.browserTitle=HRDemo Beispielanwendung
hrdemo.about=Über dieses Beispiel
hrdemo.copyright=u00a9 Deepak Bhagat, 2017
hrdemo.contact=Kontakt
UIResources_de.properties
hrdemo.browserTitle=HRDemo Sample Application
hrdemo.about=About this demo
hrdemo.copyright=u00a9 Deepak Bhagat, 2017
hrdemo.contact=Contact Us
UIResources.properties
Steps to Internationalize an Application
Create a base resource bundle containing all text strings that
are not part of the components themselves
Create a localized resource bundle for each locale supported by
the application
Register the locales with the application
Use the resource bundle on your page
Automatically Create Resource Bundles
Set project properties to create a resource bundle automatically
Automatically Create a Text Resource
1
3
4
2
Use Resource Bundle
Use <f:loadBundle …> to reference the resource bundle
Only the name of the default resource bundle needs to be
specified. Translations are looked up by appending _<language
code> to the name
Translatable strings are referenced by their key in the resource
bundle <f:view>
<f:loadBundle basename="oracle.srdemo.view.resources.UIResources"
var="res"/>
<af:document title="#{res['srdemo.browserTitle']}">
…
</f:view>
Steps to Internationalize an Application
Create a base resource bundle containing all text strings that
are not part of the components themselves
Create a localized resource bundle for each locale supported by
the application
Register the locales with the application
Use the resource bundle on your page
ADF Faces Skins
ADF Faces skins:
Allows to display own look and
feel
Provide a global style sheet for
an application
Use a CSS file to set styles
Use a resource bundle for text
Included skins:
alta
skyros
blafplus-medium
blafplus-rich
fusion
simple
ADF Faces Skins Usage
alta skin
skyros skin
Add UI Components to the Page
You can create components on a page by:
Dragging a component from the Component
Palette
Using the context menu in editor or Structure
window
Dragging a data element from the Data Control
panel
Use of Component Facets
Facets are:
 Placeholders for subcomponents
 Similar to detail elements
 Used to specify subordinate elements such as toolbars, headers, or
footers
 Displayed with the component
Using Facets
If you have a complex layout that you want to achieve but can
imagine other people needing it, there is probably something
already that provides it
Use the right component for the task
Some components even provide specialized facets to help
automate the layout for you, e.g. see:
panelCollection
panelHeader
panelFormLayout
Configuration Files
General Configuration Files:
 web.xml
 (J2EE)
 trinidad-config.xml
 (JSF Skinning)
 faces-config.xml
 (JSF)
 Similar to struts-config.xml
 Contains two main types of
components
 Managed Beans
 Navigation Model
 adf-settings.xml
 (ADF faces Settings)
 adfc-config.xml
 (ADF Faces)
 adf-config.xml
 (ADF Faces)
 weblogic-application.xml
 (WLS specific deployment
descriptor)
Custom Configuration Files
 adf-faces-config.xml
ADF faces configuration
 adf-faces-skins.xml
Skins
 adf-faces-impl.jar and adf-faces-api.jar
Component libraries
 adfshare.jar
Common library for ADF databinding
 af.tld and afh.tld
Tag libraries
web.xml File
 Web.xml
 Standard J2EE deployment descriptor
 Registers JSF Servlet (FacesServlet)
 ADF Filter
 ADF Resources Servlet
 ADF Bindings Filter
 Context param to identify CPX file
faces-config.xml File
 faces-config.xml
 JSF configuration file
 Configure JSF resources
 Navigation Rules
 Managed Beans
 Converters
 Validators
 LifeCycle (ADFPhaseListener)
 Renderer
 Can have multiple faces-configs
(param in web.xml)
Lesson Summary
Examine configuration files
Internationalizing the User Interface
Changing look and feel using ADF Faces skins
Ways to add components to the page
Use of facets
12
Planning Pages using Layout Components
Lesson Agenda
Use complex layout components
Add additional functionalities to layout components
Determine active geometry management
Use dynamic page layout
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
ADF Faces Functionality: ADF Faces Components
 Layout Components: (12)
Core Structure and Page
Management Components
Interactive Containers (Show/Hide
Capabilities) and Headers
Components
Page Layout Containers
Grouping Containers
Spacing Components
Miscellaneous Containers
 Navigation Control Components: (14)
 Menu and Toolbar explorer-type
containers: (14)
 Secondary Windows Layout: (14)
 Text and Selection Components: (18)
 Data Views: (18)
 Advance Data Visualization
Components (18)
 Data Query Components (19)
Planning Pages using Layout Components
Panel Accordion
Disclosed=many
showDetailItem
Disclosed=true
InflexibleHeaight=297
Text=“Location-Departments”
showDetailItem
Disclosed=true
Text=“Quick Search”
Panel Tabbed
showDetailItem
Text=“Employee List”
showDetailItem
Text=“Employee Search”
BATHRSystemIndex.jsf
1. Panel Splitter – vertical
splitterPosition=135
2. Panel Splitter – horizontal
splitterPosition=220
Employee List
Overview of Layout Components
Layout Components:
 Core Structure and Page Management Components
 Document, Form, Inline Frame, Template and Facet Definition
 Interactive Containers (Show/Hide Capabilities) and Headers Components
 Panel Accordion, Panel Tabbed, Panel Drawer, Panel Springboard, Panel Box, Panel
Header, Show Detail Header, Show Detail and Show Detail Item
 Page Layout Containers
 Panel Grid, Panel Stretch Layout, Panel Splitter Layout, Masonry Layout, Panel Border
Layout, Panel Form Layout, Panel Dashboard and Panel Collection
 Grouping Containers
 Panel Group Layout and Group
 Spacing Components
 Spacer and Separator
 Miscellaneous Containers
 Deck, Decorative Box, Panel List, Grid Cell
and Grid Row
Layout Components: Core Structure
Form
Creates an HTML <form> element
Inline Frame
 Creates an inline iframe tag
Layout Components: Interactive Containers
Panel Accordion
Used in conjunction with showDetailItem
components to display as a panel that can be
expanded or collapsed
Layout Components: Interactive Containers
Panel Tabbed
Used in conjunction with showDetailItem components to display as a
set of tabbed panels
If you want the tabs to be used in conjunction with navigational
hierarchy, for example each tab is a different page or region that
contains another set of navigation items, you may instead want to use
a navigationPane component in a navigational menu
Layout Components: Interactive Containers
Panel Drawer (New 12c Feature)
Used in conjunction with showDetailItem
components to display as a set of tabs that
can open and close like a drawer
Layout Components: Interactive Containers
Panel Springboard (New 12c Feature)
Used in conjunction with showDetailItem
components to display as a set of icons,
either in a grid or in a strip. When the user
clicks an icon, the associated showDetailItem
contents display below the strip
Layout Components: Interactive Containers
Panel Box
Titled box that can contain child components. Has a toolbar facet
Panel Header
Contains child components and provides a header that can include
messages, toolbars, and help topics
Layout Components: Headers Components
Show Detail Header
Can hide or display contents below the header. Often used as a child
to the panelHeader component
Show Detail
Hides or displays content through a toggle icon
Layout Components: Headers Components
Show Detail Item
Used to hold the content for the different panes of the
panelAccordion or different tabs of the panelTabbed component
Layout Components: Page Layout Containers
Panel Border Layout
Can have child components, which are
placed in its center, and also contains
12 facets along the border where
additional components can be placed.
These will surround the center
Layout Components: Page Layout Containers
Panel Form Layout
Positions input form controls, such as
inputText components so that their
labels and fields line up vertically. It
supports multiple columns, and
contains a footer facet
Layout Components: Page Layout Containers
Panel Dashboard Layout
Provides a columnar display of child
components (usually panelBox components)
Layout Components: Page Layout Containers
Panel Collection Layout
Used in conjunction with collection components such as table, tree
and treeTable to provide menus, toolbars, and status bars for those
components
Layout Components: Page Layout Containers
Panel Grid Layout
Used in conjunction with gridRow and
gridCell components to provide an
HTML table-like layout where you
define the rows and cells, and then
place other components as children to
the cells
Layout Components: Page Layout Containers
Panel Stretch Layout
Contains top, bottom, start, center, and
end facets where you can place other
components
Layout Components: Page Layout Containers
Panel Splitter Layout
Divides a region into two parts (first facet and second facet) with a
repositionable divider between the two. You can place other
components within the facets
Create Resizable Panes: Panel Splitter
Panel Splitter
Attributes
Layout Components: Page Layout Containers
Masonry Layout
Provides a dynamically-sized grid of
child components
Layout Components: Grouping Containers
Panel Group Layout
Groups child components either vertically
or horizontally. For JSP pages, used in
facets when more than one component is
to be contained in a facet (Facelet pages
can handle multiple children in a facet)
Layout Components: Grouping Containers
Group
Groups child components without regard to
layout unless handled by the parent
component of the group. For JSP pages, used
in facets when more than one component is
to be contained in a facet (Facelet pages can
handle multiple children in a facet)
Layout Components: Spacing
Spacer
Creates an area of blank space
Separator
Creates a horizontal line between items
Layout Components: Miscellaneous Containers
Deck
Provides animated transitions between its child
components, using the af:transition tag
Decorative Box
Creates a container component whose facets
use style themes to apply a bordered look to its
children. This component is typically used as a
container for the navigationPane component
that is configured to display tabs
Layout Components: Miscellaneous Containers
Panel List
Renders each child component as a list item and renders a
bullet next to it. Can be nested to create hierarchical lists
Layout Components: Additional Functionalities
Once you have added a layout component to your page, you need to add
functionality such as responding to events
 Templates: Once a layout is created, it can be saved as a template. When
template is modified, all pages that consume the template will
automatically reflect the changes
 Themes: Themes add color styling to some of layout components, such as
the panelBox component
 Skins: Can change look & feel, icons and other properties of layout
components using skins
 Localization: Instead of entering values for attributes that take strings as
values, you can use property files. These files allow you to manage
translation of these strings
Layout Components: Additional Functionality
cont.…
 Accessibility: Input components can be made accessible
 Using parameters in text: For text displayed in a component to
contain parameters, use the ADF Faces EL format tags to resolve at
runtime
 Events: Layout components fire both server-side and client-side
events that can be handled and execute some logic
 User customization: Some of the components have areas that can
be expanded or collapsed, such as the component
showDetailHeader. The state of the component (expanded or
collapsed) can be saved when the user leaves the page, by
configuring
Geometry Management and Component
Stretching
Only the following components can stretch:
*if configured to stretch
 decorativeBox*
 deck
 inputText*
 panelAccordion*
 panelBox*
 panelCollection
 panelDashboard*
 panelGridLayout*
 panelHeader*
 panelSplitter*
 panelStretchLayout*
 panelTabbed*
 region
 showDetailHeader*
 table*
 tree*
 treeTable*
 panelGroupLayout
(scroll/vertical)
Geometry Management and Component
Not Stretching
The following layout components cannot stretch:
panelBorderLayout
panelFormLayout
panelGroupLayout (default/horizontal)
panelLabelAndMessage
panelList
showDetail
tableLayout
Geometry Management: Panel Collection
Component
 The panelCollection component is one of the ADF layout
components
 It is used in conjunction with collection components, such as table,
tree, and treeTable
 It provides additional capabilities to the components that are
placed inside it:
Provides default menus and toolbar buttons to tables, trees, and treeTables
Allows for multisorting of columns, the ability to hide/wrap columns, and to
freeze a column while scrolling other columns
Geometry Management: Panel Collection
Component cont.…
Use panelCollection for table with menus and toolbars:
A panel component that aggregates collection components like table,
treeTable and tree to display standard/application menus, toolbars
and statusbar items
Active Geometry Management
Active geometry management and component stretching
Determines how best to make use of available screen real-estate
The framework
 Notifies layout components of browser resize activity
 Layout components in turn resize their children
This allows certain components to stretch or shrink, filling up any
available browser space
Active Geometry Management cont.…
Table Inside a Component That Does Not Stretch Its Child
Components
Relation of styles and stretching
 What does being stretched mean for styles?
When a Renderer stretches a child component, the root element of that
child will have an inlineStyle injected
The injection is at the beginning of the inlineStyle
Trying to override the dimensions of a stretched child is asking for trouble
 What priorities do styles/skin have?
inlineStyle beats styleClass
The further right inside of an inlineStyle wins
In a .css file, the lower the definition wins if there is equal weight but if
another definition is more specific, it wins (see W3C CSS spec for specificity
rules on how to rank specificity)
Reviewing Layout Basics
In HTML, some elements can be stretched while some can flow
Those that have no official W3C standard for stretching are
interpreted differently across web browsers, e.g.:
% means different things:
 Direct parent element
 Some ancestor element
 The browser viewport
 Nothing (e.g. inside of an auto-width HTML table cell)
Reviewing Layout Basics cont.…
 Changing styles (e.g. inlineStyle or styleClass) can impact the ability for a
component to stretch or flow
 Don’t modify styles; instead solve problems using a declarative approach to insulate you
from browser-specific issues
 In ADF Faces, the HTML limitations translates to:
 Whether the component supports being stretched by an ancestor
 Whether the component must flow on its own
 Whether the component supports stretching its children
 Whether the component must let the children flow
 Third-party components need this info documented
 The outer shell of components can be stretchable ones
 The inner island(s) of components must be flowing
 Cannot stretch components in a flowing island
Stretching and Flowing
 Browsers are unreliable; not robust:
 Some things can stretch others must flow
 % dimensions mean different things
 Don’t be a slave to the browsers, avoid inlineStyle like the plague!
 Highly recommended that you build your layouts like this:
 Use a stretchable outer frame
 Inside this frame, have flowing islands (e.g. scrollable areas)
 Do not attempt to stretch something vertically in a flowing island!
 Need custom styling?
 Find a declarative approach (theme, hint, other attribute)
 e.g. make the page dark blue with af:document’s theme="dark"
 Use the styleClass attribute
 Organizations can use a custom skin (to change how a component looks or just to make custom
global selectors)
Stretching and Flowing cont.…
W3C CSS Box model makes it hard to
combine margins, borders and padding
with width and height dimensions of
elements (See diagram)
Workarounds include nesting multiple
components to achieve desired effect
How to avoid using inlineStyle; When to use it…
 inlineStyle, contentStyle, and labelStyle are powerful but evil, use them as
a last resort but preferably not at all!
 These are less declarative, harder to maintain, contribute more to the
page's raw HTML size, and may not even be needed if one or more of the
following are used:
 Use themed decorativeBox components to organize your page into layers (in ATG,
this is what the UI Shell must do)
 Use a custom skin for consistently modified appearances if the existing skin
doesn't provide all that you need
 For instance-specific alternative styling, use the styleClass attribute. Keep the
corresponding style definitions in an easy-to-maintain location such as in a custom
skin, in the metaContainer facet of the document component, or as close to the
top of the page as possible for optimal performance
Use case: series of boxes Variation 1 of 6 - Flowing
Use case: series of boxes Variation 2 of 6 - Stretch
the 1st box
Use case: series of boxes Variation 3 of 6 - Stretch
the 2nd box
Use case: series of boxes Variation 4 of 6 - Stretch
the 3rd box
Use case: series of boxes Variation 5 of 6 - Stretch
all evenly
Use case: series of boxes Variation 6 of 6 - Stretch
1st 2 evenly
Fusion Template Basic Page Layouts
The Fusion Design Surface already
has the 4 basic PageLayouts as
backgrounds:
Regional and Contextual panes
open
Only Contextual pane open
Only Regional pane open
Neither pane open
1 3
2 4
Resizing Content Panes - 1
Starting Point
The BG_… page you want to use
Resizing Content Panes - 2
1 2
Drag the edge top corner of a layer
 In this case the splitter is
moving with the edge of the
Content Layer it since the
splitter is glued to the left layer
 If the splitter needs to be
moved the controls for the
splitter are on the left side (1). It
has connection points on the
right the other region needs to
be snapped/glued to (2).
Resizing Content Panes - 3
Drag the other regions edge to snap to the first region moved.
Building a Page Layout - 1
Starting Point
Building a Page Layout - 2
Drag out a Global Layer
Building a Page Layout - 3
Drag out a Level 1 tab snapping the left edge to the left edge of
the Global Layer
Building a Page Layout - 4
Drag out the right control point to make the tabs the length of
the Global Layer
Building a Page Layout - 5
Drag out a Primary Layer and snap it to the left edge of the
Global Region
Building a Page Layout - 6
Drag out the Primary Layers right-side control point to the
Global Layers right edge
Building a Page Layout - 7
Snap the Primary Layers bottom control point until it snaps to
the bottom of the Global Layer
Building a Page Layout - 8
Drag out a Level 2 Tab and snap it to the left edge of the
Primary Layer
Building a Page Layout - 9
Drag out the Level 2 tab’s right-hand control point to the right
edge of the Primary Layer
Building a Page Layout - 10
Drag out a Content Layer, snapping its left edge to the left edge
of the Primary Layer
Building a Page Layout - 11
Drag the Content Layers bottom control point until it snaps to
the bottom of the Global Layer
Building a Page Layout - 12
Right-click the Content Layer and turn off the Offset Left
The Offset left and right provide space for splitters between Content
Layers. Since this will be a Regional Content pane and there will be no
splitter on the left.
Building a Page Layout - 13
CTRL+Drag to duplicate the Content Layer until it’s left edge
snaps to the right edge of the existing layer.
Building a Page Layout - 14
Drag the new layers right-hand control point to the desired
width
Building a Page Layout - 15
CTRL+Drag the left-most Content Layer to duplicate it on the
right
Building a Page Layout - 16
After resizing it, right-click the layer and turn off the Offset
Right since this is an open Contextual Region
Building a Page Layout - 17
Drag out a Splitter and snap it to the gap between the first two
content layers
Building a Page Layout - 18
Drag the splitter’s bottom control point to snap to the bottom
of the Global Layer
Building a Page Layout - 19
CTRL+Drag the Splitter to duplicate it
Building a Page Layout - 20
Pick up the splitter by it’s top control point and snap it to the
right-hand gap
Adding a Page Header
 Drag Page Header shape
onto page, snapping the
left side to the top
corner of the Content
region
 Drag right corner to snap
to right of Content
region
 Double-click to edit
name
 Right-click header and
set options
1
3
2
4
Adding a Subheader - 1
Starting Point
Adding a Subheader - 2
Drag out Sub Header
onto page, snapping
left edge to edge of
Content Layer
 Subheaders have
offsets so that
they snap into
place with the
proper spacing
around them,
which is why the
control points are
not on the
geometry
Adding a Subheader - 3
Drag the Subheaders right-side control point till it meets the
edge of the container
Adding a Subheader - 4
Drag the bottom control handle to make extra space for the
form
Adding a Subheader - 5
Double-click the header to edit the name and other attributes
Adding a Subheader - 6
You’re ready to fill it with a form, table or other content
Adding Level 3 Tabs - 1
Starting Point
Adding Level 3 Tabs - 2
Drag out a Level 3 Tab
Container snapping its
upper left connection
point to the bottom of
the header
 Subheaders have
offsets so that they
snap into place with
the proper spacing
around them, which
is why the control
points are not on
the geometry
Adding Level 3 Tabs - 3
Drag out the containers right control point to the right edge of
the region
Adding Level 3 Tabs - 4
Drag out a Level 3 tab snapping the left edge to the
top of the container
Adding Level 3 Tabs - 5
Drag out the tabs right control point to the edge of the
container
Adding Level 3 Tabs - 6
The bottom control point can be dragged to resize the
container to the desired size for the content
Adding Level 3 Tabs - 7
If the region will be taller then a screen’s height then you can
add the bottom tabs by CTRL+Dragging the top tab down to
snap to the bottom of the container
Adding Level 3 Tabs - 8
The bottom tabs need to be flipped so they appear under the
container. This can be done using the right-click context menu
Performance impacts
Not everything relating to layout can be conveyed using styles;
some components use JavaScript:
“auto” in panelStretchLayout facet dimensions
columnStretching in af:table
JavaScript manipulation can reduce browser layout and resize
time 5-10% on average.
New rendering and JavaScript engines are narrowing the gap,
e.g. Safari and now Firefox 3 are drastically better than Internet
Explorer and Firefox 2
Dynamic Layouts
Dynamic page layout is made possible by using:
Partial page rendering (PPR) – (Lesson 16)
Expression Language (EL) – (Lesson 21)
Lesson Summary
Use complex layout components
Add additional functionalities to layout components
Determine active geometry management
Use dynamic page layout
13
Designing User Interfaces and Flows
Lesson Agenda
Features of task flows
Differentiate between bounded and unbounded task flows
List and discuss task flow activities
Explain static and dynamic regions
How to extract a task flow
How to convert task flow to use page fragment
How to convert to unbounded task flow
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
Designing User Interface and Flows
Panel Accordion
showDetailItem
showDetailItem
Panel Tabbed
showDetailItem showDetailItem
BATHRSystemIndex.jsf
LocationDeptartmentTF
EmployeeQuickSearchTF
EmployeeListTF EmployeeSearchTF
EmployeeCreateTF
EmployeeDetailTF
EmployeeListPF
EmployeeSearchPF
EmployeeUpdateTF
EmployeeDetailPF
LocationDeptartmentPF
QuickSearchPF
EmployeeCreatePF
EmployeeUpdatePersonPF EmployeeUpdateJobPF EmployeeUpdateConfirmPF
Region TF Call Page Fragment
Features of ADF Task Flows
ADF task flows are logical units of
page / process flows that:
 Can be either
unbounded or
bounded
 Offer advantages over JSF page
flows
An application can be broken into a
series of tasks (with visual repn.)
An application can contain nodes
other than pages
Navigate between activities, other
than pages
Have a shared memory scope
Parameter/context passing
Event firing & handling
Automatic transaction management
Dropped into a page as a Region
Exposed remotely as a Portlet
Behavior (Trains)
Additional Functionalities of ADF Task Flows
Following are the additional functionalities:
 Task flows can invoke managed beans
 Task flows are reusable
 Task flows can be secured by defining the privileges that are
required for someone to use it
 You can extend the functionality that your task flows implement by
writing custom code
 Make sure when you write custom code that you do not import
packages that are marked internal, as in the following example:
import oracle.adfinternal.controller.*;
Types of Task Flows
Un Bounded
Entry Points
Bounded
Entry Points
Exit Points Exit Points
Features of Unbounded Task Flows
Unbounded task flows often serve as the entry point to an
application, and have the following characteristics:
 First entry on task flow stack—the outermost task flow
 No well-defined boundary or single point of entry
Use an unbounded task flow if your application has multiple points of entry
 Can be used to define the “top level” flow of an application
 Bookmarkable pages
 ADF Application by default creates a unbounded task flow named
adfc-config.xml
Implementing Unbounded Task Flows
The unbounded task flow source file is adfc-config.xml
The editor contains four tabs to show different views:
Diagram
Overview
Source
History
You can easily test the task flow functionality in the
unbounded task flow, and convert to bounded when it is
functioning correctly
Features of Bounded Task Flows
Bounded task flows:
 Are modular blocks of task flow
functionality for reuse, with the
following characteristics:
Single point of entry
Well-defined boundary
pageFlow Memory scope
Declarative transaction
management
Declarative Back button support
 Consist of:
Activities
 Example: View, Router, etc..
Control flows between activities
Ability to accept input parameters
and to return values
On-demand metadata loading
Fragment reuse through task flow
templates or regions
Comparing Unbounded and Bounded Task Flows
Unbounded Bounded
First entry on task flow stack Added to task flow stack when called
No well-defined boundary or single point of entry Single point of entry, with zero or more exit points
Cannot be used as a region on a page Can be used as region on page with page fragments
Does not accept parameters Accept parameters and return values
Not securable on its own; uses page security Can be secured separately from pages
Cannot manage transactions or save for later Declarative transaction management, save for later
Cannot be called (from other task flow) Must be called to be invoked
Can be bookmarked Not bookmarkable
Can directly run on browser Cannot directly run on browser
Types of Task Flow Activities and Components
Types of Task Flow Activities and Components
Icon Component
Name
Description
View Displays a JSF page or page fragment. Multiple view activities can
represent the same page or same page fragment
Method Call Invokes a method, typically a method on a managed bean. A
method call activity can be placed anywhere within an application's
control flow to invoke application logic based on control flow rules
Task Flow Call Calls a bounded task flow from the unbounded task flow or another
bounded task flow
Types of Task Flow Activities and Components
cont.…
Task Flow
Return
Identifies when a bounded task flow completes and sends control flow
back to the caller. (Available for bounded task flows only)
Router Evaluates an EL expression and returns an outcome based on the value
of the expression. For example, a router in a credit check task flow
might evaluate the return value from a previous method call and
generate success, failure, or retry outcomes based on various cases.
These outcomes can then be used to route control to other activities in
the task flow
Wildcard
Control Flow
Rule
Represents a control flow case that can originate from any activities
whose IDs match a wildcard expression. For example, it can represent a
control case from-activity-id containing a trailing wildcard such as foo*
Types of Task Flow Activities and Components
cont.…
Control Flow
Case
Identifies how control passes from one activity to the next in the
application
URL View Redirects the root view port (for example, a browser page) to any URL-
addressable resource, even from within the context of an ADF region
Parent Action Allows a bounded task flow to generate outcomes that are passed to its
parent view activity. Typically used for a bounded task flow running in an
ADF region that needs to trigger navigation of its parent view activity
Save Point
Restore
Restores a previous persistent save point, including application state and
data, in an application supporting save for later functionality. A save point
captures a snapshot of the Fusion web application at a specific instance.
Save point restore enables the application to restore whatever was
captured when the save point was originally created
Using View Activities
 One of the primary types of task flow activities is the view
 A view activity displays a JSF page or page fragment
 Page fragment:
 is a JSF document that renders as content in another JSF page
 Page fragments are typically used in bounded task flows that can be
added to a JSF page as a region
 Must not contain the af:document, af:form, f:view,
head, body and html because JSF page already has it
 Has .jsff extension
 Page:
 Can contain many fragments
 Extension .jsf or .jspx
Defining Task Flow Return Activity
When you return from a called task flow, the task flow return
activity specifies the outcome that is returned to the caller
Using Routers
Router activities:
 Use expressions that evaluate to true or false
 Define from-outcomes based on the value of the expression
Router - Example
Use the router activity in a task flow to declaratively route
control to activities based on logic specified in an EL expression
An EL expression evaluating to either true or false, for example,
#{scope.user==“ALEN"}
Defining ADF Control Flow Rules
 Define flow through activities, such
as views (pages)
 Are stored in task flow configuration
files
 Can be defined by using:
 The visual editor (Navigation Modeler)
 The .xml console (Configuration
Editor)
 The .xml file directly
 The Structure window
 Are invoked by:
 Command components (button and link)
 Tabs or breadcrumbs
 Trains
Control Flow - Example
Using Wild Cards
To define a global (for all pages) control flow rule, drag a
wildcard control flow rule to the page:
Wildcard - Example
Make View Activities Bookmarkable
 Saving a view activity as a
bookmark is available only in
unbounded task flows
 You can:
Designate in Property Inspector at
design time
Designate at run time with the
ViewBookmarkable() method
Optionally specify:
 URL parameters
 Method to invoke before view is
rendered
Use the redirect option for a view
activity instead of making it
bookmarkable
Check for Dirty Data
Checking for Dirty Data
Add this method in your ViewObjectImpl and expose it
using client interface
Call this method in your view layer whenever you need to find
the dirty state of a VO by creating a method binding
like #{bindings.isDirty.execute}
Further modify this method to return the states as described in
point 1 above, by iterating through rows
Exception Handling
 During execution of a task flow,
exceptions can occur that may
require some kind of exception
handling, for example:
 A method call activity throws an
exception
 A user is not authorized to execute
the activity
 Can designate one activity in a
bounded or unbounded task flow as
an exception handler to handle
exceptions
ADF Regions – Static and Dynamic
Regions are created when you drag and drop a bounded task
flow on a page
Static Regions Dynamic Regions
Fixed Visibility Visible based on custom logic
Creates Task flow binding on page Creates Multi-task flow binding
Create Bounded Task Flow
You can create a bounded task flow by doing one of the
following:
Using the
 New Gallery
 OR
Extracting part
 of an existing
 task flow
Page Fragments
Extracting a Task Flow
You can create a bounded task flow by :
Using the New Gallery or
Extracting part of an Existing task flow
Converting a Bounded Task Flow to use Page
Fragments
To use a bounded task flow containing pages as a region,
convert it to a task flow with page fragments
Converting to Unbounded Task Flow
You can convert bounded task flows to unbounded:
Lesson Summary
Features of task flows
Differentiate between bounded and unbounded task flows
List and discuss task flow activities
Explain static and dynamic regions
How to extracting a task flow
How to converting task flow to use page fragment
How to converting a task flow
14
Interactively Controlling with Navigation
Components
Lesson Agenda
List of Navigation Components
Implement Buttons and Links
Use Breadcrumbs and Navigation Panes
Define Trains
Implement explorer type containers like Menu and Toolbars
Use secondary Windows like Popup, Dialog and Windows
Performing navigation
Add Accessibility compliance using Access Key
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 18)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
ADF Faces Functionality: ADF Faces Components
 Layout Components: (12)
 Navigation Control Components: (14)
 Button,
 Link,
 Breadcrumb,
 Navigation Pane,
 Navigation Item,
 XML Menu Model and
 Train
 Menu and Toolbar explorer-type
containers: (14)
 Menu Bar,
 Menu,
 Menu Item,
 Toolbar and
 Toolbox
 Secondary Windows Layout: (14)
 Popup,
 Dialog,
 Panel Window and
 Note Window
 Text and Selection Components: (18)
 Data Views: (18)
 Advance Data Visualization Components (18)
 Data Query Components (19)
Overview of Navigation Components
 Navigation components allow users to drill down for more
information, to navigate to related pages or windows, and to
perform specific actions on data and navigate at the same time
 The common forms of navigation components are buttons and
links, most of which can be used on their own and a few that can
only be used in conjunction with other components
 Some components render navigable items such as tabs and
breadcrumbs for navigating hierarchical pages and keeping track of
the user's current location in the page hierarchy. Navigation
components can provide navigation with or without server-side
actions
Using Button
Button:
ADF Faces provides button component that can be used for navigation
Depending on use case, you can configure this component to navigate
directly to another location, to submit requests, and fire ActionEvent
events
The button component can render images, along with optional text
Using Link
Link:
A link can be set to either launch an action or navigate to destination
The link can contain a textual value holder, like output text or image
Using Breadcrumbs
Breadcrumb component is used in hierarchical site layouts to
indicate the path back to the root page of the hierarchy with
links
You can define:
Breadcrumbs explicitly
Links using the XML Menu Model
Breadcrumb links
(Navigation Items)
Using Explicitly Defined Breadcrumbs
Breadcrumbs: Use the af:breadCrumbs component
Links: Use the af:NavigationItem component
Use static values:
<af:breadCrumbs>
<af:commandNavigationItem text=“Home”/>
<af:commandNavigationItem text=“Employee Data”/>
<af:commandNavigationItem text=“Add New Employee”/>
</af:breadCrumbs>
Can also use EL for dynamic values
Using Navigation Pane
Navigation Pane creates a series of navigation items
representing one level in a navigation hierarchy
You can either:
Define navigation levels explicitly
Or
Bind to XML Menu Model
Overview of XML Menu Model
XML Menu Model:
Represents navigation for a page hierarchy in XML format
Contains the following elements:
menu
groupNode
itemNode
sharedNode
Home
Benefits Employee Data
Insurance Paid
Time Off
Health Dental
Level 0 (root_menu)
Level 1 (home_menu)
Level 2 (benefits_menu)
Level 3 (insurance_menu)
Defining Sequence of Steps (Train)
The Train component:
is a specialized type of task flow with linear steps
indicates the location of the current page within a multi-step process.
Each step is represented as a train stop
Navigation buttons rendered
by af:trainButtonBar
Creating the task flow for a
train
Navigation items rendered by
af:train
Skipping Train Stop
Controlled by the skip property of the train stop:
If true, users cannot navigate to that train stop
Typically set to an expression that evaluates to true or false,
such as managed bean method or property
Step 1 of train
Step 2 of train
Step 3 of train
Using Menus for Navigation
Menu bar:
 Menu bars allow you to organize menus, buttons, and other simple
components in a horizontal bar
 When a user clicks a menu in the bar, the menu drops down and
the user can select from the menu items
 You can group menu bars and toolbars in a toolbox
Using Menus for Navigation cont.…
Menu:
Menu components are used to create menus that allow users
to add or edit items, search data, change the view, or launch
help
Using Menus for Navigation cont.…
Menu items:
Provide the vertical (drop-down) selections
Like toolbar buttons, can:
Display differently when selected
Perform navigation
Printable Page Behavior
<af:button text="Printable Page">
<af:showPrintablePageBehavior/>
</af:button>
Using Toolbar, Toolbar Buttons and Toolboxes
Toolbars contain other components
Toolbar buttons have special properties. (If
you use toolbar buttons, always put them
on a toolbar.)
Toolboxes contain multiple toolbars
You can stretch one component on a
toolbar
Overflow buttons are automatic
Menus & toolbars
 af:toolbox
wrapper for menu bars and toolbars
af:group - use one per row
 af:toolbar
af:commandToolbarButton
af:group - separators between groups of items
 af:menuBar
af:menu - nest for submenus
 af:commandMenuItem
 af:goMenuItem
af:group - separators between groups of items
Menu and Toolbar Components: Additional
Functionalities
Once you have added a menu and toolbar components to your page, you need to
add functionality such as responding to events
 Invoking functionality: ADF Faces offer tags that can be used with menu
command components to invoke functionality, such as downloading a file or
resetting submitted values
 Table menus: You can create menus and toolbars that display above a table and
work only on that table (as opposed to the whole application)
 Context menus: You can create menus that launch in a popup when a user right-
clicks an item in the UI. For more information, see How to Create a Context
Menu
 Using parameters in text: You can use the ADF Faces EL format tags if you want
text displayed in a component to contain parameters that will resolve at runtime
Menu and Toolbar Components: Additional
Functionalities cont.…
 Events: You can use command menu components to launch action events.
For more information about events, see Handling Events
 Accessibility: You can use specific attributes on the menu components to
create shortcuts that allow users to open menus using a keyboard
 Localization: Instead of entering values for attributes that take strings as
values, you can use property files. These files allow you to manage
translation of these strings
 Skins: You can change the look and feel of menus (such as the icon used to
display a selected menu item), along with some basic functionality (such as
the maximum number of menu items that display) by changing the skin
Types of Pop-ups
Panel Window: Displays its
children in a window that is
similar to a dialog, but does
not support events.
Popup Dialog: Displays its children
inside a dialog and delivers events
when the OK, Yes, No or Cancel
actions are activated.
Note Window: Displays read-only
information associated with a
particular UI component.
Menu: Displays a context menu for an associated component.
Creating Pop-up Menus
Popup:
The popup component is an invisible container control whose
contents will be used in popup windows, such as context menus, note
windows, dialogs and popup selectors
These types of "popup windows" are within the same browser
window and using layers of HTML to simulate an external browser
window
Popup Menus: Additional Functionalities
Once you have added a popup component (or related components) to your page,
you may find that you need to add functionality such as accessibility and
localization
 Using parameters in text: You can use the ADF Faces EL format tags if you want
the text displayed in a component to contain parameters that will resolve at
runtime
 Events: The dialog component renders ADF Faces button components. You can
also use a button component in conjunction with the showPopupBehavior tag to
launch a popup. The button component used in conjunction with the
showPopupBehavior tag delivers ActionEvent events when activated
 Messages: Popup dialogs and secondary windows are frequently used to provide
different levels of help information for users
Popup Menus: Additional Functionalities cont.…
 Localization: Instead of directly entering text for labels in the popup dialogs,
menus, and windows that you create, you can use property files. These files
allow you to manage translation of the text strings
 Skins: You can change the look and feel of the components that you use to
create popup dialogs, menus, and windows by changing the skin
 Accessibility: You can make your popup dialogs, menus, and windows accessible
 Dialog framework: If your application uses the full Fusion technology stack, note
that the dialog framework is integrated with ADF Controller for use with ADF task
flows
 Touch Devices: ADF Faces components may behave and display differently on
touch devices
 Drag and Drop: You can configure your components so that the user can drag
and drop them to another area on the page
Creating Context Menus
To create a context menu, use the af:showPopupBehavior
operation
Additional Functionalities of Navigation
Components
Once you have added a navigation component to your page, you
need to add functionality such as responding to events
Using parameters in text: ADF Faces EL format tags can be
used to display text in a component to contain parameters that
will resolve at runtime
Events: Components fire both server-side and client-side
events that the application react to by executing some logic
Partial page rendering: ADF Faces navigation components can
be used to trigger partial rerendering of components on a page
Additional Functionalities of Navigation
Components cont.…
 Accessibility: Navigation components can be accessible
 Localization: Instead of directly entering text for labels, can use
property files. These files allows to manage translation of the text
strings
 Skins: Can change the look and feel of navigation components by
changing the skin
 Touch Devices: ADF Faces components may behave and display
differently on touch devices
 Drag and Drop: Can configure components so that the user can
drag and drop them to another area on the page
JSF Navigation Rules
Page Flow Editor
Navigation Rules
Overview
Navigation Rules
Thumb View
JSF Navigation
JavaServer Faces uses its own controller for page navigation
NavigationHandler evaluates navigation case and routes to new page
Supports page forward and page re-directs
Navigation Cases
Basic Navigation
 Based on static string outcome
 Based on dynamic outcome
Navigation as the result of an action
 Navigation cases can be defined based on the method returning the outcome
string
How Navigation Targets are Determined
 Pluggable class that handles navigation
 Navigation is based on navigation cases defined in faces-config.xml
 Determine <from-view> element to use
 Exact ViewId match (“/app/public.jsp”)
 Wildcard ViewId match (“/app/*”)
 Default ViewId match (“*”)
 Determine navigation to case lookup
 Elements specifying both from-action and from-outcome
 Elements specifying only from-outcome
 Elements specifying only from-action
 Elements where both elements are null
Programmatic Navigation
 JavaServer Faces pages are virtual component trees
 Navigation cases in JavaServer Faces set a new tree root, the
ViewRoot
 You can programmatically navigate to any page that exist for a JSF
application
 Example code performed in backing bean
 Note: Programmatic Navigation ignores J2EE security constraint
defined for a page in the web.xml
FacesContext currentContext = FacesContext.getCurrentInstance();
ViewHandler vh = currentContext.getApplication().getViewHandler();
UIViewRoot uroot = vh.createView(currentContext,"/app/HRMain.jsp");
FacesContext.getCurrentInstance().setViewRoot(uroot);
Conditional Navigation
Bind command action to Managed Bean or Backing Bean
Return value defines navigation case
No navigation occurs if navigation case doesn’t exist
public String commandButton2_action() {
boolean isManager = FacesContext.getCurrentInstance().
getExternalContext().isUserInRole("manager");
if (isManager){
return "managerview"
}
return "employeeview";
}
Perform Navigation in ADF
Control flow rules are defined in the task flow
A component fires an action event to generate a String
outcome corresponding to the control case from-outcome
The event listener responds by executing navigation
Accessibility
ADF Faces components have built-in accessibility that work
with a range of assistive technologies, including screen readers
ADF Faces accessibility audit rules provide direction to create
accessible images, tables, frames, forms, error messages, and
popup windows using accessible HTML markup
Using Access Key
 Use for input, command, and go components
 Set component attributes:
 accessKey (input, command, or go component):
 <af:goLink text="Home" accessKey="h">
 textAndAccessKey (command or go components):
 <af:commandButton textAndAccessKey="&amp;Home"/>
 labelAndAccessKey (input components):
 <af:inputSelectDate value="Choose date"
labelAndAccessKey="D&amp;ate"/>
 valueAndAccessKey (input components):
 <af:outputLabel for="someid" valueAndAccessKey="Select Dat&amp;e"/>
 <af:inputText simple="true" id="someid"/>
 Can define same access key for multiple components
Lesson Summary
List of Navigation Components
Implement Buttons and Links
Use Breadcrumbs and Navigation Panes
Define Trains
Implement explorer type containers like Menu and Toolbars
Use secondary Windows like Popup, Dialog and Windows
Performing navigation
Add Accessibility compliance using Access Key
15
Ensuring Reusability in Web Applications
Lesson Agenda
Explain the benefits of reusing components
Create and use a resource catalog
Create and use ADF libraries
Use a bounded task flow as a region
Create a page fragment and use it in a bounded task flow
Create and use a page template and task flow template
Create a declarative component and use it on a page
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
Benefits of Reusability
Designing code to be reused has the following benefits:
Increased developer productivity
Fewer bugs—debug once
Consistency:
In functionality
In look and feel
Easier maintainability
Rapid adaptability
Designing for Reuse
 Guidelines:
Use naming conventions to:
 Avoid naming conflicts
 Facilitate identifying the component functionality
Standardize storage by agreeing on:
 Type of repository needed
 Storage and organization
 Access methods
 Make components available for reuse by using:
Resource catalog
ADF library
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Using a Resource Catalog
 Enables application developers to find and incorporate shared
resources, such as libraries containing ADF BC Model Objects,
validators, message bundles, and so on, that were created by other
members of the team
 Provides a federated view of the resources from one or more
otherwise unrelated repositories in a unified search and browse UI
 Enables you to store libraries comprising a common repository that
can be used by the developers building any client application
 Ensures that all application developers use the same business
model without any discrepancies
Using a Resource Catalog
Creating a catalog: Adding resources to a catalog:
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Reusing Components through Library
ADF Library enables you to reuse components:
Package them into ADF Library JAR files
Add them to a resource catalog
Add the library to a project to use its components
Removing an ADF Library from Project
Removed by
Using Resource Palette
Using Project Properties
Restricting BC Visibility in Libraries
Set Library Private property for a business component to true if
you do not want consumers to see the object in the library JAR
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Features of Regions
 Are reusable task flow that represents as part of a page
 They have their own Navigation rules
 They have their own Managed-beans
 They have their own ADFm Page Definition
 Each page within the region is a page-fragment (jsff)
 All of this is provided by the ADF Controller. Very little is handled by View
 Can share information and transaction boundaries with other page content
BATHRSystemIndex.jsf
DepartmentListPF.jsff
EmployeeListPF.jsff
Region-EmployeeList
<af:region>
Region-QuickSearch
<af:region>
QuickSearchPF.jsff
Wrapping a Task Flow as a Region
Drag a bounded task flow to the page as a region:
The default activity is displayed at design
time and is the initial activity that is
displayed at run time:
Regions – View Layer
<af:region> tag creates a region component
BATHRSystemIndex.jsf
<af:region value=“#{…}”/>
RegionModel
processBeginRegion
getViewId
processEndRegion
Regions – View Layer cont.…
 Region Component
Wraps all events coming from child fragment
When event is delivered, sets up context
If viewID changes during event delivery, UIRegion adds itself as a partial
target
BATHRSystemIndex
<af:region/>
Region
EmployeeList.jsff
Broadcast
event
Broadcast
wrapper
Queue
wrapper
Queue
event
Setup context
Test for
navigation
Note: Region does not render any chrome, so the RequestContext.addPartialTarget
method adds the parent component instead
Regions – View Layer cont.…
Features
Automatically convert full page requests issued by the fragment into
partial page requests
To do this the region would have to:
 Render some DOM and render a client component
 Catch the bubbling ActionEvent on the client-side and turn it into a partial page
event
BATHRSystemIndex
<af:region/>
AdfDhtmlRegion
Browse.jsff
Client-side
Queue event
Client-side
Queue action
event
Turn event into
Partial page
event
Regions – Controller Layer
Task Flow Region Model:
Manages the region’s lifecycle
Figures out the correct page fragment to render
Manages the “bindings” EL variable, within the page fragment
BATHRSystemIndex.jsf
<af:region
value=“#{bindings.region1.regionModel}”/>
RegionModel =
TaskFLowRegionModel
processBeginRegion
getViewId
processEndRegion
Regions – Controller Layer cont.…
 Region xml file
 Region navigation rules and managed
beans are stored in an xml file that is read
by the controller
<af:region value=#{bindings.
EmployeeListTF1.regionModel}”/>
BATHRSystemIndex.jsf
<taskFlow id=“EmployeeListTF1“
taskFlowId="/WEB-INF/……..
EmployeeListTF.xm#Emp...“/>
BATHRSystemIndexPageDef.xml
<adfc-config>
<task-flow-definition id=“EmployeeListTF">
<default-activity>EmployeeList</default-activity>
<view id=“EmployeeListPF">
<page>/EmployeeListPF.jsff</page>
</view>
<view id=“EmployeeDetailPF">
<page>/EmployeeDetailPF.jsff</page>
</view>
<control-flow-rule>
<from-activity-id>EmployeeList</from-activity-id>
<control-flow-case>
<from-outcome>detail</from-outcome>
<to-activity-id>EmployeeDetailTF</to-activity-id>
</control-flow-case>
</control-flow-rule>
</task-flow-definition>
</adfc-config>
WEB-INF/EmployeeListTF.xml
EmpList.jsff EmpDetail.jsff
detail
Regions – Controller Layer cont.…
Each page/fragment has
its own PageDefinition
Any Databinding.cpx files
that are packaged with
the region are merged
with the main
DataBindings.cpx
#{bindings…}
HRSystemIndex
<pageMap>
<page path="/EmpList.jsff" usageId=“EmpListPageDef"/>
<page path="/EmpDetail.jsff" usageId=“EmpDetailPageDef"/>
<page path="/HRSystemIndex.jsf" usageId=“HRSystemIndexPageDef"/>
</pageMap>
<pageDefinitionUsages>
<page id=" EmpListPageDef " path=“...pageDef. EmpListPageDef "/>
<page id=" EmpDetailPageDef " path=“pageDef. EmpDetailPageDef "/>
<page id=“HRSystemIndexPageDef" path="pageDef.HRSystemPageDef"/>
</pageDefinitionUsages>
Databinding.cpx
#{bindings…}
EmpList.jsff
#{bindings…}
EmpDetail.jsff
HRSystemIndexPageDef.xml EmpListPageDef.xml EmpDetailPageDef.xml
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Features of Page Fragments
Are built like regular pages
Have page definition files like regular pages do
Are not defined as a full web page
Can be displayed within a page that contains other content
Cannot contain af:document or f:view tags
Cannot be run on their own
Using a Page Fragment on a Page
You can use a page fragment on a page by:
Inserting the jsp:include tag:
 The included page fragment uses the binding context of the consuming page
 Page definition file for page fragment is not loaded (does not use bindings)
Inserting a bounded task flow with page fragments as a region on your
page
 The page fragment can have its own binding context
Modifying the page fragment affects all pages that use it (but
check the overall layout of consuming pages)
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Features of Page Template
Page templates:
 Are reusable single page UI
 Enable consistent look across pages or page fragments
 Are built from standard ADF components
 Cannot be nested
 Use partial page refresh when navigating between pages that use the same
template
 Use three types of files:
 Page-specific definition file (.jspx)
 Definition file for all templates: pagetemplate-metadata.xml
 Application or library file (.cpx)
Contents in Page Templates
Have custom attributes and facets
Consists of
af:pageTemplateDef
af:xmlContent - define attributes and facets
af:facetRef
af:pageTemplate
Tag in jspx to use the template
Page Template Codes
<af:pageTemplateDef var=“attrs“ definition=“Private”>
<af:xmlContent>
<afc:component>
<afc:description/>
<afc:display-name>EmployeeUpdateTemplate</afc:display-name>
<afc:facet>
<afc:facet-name>content</afc:facet-name>
</afc:facet>
<afc:attribute>
<afc:attribute-name>title</afc:attrinute-name>
<afc:attribute>
</afc:component>
</af:xmlContent>
<af:panelGroupLayout id="pt_pgl1" layout="scroll">
<af:train id="pt_t1" value=“#{controllerContext.currentViewPort
.taskFlowContext.trainModel}"/>
</af:panelGroupLayout>
</af:pageTemplateDef>
EmployeeUpdateTemplate.jsf
<af:pageTemplate id=“pt1"
viewId=“…template/EmployeeUpdate
Template.jsf">
<f:facet name=“content">
<af:attribute name=“title"
value=“Employee Update Job"/>
</f:facet>
</af:pageTemplate>
EmployeeUpdateJobPF.jsff
 XmlContent
 Mostly for design time use
 Used by the runtime to type-
convert attributes and validate
required attributes
Page Template Codes cont.…
facetRef
 This is the most complicated part of the pageTemplate
implementation
 The facetRef tags moves a component defined in the template
usage into the template definition
 The facetRef creates a new component which wraps the
relocated component, because:
Components inside the facetRef need to run in the context that they
were defined in; not in the template context
 The facetRef component restores the context to the outside context before lifecycle
methods are run on the child
Page Template Codes cont.…
Events generated by components inside facetRef need to
be delivered in the definition context and not template context
 The facetRef component wraps each event that is queued
<af:panelHeader text="#{attrs.title}">
<af:facetRef facetName=“content"/>
</af:panelHeader>
The facetRef must restore the relocated component prior
to the jsf UIComponentTag execution because otherwise
UIComponentTag will create a new facet component, and
component bindings will fail
Page Templates and Databinding
Page Templates and Databinding:
 <af:pageTemplate> supports a “value” attribute which can be
used to pass in a nested/child pageDefinition into the
pageTemplate
 This nested/child pageDefinition will become the new
“#{bindings}” EL variable for EL expressions inside the
template
 However, for EL expressions outside the template, the
#{bindings} variable must only reference the parent
pageDefinition
Page Templates and Databinding cont.…
<af:pageTemplate id=“pt1"
viewId=“EmployeeUpdateTemplate.jsf“
value=“#{bindings.Child}”>
<f:facet name=“content">
<af:outputText value=“#{bindings.Bar}"/>
</f:facet>
</af:pageTemplate>
<af:pageTemplateDef var="attrs">
<af:panelHeader
text="#{bindings.Header.label}">
<af:facetRef facetName=“content"/>
</af:panelHeader>
</af:pageTemplateDef>
EmployeeUpdateTemplate
EmployeeUpdateJobPFPageDef.xml
Bar
Child
Nested Page Definition
Header
EmployeeUpdateJobPF.jsff
Example: Page Templates
Association of Business Object to Page
 Example 1:
Employee Update Job 1 displayed in Page A
Employee Update Job 2 displayed in Page B
 Example 2:
Employee Update Person 1 displayed in Page X
Employee Update Person 2 displayed in Page Y
 Example 3:
Employee Update Confirm 1 starts from Page M
Employee Update Confirm 2 starts from Page N
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Task Flow Templates
Reusable task flow definition
Reuse by reference or as a copy
Pre-defined input and output
parameters
Can contain common
functionality and settings
Exception handlers
Task flow activity navigation
outline
Use of initializers and finalizers
Visibility settings
 URL accessible
 Visible in ADF Library
Behavior settings
 Train
 Task flow reentry
 Critical
 Data Control sharing
Types of Reusable Components
ADF supports reusing the
following types of components:
Resource catalog
ADF library
Task flows
Regions & Task flow call
Page fragments
Page templates
Task flow templates
Declarative components
Data controls
Business components
Application modules
Declarative Components
 Declarative Components use the same runtime component as PageTemplates
 The design-time creates a new jsp tag handler class and hard codes the attribute and viewId
information into this tag
 The design-time adds registers this new tag in a tld that was created for the user’s
namespace
 The design-time packages up the tld and all supporting files (jsps, tag handler classes) into
an ADF Library jar file
 Declarative components do not support the “value” attribute
<af:pageTemplate id=“pt1"
viewId=“…template/EmployeeUpdateTemplate.jsf">
<f:facet name=“content">
<af:attribute name=“title"
value=“Employee Update Job"/>
</f:facet>
</af:pageTemplate>
pageTemplate Usage
<foo:myTag id=“EmployeeUpdateTemplate"
zip=“94065”>
<f:facet name=“content">
<af:outputText value=“#{attrs.title}"/>
</f:facet>
</foo:myTag>
Declarative Component Usage
Features of Declarative Components
Declarative components:
 Are component definitions that are reusable across applications
 When changed, affect all pages that use them
 Are made up of any number of other components
 Do not have data binding in their definition
 Can be made available for reuse in the Component Palette
 Are defined only at design time in:
One .jspx file for each component
One declarativecomp-metadata.xml file for all declarative components in a
project
Creating a Declarative Component
The JSF Declarative Component dialog box:
Is invoked with New > Web Tier >
JSF/Facelets > ADF Declarative
Component
Creates the <af:componentDef>
tag in .jspx file
Creates metadata
Using a Declarative Component on a Page
To use a declarative component on a page:
Deploy the component’s project as an ADF library JAR file
Add the ADF library to your current project
Select the ADF library from the Component Palette drop-down
list
Select the declarative component and drag it to your page,
providing values for any attributes
Deciding Which Reusable Component to Use
 You can use a page template when you want:
Similar page layout to be used on multiple pages
Similar look on multiple pages
 You can use a bounded task flow when you want to:
Reuse a set of activities and control flows
Use multiple page fragments in a region on a page
Create a portlet from a set of activities and control flows
 You can use a declarative component when you want to:
Use a similar grouping of components on multiple pages or applications
Select the component from the Component Palette
Lesson Summary
Explain the benefits of reusing components
Create and use a resource catalog
Create and use ADF libraries
Use a bounded task flow as a region
Create a page fragment and use it in a bounded task flow
Create and use a page template and task flow template
Create a declarative component and use it on a page
16
Working with Parameters, Scopes and Partial
Page Refresh
Lesson Agenda
Use memory-scoped attributes to store values
Pass values using parameters
Render components using PPR
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
Scopes, Parameters and PPR
Panel Tabbed
showDetailItem showDetailItem
BAT_PSP_Index.jsf
LocationDeptartmentTF EmployeeListTF EmployeeSearchTF
EmployeeCreateTF
EmployeeDetailTF
EmployeeListPF EmployeeSearchPF
EmployeeUpdateTF
EmployeeDetailPF
LocationDepartmentPF
EmployeeCreatePF
EmployeeDetailPF EmployeeUpdatePF
Region TF Call Page Fragment
ADF Faces Functionalities
 Memory scopes
 Scope define lifespan to instantiated ADF objects at runtime
 Scope can be accessed as a java.util.Map from the ADFContext API
 Parameter passing
 Parameters can be passed across task flows, regions and pages
 Partial page rendering (Ajax support)
 When an event on one component causes only another component to be rendered
 Many ADF Faces components have ajax-style functionality implemented natively
 Example: The ADF Faces table component lets you scroll through the table, sort the table
by clicking column header, mark a row or several rows for selection, and even expand
specific rows in the table, all without requiring the page to be submitted to the server
and with no coding needed
Using Memory Scope Attributes
 JSF scopes:
 None
 Application: The object is available for the duration of the application
 Session: The object is available for the duration of the user session
 Request: The object is available from the time an HTTP request is made until a response is
sent back to the client
 Additional ADF Faces scopes:
 Page flow: The object is available for the duration of a single task flow’s lifetime
 View: The object is available until the view ID for the current view activity changes. This
scope can be used to hold values for a given page
 Backing bean: Used for managed beans for page fragments and declarative components
only. Is just like Request Scope. Each page can have multiple fragments or declarative
components and we would want to separate the scope instances from each other.
Using Memory Scope Attributes cont.…
Why use scopes?
Save state of model
Enable passing values to other pages or phases in the same scope
Can be accessed via EL or Java (except Backing Bean)
Memory Scope Duration with a Called Task Flow
Memory Scope Duration with a Region
Accessing Memory Scoped Attribute Values
You can access the scope attributes by using:
EL:
#{applicationScope.applicationScopeVar}
#{sessionScope.sessionScopeVar}
#{requestScope.requestScopeVar}
#{pageFlowScope.pageFlowScopeVar}
#{viewScope.viewScopeVar}
#{backingBeanScope.bacingBeanScopeVar}
Accessing Memory Scoped Attribute Values cont.…
Java code to access memory scoped attribute values:
import oracle.adf.share.ADFContext;
ADFContext.getCurrent()
 .getApplicationScope().get("applicationScopeVar");
 .getSessionScope().get("sessionScopeVar");
 .getRequestScope().get("requestScopeVar");
 .getPageFlowScope().get("pageFlowScopeVar");
 .getViewScope().get("viewScopeVar");
Overview of Parameters
You can use:
Task flow call activity parameters
Task flow parameters
Region parameters
View (page fragment/jsff) parameters
Page (jsf) parameters
You set the parameter values by using expressions (not by just
entering a value)
The goal is increased reusability of pages and task flows
Use Task Flow Parameters
 Task flow parameters are:
 Input parameters to pass a value into a task flow
 Defined in the .xml file for the task flow (You can use the Property
Inspector for the task flow.)
Job of the Task Flow Parameter
Stores input value in a page-flow-scoped attribute:
Pass a Value to a Task Flow
 Define an input parameter on the task flow call activity
 Define an input parameter on the called task flow
Return Values to a Calling Task Flow
To return a value, you must specify:
Return value definitions on the called task flow
Return values on the task flow call activity in the calling task flow
Names must match
Use Region Parameters
Region parameters are:
Input parameters to pass a value into a region on a page
Stored in the binding container for the page
Defined in the Structure window or Property Inspector for a
page definition file:
Job of Region Parameter
Passes the value from the page to its task flow:
Job of View Activity Parameter
Populates the page-flow-scoped attribute expected by the
page:
Use Page Parameters
Page parameters are:
Output parameters to pass a value from a page
Stored in the binding container for the page
Defined in the Structure window or Property Inspector for a
page definition file
#{bindings.nameToPass}
Job of the Page Parameter
Receives a value and stores it in a parameter in the binding
container:
Develop a Page Independently of a Task Flow
Page not aware of the task flow’s page-flow-scoped attribute:
Passing a Value to a Region
Page Fragment
View activity
parameter
Task flow
parameter
Region
parameter
Page parameter
Containing Page
Region
Task Flow
View Activity/
Define in page def file
Define in task flow .xml file
Deciding the Usage of Parameter
Parameters are designed to:
Improve reusability
Encapsulate functionality
You can use more than one type of parameter to achieve these
goals
Features of Partial Page Rendering
 Is enabled by ADF Faces
 Enables redrawing only a portion of a page
 Requires server round-trip:
Rerenders only a portion of the server-side component tree
Downloads only the appropriate fragment of HTML
 Implements certain ADF Faces patterns
Single component refresh
Cross-component refresh
 Can be enabled declaratively or programmatically
Features of Partial Page Rendering cont.…
PPR  AJAX
Update the page without refreshing the whole page
Common Examples
LOV dialog – call pop-up LOV, return selected value into calling page
Scrolling through a results table
Expanding a tree control
Partial Page Rendering Attributes
Explicit PPR attributes:
partialSubmit – Used by commandItems
autoSubmit – Used by input items / lists etc.
partialTriggers – All components
PPR - partialSubmit
Lets a link execute server code without posting the whole page
In this case to pop up an informational page
<af:link text=“Detail” action=“detail”
useWindow="true"
partialSubmit="true"/>
PPR - autoSubmit
 For a valueHolder such as a inputText or checkbox, posts the
change to the as soon as it is made – e.g. on navigation out or
selection
 Common uses:
Changing the UI based on a field value
Instant validation
<af:selectOneChoice
value="#{bindings.ServiceRequeststatus.inputValue}"
label="#{bindings.ServiceRequeststatus.label}"
autoSubmit="true"
id="status">
PPR - partialTriggers
 Refresh this item if that item changes / submits
Includes extra UI elements in the PPR process that "need to know" about
the change
Example: If the value of field a changes to "X" disable this field
 Partial Triggers attribute lists component ids that the component is
"watching"
A single component can watch multiple components
Multiple components can watch a single component
 Caution sometimes the parent container has to watch not the
component itself e.g. menus
Partial Triggers Example
 Enable / disable date input when selectOneChoice value changes
 Disabled is re-evaluated when selectOne changes
<af:selectOneChoice
value="#{bindings.ServiceRequeststatus.inputValue}"
label="#{bindings.ServiceRequeststatus.label}"
autoSubmit="true"
id="status">
<af:selectInputDate value="#{bindings.assignedDate.inputValue}"
label="#{bindings.assignedDate.label}"
partialTriggers="status"
binding="#{backing_SREdit.assignedDate}"
disabled=
"#{bindings.ServiceRequeststatus.inputValue==2}"
validator="#{backing_SREdit.assignedDateValidator}">
Conditional Rendering
You can use EL for any of a component’s attributes
Example of setting attributes with EL:
<af:selectOneChoice value="#{bindings.CardTypeCode.inputValue}"
label="#{bindings.CardTypeCode.label}"
partialTriggers="PaymentType"
rendered="#{bindings.PaymentTypeCode.inputValue == 'CC'}">
<f:selectItems value="#{bindings.CardTypeCode.items}"/>
</af:selectOneChoice>
Conditional Rendering cont.…
 JSF components have a Rendered property that can be set with EL
 Reference a method in a managed bean with EL to conditionally
render a component
#{sessionScope.sessionScopeVar=='3'}
Enabling Automatic PPR
To enable automatic PPR:
Select a binding in the page definition file
Set ChangeEventPolicy to ‘ppr’
Lesson Summary
Use memory-scoped attributes to store values
Pass values using parameters
Render components using PPR
17
Responding to Beans, Events and Listeners
Lesson Agenda
 Configure and use managed beans
 Explain the different types of events
 Handle action, value change and phase events using corresponding
listener
 Configure managed bean to contain listener
 ADF Life Cycle Phases
 Validate UI using Validators
 Converters
 Understand contextual events to coordinate regions
 Programmatically call Partial Page Rendering
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Managed and Backing Beans (L 17)
 Event and Listener Handling (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
Adding UI Code
Managed beans:
Are configured in the adfc-config.xml or other task-flow.xml file
Consist of Plain Old Java Objects (POJOs), Lists, and Maps
Have a no-argument constructor
Use lazy initialization by JavaServer Faces framework “as
needed”
Registering Existing Java Classes as Managed Beans
Use the Overview tab of the task flow.
Configuring Managed Beans
Entry in HREmployeeListTF.xml:
<managed-bean id="__1">
<managed-bean-name>employeeListBean</managed-bean-name>
<managed-bean-class>…beans.HREmployeeListBean</managed-bean-class>
<managed-bean-scope>backingBean</managed-bean-scope>
</managed-bean>
 Skeleton for new managed bean:
Context Objects
 FacesContext:
 Is a static class that provides access to information such as application messages,
renderer kits, ViewRoots, ExternalContext, and so on
 Represents the current request that is processed
 ExternalContext:
 Provides access to the world outside JSF
 ADFFacesContext:
 Is a context object to support ADF Faces–specific functionality:
 Partial page rendering (PPR)
 Skinning
 Oracle Help
 Dialog framework support
Referencing Managed Beans
Use in Expression Language on JSF Page:
 Use in Java code:
<af:outputText binding="#{employeeListBean.mvRichOutputText}”/>
Holding Values in Managed Beans
Managed beans are optional and can be used to:
Hold values
Store state
How?
Managed properties
Memory-scoped attributes
Using Managed Bean Properties
Managed bean attributes that are exposed through the getter
and setter methods
Configured in the .xml file of the task flow
Possible values:
Null
Literal string
Lists and Maps
Value binding expression (EL)
About Managed Beans
Managed beans are optional and can be used to
Store state (e.g. information about the authenticated user)
Execute Java routine, e.g. on button pressed
Define handler for Event Listeners
Managed beans ≠ Backing Beans
Backing beans contain getter/setter methods for UI components
Relationships Between Managed Beans
Managed beans can access other beans
Beans in scope … Can access beans in scope …
None Application Session Request
None YES NO NO NO
Application YES YES NO NO
Session YES YES YES NO
Request YES YES YES YES
Map Example
HashMap as managed bean
<managed-bean>
<managed-bean-name>MyBookmarksMap</managed-bean-name>
<managed-bean-class>java.util.HashMap</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<map-entries>
<map-entry>
<key>Oracle Fusion Middleware</key>
<value>http://oracle.com/middleware</value>
</map-entry>
<map-entry>
<key>Oracle ADF</key>
<value>http://oracle.com/adf</value>
</map-entry>
</map-entries>
</managed-bean>
Nested Properties
 Nested values like “foo.bar” are not supported in managed
properties
 Work around: Use the combination of two managed beans
<managed-bean>
<managed-bean-name>myBean</managed-bean-name>
<managed-bean-class>package.MyBean</managed-bean-class>
<managed- bean-scope>session</mananged-bean-scope>
<managed-property> <property-name>foo</property-name>
<value>#{fooBean}</value> </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>fooBean</managed-bean>
<managed-bean-class>package.FooBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property> <property-name>bar</property-name>
<value>Hello World</value> </managed-property>
</managed-bean>
About Backing Beans
 Backing Beans are Managed Beans, but Managed Beans are not
necessarily Backing Beans
 JavaBeans that are associated with (bound to) UI components in a
page
 Can be used to programmatically modify properties on UI
components
 Can have methods defined that associate functionality with
components, e.g.
Validation
Event handling
Navigation
Creating Managed Beans
1. Double click on button and
select backing bean or choose to create
new managed bean
2. Browse for existing Java
class or create new class
3. Search class
4. Select class
5. Create method
6. Bean automatically gets configured
In <task_flow>.xml
Automatic Backing Bean Creation in JDeveloper
 JDeveloper “auto-binding” options
 Don’t use auto-binding
 Use auto-binding
 Bind to existing Managed Bean
 Auto-binding creates instance variable and
accessor methods
for each page UI component
 Instance variable names are not meaningful
 Refactor names through ID
property in Property Inspector
 Configures Managed Bean in faces-config.xml
Demonstrating Events and Listeners
Motivation
 There are two varieties of user interface events
 Events that start back-end processing
 Events that affect only the format of the user interface
 JSF categorizes code that handles these as action controllers and event
listeners
 Action controllers handle main form submission
 Fire after bean has been populated (see last section)
 Fire after validation logic (see upcoming section)
 Return strings that directly affect page navigation
 Event listeners handle UI events
 Often fire before bean has been populated
 Often bypass validation logic
 Never directly affect page navigation
JSF Event Model
 The JSF event model is based on the event model defined by the
JavaBeans specification where the event is represented by a
specific class
 An event source object fires an event by calling an event
notification method on event listener objects registered to receive
the event, passing a reference to the event object as a notification
method argument
 Developers can write their own event listener implementations, or
reference a backing bean method using Expression Language
 Events are queued on the server and executed at the end of the
“Apply Request Value” Phase
Describing Types of Events
 Action events
Occur when a command component is activated, such as when a user clicks
a button or a link
Return a control flow outcome
 Value change events
Occur when the local value of a input component changes, such as when a
user selects a check box
Are used for managing UI elements
 Phase events
Execute as part of the JSF and ADF life cycle
Can be used to augment standard behavior
Other ADF Faces Server Events
The Property Inspector of ADF Faces components displays
appropriate event listeners:
Types of Event Listeners
 ActionListener
 Fired by submit buttons, image maps, and hypertext links with attached JavaScript
 <h:commandButton value="..." .../>
 <h:commandButton image="..." .../>
 <h:commandLink .../>
 Automatically submit the form
 ValueChangeListener
 Fired by combo boxes, checkboxes, radio buttons, textfields, and others
 <h:selectOneMenu .../>
 <h:selectBooleanCheckbox.../>
 <h:selectOneRadio .../>
 <h:inputText .../>
 Do not automatically submit the form
Using Listeners
 ActionListener was attached to button
 Form was automatically submitted when clicked
 ValueChangeListener is attached to combobox, listbox, radio button,
checkbox, textfield, etc..
 Form not automatically submitted
 Need to add JavaScript to submit the form onclick="submit()" or
onchange="submit()"
 Event incompatibility between Netscape and IE
 Netscape, Mozilla, and Opera fire the onchange events when the combobox selection changes,
radio button is selected, or checkbox is checked/unchecked
 Internet Explorer fires event after selection changes, but only when another GUI control
receives the input focus
 Older IE versions behave differently! Test on multiple browsers!
Responding to Action Events
 Command components raise action events
 Code to respond to the action event can be in the backing bean or
external class
 Stub code is generated by JDeveloper on demand
 The action is registered in the page source
 Action events are called in the Invoke Application phase of the life
cycle
 Action methods are the last to execute after other listeners, such as
valueChange events
Action Listener
 Listener is usually in the form bean class
 But can be in separate class if you use FacesContext to get the request or session object and
look up the form bean explicitly
 Takes an ActionEvent as an argument
 No return type (not String as in action controllers)
 ActionEvent is in javax.faces.event
 ActionEvent has a getComponent method that lets you obtain the UIComponent
reference
 From the UIComponent, you can get the component ID, renderer, and other low-level
information
 Sample code
public void someMethod(ActionEvent event) {
doSomeSideEffects();
}
Creating Action Methods
 To create an action method:
Invoke the action binding editor
Select an existing bean and a method, or create new
 JDeveloper:
If the bean does not exist, creates Java class and registers as a managed
bean
If the method does not exist, creates a method stub in the managed bean
class
Adds the method to the action property of component
 Add your own code
 Action methods return a String outcome
Action Listeners Vs Action Method
Action listeners differ from action methods:
 Action listeners:
 Contain code to respond to an action
 Do not return a value
 Execute after value change listeners
 Action methods:
 Are used for navigation
 Return a String outcome
 Execute last
 Fired by submit buttons, image maps, and hypertext links with attached JavaScript
 <h:commandButton value="..." .../>
 <h:commandButton image="..." .../>
 <h:commandLink .../>
 Automatically submit the form
Responding to Value Change Events
Input components raise value change events
Code for the value change listener can be in the backing bean
or external class
Stub code is generated by JDeveloper
The value change event is registered in the page source
Value change events are processed in the Invoke Application
phase of the life cycle
Value change events fire before action events
Value Change Listener
 Register a backing bean method with the component in the
Property Inspector
 Create method signature in backing bean
 Select ValueChangeListener property in Property Inspector
 The following markup gets created
public void myComponent1ValueChange(ValueChangeEvent event){
Object src = event.getSource();
CoreSelectOne comp = (CoreSelectOneChoice) event.getSource());
… }
<af:selectOneChoice value="#{bindings.(…)}"
…
valueChangeListener="#{backing_test2.myListBoxValueChanged}">
Creating Value Change Listener
Select the input component in the visual editor
Edit the valueChangeListener property and select a
bean and method, or create a new one
JDeveloper:
Creates the method in the managed bean if it does not already exist
Adds the method to the valueChangeListener property in the
page source
Add your code
Creating a Custom ValueChangeListener
 Custom listeners provide the benefit of better code reuse
 Create Java class that implements “ValueChange Listener” interface
 Value Change Events are handled in Process Validations phase
 Drop ValueChangeListener element from Component Palette JSF
Core in to e.g. input textfield
 Select ValueChangeListener tag element in Structure Pane and set
“type” property to your custom Listener Class
<h:inputText binding="#{backing_publicPageBean.messageTextInput}"
id="messageTextInput" rendered="true">
<f:validateLength maximum="10" minimum="0"/>
<f:valueChangeListener type="oracle.jsf.sample.MyValueChangeListener"/>
</h:inputText>
Using Value Change Listeners
 ActionListener was attached to button
 Form was automatically submitted when clicked
 ValueChangeListener is attached to combobox, listbox, radio button,
checkbox, textfield, etc..
 Form not automatically submitted
 Need to add JavaScript to submit the form onclick="submit()" or
onchange="submit()"
 Event incompatibility between Netscape and IE
 Netscape, Mozilla, and Opera fire the onchange events when the combobox selection changes,
radio button is selected, or checkbox is checked/unchecked
 Internet Explorer fires event after selection changes, but only when another GUI control
receives the input focus
 Older IE versions behave differently! Test on multiple browsers!
Event and Listener Execution Order
Following is the order in which the events and listeners fire:
Validator (managed bean method that performs validation on
the component’s value)
Value change listener (managed bean method to handle value-
change events)
Action listener (managed bean method to handle action
events)
Action method (managed bean method to return a logical
outcome String that is used in navigation)
ADF Faces Enhanced Event Handling
ADF Faces adds to JSF event handling by providing:
Partial page rendering (PPR)
JavaScript
Enabling PPR Programmatically
Why?
Need logic to determine whether a component should refresh
Refresh should occur on only one of several events that a triggering
component may fire (for example, on row selection in table, use a
selection listener)
How? Use the addPartialTarget method
ADFFacesContext.getCurrentInstance().addPartial
Target(employeeList.getMvRichOutputText());
Overview of Contextual Events
Using Contextual Events
Characteristics of the Contextual Event Framework
Contextual events:
Provide a way to coordinate regions
Can be invoked and consumed only by method action of a data
control
Producer and consumer may be the same or different data
controls
The root component
broadcast events to
execute action listener
and action methods
JSF Life Cycle: Phases
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
Component Tree
restored or created
~ Submitted form values stored
in component.
~ Component values converted
Component values validated
~ Component values bound to
backing bean properties
~ Component can update model
Component Tree is
created from backing
bean properties
JSF Life Cycle: Restore View Phase
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
A request comes in through the JSF servlet.
The request is examined for the viewId
to load; viewId is bound to a page.
viewId is used by the framework to look
up the components of the page.
• If it is the first time a page is requested, the
framework creates the component tree for this
page.
• If the page has been requested before, the
component tree gets reassembled.
The current viewId is saved in the
viewRoot property of FacesContext.
JSF Life Cycle: Apply Request Values Phase
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
The JSF components are retrieved from the
JSF context.
Component values are updated with the
values in the request parameter.
If a component’s immediate property is
set to true, conversion occur within this
step, and value change events fire.
JSF Life Cycle: Process Validations Phase
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
The request parameter values are
converted to the expected data types.
Validation is performed for each
component value, where immediate is
not set to true.
Value change events fire.
JSF Life Cycle: Update Model Values Phase
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
Until this step, the request only updated the
components, setting their submittedValue
property.
Now, the model (Managed Beans or in the ADF
case, the binding container) is updated with
the validated values.
JSF Life Cycle: Invoke Application Phase
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
The Invoke Application phase manages any
forms that the page submits and executes
any business logic. It also processes any
action events that are fired and evaluates
any navigation actions that need to execute.
JSF Life Cycle: Render Response Phase
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
The Render Reponse phase
prepares the view for display.
Using the immediate Attribute
 This attribute is available as a property on UI components.
 Components that have immediate set to true are
evaluated in the Apply Request Values phase.
 Use case: Enforce a component to be evaluated before others.
 The life cycle continues if no error is found.
 No updated model data is available.
 To access user-provided input, call getSubmittedValue().
 The developer has the option to short-circuit the JSF life
cycle:
 A ValueChangeEvent runs before validation is performed.
 Use ValueChangeListener to call the Render Response
phase.
 Update the model manually only if needed.
 Use case: Cancel button that should navigate to another page
without submitting the data
Restore View Render Response
Apply Request Values
Update Model Values
Invoke Application
Process Validations
Initial request
Postback
Client/ Browser
Process Events
Process Events
Process Events
Process Events
No View Available
Immediate = true
ADF Faces Functionality: ADF Life Cycle Phases
JSF and ADF Life Cycle Phases
JSF Phases ADF Phases Events
Restore View JSF Restore View before(JSF Restore View)
after(JSF Restore View)
Init Context
before(Init Context)
after(Init Context)
Prepare Model before, after
Apply Request Values JSF Apply Request Values before, after
Process Validations JSF Process Validations before, after
Update Model Values JSF Update Model Values before, after
Validate Model Updates before, after
Invoke Application JSF Invoke Application before, after
Metadata Commit before, after
Render Response JSF Render Response before, after
Only after navigation
Init Context
before, after
Only after navigation
Prepare Model
before, after
Prepare Render before, after
Describing JSF and ADF Life-Cycle Roles
 The JSF life cycle handles presentation:
Submission of values on the page
Validation for components
Navigation
Displaying the components on the resulting page
Saving and restoring state
 The ADF life cycle handles data:
Preparing and updating the data model
Validating the data at the model layer
Executing methods on the business layer
Life Cycle Controls
Controls whether updates should occur
Makes sure updates happen
Causes validation of updates
Handles Model events: create, update, delete, and any custom
events
Dispatches the action forward to the next page or action
Phase Identifiers
PhaseId.ANY_PHASE
PhaseId.APPLY_REQUEST_VALUES
PhaseId.PROCESS_VALIDATIONS
PhaseId.UPDATE_MODEL_VALUES
PhaseId.INVOKE_APPLICATION
PhaseId.RENDER_RESPONSE
PhaseId.RESTORE_VIEW
Phase Listener
 Execute custom functions at a specific time during the request
processing lifecycle
 getPhaseId is called by the JSF framework to register the
custom PhaseListener
 PhaseListener is registered in faces-config.xml
public class BATLifeCycleListener implements PhaseListener{
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
public void beforePhase(PhaseEvent event) {
System.out.println("START PHASE " + event.getPhaseId());
}
public void afterPhase(PhaseEvent event) {
System.out.println("END PHASE " + event.getPhaseId());
}
}
ViewHandler
Pluggable mechanism to provide custom handling of the
activities in the Render Response and Restore View phases of
the request processing lifecycle
This allows for implementations to support different response
generation technologies, as well as alternative strategies for
saving and restoring the state of each view
Good place to add custom security handling
Configured in faces-config.xml
Custom ViewHandler can decorate default ViewHandler
Example Usage of Phase Listener
BATHRSystemLab_16 uses “BATLifecyclePhaseListener” to
customize ADF error messages
Localize error messages
Suppress JBO-<error> prefix
Raise custom exception for known error so that error stack is not
further processed
Register the Listener in faces-config.xml
<lifecycle>
<phase-listener>bat.ui.BATLifecyclePhaseListener</phase-listener>
</lifecycle>
JSF Lifecycle Example - Initial
1. Restore View
UI Component Tree
RichPanelHeader
RichPanelGroupLayout
RichPanelFormLayout
RichInputText
RichInputDate
6. Render Response
JSF Lifecycle Example - Postback
1. Restore View
2. Apply Request Values
richInputText.setSubmittedValue(“Steven”)
richInputDate.setSubmittedValue(“04-12-2012”)
JSF Lifecycle Example - Postback
1. Restore View
2. Apply Request Values
3. Process Validations
•Validate and convert (if needed) name and date
•Call richInputText.setValue() with converted value
if valid
•Clear submittedValue
•Queue valueChange event (if applicable)
1. Restore View
value=“#{viewScope.HelloBean.name}
2. Apply Request Values
3. Process Validations
4. Update Model
•Call HelloBean.setName with component value
•Call HelloBean.setDate with component value
•Clear submitted and (local) component value
value=“#{viewScope.HelloBean.date}
JSF Lifecycle Example - Postback
JSF Lifecycle Example - Postback
1. Restore View
2. Apply Request Values
actionListener=“#{viewScope.helloBean.sayHello}
3. Process Validations
4. Update Model
5. Invoke Application
•Call HelloBean.sayHello
JSF Lifecycle Example - Postback
1. Restore View
2. Apply Request Values
3. Process Validations
4. Update Model
5. Invoke Application
6. Render Response
Validation
 We can add validation so that when a user edits or enters data in a field
and submits the form, the data is validated against any set rules and
conditions. If validation fails, the application displays an error message
 ADF Faces provides the following types of validation:
 UI component attributes
 Default ADF Faces validators
 Custom ADF Faces validators
 Use ADF Faces validation to provide immediate feedback to users, instead
of waiting for commit
 You should always define equivalent validation at the business component
level
Validation Approaches
 Manual validation
 Use string properties for bean
 Do validation in setter methods and/or action controller
 Return null to redisplay form
 Create custom error messages
 Implicit automatic validation
 Use int, double, etc.. bean properties. Or add required.
 System redisplays form if there is conversion error
 Use h:message to display field-specific error message
 Explicit automatic validation
 Use f:convertNumber, f:convertDateTime, f:validateLength, f:validateDoubleRange, or f:validateLongRange
 System redisplays form if failure; use h:message again
 Custom validators
 Extend Validator, override validate, register in faces-config.xml
Manual Validation
 Setter methods convert from strings
 Use try/catch blocks
 Use application-specific logic
 Action controller checks values
 If values are OK
 Returns normal outcomes
 If values are missing or illegal
 Stores error messages in bean
 Returns null
 Input Form
 Displays error messages
 Error message should be empty string by default
 In h:outputText, use escape="false" if error messages contain HTML tags
Implicit Automatic Validation
 Define bean properties to be simple standard types
 int, long, double, boolean, char, etc..
 System attempts to convert automatically in same manner as with jsp:setProperty
 I.e., Integer.parseInt, Double.parseDouble, etc..
 If there is conversion error, form redisplayed
 And error message stored
 You can also add required attribute to any input element to indicate that empty values are
errors
 Use h:message to display error messages
 h:message returns empty string if there is no message
 h:message accepts styleClass for CSS style name
 Add immediate attribute to bypass validation
 E.g., for h:commandButton with logout or cancel operation
Explicit Automatic Validation
 Define bean properties to be simple types
 int, long, double, boolean, char, etc..
 Add f:validateBlah or f:convertBlah elements
 System checks that fields follow restrictions
 f:validateBlah attributes let you control format
 If there is validation error, form redisplayed
 And error message stored
 Other approaches stay the same
 You can still add required attribute to any input element to indicate that empty values are errors
 Still use h:message to display error messages
 h:message returns empty string if there is no message
 Still add immediate attribute to bypass validation
 E.g., for h:commandButton when implementing logout or cancel operation
Example of Explicit Validation
<h:form>
<TABLE>
<TR>
<TD>User ID:
<h:inputText value="#{bean.userID}“ id="userID">
<f:validateLength minimum="5" maximum="6"/>
</h:inputText>
</TD>
<TD> <h:message for="userID“ styleClass="RED"/> </TD>
</TR>
<TR>
<TD>Keyword:
<h:inputText value="#{bean.keyword}“ id="keyword">
<f:validateLength minimum="3"/>
</h:inputText>
</TD>
<TD><h:message for="keyword“ styleClass="RED"/></TD>
</TR>
Creating Custom Validation Method
 Use validator attribute in the component on which you have to validate
 The attribute takes a method name as an attribute
 <h:inputText … validator=“#{somebean.validatorMethod}”/>
 The validator method should have the following signature
public void inputText_validator(FacesContext
facesContext, UIComponent uiComponent, Object object)
{
// Add event code here...
}
 JDeveloper gives a way automatically creating the validator methods
Custom Validation Components
Create a class that implements the Validator interface
(javax.faces.validator.Validator)
Implement the validate method
Register your custom validator in the faces-config.xml file
Use the <f:validator/> tag in your JSPs
UI Validation
Managed beans:
Are configured in adfc-config.xml or other task flow .xml
file
Consist of Plain Old Java Objects (POJOs), Lists, and Maps
Have a no-argument constructor
Use lazy initialization by JavaServer Faces framework “as
needed”
Input Validation
 Use input validation to
Avoid “garbage-in-garbage-out” applications
Block bad user input
Avoid attacks
Avoid misuse of form fields
 JavaServer Faces and ADF provide the following options for
validation
ADF binding validation
JSF validator components
Backing bean "coded" validation
Additional ADF Faces Validators
ADF Faces provides additional validators for
Date RangeValidator
RegularExpression Validator - (Example [^0-9]{1,10})
ByteLength Validator
ADF Faces validators support client-side validation through
Javascript
<af:inputText
value="#{bindings.DepartmentName.inputValue}”>
<af:validateRegExp
noMatchMessageDetail="Value not allowed"
pattern="[^0-9]{1,10}"/>
</af:inputText>
Creating Backing Bean Validation in JDeveloper
Backing Bean Validation Example Code
public void validateDepartmentId(FacesContext facesContext, UIComponent uiComponent,Object
object) {
String expr = "[^0-9]{1,10}"/>";
Pattern p = Pattern.compile(expr);
Matcher m = p.matcher((String)object);
//write message if input is invalid
if (!m.find()){
facesContext.addMessage("RegExError",new FacesMessage(
FacesMessage.SEVERITY_ERROR, "InvalidValue Provided
for Deptno",null));
facesContext.getApplication().getViewHandler().
restoreView(facesContext,"/Dept.jsp");
}
}
JSF Conversion
javax.faces.BigDecimal javax.faces.convert.BigDecimalConverter
javax.faces.BigInteger javax.faces.convert.BigIntegerConverter
javax.faces.Boolean javax.faces.convert.BooleanConverter
javax.faces.Byte javax.faces.convert.ByteConverter
javax.faces.Character javax.faces.convert.CharacterConverter
javax.faces.DateTime javax.faces.convert.DateTimeConverter
javax.faces.Double javax.faces.convert.DoubleConverter
javax.faces.Float javax.faces.convert.FloatConverter
About Converters
 All web input and output is a string
 Converters translate objects into strings and vice versa
 Values that cannot be converted cause an error message
Standard errors are defined and can be overridden
 Converters can be used as programmatic format masks
 If no converter is explicitly defined for a component, the JSF
framework will select one. Basic converters used in such a cases
are:
 BigDecimal
 Big Integer
 Short
 Double
 Character
 Integer
 Float
 Long
 Boolean
 Byte
ADF Faces Converters
Converters provided by ADF Faces in addition to the JavaServer Faces
converters:
 ColorConverter
Converts string values to colors and vice versa
Uses RGB value codes
 DateTimeConverter
Converts an strings to and from java.util.Date objects
Supports timezones through settings in adf-faces-config.xml. Timezone
defaults to GMT
 NumberConverter
Extends JavaServer Faces NumberConverter functionality
Custom Converters
Implement the Converter interface (a.k.a.
javax.faxes.convert.Converter)
Implement the getAsObject method, which converts a field
(string) into an object (for example, PhoneNumber)
Implement the getAsString method, which converts an
object (for example, PhoneNumber) into a string
Register your custom converter in the Faces context
Insert the converter into your JSPs with the <f:converter/> tag
Step 1: Implement the Converter interface
import javax.faces.convert.Converter;
public class PhoneConverter implements Converter { ... }
Step 2: Implement the getAsObject method
public class PhoneConverter implements Converter{
public Object getAsObject(FacesContext context, UIComponent component,
String value)
{
}
}
Step 3: Implement the getAsString method
public String getAsString(FacesContext context, UIComponent component, Object
value){
return value.toString();
}
Custom Converters
Step 4: Register custom converter with faces context
<converter>
<converter-id>suwega.PhoneConverter</converter-id>
<converter-class>com.suwega.converters.PhoneConverter</converter-class>
</converter>
<converter>
<converter-for-class>com.suwega.value.PhoneNumber</converter-for-class>
<converter-class>com.suwega.converters.PhoneConverter</converter-class>
</converter>
Step 5: Use the converter tag in your JSPs
<h:inputText id="phone" value="#{UserRegistration.user.phone}">
<f:converter converterId=“suwega.PhoneConverter" />
</h:inputText>
Custom Converters
Lesson Summary
 Configure and use managed beans
 Explain the different types of events
 Handle action, value change and phase events using corresponding
listener
 Configure managed bean to contain listener
 ADF Life Cycle Phases
 Validate UI using Validators
 Converters
 Understand contextual events to coordinate regions
 Programmatically call Partial Page Rendering
18
Binding Model Layer with Business Services and
Databound View
Lesson Agenda
Explain output, input, selection and List Of Values components
Implement data bound components like table and trees
Bind method call
Stretch data view components
Data visualization components
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
ADF Faces Functionality: ADF Faces Components
 Layout Components: (12)
 Navigation Control Components: (14)
 Menu and Toolbar: (14)
 Secondary Windows Layout: (14)
 Text and Selection Comps: (18)
Output Comps*
Input Comps*
List-of-Values (LOV) Comps*
 Data Views: (18)
Collection-Based Comps*
Specialty Display Comps*
 Advance Data Visualization
Comps* (18)
 Data Query Components (19)
Chart
Graph
Gauge
NBox
Pivot Table
Map
Gantt
Timeline
Hierarchy
Viewer
Sunburst
Diagram
*Comps = Components
ADF Faces Components
 Text and Selection Components:
 Output Component
 Output Text, Message, Image, Icon, Media, Progress Indicator, Status Indicator and Carousel
 Input Component
 Input Text, Input Number, Form, Rich Text Editor, File Upload, Color Chooser, Date Chooser and
Code Editor
 Selection
 Boolean selection: Select Boolean Checkbox, Select Boolean Radio
 Single Selection: Select One Radio, Select One Listbox, Select One Choice
 Multiple Selection: Select Many Checkbox, Select Many Listbox, Select Many Choice, Select Many
Shuttle, Select Order Shuttle, Slider (range)
 List-of-Values (LOV) Component
 Input List of Value and Input Combobox List of Value
ADF Faces Components cont.…
Data Views:
Collection-Based
 Table
 Tree
 Tree Table
 List View
 Carousel
Specialty Display
 Calendar Component
Data Visualization:
Graph
Chart
Gauge
NBox
Pivot Table
Pivot Filter Bar
Geographic Map
Thematic Map
Gantt Chart
Timeline
Hierarchy Viewer
Tree Map
Sunburst
Diagram
Output Components
With output components, you can:
Display text, messages, icons and images
Play audio and video files
Output Components
Output Text:
The outputText component can be used as a child to many other
components to display read-only text
When you need the text to be formatted, you can use the
outputFormatted component
Output Components
Message:
Messages can typically be divided into two types:
Error messages that display when an error occurs in the application,
for example when a user enters incompatible information
Informational messages to display more detailed information
Output Components
Image:
Use the image component to display images
Icons:
Renders an icons
Output Components
Media:
The media component displays media content such as audio, video or
image in a player embedded in the user agent
Output Components
Progress Indicator:
It can be used to give users an understanding
that there is a back end task in progress
Status Indicator:
Used to display a busy/idle status indicator that
displays the status of ppr activity
Output Components
Carousel: (12c feature)
Displays a spinning series of items based on rows of a collection
model
Output Components: Additional Functionalities
Once you have added these components to your page, you may
find that you need to add functionality such as drag and drop
and accessibility
Using parameters in text: You can use the ADF Faces EL format
tags if you want text displayed in a component to contain
parameters that will resolve at runtime
Conversion: In some cases, a value may need to be converted
to a string in order to display
Output Components: Additional Functionalities
cont.…
Drag and drop: You can configure a page so that a user can
drag and drop output components or values of output
components, to another area on a page
Localization: Instead of entering values for attributes that take
strings as values, you can use property files. These files allow
you to manage translation of these strings
Skins: You can change the look and feel of output components
by changing the skin
Input Components
Input components accept user input in a variety of formats.
The most common formats are text, numbers, date, and
selection lists that appear inside a form and are submitted
when the form is submitted. The entered values or selections
may be validated and converted before they are processed
further
Input Components
Input Text:
the inputText component is the basic input component for entering
values
Input Number:
There are two types of input number components:
 Input Number Spinbox: Used to enter numbers and it has a spinbox to quickly
increment or decrement the number
 Input Number Slider: The inputNumberSlider component has one marker and
allows the user to select one value from the slider
Input Components
Rich Text Editor:
An input control for richly formatted text
Input Components
File Upload:
The inputFile component is a component that can be used to upload a
file. It supports displaying a label, text and messages
Color Chooser:
The inputColor component allows users to pick a color from a palette
Input Components
Date Chooser:
The inputDate component presents a text input field for entering
dates and a button for picking dates from a popup calendar
Input Components
Code Editor:
The af:codeEditor component provides an in-browser code editing
solution and enables the user to display and edit program code at
runtime in the Fusion web application
Input Components: Selection components
Selection Components:
The selection components allow the user to select single and multiple
values from a list or group of items
The select components are categorized into three types as shown in
the following list:
 Boolean Selection
 Single Selection
 Multiple Selections
Selection components: Boolean Selection
Boolean selection: Components of this type provide a user
with two states: either true or false
selectBooleanCheckbox
 The selectBooleanCheckbox component value must always be set to a boolean
and not an object
 selectBooleanRadio
 The selectBooleanRadio component displays a boolean
choice, and must always be set to a boolean. Unlike the
selectBooleanCheckbox component, the selectBooleanRadio
component allows you to group selectBooleanRadio
components together using the same group attribute
Selection components: Single-Selection
Single selection:
Components of this type present multiple values and expect a single
value to be selected
In order to present multiple options, these components have to
nest f:selectItems, f:selectItem or af:selectItem
You can also create items programmatically by creating a list
of javax.faces.model.SelectItem
Selection components: Single-Selection
The components that are included in this category:
 selectOneRadio
 This component to create a list of radio buttons from which the
user can select a single value from a list
 selectOneListbox
 This component allows the user to select a single value from a list
of items displayed in a shaded box
 selectOneChoice
 It creates a menu-style component, which allows the user to
select a single value from a dropdown list of items
Selection components: Multiple Selection
Multiple selections
Like single selection components, these components present multiple
values and expect multiple values to be selected
The components that are included in this category are:
 selectManyCheckbox
 It is used to create a list of checkboxes from which the user can select one or more values
Selection components: Multiple Selection
 selectManyListbox
 It allows the user to select many values from list of items
 selectManyChoice
 This component creates a menu-style dropdown component, which allows the user to select
multiple values from a dropdown list of items
Selection components: Multiple Selection
 selectManyShuttle
 It allows user can select a single item or multiple items to
shuttle between the leading (Available values) list box and
the trailing (Selected values) list box
 selectOrderShuttle
 This component additionally includes up and down arrow
buttons that the user can use to reorder values in the
Selected values list box
Input Components: Additional Functionalities
Once you have added an input component or form to your page, you may
find that you need to add functionality such as validation and accessibility
 Using parameters in text: You can use the ADF Faces EL format tags if you
want text displayed in a component to contain parameters that will resolve
at runtime
 Client components: Input components can be client components
 JavaScript APIs: All input components have JavaScript client APIs that you
can use to set or get property values
 Events: Input components fire both server-side and client-side events that
you can have your application react to by executing some logic
Input Components: Additional Functionalities
cont.…
 Can add validation and conversion to input components
 Can display tips and messages, as well as associate online help with input
components
 There may be times when you want the certain input components to be
validated before other components on the page
 If other components on the page to update based on selections, make from a
selection component
 Use the scrollComponentIntoViewBehavior tag with the richTextEditor
component to allow users to jump to specific areas in the component
 Can change the icons used for required and changed notifications using skins
 Can make your input components accessible
List-of-Values (LOV) Components
 ADF Faces provides two list-of-values (LOV) input components that
can display multiple attributes of each list item and can optionally
allow the user to search for the needed item
 These LOV components are useful when a field used to populate an
attribute for one object might actually be contained in a list of
other objects, as with a foreign key relationship in a database
 Example: suppose you have a form that allows the user to edit
employee information. Instead of having a separate page where
the user first has to find the employee record to edit, that search
and select functionality can be built into the form
List-of-Values (LOV) Components cont.…
Input List Of Value:
 The inputListOfValues component uses the ListOfValues model you
implemented to access the list of items
Input Combobox List Of Value:
 It allows a user to select a value from a dropdown list and populate the LOV
field, and possibly other fields, on a page
List-of-Values Components:
Additional Functionalities
Once you have added a list-of-value component to your page,
you may find that you need to add functionality such as
validation and accessibility
Client components: Components can be client components
JavaScript APIs: All list-of-value components have JavaScript
client APIs that you can use to set or get property values
Events: List-of-value components fire both server-side and
client-side events that you can have your application react to
by executing some logic
List-of-Values Components:
Additional Functionalities cont.…
 You can add validation and conversion to list-of-values components
 You can display tips and messages, as well as associate online help
with list-of-values components
 There may be times when you want the certain list-of-values
components to be validated before other components on the page
 You may want other components on the page to update based on
selections you make from a list-of-values component
 You can change the appearance of the components using skins
 You can make your list-of-values components accessible
List-of-Values Components:
Additional Functionalities cont.…
 Instead of entering values for attributes that take strings as values,
you can use property files. These files allow you to manage
translation of these strings
 The LOV components use the query component to populate the
search list
 Other list components, such as selectOneChoice, also allow users
to select from a list, but they do not include a popup dialog and
they are intended for smaller lists
 If your application uses ADF Model, then you can create
automatically bound forms using data controls (whether based on
ADF Business Components or other business services)
Defining a List
You can define a list:
At the model layer
In the UI
Select a Date
Date attributes are automatically created as af:inputDate
components:
Data Views: Collection-based Components
Collection-based Components:
These components can be used to iterate through and display
collections of structured data
Instead of containing a child component for each record to be
displayed, and then binding these components to the individual
records, these components are bound to a complete collection, and
they then repeatedly render one component by stamping the value
for each record
Example: an outputText component
Collection-based Components
Table:
Table is used to display tabular data. It also supports selection (both
single and multiple), sorting and record navigation
Using Tables
ADF Faces table component adds to JSF table by providing
Column sorting
and reordering
Column resize
Column move
Data
filtering
Row selection
(single or
multiple rows)
There are many formatting options for ADF tables
Setting Table Attributes
Type Description Attribute(s) Setting(s)
Grid Lines
(table attribute)
Lines separating cells verticalGridVisible
horizontalGridVisible
true or false
Banding
(table attribute)
Alternating background colors rowBandingInterval
columnBandingInterval
Number of rows or columns you want to
be in each band
Column or row
headers
Labels for columns or rows header facet or headerText
attribute
Text to display in header
rowHeader column attribute true or false
Column groups Common label for group of
columns
To group columns, nest af:column tags, using the outer af:column tag as
the group, and the inner tags as the columns within the group.
Column formatting Align, wrap, width, height Align nowrap
width, height
start,end,left, right, center, true or false
number or %
Row selection Selection of single or multiple
rows
rowSelection single or multiple
Collection-based Components
Tree:
Tree component displays hierarchical data, such
as organization charts or hierarchical directory
structures
In data of these types, there may be a series of
top-level nodes, and each element in the
structure may expand to contain other elements
Collection-based Components
Tree Table:
Display hierarchical data in a table
Combine features of trees and tables
Using Table Model Methods in a Selection Listener
You can do the following programmatically:
Make row current: setRowIndex() or setRowKey()
Access data in the current row: getRowData()
Obtain number of rows: getRowCount()
Determine whether you are at the end of the table:
isRowAvailable()
Using Tree Model Methods in a Selection Listener
You can do the following programmatically:
Determine whether a row has children: isContainer()
Access children of current row: enterContainer()
Revert to parent collection: exitContainer()
Collection-based Components
List component:
Instead of using a table with multiple columns, you can use the
listView and listItem components to display structured data in a
simple table-like format that contains just one column
The listView component with
a listItem component
Organizing Items
 Organizing labels & fields:
af:panelFormLayout
Specify the # of columns and rows per column
Can configure labelWidth and fieldWidth
Typically contains af:input* and af:select* components
For other kinds of content, use af:panelLabelAndMessage if:
 Don’t have a label, or
 Need multiple fields per label
Use af:group if you need to separate sections
 Bulleted or ordered lists
af:panelList
Collection-based Components:
Additional Functionalities
Once you have added a collection-based component to your page, you may
find that you need to add functionality such as validation and accessibility
 Customizing the toolbar: You can customize the toolbar included in the
panelCollection component, which provides menus, toolbars, and status
bars for the table and tree table components
 Geometry management of the table width: If the table is a child to a
component that stretches its children, then this width setting will be
overridden and the table will automatically stretch to fit its container
 Active data: If your application uses active data, then you can have the
data in your tables and trees update automatically, whenever the data in
the data source changes
 Accessibility: You can make your components accessible
Collection-based Components:
Additional Functionalities cont.…
 Events: Collection-based components fire both server-side and client-side
events that you can have your application react to by executing some logic
 Partial page rendering: You may want a collection-based component to
refresh to show new data based on an action taken on another component
on the page
 Personalization: Users can change the way the component displays at
runtime (for example the user can reorder columns or change column
widths), those values will not be retained once the user leaves the page
unless you configure your application to allow user customization
 Automatic data binding: If your application uses the Fusion technology
stack, then you can create automatically bound tables and trees based on
how your ADF Business Components are configured
Specialty Display Components
Calendar:
Calendar component provides the user the ability to view a calendar
and the activities by day, week, month or list views
Data Visualization Components (DVT)
Data Visualization Component:
ADF Data Visualization components
provide significant graphical and
tabular capabilities for displaying and
analyzing data
Using Data Visualization Components
Common features:
Design time creation by using:
Data Controls panel
JSF visual editor
Property Inspector
Component Palette
Live data preview at design time
Support for data binding
Chart
NBox
Gauge
Graph
Hierarchy Viewer
Data Visualization Components: Examples
13 - 38
Geographic
map
Pivot table
Gantt chart
Data Visualization Components: Examples
Pivot Filter
Thematic Map
Time Line
Tree Map
Sunburst Diagram
Data Visualization Components:
Additional Functionalities
Once you have added a data visualization component to your page, you may
find that you need to add functionality such as validation and accessibility
 Partial page rendering: You may want a data visualization component to
refresh to show new data based on an action taken on another component
on the page
 Personalization: Users can change the way the data visualization
components display at runtime, those values will not be retained once the
user leaves the page unless you configure your application to allow user
customization
 Accessibility: By default, data visualization components are accessible. You
can configure your application pages with data visualization components to
be accessible to screen reader users
Data Visualization Components: Additional
Functionalities cont.…
 Touch devices: When you know that your ADF Faces application will be run on
touch devices, the best practice is to create pages specific for that device
 Skins and styles: You can customize the appearance of data visualization
components using an ADF skin that you apply to the application or by applying
CSS style properties directly using a style-related property (styleClass or
inlineStyle)
 Placeholder data controls: If you know the data visualization components on
your page will eventually use ADF data binding, but you need to develop the
pages before the data controls are ready, then you should consider using
placeholder data controls, rather than manually binding the components. Using
placeholder data controls will provide the same declarative development
experience as using developed data controls
AJAX with PPR
Additional event types include AJAX events:
Freeze Columns
Delete and Insert Rows
Run and Test the Page
Run the page
Test the functionality
Lesson Summary
Explain output, input, selection and List Of Values components
Implement data bound components like table and trees
Bind method call
Stretch data view components
Data visualization components
19
Querying Data with Search Components
Lesson Agenda
Query search
Quick query components
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
ADF Faces Functionality: ADF Faces Components
 Layout Components: (12)
 Navigation Control Components: (14)
 Menu and Toolbar explorer-type
containers: (14)
 Secondary Windows Layout: (14)
 Text and Selection Components: (18)
 Data Views: (18)
 Advance Data Visualization
Components (18)
Data Query Components (19)
Query and
Quick Query
Query Search Component
Query:
The query component provides the user the ability to perform a query
or personalize saved searches
Advanced mode query with dynamically added search criterion
Creating Query Search Form
Drag a named criteria from the Data Controls panel:
Modifying Query Behavior
You can set properties that affect query behavior:
On the model’s view criteria
On the query in the UI
Quick Query Component
Quick query:
Has a selectable list of attributes to search on
Has a single search criterion input field
Can have a link to more advanced search capabilities, with switching
implemented in a managed bean
Query Components: Additional Functionalities
Once you have added a query or quick query component to your page, you may
find that you need to add functionality such as validation and accessibility
 All query components have JavaScript client APIs that you can use to set or get
property values
 You can display tips and messages, as well as associate online help with query
components
 You can change appearance of the components using skins
 You can make your query components accessible
 Instead of entering values for attributes that take strings as values, you can use
property files. These files allow you to manage translation of these strings
 If your application uses ADF Model, then you can create automatically bound
search forms using data controls (whether based on ADF Business Components
or other business services)
Schematic Representation of a Query Process
Lesson Summary
Query search
Quick query components
20
Implementing Transactions
Lesson Agenda
Describe ADF BC transaction handling
Implement task flow transaction control
Handle transaction exceptions
Define response to the browser’s Back button
Enable the save for later functionality
Functionalities of ADF Faces
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management
(Lesson 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax
support) (Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
 ADF Model support (Lesson 21)
Handling Transactions with ADF BC
Application modules handle transaction and concurrency
support
No coding is required unless you want to customize the default
behavior
For nested application modules, the outermost application
module provides the transaction context for the others
Default ADF Model Transactions
Operations
Sharing Data Controls
Data control scopes:
 Shared (default): Called flow shares data
control (AM) instances with calling flow
<data-control-scope>
<shared/>
</data-control-scope>
 Isolated: Called flow has unique instance
of data controls (AM)
<data-control-scope>
<isolated/>
</data-control-scope>
Transaction Scope
Transaction Scope:
With isolated data control scope each
TF has own transaction
With shared data control scope,
transaction is shared by default, but can
be changed using Transaction setting
Using Data Control and Transaction Scopes
Limits reuse options!
Isolated transactions needed for dynamic tabs
Shared transaction needed for child region
Handling Transaction Exceptions
You should designate an exception handling activity on
transactional task flows
Can be any activity type, such as:
View: To display a message
Router: To call a method depending on the type of exception
Designating an Exception Handler Activity
Transaction Support Features of Bounded Task
Flows
Saving for Later
Enabling Explicit Save for Later
Save for later task flow
Contains button
that performs
save for later
Calls
createSavePoint
to add a
save-point-id
Contains field for
user to enter
save-point-id to
pass to restore
activity
Restores
application state
and data to what
was captured in
save-point-id
Enabling Implicit Save for Later
To enable implicit save for later:
Change a setting in adfc-config.xml
Mark the task flow as critical
Restoring Save Points
A Save Point Restore activity:
Restores the state of the application
Deletes the savepoint from its persistence store
Optionally performs additional logic with a Save Point Restore
Finalizer
Is required in applications that are responsible for restoring
save-point-id (not necessarily the same application that was
saved for later)
Setting Global Save for Later Properties
Set properties in the adfc-config.xml file:
savepoint-expiration
savepoint-manager
savepoint-datasource
enable-implicit-savepoints
Create and CreateInsert
The Create operation performs the following code:
// 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);
In addition, the CreateInsert operation performs:
// insert new row into view object's default rowset
yourViewObject.insertRow(newRow);
Defining Response to the Back Button
The Task Flow Reentry property
determines whether the user can
return to an exited task flow by
clicking the browser’s Back button:
reentry-allowed: OK
reentry-not-allowed: Throws
exception
reentry-outcome-dependent:
Depends on the outcome from exited
task flow
Lesson Summary
Describe ADF BC transaction handling
Implement task flow transaction control
Handle transaction exceptions
Enable the save for later functionality
Define response to the browser’s Back button
21
Understanding Data Controls and Bindings
Lesson Agenda
Importance of model
Types of data controls
Types of data bindings
ADF Configuration files
Data binding using Expression Language (EL)
ADF binding class hierarchy
Refresh Binding Executables
ADF Faces Functionalities
 Internationalization (Lesson 11)
 Skinning (Lesson 11)
 Active Geometry Management (L 12)
 Advance Page Flow and Task Flow
(Lesson 13)
 Navigation (Lesson 14)
 Accessibility (Lesson 14)
 Reusability using Templating and
Declarative Component (L 15)
 Memory Scopes (Lesson 16)
 Parameter Passing (Lesson 16)
 Partial Page Rendering (Ajax support)
(Lesson 16)
 Event and Listener Handling (L 17)
 Managed and Backing Beans (L 17)
 Enhanced Lifecycle (Lesson 17)
 Drag and Drop Data Binding (L 18)
 Advance Databound Search
Capability (Lesson 19)
 Transaction Management (L 20)
ADF Model support out-of-
the-box (21)
Client-Server Architecture
Server
Relational Data Legacy Data
Data
Services
ADF Swing Swing Office
EJB POJO
Toplink Hibernate Tuxedo
Client
Model View Controller (MVC) Architecture
Model
View
Controller
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
JSF JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet
BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
JSF/OAFwk
ADF BC
Server
The Need for a Standard
There is no standard way to bind data from any user interfaces
to any business services
Developers create their own integration layers
Vendors have implemented different solutions
Integrating components from different vendors requires
learning and coding
Tech-Stack of ADF
Metadata
Services
JDeveloper
Model (JSR227)
View
Controller
Business Services
Relational Data XML Data Packaged Apps
Legacy Data
Data
Services
ADF Faces
JSF/ADFc/Taskflow
ADF Model /Binding Context /Data Binding
ADF
BC
JSP
Struts
ADF Swing Swing Office
ADFdi
EJB
Web
Services
POJO
Toplink Hibernate Portlet BI
XML
Web / Wireless Rich Client / Desktop
User Actions Modify View
ViewController/
User Interface
Project
Model/ Service
Project
Model
Presentation
Layer
v
m
bc
BAM
BPL
JSF
Benefits of the Standard
Client code contains no references to the business service
Better design practice
Code is more maintainable
Decouples presentation layers and business service layers
Allows tools to build application
using declarative implementation of metadata service
without code generation
Allows implementation of support for any business service and
any user interface
ADF Faces
ADF Binding Layer
Model
(JSR227)
Business
Services
Application Module/ Services
Data Control
/Binding Context
ADF BC
Binding Container / Bindings
View
Controller
/Data Binding
ADFm
 Provides public interfaces of
business services
 Gives access to service layer
 Defines all the bindings for a page by
connecting UI components to data or
actions and data control
 Created automatically when a data-
bound component is added to a page
 Maps pages to page definitions
 Declares data control usages
 Binds page components to
data without writing any code
ADF Faces
Types of Data Controls
Model
(JSR227)
Business
Services
Data
Control
/Binding Context
Binding Container / Bindings
View
Controller
/Data Binding
ADFm
Data
Control
Data
Control
Data
Control
Data
Control
Web Services
(REST/SOAP)
EJB POJO URL
ADF BC BI Essbase BAM
Data
Control
Data
Control
Data
Control
Default Data Control Functionality
Data Control
Type
Supports
Transactions?
Supports
Sorting?
Supports
Updates?
ADF BC Yes Yes Yes
EJB No Yes Yes
Java Bean No Yes No
Web Services No No No
URL No Yes No
Example
Types of Bindings
Model
(JSR227)
Business
Services Application Module/ Services
/Binding Context
ADF BC
View
ADFm
#{Binding Expression}
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
…
…
…
…
…
ADF Faces/ JSF/ JSFF/ JSPX
Binding Container /
/Data Binding
#{bindings.DepartmentName.hints.label}
Data Control
Bindings
Types of Bindings: Source View
Model
(JSR227)
Business
Services Application Module/ Services
/Binding Context
ADF BC
View
ADFm
<af:inputText value=“#{bindings.DepartmentName.inputValue}” label =“#{bindings.DepartmentName.hints.label}”
ADF Faces/ JSF/ JSFF/ JSPX
Binding Container / /Data Binding
Data Control
<executables>
<iterator id="Department1Iterator"
DataControl="HRSystemAMDataControl"
Binds="Department1"/>
</executables>
<bindings>
<attributeValues IterBinding="Department1Iterator“ id="DepartmentName">
<AttrNames> <Item Value="DepartmentName"/> </AttrNames>
</attributeValues> ...
</bindings>
Bindings
Example
Example
ADF Faces
ADF Configuration and Metadata Files
Model
(JSR227)
Business
Services
Application Module/ Services
Data Control
/Binding Context
ADF BC
Binding Container /
<pagename>.jsf /.jspx*
<pagename>PageDef.xml*
View
Controller
/Data Binding
ADFm
ViewController/ User
Interface Project
(<ViewController>.jpr)
Model/ Service
Project (<Model>.jpr)
<ApplicationModuleName>.xml
bc4j.xcfg
DataControls.dcx
DataBindings.cpx
<Model>.jpx
web.xml
adfc-config.xml
faces-config.xml (ADFBindingFilter)
trinidad-config.xml
<task-flow-definition>.xml
adfm.xml
Web Configuration Files
Data Binding Files
Data Control Files
Presentation
Layer
Application
Configuration
Files
adf-config.xml
ADF Configuration Files
adf-settings.xml
* Denotes multiple files of
this type may exist in
the project
 Solid lines indicate
hierarchy of metadata
--> Dotted lines indicate
references to objects in
the ADF binding context
Metadata
Services
JDeveloper
Bindings
ADF Faces
ADF Binding Control: Run Time
Model (JSR227)
Business Services
Application Module/ Services
Data Control
/Binding Context
ADF BC
Binding Container
<pagename>.jsf /.jspx*
<pagename>PageDef.xml*
View
Controller
/Data Binding
ADFm
<ApplicationModuleName>.xml
bc4j.xcfg
DataBindings.cpx
web.xml(ADFBindingFilter)
adfm.xml
Web Configuration Files
Data Binding Files
Data Control Files
* Denotes multiple files of
this type may exist in the
project
 Solid lines indicate
hierarchy of metadata
--> Dotted lines indicate
references to objects in
the ADF binding context
/ Bindings
ADF Binding Control: File Hierarchy
web.xml
<filter>
<filter-name>adfBindings</filter-name>
</filter>
adfm.xml
<MetadataDirectory> …
</MetadataDirectory>
DataBindings.cpx
<Application >
</Application>
<pagename>.jsf /.jspx*
<af:xxx
</af:xxx>
<ApplicationModuleName>.xml
bc4j.xcfg
<BC4JConfig>
</BC4JConfig>
<pagename>PageDef.xml*
<pageDefinition>
</pageDefinition>
<filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
<DataBindingRegistry path=".../DataBindings.cpx"/>
<dataControlUsages>
<BC4JDataControl id=“<amname>“ Configuration=“<AM>Local”…/>
</dataControlUsages>
<pageDefinitionUsages>
<page id="<pagename>PageDef" path=“<pkgname>“/>…
</pageDefinitionUsages>
<AppModuleConfigBag> <AppModuleConfigname=“<AM>Local”>…
<ViewUsage Name=“<voname>” ViewObjectName=“<ViewObject>”/>
value="#{bindings.<Attribute>.inputValue}“
columns="#{bindings.<Attribute>.hints.displayWidth}"
label="#{bindings.<Attribute>.hints.label}“
<executables>
<Iterator id=“<voname>Iterator” Binds=”<voname>”/> …
</executables>
<bindings>
<… <IterBinding=“<voname>Iterator”>… /> …
</bindings >
Model
(JSR227)
Business
Services
View
Controller
Example
Creating Page Definition Bindings
 In the Bindings section, click on the +
icon.
 The Insert Item wizard opens and will
list all the bindings options for the page
definition file as shown in the following
screenshot:
 Click on the action item; this will open a
Binding for Action palette.
 Select the
EmpDirectoryModuleDataControl
option; this will populate the Operation
section with the Commit operation.
 Click on the OK button and binding
creation is complete.
ADF Region Architecture
Architectural View Of The Use Case
Implementation
web.xml
adfm.xml
DataBindings.cpx DataControls.dcx
PageDef.xml
ADF Binding Validation
 Validator is declaratively added to ADF attribute
 Validation rule is enforced on server
Control Hints and Validation
 Declarative validation rules for data
controls and bindings
Consistent interface for common validation
Extensible for complex application
validation
Metadata based
 Control hints for data controls and
bindings, including:
Labels
Date and currency formatting
ADF Binding Using Expression Language (EL)
JavaServer Faces pages can create value bindings to the ADF
binding container (pageDef) using EL accessing the “bindings”
object
The “bindings” object is created by the ADF servlet filter that is
defined in the web.xml file
The ADF servlet filter is mapped to *.jsf, *.jsff, *.jsp and *.jspx
file types
#{bindings.DepartmentName.inputValue}
Expression Language (EL) and Bindings
 Databinding expressions are written using EL
 Evaluated at runtime to determine what data to display
 ADF EL expressions typically have the form:
 #{bindingVariable.BindingObject.propertyName}
Refers to the binding
object in the container
of the current page
It is an ID for the bindingObject
in the container of the page
(PageDefinition)
It sets the values
for the binding
Objects at runtime
<af:inputText
value=“#{bindings.DepartmentName.inputValue}”
label=“#{bindings.DepartmentName.hints.label}”
required=“#{bindings.DepartmentName.mandatory}”/>
EL Expression
example:
Using Expression Language (EL)
Use Expression Builder to declaratively create EL expressions.
Immediate EL Syntax: ${}
 It is evaluated immediately.
 It can be used only within template text or as the value of a JSP tag
attribute.
<fmt:formatNumber value="${sessionScope.cart.total}"/>
 Code example: The JSP value attribute references the EL that gets
the total price from the session-scoped bean named cart. The JSP
engine evaluates the expression, converts it, and passes the
returned value to the tag handler.
 Immediate evaluation expressions are always read-only value
expressions. The example can only get the total price from the cart
bean; it cannot set the total price.
Deferred EL Syntax: #{}
 It is evaluated at other phases of the page life cycle as defined by the
technology that uses the expression (JSF).
<h:inputText id="name" value="#{customer.name}" />
 Code example: The JSF value attribute references the EL that points to the
name property of the customer bean.
 First request: #{customer.name} is evaluated during the Render Response
phase of the life cycle. EL gets the value of name from the customer bean, as is
done in the immediate evaluation.
 Postback: JSF evaluates the expression at different phases of the life cycle, during
which the value is retrieved from the request, validated, and propagated to the
customer bean.
 Deferred EL can be value expressions that can be used to read and write
data.
Programmatic Expression Language
Programmatic Expression Language cont.…
Class Files in Programmatic Approach
Model
(JSR227)
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container /
/Data Binding
Data Control
oracle.adf.model.BindingContext
bctx = BindingContext.getCurrent();
oracle.adf.model.binding.DCBindingContainer
bctr = bctx.getCurrentBindingsEntry();
oracle.adf.model.binding.DCIteratorBinding
itrb = bctr.findIteratorBinding("ViewObject1Itr");
oracle.binding.OperationBinding
oprb = bctr.getOperationBinding(oprName);
oracle.adf.model.binding.DCControlBinding
valb = bctr.getControlBinding(valuename);
oracle.adf.model.binding.DCDataControl
dc = bctr.findDataControl(“MyAMDataControl”);
Bindings
*
1
1
*
1
*
0..*
1
0..*
1
1
*
*
1
ADF Binding Class Hierarchy
BindingContext
BindingContainer
DCDataControl DCBindingContainer
DCIteratorBinding
DCControlBinding ControlBinding
JUIteratorBinding
JUControlBinding OperationBinding AttributeBinding
getCurrentBindingsEntry() 1
*
1
*
1
*
1
*
1
*
1
*
1
*
0..*
1
0..*
1
0..*
1
0..*
1
findDataControl()
findIteratorBinding()
getOperationBinding() getControlBinding()
getAttributeBindings()
findCtrlBinding()
getDataControl()
getApplication()
getDCIteratorBinding()
getIteratorBinding()
Prefix Package
DC* oracle.adf.model.binding
JU* oracle.jobo.uicli.binding
Others oracle.adf.model or
oracle.binding
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container
/Data Binding
Data Control
Bindings /
ADF Binding Class Hierarchy cont.…
JUControlBinding
JUCtrlTreeBinding
JUCtrlListBinding
JUCtrlHierBinding
JUCtrlRangeBinding JUCtrlAttrsBinding
JUCtrlValueBinding JUCtrlActionBinding
Prefix Package
DC* oracle.adf.model.binding
JU* oracle.jobo.uicli.binding
Others oracle.adf.model or
oracle.binding
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container
/Data Binding
Data Control
Bindings /
DCControlBinding
ADF Binding Class Diagram
Programmatic Approach of Binding
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container
/Data Binding
Data Control
Bindings /
Programmatic Approach of Binding
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container
/Data Binding
Data Control
Bindings /
Programmatic Approach of Binding cont.…
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container
/Data Binding
Data Control
Bindings /
Programmatic Approach of Binding cont.…
/Binding Context
ADFm
Value bindings
 Attribute binding
 List binding
 Table binding
 Tree binding
Iterator bindings
 Iterator
 Method iterator
 Accessor iterator
 Variable iterator
Action bindings
 Operation binding
 Method binding
Binding Container
/Data Binding
Data Control
Bindings /
JUCtrlActionBinding
Implements actions on BC4J RowIterator to which this control is bound. This class supports the
following actions:
 ACTION_EXECUTE Executes the ViewObject query.
 ACTION_NEXT Moves the currency to the next row.
 ACTION_PREVIOUS Moves the currency to the previous row.
 ACTION_FIRST Moves the currency to the first row.
 ACTION_LAST Moves the currency to the last row. mAction = action;
 ACTION_RESET Resets the currency to the beginning of the RowIterator.
 ACTION_REMOVE_CURRENT_ROW Removes the current row in this iterator.
 ACTION_CREATE_INSERT_ROW Creates a new row and insert it into this iterator before the current
row.
 ACTION_COMMIT_TRANSACTION Commits all changes in the current BC4J application module
session into database.
 ACTION_ROLLBACK_TRANSACTION Rolls back any changes in the current BC4J application module
session.
Specify When to Refresh Binding Executables
Refreshing the iterator reconnects the binding with the
RowSetIterator object.
Refreshing the invoke action binding invokes the action.
You can set the Refresh property to determine when to
refresh
Specify Whether to Refresh Binding Executables
Set RefreshCondition to an EL expression evaluating to
true (default) or false.
Example: A search page that initially shows no data has iterator
binding with settings:
 RefreshCondition="#{!adfFacesContext.isInitialRender}"
(false when page is first rendered)
Refresh="renderModel"
Task Flow and ADF Life Cycle
 Regions are refreshed when the parent page is displayed.
 Bindings are refreshed based on property values.
 Even components that are not initially displayed are initialized.
 EL expression values of the RefreshCondition attribute are
evaluated during the Prepare Render phase of the life cycle.
default: The region is refreshed only once.
ifNeeded: The region is refreshed only if there has been a change to the
task flow binding parameter values.
 If the “bindings” variable is used within the EL expression, the
context refers to the binding container of the parent page.
Declarative Control over Individual Page Life Cycle
 Executables:
Iterator bindings
invokeAction
 Refresh attribute values:
ifNeeded: Fires both during the Prepare Model and Prepare Render
phases
prepareModel: Fires only during the Prepare Model phase
renderModel: Fires only during the Prepare Render phase
 RefreshCondition expression: Boolean expression, which
controls whether the executable should fire at all
Lesson Summary
Importance of model
Types of data controls
Types of data bindings
ADF Configuration files
Data binding using Expression Language (EL)
ADF binding class hierarchy
Refresh Binding Executables
22
Programmatically
Customizing Business Services
Lesson Agenda
Using business component client APIs
Implement programmatic modifications
Implement method validation
Generate Java classes for business components
Add service methods to an application module
Handle transactions
Create a test client
Types of Programmatic Customization of ADF
Business Component
Use ADF Business Component APIs
Programmatically customizing entity object (EO)
Programmatically customizing view object (VO)
Programmatically customizing application module (AM)
Programmatically accessing business component objects from
Java client
Types of Programmatic Customization:
Business Component APIs
Using ADF Business Component APIs
Programmatically customizing entity object (EO)
Programmatically customizing view object (VO)
Programmatically customizing application module (AM)
Programmatically accessing business component objects from
Java client
Using ADF Business Component APIs
 Provides prebuilt code in two main packages:
oracle.jbo.server
oracle.jbo
 Server interfaces in the oracle.jbo.server package include:
Entity Object
 Client interfaces in the oracle.jbo package include:
Application Module
View Object
Row
(But NOT Entity)
Relationship among ADF BC Objects
Set Of
Defines Query
to Produce
Class Diagram of ADF BC
EntityDefinition
ApplicationModule
ViewCriteriaRow
RowSetIterator
Key
ViewCriteria
RowSet
Row
ViewObject
StructureDef
AttributeHints
AttributeDef
Entity Key
Transaction
Table
Rows
Set Of
Can Be Filtered Using
Query by Example
Iterates Rows in
Group Of
Uses Transaction
Contains Data Model Instances
Identified By
HasUIHints
Identified By
Represents
Row in and
Encapsulates
Validation For
Manages
Associated To
Linked To
RELATED_TO
Uses Attributes From
1
0..1
1
1
1
*
1
*
*
*
*
*
* 1
0..1
*
0..1
*
0..1 *
1
*
1
1
1
*
0..1
*
Defines
Mapping To
Delegates Storage and
Validation To
0..1
*
File Structure of ADF BC
Application Module
---------------------------
Data Model
View Object
XML
Definition
XML
Definition
Entity Object
XML
Definition
Custom
AMImpl
AM
Base Class
Custom
VOImpl
VO
Base Class
EO
Base Class
Custom
EOImpl
DB
DB
DB
1 *
References
Extends
References
Extends
References
Extends
ADF Business Components
oracle.jbo.server.ApplicationModuleImpl
oracle.jbo.server.EntityImpl
oracle.jbo.server.ViewObjectImpl
XML-Only Component
on a Framework Extension Class
The ComponentClass attribute is read at run time to identify
the Java class.
Custom Java Component
on a Framework Extension Class
The YourServiceImpl class inherits its base behavior from
the CustomAppModuleImpl framework extension class
Types of Programmatic Customization:
Entity Objects
Use ADF Business Component APIs
Programmatically customizing entity object (EO)
Programmatically customizing view object (VO)
Programmatically customizing application module (AM)
Programmatically accessing business component objects from
Java client
Ingredients of an Entity Object
Programmatically Customizing Entity Object (EO)
Default metadata - <EntityObjectEO>.xml
Java classes (generate)
Programmatically customizing default behavior (within EO)
Business rules
Override methods
Programmatic operations (from outside EO)
Placement of entity operations
CRUD operations
Programmatically Customizing EO:
Default Metadata
 Default metadata -
<EntityObjectEO>.xml
 Java classes (generate)
 Programmatically customize default
behavior (within EO)
Business rules
Override methods
 Programmatic operations (from outside
EO)
Placement of entity operations
CRUD operations
Programmatically Customizing EO:
Java Classes
 Default metadata
<EntityObjectEO>.xml
 Java classes (generate)
 Programmatically customize
default behavior (within EO)
Business rules
Override methods
 Programmatic operations (from
outside EO)
Placement of entity operations
CRUD operations
Generating Entity Java Classes
To generate a Java class:
On the business component editor’s Java page, click Edit
Select the classes to generate
Select Classes Extend… to extend custom base class
Generated Entity Java Classes
 <EntityEO>Impl.java:
 Is the entity class
 Represents a row
 Provides getter and setter methods
 <EntityEO>CollImpl.java:
 Represents the cached set of rows from the entity
 Is not usually necessary for the user to modify or
override methods in this class
 <EntityEO>DefImpl.java:
 Is the entity definition class
 Represents the whole entity
 Can be used to modify the entity definition
Programmatically Customizing EO:
Default Behavior
 Default metadata -
<EntityObjectEO>.xml
 Java classes (generate)
 Programmatically customizing default
behavior (within EO)
Business rules
Override methods
 Programmatic operations (from outside
EO)
Placement of entity operations
CRUD operations
Programmatically Customizing Default Behavior
Programmatically customizing default behavior (within EO)
Business rules
 Method Validation
Override base class methods
Examples:
 initDefaults() to initialize PK with DBSequence
 remove() and doDML() to delete a row
 beforeCommit(), validateEntity(), etc.
Programmatically Customizing Default Behavior:
Business Rules
Programmatically customizing default behavior (within EO)
Business rules
 Method Validation
Override base class methods
Examples:
 initDefaults() to initialize PK with
DBSequence
 remove() and doDML() to delete a row
 beforeCommit(), validateEntity(), etc.
Business Rule: Method Validation
1
2
3
Programmatically Customizing Default Behavior:
Override Methods
Programmatically customizing default behavior (within EO)
Business rules
 Method Validation
Override base class methods
Examples:
 initDefaults() to initialize PK with
DBSequence
 remove() and doDML() to delete a row
 beforeCommit(), validateEntity(), etc.
…
Override Method: Some Useful Methods
Operation Explanation
setAttribute(): For example, if the attribute is Empno,
the setter will be setEmpno().
This method is used to set the attribute information for an entity object.
getAttribute(): For example, if the attribute is Empno,
the setter will be getEmpno().
This method is used to get the attribute value of an entity object.
create() This is used to create a new entity object.
initDefaults() The defaulting logic for an entity object can be added to this method.
validateEntity() This method is used to validate an entity.
beforeCommit() Logic that has to be applied before committing the record is added in this
method.
afterCommit() Logic that has to be applied after committing the record is added in this
method.
remove() This method is used to remove an entity object.
doDML() This method is used to perform operations based on the DML operations
INSERT, UPDATE, and DELETE.
Override Method:
Assigning Primary Key using a Database Sequence
In EmployeeEOImpl.java override the initDefaults() method
Programmatically assigning values from database generated
sequence to primary key
Override Method:
Updating Deleted Flag Instead of Deleting Rows
Overriding the remove() and doDML() methods:
// In <EntityObjectEO>Impl.java
public void remove() {
setDeleted("Y");
super.remove();
}
protected void doDML(int operation, TransactionEvent e) {
if (operation == DML_DELETE) {
operation = DML_UPDATE;
}
super.doDML(operation, e);
}
Programmatically Customizing EO: Operations
Default metadata - <EntityObjectEO>.xml
Java classes (generate)
Programmatically customizing default behavior (within EO)
Business rules
Override methods
Programmatic operations (from outside EO)
Placement of entity operations
CRUD operations
Programmatic Operations on EO
 Programmatic operations (from outside EO)
Placement of entity operations
CRUD operations
 Read (Find) entity object
 By primary key
 By traversing association from
» Master entity to detail entity
» Detail entity to master entity
 Through view object
 Update (modify) entity object
 Delete (remove) entity object
 Create (add) entity object
Programmatic Operations on EO
Programmatic operations (from outside EO)
Placement of entity operations
CRUD operations
 Read (Find) entity object
 By primary key
 By traversing association
 Through view object
 Update (modify) entity object
 Delete (remove) entity object
 Create (add) entity object
Programmatic Operations on EO: Placements
Code to manipulate an entity object is typically placed outside
it, in
Another entity object class
A service method of an application module class (though VO)
Java clients accessing business components such as entity object, view
object or service methods
Programmatic Operations on EO: CRUD Ops
 Programmatic operations (from outside EO)
Placement of entity operations
CRUD operations
 Read (Find) entity object
 By primary key
 By traversing association from
» Master entity to detail entity
» Detail entity to master entity
 Through view object
 Update (modify) entity object
 Delete (remove) entity object
 Create (add) entity object
Reading EO: Find by Primary Key
Reading EO: Traverse Association:
Iterate Master to Detail Hierarchy
 The source entity’s EntityImpl contains associated row iterator
 Example: get names of all employees in current department
EmployeeEO
getDepartment1()
setDepartment1()
getEmpLastName()
DepartmentEO
getEmployee1()
getDeptName()
1
M
*
D
EmpDeptFkAS
Reading EO: Traverse Association:
Iterate Detail to Master Hierarchy
 The destination entity’s EntityImpl contains the source entity
 Example: EmployeeEOImpl contains getDepartment1() and
setDepartment1()
 Get the department name of the associated department
EmployeeEO
--------------------------
getDepartment1()
setDepartment1()
getEmpLastName()
DepartmentEO
------------------------
getEmployee1()
getDeptName()
1
M
*
D
EmpDeptFkAS
Reading EO: Find EO through View Object
Updating an Existing EO Row
Find entity object by one of the above four find by approaches
Set one or more attributes to new values, Using the EntityImpl
class, setAttribute() method
Example:
Deleting an Existing EO Row
Find entity object by one of the above four find by approaches
Call remove() method
Example:
Creating a New EO Row
Find entity object by one of the above four find by approaches
Call createRow() method
Example using destination/ child entity
Creating a New EO Row
Programmatically Customizing EO: Summary
Read by
Primary Key
Read through
Association
Read through
View Object
Update Delete Create
EO Yes Yes No Yes Yes Yes
VO (services) No No Yes Yes Yes Yes
Java Client - EO Yes Yes No Yes Yes Yes
Java Client - VO No No Yes Yes Yes Yes
Java Client – Services No No Yes Yes Yes Yes
Types of Programmatic Customization:
View Objects
Use ADF Business Component APIs
Programmatically customizing entity object (EO)
Programmatically customizing view object (VO)
Programmatically customizing application module (AM)
Programmatically accessing business component objects from
Java client
Ingredients of a View Object
Programmatically Customizing View Object (VO)
 Default metadata -
<ViewObjectVO>.xml
 Java classes (generate)
 Programmatically customizing
default behavior (within VO)
Business rules
Override methods
Examine VO methods
 Programmatic operations (from
outside VO)
Placement of view object
operations
CRUD operations
 Programmatic customization of
default sorting and selection
(from outside VO)
Order by (sorting)
Where clause
Parameterize where clause
Structure where clause (view
criteria)
Programmatically Customizing View Object (VO):
Default Metadata
 Default metadata -
<ViewObjectVO>.xml
 Java classes (generate)
 Programmatically customizing default
behavior (within VO)
 Programmatic operations (from
outside VO)
 Programmatic customization of
default sorting and selection (from
outside VO)
Programmatically Customizing View Object (VO):
Java Classes
Default metadata - <ViewObjectVO>.xml
Java classes (generate)
Programmatically customizing default
behavior (within VO)
Programmatic operations (from outside
VO)
Programmatic customization of default
sorting and selection (from outside VO)
Generating View Object Java Classes
To generate a Java class:
On the business component editor’s Java page, click Edit
Select the classes to generate
Generated View Object Java Classes
 <ViewobjectVO>Impl.java:
 Is the view class
 Provides methods to manage the row set
 <ViewobjectVO>RowImpl.java:
 Is the view object row class
 Is instantiated for each record returned by the query
 Provides attribute accessors
 <ViewobjectVO>DefImpl.java:
 Is the view definition class
 Represents the whole view
 Can be used to modify the view definition
Programmatically Customizing View Object (VO)
 Default metadata - <ViewObjectVO>.xml
 Java classes (generate)
 Programmatically customizing default behavior (within VO)
Business rules
Override methods
Examine VO methods
 Programmatic operations (from outside VO)
 Programmatic customization of default sorting and selection (from
outside VO)
Programmatically Customizing Default Behavior:
Business Rule
Programmatically customizing default behavior (within VO)
Business rules
 Only for transient attributes that are not read-only
Override methods
Examine VO methods
Programmatically Customizing Default Behavior:
Override Methods
Programmatically customizing default behavior (within VO)
Business rules
Override methods
Examples:
 remove() to delete a row
 beforeCommit(), validate(), etc.
Examine VO methods
…
Programmatically Customizing Default Behavior
Programmatically customizing default behavior (within VO)
Business rules
Override methods
Examine VO methods
Examining VO Methods: Lifecycle Callback
Updatable VO based on Single EO:
Sequence Diagram
Examining View Object Methods
Rowset is an interface representing a scrollable range of rows, of which one
may be designated as the current row. Some of its methods include the
following:
 executeQuery(), to execute the view object's query and populate its
row set of results
 getEstimatedRowCount(), to count the number of rows a view
object's query would return
 createRowSetIterator(java.lang.String name): Creates an
iterator for the row set
 getApplicationModule(): Gets the row set’s Application Module
 getMasterRowSetIterators(): Returns all controlling masters of
this row set
Examining View Object Methods cont.…
 getName(): Gets the row set’s name
 getViewObject(): Gets the view object that contains the row
set
 getWhereClauseParams(): Gets the bind-variable values to be
used with the view object’s query condition
 setWhereClauseParam(int index, java.lang.Object
value): Specifies a single bind-variable value to use with the view
object’s query condition, and executes the query
 setWhereClauseParams(java.lang.Object[] values):
Specifies the bind- variable values to use with the view object’s
query condition, and executes the query
Examining View Object Methods cont.…
The RowSet interface implements the RowIterator interface, which enables access
to the row set. Some of its methods include the following:
 createRow(): Creates a new Row object, but does not insert into the rowset
 findByEntity(int eRowHandle, int maxNumOfRows): Finds and
returns view rows that use the entity row, identified by the entity row handle,
eRowHandle
 findByKey(Key key, int maxNumOfRows): Finds and returns view rows
that match the specified key
 first(): Designates the first row of the row set as the current row
 getRow(Key key): Accesses a row through a unique key
 hasNext(): Tests for the existence of a row after the current row
Examining View Object Methods cont.…
 hasPrevious(): Tests for the existence of a row before the current row
 insertRow(Row row): Adds a row to the row set, before the current row
 last(): Designates the last row of the row set as the current row
 next(): Steps forward, designating the next row as the current row
 removeCurrentRow(): Removes the current Row object from the row
set
 previous(): Steps backward, designating the previous row as the current
row
 reset(): Clears the “current row” designation and places the iterator in the
slot before the first row
 setCurrentRow(Row row): Designates a given row as the current row
Examining View Object Methods cont.…
In addition to the RowSet and RowIterator interfaces, ViewObjectImpl
implements the ViewObject interface, containing the following methods:
 applyViewCriteria(ViewCriteria criteria): Applies the view
criteria to this view object
 createRowSet(java.lang.String name): Creates and names a row set
for the view object
 createViewCriteria(): Creates a “Query by Example” view criteria object
 findViewLinkAccessor(ViewLink vl): Finds the view link accessor
attribute
 getOrderByClause(): Retrieves the current ORDER BY clause of the view
object’s query statement
 getQuery(): Retrieves the view object’s query statement
Examining View Object Methods cont.…
 getViewCriteria(): Gets this view object’s view criteria
 getViewLinkNames(): Retrieves the names of the view object’s View Links
 getWhereClause(): Retrieves the current WHERE clause of the view object’s
query statement
 isReadOnly(): Tests if the view object is read-only
 setOrderByClause(java.lang.String expr): Sets the ORDER BY
clause of the view object’s query statement
 setWhereClause(java.lang.String cond): Sets the WHERE clause of
the view object’s query statement
The ViewObjectImpl class also implements some listener interfaces and
contains many methods of its own, so there are several opportunities for
programmatic manipulation. For a complete description of all methods that you can
use for a view object, see Javadoc
Programmatically Customizing View Object (VO)
Default metadata - <ViewObjectVO>.xml
Java classes (generate)
Programmatically customizing default behavior (within VO)
Programmatic operations (from outside VO)
Placement of view object operations
CRUD operations
Programmatic customization of default sorting and selection
(from outside VO)
Programmatic Operations on VO
 Programmatic operations (from outside VO)
Placement of view operations
CRUD operations
 Read (Find) view object
 By foreign key
 By traversing links from
» Master view to detail view
» Detail view to master view
» Retain and reuse a view link accessor row set
 Update (modify) view object
 Delete (remove) view object
 Create (add) view object
Programmatic Operations on VO
 Programmatic operations (from outside VO)
Placement of view operations
CRUD operations
 Read (Find) view object
 By foreign key
 By traversing links from
» Master view to detail view
» Detail view to master view
» Retain and reuse a view link accessor row set
 Update (modify) view object
 Delete (remove) view object
 Create (add) view object
Programmatic Operations on VO: Placements
Code to manipulate a view object is typically placed outside it,
in
Another view object,
Service method of an application module, or
Java clients accessing business components
Programmatic Operations on VO: CRUD Ops
 Programmatic operations (from outside VO)
Placement of view operations
CRUD operations
 Read (Find) view object
 By key (findByKey)
 By traversing links from
» Master view to detail view
» Detail view to master view
» Retain and reuse a view link accessor row set
 Update (modify) view object
 Delete (remove) view object
 Create (add) view object
Reading VO: Find by Key and Update
Reading VO: Traverse Links
Links may be traversed in either direction
ViewRowImpl contains associated row iterator
For example, DepartmentVORowImpl contains the method:
public oracle.jbo.RowIterator getEmployee()
Use the methods of RowIterator to move from row to row
and to get individual attribute values
Reading VO: Iterate Master-Detail Hierarchy
Reading VO:
Retain and Reuse a View Link Accessor Row Set
Generate a Java class for the source view object
Override the create() method
Add setViewLinkAccessorRetained(true)
Call reset() each time you reuse the RowSet object
Creating a New VO Row
Programmatically Customizing View Object (VO)
 Default metadata - <ViewObjectVO>.xml
 Java classes (generate)
 Programmatically customizing default behavior (within VO)
 Programmatic operations (from outside VO)
 Programmatic customization of sorting and selection (from
outside VO)
Order by (sorting)
Where clause
Structured where clause (view criteria)
Parameterize clauses (use of named bind variable)
Programmatic Customization of
Sorting and Selection
 Programmatic customization of sorting and selection (from outside VO)
 Getting handle of view object instance
 Default order by (sorting)
 Dynamic order by (sorting)
 Default where clause
 Dynamic where clause
 Default structured where clause (view criteria)
 Dynamic structured where clause (view criteria)
 Default Parameterize clause (use of named bind variable)
 Dynamic Parameterize clause (use of named bind variable)
 Execute view object query
 Using query results
Programmatic Customization of
Sorting and Selection cont.…
 Getting handle of view object instance
 get<ViewObject> - Inside service method of AM
 findViewObject() - In Java client
 Example:
 ViewObject vo = getLocation1(); // Inside service method of AM
 ViewObject vo = am.findViewObject(“Location1”) // In Java client
 Default order by (sorting)
 Programmatic execution of view object query (shown later), with order by clause
executes the default order by
 Dynamic order by (sorting)
 setOrderBy() overrides or sets order by on VO query at runtime
 Example: vo.setOrderBy(“CITY”);
Programmatic Customization of
Sorting and Selection cont.…
 Default where clause
 Programmatic execution of view object query (shown later), with where clause, executes
the default where clause
 Dynamic where clause
 setWhereClause() is used to set where clause dynamically at runtime
 Example: vo.setWhereClause(“POSTAL_CODE like ‘733%’");
 Default structured where clause (view criteria)
 First get the view criteria manager using getViewCriteriaManager()
 Next get the view criteria from it’s manager using getViewCriteria()
 Next apply it to the view object using applyViewCriteria()
 Example:
 ViewCriteriaManager vcmanager = vo.getViewCriteriaManager();
 ViewCriteria vc = vcmanager.getViewCriteria("LocationVOCriteria");
 vo.applyViewCriteria(vc);
Programmatic Customization of
Sorting and Selection cont.…
Dynamic structured where clause (view criteria)
First create view criteria using createViewCriteria()
Next create view criteria row using createViewCriteriaRow()
Next add criteria items to the row using setAttribute()
Next add the row to the view criteria
Next apply the view criteria to the view object using
applyViewCriteria()
Programmatic Customization of
Sorting and Selection cont.…
Example:
 ViewCriteria vc = vo.createViewCriteria();
 ViewCriteriaRow cityRow = vc.createViewCriteriaRow();
 ViewCriteriaRow stateRow = vc.createViewCriteriaRow();
 cityRow.setAttribute(“City", “= ‘DALLAS’");
 cityRow.setAttribute(“City", “= ‘AUSTIN’");
 stateRow.setAttribute(“StateProvince", “= ‘TEXAS’");
 vc.addElement(cityRow);
 vc.addElement(stateRow);
 vo.applyViewCriteria(vc);
TIP: Architecture of View Criteria
Programmatic Customization of
Sorting and Selection cont.…
 Default Parameterize clause (use of named bind variable)
setNamedWhereClauseParam() is used to assign values at run time
to named bind variables of parameterized where clause and view criteria
Example: vo.setNamedWhereClauseParam("p_manager_id", “103”)
 Dynamic Parameterize clause (use of named bind variable)
defineNamedWhereClauseParam() is used to add at run time to
named bind variables of dynamic where clause and dynamic view criteria
with bind variables
Example:
 vo.setWhereClause(“COUNTRY_ID = :p_countryId");
 vo.defineNamedWhereClauseParam(“p_countryId", null, null);
 vo.setNamedWhereClauseParam(“p_countryId", “US”);
Programmatic Customization of
Sorting and Selection cont.…
 Execute view object query
executeQuery() executes query with all clauses (if any, like order by,
where clause, view criteria, bind variable, etc..)
Example: vo.executeQuery();
 Using query results
After getting handle to view object, applying sorting, selecting (where and
view criteria) and execution of view object’s query, row set of results are
populated
RowSet, RowSetIterator and Row uses hasNext(), next() to
iterate through the query result sets
Example: Refer Iterating Master-Detail Hierarchy section
Execute a View Object: Sequence Diagram
Change WHERE or ORDER BY Clause at Run Time
ID FIRSTNAME
201 Michael
202 Pat
203 Susan
LASTNAME
Hartstein
select FIRST_NAME,
LAST_NAME
from EMPLOYEES
order by FIRST_NAME
ViewObject vo = am.findViewObject(“Employee1");
vo.setWhereClause(“FIRST_NAME < 'Su'");
vo.setOrderBy(“LAST_NAME");
Mavris
First Name Last Name
Michael
Pat
Susan
Hartstein
Fay
Mavris
First Name Last Name
Pat
Michael
Fay
Hartstein
EmployeeNamesVO
Relational Data /
App Schema Fay
Types of Programmatic Customization:
Application Module
Use ADF Business Component APIs
Programmatically customize entity object (EO)
Programmatically customize view object (VO)
Programmatically customize application module (AM)
Programmatically accessing business component objects from
Java client
Ingredients of an AM
Programmatically Customizing AM
 Default metadata
<AppModuleAM>.xml
bc4j.xcfg
 Java classes (generate)
 API
 Service Methods
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
 Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
 Configuration Properties
Programmatically Customizing AM:
Default Metadata
 Default metadata
<AppModuleAM>.xml
bc4j.xcfg
 Java classes (generate)
 Service Methods
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
 API
 Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
 Configuration Properties
Programmatically Customizing AM:
Default Metadata
Default metadata
<AppModuleAM>.xml
 Includes detailed metadata
about the view objects included
bc4j.xcfg
Programmatically Customizing AM:
Default Metadata
Default metadata
<AppModuleAM>.xml
bc4j.xcfg:
 Contains all the configuration
and connection details
Programmatically Customizing AM
 Default metadata
<AppModuleAM>.xml
bc4j.xcfg
 Java classes (generate)
 Service Methods
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
 API
 Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
 Configuration Properties
Generate Application Module Java Classes
To generate a Java class:
On the business component
editor’s
Java page, click Edit
Select the classes to generate
Generated Application Module Java Classes
Supporting Java classes:
<AppMod>Impl.java: Contains
all the methods and behaviors that
affect each application module
instance
<AppMod>Def.java: Contains
methods to be used by all instances
of the application module
Programmatically Customizing AM:
Service Methods
 Default metadata
 Java classes (generate)
 Service Methods (Facade Pattern)
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
 API
 Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
 Configuration Properties
Adding Service Methods to an Application Module
Service methods:
Are useful for:
 Code that is not dependent on a
specific view
 Performing operations across view
object instances
 Managing transactions
 Dynamically changing the data
model
Can be called from the client,
requiring very little data
manipulation in the client itself
Are implemented in the
application module’s class
Are added by:
 Adding code to the Java class
 Publishing to the client interface
Implementing the Service Method
 Add the Java code for the method to the
HRSystemAMImpl.java file
public void applyLocationVOCriteria() {
ViewObject vo = getLocation1();
ViewCriteriaManager vcmanager =
vo.getViewCriteriaManager();
ViewCriteria vc =
vcmanager.getViewCriteria("LocationVOCriteria");
vo.applyViewCriteria(vc);
vo.executeQuery();
}
Publishing the Service Method
To publish the service method to
clients:
Open the Application Module
Editor and click the Java page
Click the Pencil icon to edit the
Client Interface
Shuttle the method you want
to publish to the Selected list
Test Services using ADF Model Tester
Show the AM
Select the method. Set
Parameter values
Click Execute
Observe results
Programmatically Customizing AM:
API
Default metadata
Java classes (generate)
Service Methods
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
API
Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
Configuration Properties
Some Common API
Operation Explanation
createViewObject() This method is used to create a view object for an application module.
findViewObject(String) This method will find the view object added to an application module.
The String parameter will represent the view object's name.
getTransaction() This method is used to get the current transaction object.
beforeRollback() All operations that have to be done before rolling back the transaction
are done in this method.
beforeCommit() All operations that have to be done before committing the transaction
go in here.
Programmatically Customizing AM:
Transactions
Default metadata
Java classes (generate)
Service Methods
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
API
Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
Configuration Properties
Accessing Transaction
 Transaction and DBTransaction are interfaces that define database
transactions
 Use the methods in these interfaces to access an application
module’s transaction
 Example:
// In service method
 getDBTransaction().commit(); // Commit the transaction
// In Java client
 ApplicationModuleImpl am;
 am.getTransaction().commit(); // Commit the transaction
Committing Transactions
Post phase
1. Validate pending changes
2. Post updates to the database
Commit phase
Commit the transaction
Committing Transaction: Sequence Diagram
Oracle ADF Tutorial
Customizing the Post Phase
 Override the entity object’s postChanges() method
 Example: For a deleted entity, mark the database row instead of
deleting the data
public void postChanges(TransactionEvent e) {
if (getPostState() == Entity.STATUS_DELETED) {
// Custom code to mark database rows, such as
// by updating a Deleted flag in the record
}
else {
super.postChanges(e);
}
}
Customizing the Commit Phase
 Implement a TransactionListener
 Implement beforeCommit() and afterCommit()
 Add your listener to the transaction’s list of event subscribers
 Alternatively, override the entity object’s beforeCommit() or
afterCommit() methods
 Example:
 In EmployeeEOImpl, print notification that record is committed:
@Override
public void afterCommit(TransactionEvent transactionEvent) {
System.out.println("Record committed for " + getFirstName() + " "
+ getLastName());
super.afterCommit(transactionEvent);
}
Programmatically Customizing AM:
Transactions
Default metadata
Java classes (generate)
Service Methods
Add
Implement
 EO and AS
 VO and VL
Publish
Test (using ADF Model Tester)
API
Transactions
Access transaction
Commit transaction
 Post Phase
 Commit Phase
Locking
Configuration Properties
Programmatically Customizing AM:
Configuration Properties
Property Description Default Value
jbo.ampool.initpoolsize The number of application module instances
created when the pool is initialized.
0
jbo.ampool.minavailablesize The minimum number of available application
module instances that the pool monitor should
leave in the pool during the resource cleanup
operation.
5
jbo.ampool.timetolive How long to wait before the application
module in the pool becomes a candidate for
removal.
3600000 ms
jbo.load.components.lazily Determines whether to load components
definitions lazily.
false
Programmatically Customizing AM:
Configuration Properties
Property Description Default Value
jbo.dofailover Enable eager passivation of the pending transaction state
each time an application module is released to the pool in
managed release (stateful) mode. This needs to be turned
ON for high availability.
false
jbo.max.cursors The maximum number of cursors the business
components may have open. The framework will clean up
free JDBC statements as the number of cursors
approaches this number.
50
jbo.recyclethreshold Maximum number of application module instances that
attempt to preserve session affinity for the next request.
10
Types of Programmatic Customization: Java Client
Use ADF Business Component APIs
Programmatically customizing entity object (EO)
Programmatically customizing view object (VO)
Programmatically customizing application module (AM)
Programmatically accessing business component objects from
Java client
Implementing Java Client
Programmatically accessing business component objects from
Java client:
Access AM
Access service methods
Access and modify VO
Access and modify EO
Access transaction
Creating a Test Client
 If you want to test custom code, you can create a test
client program. Create a Java class
 The file opens in the editor to show the skeleton code
 Place the cursor on a blank line inside the body of the
main() method and enter the characters bc4jclient,
and then press Ctrl + Enter to expand the code template
Creating a Test Client cont.…
 Need to modify names in
generated skeleton code
to reflect your AM package
name such as
module.HRSystemAM
and HRSystemAM Local
Change the VO instance
name in the call to
findViewObject() to be
the one you want to work
with such as Employee1
Invoking Service Method from UI
Panel Accordion
showDetailItem
showDetailItem
Panel Tabbed
showDetailItem showDetailItem
BATHRSystemIndex.jsf
LocationDeptartmentTF
EmployeeQuickSearchTF
EmployeeListTF EmployeeSearchTF
LocationDeptartmentPF
QuickSearchPF
Region TF Call Page Fragment
showDetailItem
EmployeeFilterTF
EmployeeFilterPF
EmployeeListPF EmployeeSearchPF
EmployeeDetailTF
EmployeeCreateTF
EmployeeUpdateTF
Method Call
applyViewCriteria…
defineDynamicWhereClause…
defineDynamicViewCriteria…
router
Invoking Service Method from UI contd…
Display Message
FacesContext fctx = FacesContext.getCurrentInstance();
FacesMessage fm = new FacesMessage("Message text");
fm.setSeverity(FacesMessage.SEVERITY_WARN);
fctx.addMessage(null, fm);
Lesson Summary
Use business component client APIs
Implement programmatic modifications
Generate Java classes for business components
Override class methods
Add service methods to an application module
Handle transactions
Create a test client
23
Deploying ADF Applications
Lesson Agenda
ADF supported application servers
ADF deployment diagram
Building and deploying ADF
ADF build setup
Deployment profile types
Deployment to cloud service
Create various deployment profiles
Deploy and run an ADF Application
ADF Supported Application Severs
Application Servers ADF 12.2.1.0.0 ADF 12.1.3.0.0 ADF 11.1.2.0.0 ADF 11.1.1.7.0
Fusion Middleware
(WLS)
12.2.1 12.1.3 11.1.2 11.1.1.7
GlassFish 4.1 (Essentials) 3.1 (Essentials) 3.1.2 (Essentials) Not Supported
WebSphere Not Supported Not Supported 7.0.0.13 7.0.0.13
JBoss Not Supported Not Supported Not Supported Not Supported
Tomcat Not Supported Not Supported Not Supported Not Supported
Java Cloud Service - SaaS
Extension
Not Supported Not Supported 14.1
Java Cloud Service Not Supported Not Supported 14.1
ADF Application
[EAR = JAR + WAR]
ADF Deployment Diagram
Business Service
[JAR]
View Controller
[WAR]
…
Building and Deploying ADF Application
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration
The Act of "Building" Software
The act of building software from source code includes
Checking out code
Compiling and linking code
Dependency management and build orders
Packaging code into deployable artefacts
Deployment
Running tests
Creating automated documentation and release notes
Building and Deploying ADF Application
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration
JDeveloper Build Setup
Setting up an ADF build process requires the following:
Configuring
JDeveloper
deployment
profiles
Choosing and
configuring
tools to build
the application
Catering for
dependency
management &
build order
Configuring WLS
deployment plans
& post build
modifications
Building and Deploying ADF Application
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration
JDeveloper Deployment Profiles
 Define & include options for how applications and code are:
Packaged as deployment artifact: JARs, WARs, EARs, ADF Library JARs etc
Specific deployment platforms: WLS deployment descriptors
And much more depending on the deployment profile type....
 Used by JDeveloper or ojdeploy to build the artifact
 Removes grunt work of assembling & generating artifacts yourself
 Within JDeveloper define 1 or more at the application or project
level
JDeveloper Deployment Profiles Types
 Application Deployment Profile Types  Project Deployment Profile Types
 ADF Mobile for Android
 ADF Mobile for iOS
 EAR files
 MAR files
 ADF Library JAR file
 ADF Mobile feature archive
 Business Components archive file
 Business Components EJB Session Bean
 Business Components Service Interface
 Client JAR files
 EJB JAR files
 Extension JAR file
 JAR file OSGi
 bundle RAR file
 Shared Library JAR file Taglib JAR file
 WAR files
Project Properties – Deployment Profiles
Application Properties – Deployment Profiles
Deployment Profile Types
Project Deployment Profile Types
WAR Files
ADF Library JAR
Business Component Service Interface
Application Deployment Profile Types
EAR Files
MAR Files
Deployment Profile Types
 Project Deployment Profile Types
 WAR Files
 ADF Library JAR
 Business Component Service Interface
 Application Deployment Profile Types
 EAR Files
 MAR Files
Java EE Web ARchives
 Contains web components. e.g.
JSPs, JSFs, HTML, servlets and
other resources
 + deployment descriptors (e.g.
web.xml)
 Use when you want to create/
deploy a Java EE web application
to a Java EE server
Deployment Profile Types
 Project Deployment Profile Types
 WAR Files
 ADF Library JAR
 Business Component Service Interface
 Application Deployment Profile Types
 EAR Files
 MAR Files
 Oracle proprietary Java ADF archive
 Contains reusable ADF components:
ADF task flows, declarative
components, task flow templates,
model projects
 + hidden generated deployment
descriptors (e.g. task-flow-
registry.xml)
 Some limitations compared to JAR
archive such as inability to filter
content
 Use when you want other ADF
applications to reuse the ADF Library
JARed components
Deployment Profile Types
 Project Deployment Profile Types
 WAR Files
 ADF Library JAR
 Business Component Service Interface
 Application Deployment Profile Types
 EAR Files
 MAR Files
 For publishing ADF BC objects as
SDOs
 Generates both client proxy JAR
for consumers to use and server
JAR
Deployment Profile Types
 Project Deployment Profile Types
 WAR Files
 ADF Library JAR
 Business Component Service Interface
 Application Deployment Profile Types
 EAR Files
 MAR Files
Java EE Enterprise ARchives
 For deploying one or more
applications or modules to Java
EE server
 Contains 1 or more WAR, EJB JAR
and client JAR files
 + deployment descriptions (e.g.
weblogic-application.xml)
 Includes options for deploying
security artifacts to WebLogic
Server
Deployment Profile Types
 Project Deployment Profile Types
 WAR Files
 ADF Library JAR
 Business Component Service Interface
 Application Deployment Profile Types
 EAR Files
 MAR Files
Metadata ARchive file
 For deploying seeded
customizations or base metadata
for MDS repository in application
server
Deployment Profile Types
Consider defining naming standards
for the deployment profiles, the
default profile names can be messy.
Don’t leave outdated or unused
deployment profiles against the
applicaIons an d p rojects, it's
hard for the next programmer to
know which one to use.
Building and Deploying ADF Application
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration
Build Tools & Options
 Manually/by hand – Not recommended!
 Within JDeveloper – Only suitable for development
 Via ojdeploy
Via command line
Via Ant script
 Inline or outside JDeveloper including command line or CI engine
Via ojserver
Via Maven (JDev 12c)
 Via Oracle Developer Cloud Services (and Hudson and ojdeploy)
Build Tools & Options – ojdeploy
Compilation and intelligent ADF post compilation processor
Badly named – “builds” not “deploys”
"Headless" JDeveloper version
Called via command line or Apache Ant
Calls the inline build function in JDeveloper
Builds one artifact at a time
Requires file system access to source code
Requires a full-blown JDeveloper install to operate
Build Tools & Options – ojdeploy
Features
Validates ADF metadata XML files
Generates ADF specific metadata files (e.g. task-flow-registry.xml)
Edits detail of connection manager (connections.xml)
Compiles and generates files for ADF BC & ADF Security
Creates Oracle deployment artifacts (e.g. ADF Libraries and MAR files)
Every check & automation the JDeveloper inline build tool
does, ojdeploy does too
Build Tools & Options – ojdeploy
 Pros
Understands JDeveloper application artifacts
Beyond compilation ensures health of your ADF project
Automagical
 Cons
Requires full check of source code, no version control intelligence
Requires a full JDeveloper install on your build server
Start/stop cycle is slow
Blackbox implementation
No inbuilt dependency management intelligence
Oracle Developer Cloud Services
Developer
Develop A turnkey development platform
securely hosted in the cloud
Collaborate Integrated tools to manage and
track tasks, builds, and documentation
Deploy Automatic deployment to Oracle Java
Cloud Service or your local infrastructure
Standards-based Git, Hudson, Maven
Oracle Developer Cloud Services
Oracle Developer Cloud Services
 Currently supports (Jan 2017) JDev/ADF 12.2.1.2.0
 Must use Git for source control
 Modify build.xml/build.properties to work with Cloud environment
Still uses ojdeploy
 Push local/developer Git repository changes to cloud repository
Or other 3rd party Git repository e.g. GitHub
 Built via Hudson Job
Extracts code from Git repository
Calls build.xml
Creates deployment artifact
Building and Deploying ADF Application
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration
Build Tools & Options - Dependency Management
To build in the correct order dependencies must be configured
JDeveloper projects record the libraries they're dependent on
But is locked up in the associated/undocumented .jpr file
JDeveloper provides no useful dependency management assistance
Supplement JDeveloper with a dependency management tool
Manual Apache Ant scripts
Apache Ivy
Apache Maven
Build Tools & Options - Dependency Management
 Hardcoded Ant scripts for small projects are okay
Simply wont scale to large projects – scripts become impossible to maintain
 Dependency management tools provide assistance with
Define and track the modules, versions and dependencies
Library repositories
Allows developers share versioned modules
Through publish/retrieve mechanism
Define dependencies and transient (indirect) dependencies
Conflict resolution on dependencies
Post Build
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration
Building and Deploying
 Upon deployment of the artefacts may be necessary to modify it
 Such as modifying configuration files for different dev/test/prod environments
 e.g. these web.xml settings should be set/unset per environment
<context-param>
<param-name>oracle.adf.view.rich.ASSERT_ENABLED</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
 2 options
 WLS deployment plans
 Ant scripts
Building and Deploying ADF Application
Building Source Code
ADF Build Setup
Pre Build: Deployment Profiles
Build Tools & Options
Dependency Management
Post Build: WLS Deployment Plans & Build Modifications
Continuous Integration (CI)
The Discipline of Continuous Integration
CI dictates software builds are not just limited to building your
application for deployment and use
Includes:
Regular run sanity checks testing integrity of your code after check-ins
Run periodic tests
Provide early feedback to developers
Don't confuse a CI engine with the actual build tool itself. A CI
engine is typically a scheduling tool that kicks off the build tool
Hudson
 There are plenty of CI engines available
 Oracle recommends Hudson
 Hudson was inherited by Oracle from Sun
 Was donated to the Eclipse Foundation in 2012
 Jenkins was an open source fork of Hudson
 Oracle recommends Hudson over Jenkins
Ongoing support from Oracle
Removed IP concerns over internal code
Used internally by Oracle and Oracle's Developer Cloud Services extensively
Widening supports for ADF applications
The CI Maturity Model
No Build Server
Nightly Builds
Nightly Builds and Basic Automated Tests
Metrics
Sophisticated Testing Methodologies
Automated Acceptance Tests and More Automated
Deployment
Continuous Deployment
Conclusion
 Building your applications isn't a 1 click affair
 Consider your
Deployment profiles and options
Build tools
Post build modifications
 Introduce a process and document it
 Plan to introduce tools to assist you with dependency management
 Make continuous integration a central mantra of your development
efforts
Lesson Summary
ADF Supported Application Servers
ADF Deployment Diagram
Building And Deploying ADF
ADF Build Setup
Deployment Profile types
Deployment to Cloud Service
24
Securing ADF Applications
Lesson Agenda
Authentication and Authorization
ADF Security Architecture
Configuring the Application to use ADF Security
Defining Users in the Identity Store
Defining Application Roles
Implementing Security on Task Flows and Pages
Testing ADF Security
Authentication and Authorization
Authentication: Is this user allowed
to access this application?
Authorization: Is this user’s role
allowed to access this resource?
Resource 2
Resource 1 Resource 3
Resource 4 Resource 5 Resource 6
Application
ADF Security Diagram
ADF Security Architecture
Oracle Platform Security Service (OPSS)
Oracle ADF Tutorial
Lesson Summary
Authentication and Authorization
ADF Security Architecture
Configuring the Application to use ADF Security
Defining Users in the Identity Store
Defining Application Roles
Implementing Security on Task Flows and Pages
Testing ADF Security
25
Debugging and Troubleshooting ADF
Applications
Lesson Agenda
Troubleshooting Business Services and User Interfaces
JUnit, ADF Model Tester and Java test client
Design-time code validation
Tools for logging and diagnostics
JDeveloper Debugger
JDeveloper Profiler and FileMon
Sources of help
Troubleshooting Business Service (BS)
Test a business service in isolation from views or controllers:
ADF Model Tester
Java test clients
Using Tools and Utilities:
Use JUnit to build unit tests
 Is an open source regression-testing framework
 Run repeatable tests to verify Java code
 Assertions for testing expected results
 http://www.junit.org
Test Java Code with JUnit
JUnit is an open source regression-testing framework.
It is useful for creating tests to verify Java code.
JDeveloper’s JUnit extension provides wizards for creating test
components.
More information and examples:
SRDemo sample application
Toystore sample application
JDeveloper online documentation
http://www.junit.org
Unit Test with JUnit
JUnit makes it easy for developers to write and run repeatable
tests. Its features include:
Assertions for testing expected results
Test fixtures for sharing common test data
Test suites for organizing and running tests
Graphical and textual test runners
Troubleshooting BS and View Controller (VC)
 Using design-time code validation
Java, XML, JSPX
 Using logging and diagnostics
Display debug message, Java logging, ADF logging, ADF ODL
 Debugging through source (using JDeveloper Debugger) - lab
Breakpoints, watches, evaluate EL, quick Javadoc, access ADF source library
 Tools and Utilities
JDeveloper Profiler, Audit Profiles, FileMon
 Obtaining Help
Online Help, Javadoc, Support, Forums, Blogs, Internet Search
Troubleshooting BS and View Controller (VC)
 Using design-time code validation
Java, XML, JSPX
 Using logging and diagnostics
Display debug message, Java logging, ADF logging, ADF ODL
 Debugging through source (using JDeveloper Debugger)
Breakpoints, watches, evaluate EL, Javadoc, access source library
 Tools and Utilities
JDeveloper Profiler, Audit Profiles, FileMon
 Obtaining Help
Online Help, Javadoc, Support, Forums, Blogs, Internet Search
Using Design-Time Code Validation
JDeveloper’s editors provide error cues and correction
suggestions for files such as:
Java
XML
 xsd
JSPX
 Syntax is checked and errors and warnings are flagged
 Errors are visible in Design, Source and Bindings editors
Troubleshooting BS and View Controller (VC)
 Using design-time code validation
Java, XML, JSPX
 Using logging and diagnostics
Display debug message, Java logging, ADF logging, ADF ODL
 Debugging through source (using JDeveloper Debugger)
Breakpoints, watches, evaluate EL, Javadoc, access source library
 Tools and Utilities
JDeveloper Profiler, Audit Profiles, FileMon
 Obtaining Help
Online Help, Javadoc, Support, Forums, Blogs, Internet Search
Using Logging and Diagnostics
 Displaying debug messages to the console
http://localhost:7101/console weblogic/weblogic1
-Djbo.debugoutput=console/silent/file/adflogger (project properties > Run)
-Djbo.debugoutput=adflogger -Djbo.adflogger.level=FINE
 Java logging
Use java.util.logging.Logger api (instead of System.out.println)
Edit <Java_Home>/jre/lib/logging.properties:
 Set java.util.logging.ConsoleHandler.level=FINE
 ADF logging and Oracle Diagnostic Logging (ODL)
Using Logging and Diagnostics cont.…
ADF logging and Oracle Diagnostic Logging (ODL)
Use ADFLogger api (instead of System.out.println in Java source code)
Use ODL Log Analyzer to view log entries of a log file
ODL provide control over messages’
 Logging level and
 Module filter
Edit logging.xml to control level or filter over messages; or
Configure ODL Configuration to control level or filter over messages
 Access ODL Configuration from Application Server Navigator or Log window
Java and ADF Logging Levels
 Failure Reporting:
SEVERE – Fatal or Unexpected
errors or very important messages
WARNING – Warning messages
 Progress Reporting:
INFO – Key flow steps or
Informational run-time messages
CONFIG – Configuration properties
& environment setting messages
FINE – Detail messages
FINER – Greater detail messages
FINEST – Greatest detail messages
ALL – All level messages
NONE – No message
Configure logging to produce different levels of logging output:
Configure ADF Logging
The Oracle Diagnostic Logging (ODL) configuration file
(logging.xml) controls the loggers under the Oracle tree.
You use the overview editor for Oracle Diagnostic Logging
Configuration to configure the logging levels specified in the
logging.xml file.
You access the overview editor for Oracle Diagnostic Logging
Configuration from the Application Server Navigator or from
the Log window.
ODL Configuration Overview Editor
You can:
Choose to view ODL log levels or Java log levels for the logger types
Add persistent or transient loggers
Specify a handler for a logger
Create Log Configurations in JDeveloper
ADF Model debugging configuration:
Edit the project’s run configuration.
Set Java options: -Djbo.debugoutput=adflogger -
Djbo.adflogger.level=FINE
View ODL Logs
You use the Oracle Diagnostic Log Analyzer to view the log
entries of a log file.
The log analyzer enables you to filter the entries by log level,
entry type, log time, and entry content
Troubleshooting BS and View Controller (VC)
 Using design-time code validation
 Java, XML, JSPX
 Using logging and diagnostics
 Display debug message, Java logging, ADF logging, ADF ODL
 Debugging through source (using JDeveloper Debugger)
 Breakpoints, watches, evaluate EL, Quick Javadoc, access ADF source library
 Tools and Utilities
 JDeveloper Profiler, Audit Profiles, FileMon
 Obtaining Help
 Online Help, Javadoc, Support, Forums, Blogs, Internet Search
Using the JDeveoper Debugger
Set Breakpoints,
 Source, Exception, Method, Class,
TF Activity, Executable, Binding
Set watches,
Evaluate EL using EL Evaluator,
ADF Structure Window
 Shows all items in current viewport
ADF Data Window
 Item selected in structure window
 ADF Context
 Scoped variable
Stepping through the code,
ADF source library, (source zip)
JDeveloper Quick Javadoc
The Debugger helps in pinpointing issues
Debug problems using:
Types of Breakpoints
Type Breaks when…
Source A particular source line in a particular class in a particular package is run
Exception An exception of the class (or a subclass) is thrown
Method A method in a given class is invoked
Class Any method is a class is invoked
Watchpoint A given field is accessed or modified
Task flow activities A particular task flow activity in task flow diagram
Executables A particular executable in pageDef
Bindings A particular binding in pageDef
Using Breakpoints
Create groups of breakpoints
Use conditional breakpoints. Examples:
value instanceof oracle.jbo.domain.Date
jobId.equalsIgnoreCase(“CLARK")
i > 50
Use actions other than stop with breakpoints
Object Preferences
Filter out the fields that are displayed in the debugger.
Change the default value displayed in the debugger.
Show expressions as details instead of fields.
Customize types throughout the type hierarchy.
Use the EL Evaluator
The Expression Language evaluator enables:
Introspection of the values between the view and model
Watches based on EL
Use Oracle ADF Source Code for Debugging
Adding ADF source code enables you to:
Access Java docs in the code editor
Set breakpoints on Oracle code as well as your own
Access symbolic names via Debug libraries
Set Up Oracle ADF Source Code for Debugging
To use source code for debugging, you can:
Add the source zip into the user library
Add the library to a project
Set Breakpoints in Source Code
To set a breakpoint in Oracle code, perform the following
steps:
Press Ctrl + – (the minus sign).
Enter an Oracle ADF class name or its uppercase letters.
Set breakpoints in the source file that JDeveloper opens.
Use Common Oracle ADF Breakpoints
 ADF breakpoints are useful for debugging declarative functionality.
 In the oracle.jbo package, you can set breakpoints on:
JboException
DMLException
uicli.binding.JUCtrlActionBinding.doIt()
server.ViewObjectImpl.executeQueryForCollection()
server.ViewRowImpl.setAttributeInternal()
server.EntityImpl.setAttributeInternal()
Debug
<debug-output> element in adf-faces-config.xml
<debug-output>true</debug-output>
Context parameter in web.xml
<context-param>
<param-name>
oracle.adfinternal.view.faces.DISABLE_CONTENT_COMPRESSION
</param-name>
<param-value>true</param-value>
</context-param>
Debug Interactions with the Model Layer
Controlled by two classes:
oracle.adf.controller.faces.lifecycle.FacesPageLifecycle
oracle.adf.controller.v2.lifecycle.PageLifecycleImpl
Set breakpoints if encountering problems such as:
Components not displaying correctly with complete data
Validation errors not rendering properly
Correct Failures to Display Data
To debug all executables:
oracle.adf.model.binding.DCBindingContainer
internalRefreshControl(int, boolean)
To debug the method iterator:
oracle.jbo.uicli.binding.JUMethodIteratorDef
initSourceRSI()
To debug an attribute binding:
oracle.jbo.uicli.binding.JUCtrlValueBinding
getInputValue()
Correct Failures to Invoke Actions and Methods
Actions are ignored if an executable or its target binding is not
executed.
You can debug the action or method invocation by breaking on
DCDataControl.invokeOperation(), which is the
entry point for action and method execution.
You can debug the invocation of coded methods by breaking
on DCGenericDataControl.invokeOperation().
Debug Life Cycle Events: Task Flows
Before a task flow’s input parameters are resolved:
oracle.adfinternal.controller.activity.
TaskFlowCallActivityLogic.getInputValues()
Before a task flow is called:
oracle.adfinternal.controller.activity.
TaskFlowCallActivityLogic.execute()
Before and after a task flow returns:
oracle.adfinternal.controller.activity.
TaskFlowReturnActivityLogic.execute()
Debug Life Cycle Events: Parameters and Methods
 For debugging the ADF controller’s interpretation of the navigation
routing: oracle.adfinternal.controller.engine.
ControlFlowEngine.doRouting()
 For debugging before the view activity’s input parameters are
evaluated:
oracle.adfinternal.controller. application.PageParameterPagePhaseListener
.beforePhase()
 For calling an ADF controller method action:
oracle.adfinternal.controller.activity.
MethodCallActivityLogic.execute()
Debug Life Cycle Events: Switching Between the
Main Page and Regions
To keep track of the context switching between the main page
and regions, set a breakpoint in:
oracle.adfinternal.controller.state.
RequestState.setCurrentViewPortContext()
ADF Structure Window and ADF Data Window
During debugging:
ADF Structure window shows items in the current viewport
ADF Data window shows data within:
 The item selected in the ADF Structure window
 The ADF context
 Scoped variables
Troubleshooting BS and View Controller (VC)
 Using design-time code validation
Java, XML, JSPX
 Using logging and diagnostics
Display debug message, Java logging, ADF logging, ADF ODL
 Debugging through source (using JDeveloper Debugger)
Breakpoints, watches, evaluate EL, Javadoc, access source library
 Tools and Utilities
FileMon, Audit Profiles, JDeveloper Profiler
 Obtaining Help
Online Help, Javadoc, Support, Forums, Blogs, Internet Search
Using FileMon
Is useful for troubleshooting CLASSPATH problems
Shows path that an running application is looking in for classes
and files
Free Windows utility that can be downloaded from
http://www.sysinternals.com
Using Audit Profiles
An audit profile defines the rules, code assists, and metrics
that will be used to analyze source code.
Some audit profiles are predefined, but you can create your
own.
You modify an audit profile by enabling or disabling rules, code
assists, and metrics, or by changing its configuration.
Tools > Preferences > Audit
Using JDeveloper’s Profiler
With the Profiler, you can:
Monitor programs as they run
Find bottlenecks and memory leaks
Two types of profiling:
CPU: Method processing times
Memory: Allocation and freeing of data objects
Troubleshooting BS and View Controller (VC)
 Using design-time code validation
Java, XML, JSPX
 Using logging and diagnostics
Display debug message, Java logging, ADF logging, ADF ODL
 Debugging through source (using JDeveloper Debugger)
Breakpoints, watches, evaluate EL, Javadoc, access source library
 Tools and Utilities
JDeveloper Profiler, Audit Profiles, FileMon
 Obtaining Help
Online Help, Javadoc, Support, Forums, Blogs, Internet Search
Obtain Help
Sources of help include:
Online Help
Javadoc
Support (My Oracle Support)
Forums
Blogs
Internet Search
Request Help
 Post your request to the appropriate forum:
Use a meaningful subject line.
Describe exact steps to reproduce the problem.
Include the exact error information (error number, exception) if you receive
an error message.
Include a stack trace if appropriate.
Include a test case if possible.
List technologies and product version numbers.
Provide concrete examples rather than abstract descriptions.
List the troubleshooting steps that you have tried and describe how they
affected the problem.
Lesson Summary
In this lesson, you should have learned how to use:
Troubleshooting Business Components and View Controller
Design-time code validation
Tools for logging and diagnostics
JDeveloper Debugger
JUnit, JDeveloper Profiler and FileMon
Sources of help
26
ADF Best Practices
Lesson Agenda
Entity Objects
View Objects
Association and View Link
Application Modules
Model / Binding
Pages / View
Layout
Task Flows and Memory
Scopes
Designing for reuse
Conform to PPR Guidelines
Managed Beans
Other general Java best
practices
Entity Objects
Define at least one EO key attribute per EO
Define EO attribute labels for UI displayed attributes
Ensure EO UI Hints and messages are internationalized
Create error messages for EO mandatory and precision
validators
Do not access an AM from an EO
Avoid using the EO validateEntity() method for validation
Avoid EO attribute validation in accessors
View Objects
 Create VO tailored to a specific
usage
 Use VO bind variables over
dynamic SQL
 Use view criteria over editing VO
where clauses
 Tune VO fetch size and access
mode. (N+1)
 Ensure to use VO accessor
tuning
 Reuse VO for Validation and LOV
 Avoid use of VO expert mode
 Avoid hardcoding VO queries
with literals
 Avoid calling getRowCount
 Avoid defining circular list of
value dependencies
 Never use SELECT * for a VO
query
Association and View Link
Specify fetch size for association when needed
Use Retain Association/View Link Accessor
Avoid repeated calls to association or view link accessors
Close unused RowSet
Application Modules
Use optimistic locking
Use view object typesafe getters
Use application module JDBC data source only
not JDBC URLs
Use the Lazy Loading option
Close callableStatement and preparedStatements
Don’t import view or controller classes
Don't hardcode human readable text
Model / Binding
Do not use Refresh = “always” for the executable
iterator binding.
Do not leave any unused executables or binding entry in a page
definition file.
The RangeSize property must be set appropriately so that
only the required rows are fetched to the middle tier.
Pages / View
 Use JSPX XML compliant files rather than JSP
 Use rendered=false over visible=false if possible
 Consider command partialSubmit=true
 Avoid inline HTML use
 Avoid long component ID lengths (use short id)
 Never rely on UI side validation only
Validate both in UI and Server Layers
 Don't hardcode human readable text
 Do not prefix EL references to managed beans in request, session
or application scope (Eg. #{requestScope.bindings.myBean})
Layouts
InlineStyle, contentStyle, and labelStyle are powerful but evil
use them as a last resort but preferably not at all!
Avoid stretching vertically inside a non-stretched container
Never specify a height value with percent units
Never use the "position" style
These results in inconsistent behaviour across browsers
Minimize the use of components with stretchable behavior
Go for the deferred child component creation if possible
When to use panelGroupLayout layout="scroll“
This tends to be abused
Only use layout="scroll" if the panelGroupLayout component is
stretched by its parent
Consider alternatives:
af:panelGroupLayout layout="vertical"
af:group
No component at all
Task Flows and Memory Scopes
 Define a common task flow template
 Use required parameters
 Use bound methods on task flows rather than invokeAction
executables in the pageDef
 Use such variable or component that is calculated or persisted
 Define task flow exception handlers
 Avoid Session and Application scopes
 Do not cache shorter living objects, due to high availability issue
 Go for lazy loading of initialization of task flows whenever possible
Designing for Reuse
Guidelines:
Use naming conventions to:
 Avoid naming conflicts
 Facilitate identifying the component
functionality
Standardize storage by agreeing
on:
 Type of repository needed
 Storage and organization
 Access methods
Make components available
for reuse by using:
Resource catalog
ADF library
Avoid unwanted regions in the
page. It is recommended to
have a maximum of 10
regions in a page
Avoid task flow in a pop-up
Conform to PPR Guidelines
Use PPR as much as possible
Purposes of PPR:
Improve application performance
Improve the user experience
PPR should not be used:
When navigating to another page
When response times may be long
When multiple sections of the page need to be redrawn
PPR may cause accessibility issues
Managed Beans
 Limit custom code in bean accessors
 Implement serialization for application, session, pageFlow and view scope
beans
 Only interact with BC custom methods through exposed client interface
 Define application and session scope beans in adfc-config.xml
 Define bounded task flow bean in their own .xml file
 Utilize common utility class for common functions
 Only create backing beans when actually needed
 Avoid business logic in bean methods (delegate them to BC)
 Avoid application and session scope variables, instead use pageFlow scope
 Do not bind unnecessary component references into backing beans
Other General Java Best Practices
 Ensure catch blocks do not swallow errors
 Always reformat code
 Only interact with the business model through the binding layer
 Use the ADFLogger
 Don't use System.exit(), System.out.* or System.err.*
 Don't use internal ADF packages
 Do not make ViewController do BC work. Do not call AM, VO
or importing packages oracle.jbo, etc.
 Don't hardcode human readable text
Tuning ADF Application
To tune ADF application, refer to the chapter on Oracle
Application Development Framework Performance Tuning in
“Oracle Fusion Middleware Performance and Tuning Guide”
Lesson Summary
Entity Objects
Vie Objects
Association and View Link
Application Modules
Model / Binding
Pages / View
Layout
Task Flows and Memory
Scopes
Designing for reuse
Conform to PPR Guidelines
Managed Beans
Other general Java best
practices
27
Miscellaneous
Lesson Agenda
ADF 12c New Features
Projects in ADF
ADF 12c New Features
JDeveloper IDE -3
ADF Business Components -2
ADF Model -1
ADF Controller -1
ADF View -1
ADF Faces -1
DVT -14
JDeveloper IDE
 Oracle Public Cloud: upload database objects to your Database Cloud Service.
 Background processing: Supports scheduling jobs for background processing and a UI to
manage these jobs. For example creating/scanning indexes.
 File Templates: Define custom file templates and invoke them from the gallery.
 Show Empty Folders: New option to display empty folders in the Application navigator.
 Common Issues Window: Any problems found with your application are now reported into
a single, consolidated Issues window so you can see all your mistakes at glance!
 Build on Save: A new preference allows to compile modified files automatically on saving.
 Download and Apply patches from Update Center: Distribute critical patches through
Check for Updates tool.
 Windowing System:
 Ability to drag-and-drop to reorder editor tabs
 Ability to float editor windows outside of the
IDE
 Fully customizable toolbar
 Drag-and-drop reshaping / resizing of docking
areas
 Ability to use editors in maximized state
JDeveloper IDE contd…
Start Page
JDeveloper IDE contd…
Context-sensitive New menu
JDeveloper IDE contd…
Dependency Explorer
Business Components
 Support for offline databases: The user can create new offline database objects
based on existing objects in a database. The user can also compare the two. New
wizards make working easier.
 Support for RowFinder feature: The Row Finder feature provides users a
declarative means of using a View Criteria on a View Object. A use case is to use
a Row Finder object to find a row (or a set of rows) in a single subordinate detail
table based on a row in a master table.
 Support for multiple required View Criteria: Multiple View Criteria can be
created on a single View Object. In addition, one or more of them can be marked
as required so that one can now have multiple mandatory View Criteria being
used per View Object.
 Groovy Debugging: One can set breakpoints and use the debugger to debug
Groovy expressions.
Business Components contd…
 REST Web Service Improvements:
 Include children in describe: Clients can request information about the collection and
nested resources using the new "includeChildren" query parameter. When a resource
item is requested and includeChildren=true is provided, all children will be
recursively included in the describe.
 Expand multiple levels of children: The expand query parameter is enhanced to support
multiple levels, for example:
"app/rest/Accounts/12345?expand=Contacts,Contacts.Addresses"
returns all contacts for the account and all addresses for the contacts.
 Versioning of REST payload formats is now supported, enabling clients to continue
working with older formats when backward incompatible changes are introduced.
 Improved query capabilities: For richer querying support, the query parameter accepts a
new SQL-like VC filter expression format that identifies the specific rows to retrieve from
the resource. Example: (AssignedTo_Id is null) or ( (Priority <= 2)
and (RecordName like 'TT-99%'))
ADF Model
 Bean Data Control Improvements:
Create Bean Data Control Wizard with new options for scrolling and range
paging as well as defining a wrapper class for data control implementation
code
Declarative Lists of Values (LOV)
Automatically call mergeEntity
Support CreateInsert and CreateWithParameters operations
 Web Service Data Control Enhancements:
Support for all REST operations
Create a Web Service Data control from RESTful service URL
ADF Controller
 Pretty URLs: In this release, the ADF Controller state information is
no longer included in the URL whenever possible.
 Unauthorized Region Taskflow: Allows developer to specify a "fall-
back" bounded task flow to be shown in case the user is not
authorized to access the current one.
 Recursive bounded task flows Support for calling bounded task
flows recursively. In previous versions, the view layer did not detect
that the view activity had occurred and did not re-render the
region.
ADF View (ADF Faces, DVT)
JSF 2.0 Support:
Facelets
Ajax
Get
Composite components
Annotated managed beans
New scopes
Conditional navigation
Add EL directly in page content
EL methods with arguments
System events
ADF View (ADF Faces)
 Skyros and Alta Skin
 Code Editor
 Enable Runtime Skin Updates
 Calendar support for 15min appointments and ability to zoom in
 OutputFormatted supports header tags h1 to h6
 Reorder Fields in Query
 ADF No Longer Requires Special Accessibility Modes
 af:inputDate now opens immediately on the client
 Export to Excel / CSV Enhancements
ADF View (DVT)
 Client Side Charting Solution
Client Side Resizing
Improved Server Scalability
Rich Set of Features:
 Over 30+ chart types
 Redesigned zoom and scroll
 Marquee zoom and selection
 Redesigned Time axis
 Hide and show series and ability to change
layout with client side rescale
 Improved data labeling
DVT - Panel Drawer
Treemap
New Gauges
Thematic Map
NewMarker Rotation
Base Maps
Deck Component
Sunburst
Timeline
List View
Picto Chart
Tag Cloud
Stock Chart
ADF Vs JET
ADF Vs JET
Projects
Lab Solutions: Lab03 to Lab24 (excluding Lab15 & Lab16)
Advance ADF Lab Solution: Lab28
Book ‘Developing Web Applications with Oracle ADF
Essentials’ by Sten E. Vesterli.
Chapter 5: Building Enterprise Application
 Section ‘Example Application’
Oracle Fusion Order Demo (FOD) Samples
Oracle Submit Samples
Lesson Summary
ADF 12c New Features
Projects in ADF
28
Advance ADF
Lesson Agenda
Following will be covered in Labs:
 Custom View Criteria
 Contextual Events
 Traversing and deleting master-
detail
 Creating an Application Module
base class
 Programmatically calling EL, scopes
and conditional display
 Adding Router Activity
 Programmatically handling confirm
Dialog Yes and No
 Programmatically invoking Popup
 Programmatically closing Popup
 Rendering Dynamic Region
 Add Context Menu
 Creating Data Control Method from
Backing Bean
 Programmatically adding PPR
 Programmatically handling UI CRUD
transactions
UI and Page Flow Design
Panel Accordion
showDetailItem
showDetailItem
Panel Tabbed
showDetailItem showDetailItem
HRSystemIndex.jsf
HRLocationDeptartmentTF
HREmployeeQuickSearchTF
HREmployeeSearchTF
HREmployeeCreateTF
HREmployeeSearchPF
HREmployeeUpdateTF
HRLocationDeptartmentPF
HREmployeeQuickSearchPF
HREmployeeCreatePF
HREmployeeListTF
HREmployeeDetailTF
HREmployeeListPF
HREmployeeDetailPF
HREmployeeDetailPF
Dynamic Region
HREmployeeSalaryGraphTF
HRDeptManagerDetailTF
Region TF Call HREmployeeUpdatePersonPF HREmployeeUpdateJobPF HREmployeeUpdateConfirmPF
Page Fragment
applyLocationVOCriteria
Custom View Criteria
Contextual Event
Panel Accordion Panel Tabbed
HRSystemIndex.jsf
HRLocationDeptartmentTF HREmployeeListTF
PageDef
PageDef
HREmployeeListPF
HRLocationDeptartmentPF
Create data control
Create data control
Bindings
1
8
7
6
4
3
2
11
9
14
13
12
4
3
2
1 5
6
5
7
10
Characteristics of the Contextual Event
Framework
Contextual events:
Provide a way to coordinate regions
Can be invoked and consumed only by
method action of a data control
Producer and consumer may be the
same or different data controls.
Contextual Events: Overview
Using the Contextual Event Framework to
Coordinate Page Regions
Using the Contextual Event Framework to
Coordinate Page Regions: Step 1
Using the Contextual Event Framework to
Coordinate Page Regions: Step 2
Using the Contextual Event Framework to
Coordinate Page Regions: Step 3
Using the Contextual Event Framework to
Coordinate Page Regions: Step 4
Using the Contextual Event Framework to
Coordinate Page Regions: Step 5
Using the Contextual Events Tab to Define an
Event
Using the Contextual Event Framework to
Coordinate Page Regions: Step 6
Using the Contextual Event Framework to
Coordinate Page Regions: Step 7
Using the Contextual Event Framework to
Coordinate Page Regions: Step 8
Using the Contextual Events Tab to Map the
Event
Using the Contextual Event Framework to
Coordinate Page Regions: Step 9
The Active Data Service Framework
Lesson Summary
 Custom View Criteria
 Traversing and deleting master-
detail
 Creating an Application Module
base class
 Programmatically calling EL, scopes
and conditional display
 Adding Router Activity
 Programmatically handling confirm
Dialog Yes and No
 Programmatically invoking Popup
 Programmatically closing Popup
 Rendering Dynamic Region
 Add Context Menu
 Creating Data Control Method from
Backing Bean
 Contextual Events
 Programmatically adding PPR
 Programmatically handling UI CRUD
transactions
29
Integrating ADF with Web Service
Developing ADF Applications with
ADF Data Controls
Lesson Agenda
 What is Web Service
 Types of Web Service
 REST versus SOAP
 When to use
 Create REST Web Service with ADF Business Service
 Create SOAP Web Service with ADF Business Service
 Consume REST Web Service (ADF)
 Consume REST Web Service (Generic)
 Consume SOAP Web Service
ADF Faces
Types of Data Controls
Model
(JSR227)
Business
Services
Data
Control
/Binding Context
Binding Container / Bindings
View
Controller
/Data Binding
ADFm
Data
Control
Data
Control
Data
Control
Data
Control
Web Services
(REST/SOAP)
EJB POJO URL
ADF BC BI Essbase BAM
Data
Control
Data
Control
Data
Control
Types of ADF Integrations with WS
Expose ADF as Web Service
Expose ADF Business Service as REST Web Service
Expose ADF Business Service as SOAP Web Service
Develop ADF Application with ADF Data Controls
Consume REST Web Service (ADF) Data Control
Consume REST Web Service (Generic) Data Control
Consume SOAP Web Service Data Control
Consume EJB Data Control
…
Types of ADF Integrations contd…
Integrate ADF Application with
Service Oriented Architecture (SOA)
Mobile Application Framework (MAF)
Cloud Service
WebCenter (WC)
PLSQL (Lesson 03 Extended Example)
Business Intelligence (BI)
…
Web Service Integration
What is Web Service
A Web Service is a service offered by an electronic device to
another electronic device, communicating with each other via
the World Wide Web.
Commonly used for integration
Hides complexities between network
Type of Web Services
 REST (REpresentational State Transfer)
HTTP based (GET, POST, PATCH, DELETE …)
Simple familiar
Programmer friendly
No Contract
 SOAP (Simple Object Access Protocol)
Relies on XML message format
Requires WSDL document
Requires Contract
Enterprise Standard
REST Vs SOAP
REST Vs SOAP
REST (REpresentational State Transfer) SOAP (Service Oriented Architecture Protocol)
External Calls / Invoke Service URL path Calling RPC method
Message Format JSON or XML Only XML inside a SOAP envelope
Communication JSON or XML WSDL
Performance High Performance, Scalability & Caching Low performance, scalability and no caching
To Expose Business Logic Uses URI Uses Service Interface
Call from JavaScript Easy to call Difficult to implement
Error Handling Built-in Does not support
Results Human readable Not Human Readable
Transport Simple HTTP protocol Uses SOAP envelope to transfer over HTTP protocol
Architectural Constraints
When to Use
When to use REST
Cloud-based and mobile applications
Creating highly scalable stateless applications
When to use SOAP
Internet applications – More mature tooling
B2B applications – Strong contract
Exposing existing applications
REST is better than SOAP
REST can be consumed by any client, even a web browser with
Ajax and Javascript
REST is lightweight
Does not require XML parsing
Consumes less bandwidth – no header for every message unlike SOAP
REST is easier to learn than SOAP
Summary of HTTP Methods for RESTful APIs
HTTP Method CRUD
Entire Collection (e.g. /users)
(all resources in a collection)
Specific Item (e.g. /users/123)
(a single resource)
POST Create
201 (Created), ‘Location’ header with link to /users/{id}
containing new ID.
Avoid using POST on single resource
GET Read
200 (OK), list of users. Use pagination, sorting and
filtering to navigate big lists.
200 (OK), single user. 404 (Not Found), if ID not found or
invalid.
PUT Update/ Replace
404 (Not Found), unless you want to update every
resource in the entire collection of resource.
200 (OK) or 204 (No Content). Use 404 (Not Found), if ID
not found or invalid.
PATCH Partial Update/ Modify
404 (Not Found), unless you want to modify the
collection itself.
200 (OK) or 204 (No Content). Use 404 (Not Found), if ID
not found or invalid.
DELETE Delete
404 (Not Found), unless you want to delete the whole
collection — use with caution.
200 (OK). 404 (Not Found), if ID not found or invalid.
HEAD Read Header Retrieve all resources in a collection (header only) Retrieve a single resource (header only)
OPTIONS any Return available HTTP methods and other options Return available HTTP methods and other options
Who's using SOAP / REST
SOAP REST
Amazon  
EBay  
Yahoo! 
Google Maps 
Google Search 
Blogger (blogs) 
PayPal 
Del.icio.us 
MSN Search 
MS Office 
SalesForce 
Using the Data Control Palette
Methods
Parameters
Return values
Creating ADF Data Bindings
Methods
Parameters
Return values
ADF Command button
ADF Output Text w/ Label
ADF Input Text w/ Label
Creating ADF Data Bindings
Note: Data Control Validation & UI Hints not available in 10.1.3.0
Customizing ADF Data Binding Properties
Label property
Text property
Web Service Provider
Web Service can be
Java Web Service, C, C++, C# Web Service
EJB Web Service
PL/SQL Web Service
BC4J Web Service
Any software component which adheres to the standards can be
exposed as Web Service
SOAP Web Service Standards
 WSDL – Web Service Definition Language
 XML format published for describing Web services
 Describes the public interface to Web Service, how to communicate to web service, protocol bindings and
message formats required to interact with web service.
 SOAP – Simple Object Access Protocol
 Protocol for exchanging XML-based messages over a computer network, normally using HTTP
 Providing a basic messaging framework
 Different types of messaging patterns in SOAP, but by far the most common is the Remote Procedure Call
(RPC) pattern, where one network node (the client) sends a request message to another node (the server),
and the server immediately sends a response message to the client.
 UDDI - Universal Description, Discovery, and Integration
 A platform-independent, XML-based registry for businesses worldwide to list themselves on the Internet
 Enabling businesses to publish service listings, discover other web services, define how the services or
software applications interact over the Internet
Create SOAP Web Service
ADF BC Web Service (Sample)
 Create ADF BC Objects (Employee EO & VO Objects)
 Create Application Module (EmployeeAM)
 Expose Application Module as Web Service
(EmployeeWebService)
 Deploy the EmployeeWebService in WLS Server
Create SOAP Web Service
Java Web Service
 Create Java Class
 Create Service Interface
 Create WSDL
 Deploy the Service in Server
 Test the Service using SOAP messages
Building REST Web Services with ADF BC
Oracle REST Standards include standards for
Resource naming
Resource URI
Resource Metadata
Resource Catalog
Pagination
Security
Caching
Oracle REST API’s Use JSON Payload
JavaScript Object Notation
text-based open standard designed for
human-readable data interchange. It is
derived from the JavaScript scripting
language for representing simple data
structures and associative arrays, called
objects. Despite its relationship to
JavaScript, it is language-independent,
with parsers available for many
languages.
Oracle and JSON Schema
 JSON Schema is WSDL + XSD for JSON
Describes the available Resource URI’s, Request and Response MediaTypes,
Resource metadata, etc.
Not an industry standard (yet)
Not yet widely adopted, though Google uses it
Extensible
Validation tools available
 Oracle resource catalog will be based on JSON Schema with
keyword extensions
Oracle will add more metadata for Data Controls / UI Generation
REST support
New ADF BC REST wizard to generate RESTful services using
JSON
New REST Data Control
No longer part of URL Data Control
ADF BC Rest Services
The resources are based on VO instances (and its accessors)
and are defined by a Resource Definition File
Resource Departments: Based on DepartmentVO and its accessor to
EmployeeVO
Resource Employees: Based on EmployeeVO
Each resource definition provides two kinds of resources:
Resource Collection
Resource
ADF BC Rest – Resource Collection
Departments
http://server/application/rest/Departments
Employees
http://server/application/rest/Employees
Employees in a "department context"
http://server/application/rest/Departments/10/Employees
ADF BC Rest – Single Resource
Department
http://server/application/rest/Departments/10
Employee
http://server/application/rest/Employees/103
Employee in a "department context"
http://server/application/rest/Departments/10/Employees/103
Application Module – REST Tab
REST Resources Definition
Example -/rest/Departments
ADF BC Rest - Expanding Links
?expand=EmployeesView
ADF BC Rest - No Links
?onlydata
ADF BC Rest - Pagination
Request param ‘limit’ specifies range size
Request param ‘offset’ specifies start index
Example:
/rest/Departments?limit=3&offset=0
 Retrieves first three departments
ADF BC Rest – Collection Filtering
Request param ‘query’ can specify “where clause”
Examples:
query={DepartmentName M*}
 Returns departments starting with M
query={DepartmentName *u*}
 Returns departments containing an ‘u’ in the name
query={DepartmentId < 40}
 Returns departments with Id lower than 40
ADF BC Rest – Payload Filtering
Request param ‘fields’ can specify comma-delimited list of
attributes to include
Example:
/rest/Departments?fields=DepartmentName
 Retutrns only DepartmentName in JSON payload
ADF BC Rest – Resource Catalog
http:/server/application/rest/describe
Lists all resources, attribute metadata, links, children, actions
Describe can also be done for one specific resource
http://server/application/rest/Departments/describe
New ADF Mobile REST Data Control
Goal: Leverage ADF BC Rest Services
Support CRUD operations and provide data control operations
that allow the developer to easily use declarative bindings
Use metadata exposed by the services' describe
Support for links and relationships
Support for paging
Lesson Summary
 What is Web Service
 Types of Web Service
 REST versus SOAP
 When to use
 Create REST Web Service with ADF Business Service
 Create SOAP Web Service with ADF Business Service
 Consume REST Web Service (ADF)
 Consume REST Web Service (Generic)
 Consume SOAP Web Service
30
Integrating ADF with EJB
Lesson Agenda
ADFBC and EJB Mapping
Consume EJB Data Control
ADF BC and EJB Mapping
ADF Business Components (BC) Enterprise Java Bean (EJB)
Entity Objects Entities from Tables (Java POJOs)
View Objects Named Queries (inside entity)
Application Module Session Facade
• Commit and Rollback • Persist and Update
• DataModel VOs • Named Queries
Data Control (automatically created) Data Control (manually created)
Lesson Summary
ADFBC and EJB Mapping
Consume EJB Data Control
31
Integrating ADF with Service Orientated
Architecture (SOA)
Lesson Agenda
Service Oriented Architecture
Key SOA Standards
Oracle SOA Platform
Orchestrating services
Create, deploy a SOA service and test
IT System Runtime Architecture
Orchestration Human interaction
Policy evaluation
Monitoring
Rules
Engine Assign
Task
Task
Complete
Human
Workflow
Service
BPEL Process,
Events, Alerts
results
facts
Business
Activity
Monitoring
Fusion Service Bus / XML Transformation
.Net Apps Legacy Apps
CRM
ERP
Fusion Applications (ADF)
Relational Data/
Apps Schema
Data Hub Legacy Data
ADF BC Services Services
Services
Common business logic &
data across multiple
instances and applications
Centralized & reliable messaging
across infrastructure
Combine re-usable services to
meet changing requirements
Centralized & secure data
access across all applications
Separate data persistence
from business logic
Service Oriented Architecture (SOA)
Orchestration Human interaction
Policy evaluation
Monitoring
Rules
Engine Assign
Task
Task
Complete
Human
Workflow
Service
BPEL Process,
Events, Alerts
results
facts
Business
Activity
Monitoring
Fusion Service Bus / XML Transformation
Relational Data/
Apps Schema
Common business logic &
data across multiple
instances and applications
Centralized & reliable messaging
across infrastructure
Combine re-usable services to
meet changing requirements
Centralized & secure data
access across all applications
Separate data persistence
from business logic
Model (JSR227)
View Controller
Business Services
ADF Faces
Taskflow ADF BC
ADF Model
WebCenter
SDO Services
Key SOA Standards
Oracle SOA Platform
Orchestrating Services
Lesson Summary
Service Oriented Architecture
Key SOA Standards
Oracle SOA Platform
Orchestrating services
Create, deploy a SOA service and test
32
Integrating ADF with Mobile Application
Framework (MAF)
Lesson Agenda
Mobile Application Choices
Native vs Web Hybrid
Responsive Design
Introduction of MAF
History of MAF
Prerequisites for MAF
MAF Development Tools
Non-Oracle Tools Needed
Working with Emulator
MAF Runtime Architecture
MAF App Basic
Creating MAF App
Mobile Application Choices
Native
Deploy “native” specific to iOS or Android (or other…)
Web
Deploy as web application; works on pretty much any browser
Hybrid
Vendor provided development environment that deploys to iOS
or Android (or other…) but leverages open technologies like
JavaScript, HTML5, and CSS
Native vs Web vs Hybrid
 Here’s a great comparison
 http://java.dzone.com/articles/state-native-vs-web-vs-hybrid
Responsive
Whether apps are Native iOS/Android, Hybrid, or Web-based;
our user’s devices come in all shapes and sizes
Well-designed apps respond gracefully
Responsive Design
Think flexibly; layouts should stretch and compress to fit
different heights and widths
Maximize layouts; larger devices should use the extra “real
estate” – views should combine multiple sub-views to ease
assembly
Prepare for density differences (DPI); might require resources
for different densities
Introduction to Mobile Application Framework
 MAF is a hybrid mobile architecture
 It is Single framework for both Android and iOS
 Can build same apln. for both devices without using any platform-specific tool
 It uses pre-installed HTML5, JavaScript, and CSS to render the UI
 It’s Components are defined for Apache Cordova objects,
 To access device features such as camera, contacts, GPS, e-mail, etc.
 It uses Webservices and SQLLite DB for Data sources
 It has a MVC framework
 It’s Application can be deployed in the Device or Emulator
 It is feely available as a plugin for both JDeveloper and Eclipse IDE’s
Market Place
Oracle recently released results from a global study with staggering statistics:
 1 in 6 employees have found ways to bypass their companies’ IT security
and use personal mobile devices for work without their employer knowing
 Only 18 percent of respondents believe their company effectively controls
what can be done on a mobile device
 67 percent of workers are using their own personal mobile devices for
work
 68 percent of workers said they would be happier working in a more
mobile and flexible way
 Sales for Oracle Mobile is about 60% more when compared to sales in
previous year, the same for ADF is about 20%
History of MAF
 Can migrate from Oracle ADF Mobile Applications to MAF
 There is no need to worry about the configuration of the file that
changes; it will all be performed by JDeveloper, automatically.
 Added as a plugin to JDeveloper 11g and later as plugin for
JDeveloper 12c
 Extended security using O – Auth and Web SSO. Integration with
Oracle Mobile Security provides high security for our application
features.
 Additional plugins, which allows us to extend our app’s
functionality like barcode integration.
Comparing Oracle MAF with ADF Mobile
Prerequisites for MAF
System should be of 64 bit with more than 4 GB RAM for better
performance
The application are built on JDeveloper, so have to install it
Install the plugin for Oracle MAF
Must have an understanding on Java
MAF Development Tools
JDeveloper
Eclipse
Non-Oracle Tools Needed
 Java SDK
 Android
 Android SDK
 Android Simulator
 Intel HAXM (Hardware Accel. Exec. Manager)
 iOS
 Apple Developer account
 Xcode
 Oracle MAF Certification Matrix
 http://www.oracle.com/technetwork/developer-
tools/maf/documentation/maf241certmatrix-3746359.html
Working with Emulator
MAF Runtime Architecture
Working with Data in MAF
Bindings and Data Controls
MAF Model Layer
Business Services (SOAP or WSDL)
Managed Beans
SQLLite (via JDBC)
ADF BC Objects? – Coming in a later release
MAF User Interface
Views
Task Flows
HTML5 + JavaScript + CSS – Touch, Gestures, Responsiveness
Apache Cordova (PhoneGap) – Device Features
MAF App Basics
App Project
App Model
App View
Creating MAF App
1) Watch User at Work
2) Design application (wireframe) to minimize interfaces and
maximize impact
3) Determine data required for display, input, and output
4) Determine on-device features to use
5) Create MAF project
6) Add Features to app
7) Create main MAF Task Flow & Empty Views
Creating MAF App contd…
8) Create Data Controls and supporting Model components
9) Create and test UI
a) Simple functionality?
b) Ease of use?
c) Get job done in few steps?
Creating MAF App contd…
10) Enable and test mobile features
a) Visualizations
b) Camera
c) GPS
d) Email
e) Text
f) Address Book
g) Web Services
11) Prepare for Deployment
12) Deploy
Creating MAF App contd…
13) Deployment Steps
a) Create Deployment Profile
b) Deploy to Android Simulator
c) Deploy to iOS Simulator
d) Deploy to live Android
e) Deploy to live iOS
i. Deploy to file
ii. Import file into iTunes
iii. Sync with device
14) Test on all likely devices
Wrapping it Up
Oracle Mobile Application Framework (MAF) is a toolset you
can use today to build and deploy hybrid mobile apps
MAF’s tooling insulates you against changes to standard
libraries
Creating MAF applications is relatively simple; building quality
mobile apps will take some real design
Lesson Summary
Mobile Application Choices
Native vs Web Hybrid
Responsive Design
Introduction of MAF
History of MAF
Prerequisites for MAF
MAF Development Tools
Non-Oracle Tools Needed
Working with Emulator
MAF Runtime Architecture
MAF App Basic
Creating MAF App
33
Integrating ADF with Cloud Service
Lesson Agenda
What is Cloud Computing
Cloud Service Models
Cloud deployment models
Elasticity
Business Benefits of Cloud
Technical Benefits of Cloud
What is Cloud Computing?
Cloud computing allows application software to be operated
using internet-enabled devices
Cloud Service Models
Cloud Service Models contd…
Cloud Deployment Models
Hybrid
Cloud
Public
Cloud
Private
Cloud
Community
Cloud
Elasticity
Power to scale
Key Concept in Cloud Computing
Solves Traditional Problems
Scale-up (Vertical)
Scale-out (Horizontal)
Business Benefits of Cloud
Low up-front Investment
In time Infrastructure
Efficient Resource utilization
Usage bases Cost
Reduce time to market
Technical Benefits of Cloud
Automation
Auto-scaling
Proactive scaling
Efficient development lifecycle
DR and Business Continuity
Lesson Summary
What is Cloud Computing
Cloud Service Models
Cloud deployment models
Elasticity
Business Benefits of Cloud
Technical Benefits of Cloud
34
Integrating ADF with WebCenter
Lesson Agenda
 What is WebCenter
 Pillars of WebCenter
 Key Benefits of WebCenter
 What is WebCenter Sites
 WebCenter Sites Architecture
 What is WebCenter Portal Cloud
 WebCenter Portal Architecture
 What is WebCenter Content
 WebCenter Content Architecture
What is WebCenter?
 WebCenter is the enterprise Web 2.0 extentional framework, build
on top of ADF to develop complete portfolio of Sites, Portal and
Content Management
 WebCenter Pillars:
WebCenter Sites
WebCenter Portal Cloud
WebCenter Content
 Implements the (run-time)
customization and
personalization requirements
 Allows consumption of third
party, external portlets
 Provides many Web 2.0
Services and Community
Workspaces
Key Benefits of Oracle WebCenter
Supporting industry standards
Enabling easy integration into an existing infrastructure
Providing a single paradigm to build all UIs
Extending existing Java EE and SOA applications
Reducing development time
WebCenter Sites
 To drive sales, marketing and loyalty, and to convert customers;
marketers and business users:
create, manage and moderate contextually relevant, targeted, media rich,
social and interactive online experiences (dynamic websites)
optimize customer engagement across multiple channels (web, mobile,
social channel, etc.)
manage large-scale global presences, with integration to enterprise
application
 Competes in the Web Experience Management market space
 Example: Amazon
WebCenter Sites Architecture
WebCenter Sites Sample
WebCenter Portal Cloud
Organization create intranets, extranets, mash-ups, self-service
enterprise portals (websites) and composite applications, with
integrated collaboration and social services, like Portlets, RSS,
Discussion forums, etc.
Competes in the Mash-up and Self-Service Portal market space
Example: Facebook, Vodafone, Verizon, Airtel
WebCenter Portal Sample
WebCenter Portal Architecture
work environment for effective team collaboration
WebCenter Portal Framework
 Content integration
 JCR 170 support
 Several content
repositories
 Portlets
 Consumable portlets
 Portlet containers for
 JSR 168/PDK-Java
 JSF-Portlet Bridge
 Out-of-the-box portlets
 Run-time customization
WebCenter Portal Services
A complete set of complementary services that enables you to
embed Web 2.0 communication and collaboration services directly
into an ADF application
WebCenter Portal Spaces
A prebuilt application that provides an online environment for
social networking, communication, collaboration, and personal
productivity
Instant communities
Team sites
Portals
WebCenter Spaces
Personal Space
 Users have secure,
individual workspace or
dashboard.
 It is highly personalizable
with social feeds, email,
tasks, tags, recent
documents, and so on.
 Users create pages, add
content, and customize
views using Oracle
Composer.
Business Role Pages
 Secure team sites and
community collaboration
 Role-based views and
access to information
 Completely customizable
 Easily embed ad hoc
activities in a business
process or application
 Users can share and reuse
Group Spaces as templates.
Group Spaces
 Role-based
communication with
user communities
 Prebuilt templates that
simplify linking pages
and content to a
specific enterprise role
 All users in a given role
easily kept up-to-date
with relevant
information.
 Integrated with user’s
Personal Space
WebCenter Portal Personal Space Sample
WebCenter Portal Group Space Sample
WebCenter Portal Composer
 Run-time customization
performed in the browser, in-place
 Rich, intuitive user experience
 Drag-and-drop
 Typical operations:
 Browse and add resources to pages
 Rearrange page layout
 Set page and component
properties
 Wire components together
 Changes stored in MDS
 Page creation API
WebCenter Portal Composite Applications and
Mash-ups
Metadata Services (MDS)
 Stores changes of ADF Faces pages
 Separate XML documents
 Only the changes are stored
 Supports attribute modification and insert/remove/move/reparent of elements
 Merges based on context when rendering a page
 Deployed page becomes the base document.
 Modifications come from MDS.
 Offers layered customization
 Provides a persistent store
 File System
 Database Schema
The Metadata Service Framework
WebCenter Portal – Other Key Features
What Is a Portlet?
A remote Web component that renders information in HTML
format
Portlets
Render dynamic content
Provide their own user interface
Allow customization and personalization
Are reusable
Portlet Overview
Register the producer, providing a URL
endpoint for the portlet producer.
Drag the portlet to the page.
WebCenter Content
 Provides unified repository to store unstructured contents,
documents, images, rich media, records, etc.
has the capability of creating, and publishing business-user websites
focused on targeted audiences
 manage end-to-end content lifecycle from creation to archiving
 automate business processes with prebuilt enterprise application
integrations
allow websites to dump files in and have them be accessible to business
users or other WebCenter applications
 Competes in the Enterprise Content Management market space
 Example: provides contents to WC Sites and WC Portal
WebCenter Content Architecture
WebCenter Content Sample
Lesson Summary
 What is WebCenter
 Pillars of WebCenter
 Key Benefits of WebCenter
 What is WebCenter Sites
 WebCenter Sites Architecture
 What is WebCenter Portal Cloud
 WebCenter Portal Architecture
 What is WebCenter Content
 WebCenter Content Architecture

More Related Content

Similar to Oracle ADF Tutorial (20)

PPT
Oracle Fusion Development, May 2009
Jaime Cid
 
DOCX
Best Weblogic Server Online Training
Samatha Kamuni
 
PDF
Oracle ADF Tutorial/Training Study Guide
Deepak Bhagat
 
PPTX
Oracle fusion dba online training
Glory IT Technologies Pvt. Ltd.
 
PDF
Oracle fusion adf_online_training_in_africa
magnificsmile
 
PPT
00CourseIntro_00CourseIntro_00CourseIntro.ppt
MahmoudGad93
 
PPT
oracle adf training | oracle adf course | oracle adf certification training
Nancy Thomas
 
PPTX
ADF in Action - getting (re)acquainted with Oracle’s premier application deve...
Lucas Jellema
 
PPT
01FusionADFIntro_01FusionADFIntro___.ppt
MahmoudGad93
 
PPT
SOA 11g Foundation - G - ADF Development.ppt
SudhirSinghShakyaVan
 
PPTX
OAF & ADF.pptx
ssuserb8935e
 
PDF
Build java-ee-applications-with-adf
Amit Sharma
 
PDF
A guide to ADF fusion development
DataNext Solutions
 
PDF
Oracle - Programatica2010
Agora Group
 
PPTX
Comparison between OAF & ADF.pptx
ssuserb8935e
 
PDF
Adf coursecontent(1)
Amit Sharma
 
DOCX
Oracle adf online training
o2education
 
PPT
Application development framework
Eastern Software Systems
 
PDF
Adf coursecontent(1)
Amit Sharma
 
Oracle Fusion Development, May 2009
Jaime Cid
 
Best Weblogic Server Online Training
Samatha Kamuni
 
Oracle ADF Tutorial/Training Study Guide
Deepak Bhagat
 
Oracle fusion dba online training
Glory IT Technologies Pvt. Ltd.
 
Oracle fusion adf_online_training_in_africa
magnificsmile
 
00CourseIntro_00CourseIntro_00CourseIntro.ppt
MahmoudGad93
 
oracle adf training | oracle adf course | oracle adf certification training
Nancy Thomas
 
ADF in Action - getting (re)acquainted with Oracle’s premier application deve...
Lucas Jellema
 
01FusionADFIntro_01FusionADFIntro___.ppt
MahmoudGad93
 
SOA 11g Foundation - G - ADF Development.ppt
SudhirSinghShakyaVan
 
OAF & ADF.pptx
ssuserb8935e
 
Build java-ee-applications-with-adf
Amit Sharma
 
A guide to ADF fusion development
DataNext Solutions
 
Oracle - Programatica2010
Agora Group
 
Comparison between OAF & ADF.pptx
ssuserb8935e
 
Adf coursecontent(1)
Amit Sharma
 
Oracle adf online training
o2education
 
Application development framework
Eastern Software Systems
 
Adf coursecontent(1)
Amit Sharma
 

Recently uploaded (20)

PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Ad

Oracle ADF Tutorial

  • 1. Download free Oracle ADF Training materials and resources (Tutorial) Deepak Bhagat’s Oracle ADF Blogs
  • 2. 1 Overview of Fusion Middleware and ADF
  • 3. Lesson Agenda Fusion Middleware (FMW) architecture MVC architecture ADF MVC and application architecture ADF technology stack Functionalities of ADF Challenges Faced when Building J2EE Applications Overview, Features and Key Benefits of ADF Advantages of ADF over J2EE Business Benefits of ADF Over Other Frameworks
  • 4. IT System Runtime Architecture Orchestration Human interaction Policy evaluation Monitoring Rules Engine Assign Task Task Complete Human Workflow Service BPEL Process, Events, Alerts results facts Business Activity Monitoring Fusion Service Bus / XML Transformation .Net Apps Legacy Apps CRM ERP Fusion Applications (ADF) Relational Data/ Apps Schema Data Hub Legacy Data ADF BC Services Services Services Common business logic & data across multiple instances and applications Centralized & reliable messaging across infrastructure Combine re-usable services to meet changing requirements Centralized & secure data access across all applications Separate data persistence from business logic
  • 5. Fusion Middleware (FMW) Architecture Cloud Application Foundation
  • 6. Client-Server Architecture Server Relational Data Legacy Data Data Services Oracle Forms Swing Office EJB POJO Toplink Hibernate Tuxedo Client PowerBuilder Visual Basic
  • 7. Model View Controller (MVC) Architecture Model View Controller Relational Data XML Data Packaged Apps Legacy Data Data Services JSF JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View JSF/OAFwk ADF BC Server
  • 8. MVC & Application Architecture Metadata Services JDeveloper Model (JSR227) View Controller Business Services Relational Data XML Data Packaged Apps Legacy Data Data Services ADF Faces JSF/ADFc/Taskflow ADF Model ADF BC JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View ViewController/ User Interface Project Model/ Service Project Model Presentation Layer v m bc BAM BPL JSF
  • 9. ADF Training Breakup Application Development Framework (ADF) Fusion Middleware and It’s Architecture (Lesson 1) ADF Integrated Development Environment –JDeveloper (Lesson 2) ADF Business Component functionalities (Lesson 4 to 9 & 22) ADF Faces functionalities (Lesson 10 to 21) ADF Advance Topics (Lesson 3 and 23 to 34)
  • 10. Functionalities of ADF Business Components  Building Business Services with ADF Business Components (L4)  Persisting Data using Entity Objects (Lesson 5)  Querying Data using View Objects (Lesson 6)  Exposing Business Services and managing transaction through Application Module (Lesson 7) Master – Detail Data Model  Declaratively Customizing Business Services (Lesson 8) Custom Fields  Validating Business Services (Lesson 9)  Programmatically Customizing Business Services (Lesson 22)
  • 11. Functionalities of ADF Faces  200+ featured Rich UI Components  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (L 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (Lesson 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (Lesson 20)  ADF Model support (Lesson 21)
  • 12. ADF Faces Functionality: ADF Faces Components  Layout Components: (L 12)  Headers, Layout, Grouping, Spacing, etc..  Navigation Control Components: (L14)  Button, Link, Train, Navigation, etc..  Menu and Toolbar explorer-type containers: (L 14)  Menu, Toolbar, Toolbox, etc..  Secondary Windows Layout: (L 14)  Popup, Dialog, Window, etc.  Text and Selection Components: (L18)  Output, Input, LOV, etc..  Data Views: (L 18)  Table, Tree, List, Carousel, Calendar, etc.  Advance Data Visualisation Components (L 18)  Chart, Graph, Gauge, NBox, Pivot Table, Map, Gantt, Timeline, Hierarchy Viewer, Sunburst, Diagram, etc..  Data Query Components (L 19)  Query and Quick Query
  • 13. Definition Examples Component Type UI Page Service / Operation Business Rule Business Event Business Object Organized data made visible to a user. May be part of a task flow or accessed as a standalone Lesson Summary of data. Implemented using JSF, Portlets, AJAX etc.. Functions, procedures, and legacy transactions which represent the operations of the business. Implemented using ADF BC EO/VO and SDO/WS. Policies that represent the key decisions of a business. Rules are centralized using metadata services as part of data validation or processing. Event of significance to an organization that is used to communicate information to other systems. Implemented using ESB. Logical data model of the information stored in a business. Defines the enterprise service object definition used for integration and services. Enter Company Information page; Opportunity Lesson Summary page Calculate Tax Service; Invoice Service “Offer 10% discount if Status = Gold” “Purchase Order Created”; “Inventory Threshold Reached” Customer; Opportunity; Order entity; Invoice Business Process A series of steps in a directed graph that represent the workings of an enterprise. Implemented using BPEL and Human Workflow components. Quote-to-Order Process; Defect Management Process Task Flow A series of pages organized in a directed graph that represent steps to be performed by a single individual in one sitting. Implemented using ADF. Enter Opportunity Task Flow; Create New Contact Task Flow Fusion Middleware Concepts
  • 14. Challenges Faced when Building J2EE Applications  Building J2EE applications can be complex  Development time can be extensive  Choosing and implementing appropriate design patterns can be overwhelming  “Do it yourself” applications often repeat existing application code  A large portion of “do it yourself” code is dedicated to common tasks  The more code you write, the greater the chance of errors  An application framework is needed
  • 15. Overview of ADF Industry Standard-Base Is an end-to-end J2EE framework that is extensible Enables developers to focus on the application, not the low-level infrastructure Creates reusable and maintainable code (Enhanced Reusability) Uses metadata, simplifying the basic task of wiring user interfaces to services Implements J2EE best practices and design patterns, including MVC (abstracts J2EE complexity) Choice of technology
  • 16. Overview of ADF cont. … Increase Productivity & Ease-of-use Provides declarative and visual development with JDeveloper Less coding, more reuse Reduce learning curve & resource issues XML Metadata
  • 17. Difference between Features and Functionality The meanings are similar, but with different nuances. "function" is used to describe a capability something has. "feature" is used to refer to a particular function that's special or notable in some way. For example: "A car uses a motor to function." "One of the functions of a car is the ignition.“ "This car has many safety features." "This car features anti-lock brakes and air bags."
  • 18. Features of ADF Integrated and pluggable Model-View-Controller framework implementation Declarative Business Services with ADF Business Components Rich web based interfaces Multi-channel client support Mobile device development Declarative application customization Declarative end-to-end integrated security Designed to Work Together Integrated
  • 19. Features of ADF cont.… Caching Integration with other Oracle ADF technologies, such as Web Services, WebCenter, EJB, SOA, BI, Cloud, PLSQL, etc.. Widely available documentation and support Platform independent Excellent development environment (JDeveloper tool) Extensive IDEs Support (Eclipse, etc.) Free Option – Oracle ADF Essentials
  • 20. Key Benefits of ADF Speeds up application development Protects from technology shifts Increase reusability across applications Create open and standard based applications Standards-Based Architecture Open
  • 21. Advantages of ADF over J2EE Category Struts / Spring Framework Oracle ADF Framework Framework Action-based Component-based Source code Developer has to write source code for all the UI components Built-in UI components and Rich look & feel Database connection Developer has to explicitly write Data base connectivity code to retrieve connection Built-in configuration of database connectivity, no explicit retrieval required SQL Statements Developer has to write SQL statements and execute them Declarative approach builds the required SQL statements Transactions Developer has to take care of Transaction management Transactions are managed by the framework
  • 22. Advantages of ADF over J2EE cont.… Page navigation Page navigations are based on the config XML files which should be taken care of by the Developer Controller takes care of page navigations when declaratively given Validations Each validation should be written in validation logic specific methods and each validation error should be managed separately and navigated to respective error pages Sophisticated validation hookups provided by ADF at various levels: UI level, AM Level, and Entity Level; developer can decide the right place of validation for a scenario Security User has to design and develop a user login UI page Declarative approach to security enables the developers to provide security at various levels: to pages, regions, tabs, sections, components Development time To build a normal CRUD operation module, developers take 3 days on an average To build a normal CRUD operation module, developers need 10 minutes on an average, having proper AM, EO, VO configured
  • 23. Advantages of ADF over J2EE cont.… Category Struts / Spring Framework Oracle ADF Framework Authentication Developer has to verify username and password against the data source provided Though it is not a direct feature of ADF, WebLogic provides various ways to authentication to which an ADF application can easily couple with SQL Authentication, SAML Authentication, LDAP Authentication, etc.. Wizard Developers find hardly any wizards to help in building framework features ADF is all about wizards and when users make proper use of these wizards they make the application work for the business requirements—and ADF provides all the source code Servers Framework can make use of web application servers like Apache tomcat, WebSphere, JBoss etc.. Built-in WebLogic server configurations make deployment much easier
  • 24. Competition Microsoft ADF allows us to compete head-to-head on the development productivity with MSFT IBM Different tools, not integrated No common framework Spring and other OSS frameworks No productive tooling
  • 25. Benefits of ADF Over Other Frameworks  End-to-End solution: an integrated solution for every J2EE layer  Development Environment: visual and declarative approach  Platform Independence: any J2EE compliant server and SQL-92 DB  Technology Choice: supports multiple technologies for each layer  Technology Commitment: develop rich we and cloud application  Metadata-Driven:  Declarative Customization:  Enhanced Reusability: task flow, template, libraries, fragment, etc.
  • 26. Lesson Summary IT system runtime architecture FMW, MVC, ADF MVCS and application architecture ADF technology stack Challenges Faced when Building J2EE Applications Overview, Features, Functionalities and Key Benefits Advantages of ADF over J2EE Business Benefits of ADF
  • 28. Lesson Agenda Overview of JDeveloper Confusing Terminologies and Abbreviations Create an ADF Application, Projects and DB Connections Explore JDeveloper and examine Application Artifacts Explore and Work with Windows of JDeveloper Use Help Centre and Refactor JDeveloper Artifacts Setup Integrated Development Environment (IDE) preferences Advantages of JDeveloper
  • 29. Overview of Development Tool: JDeveloper Code and Develop J2EE Applications Analysis and Design Applications Deploy and Manage Secure and Maintain Develop DBMS Schemas Integrate, Orchestrate and develop Business Process Team Development and Versioning Profile, Debug, Test, Tune and Optimize JDeveloper
  • 30. General ADF JDev Project Name for Fusion Application Business Service/ Service ADF Business Component Model Model-View-Controller ADF Faces / ADFm-ADFv-ADFc / ADF Model-View-Controller / ADF UI ViewController Confusing Terminologies
  • 31. Confusing Terminology “View” Database View ADF Business Component’s View Objects ViewController project View as page or page fragment View Scopes View layer in MVC
  • 32. Abbreviations AM- Appln Module AS- Association BC- Business Component BS-Business Service DB- Database DO- Domain Object Dept- Department EO- Entity Object Emp- Employee Loc- Location MAF- Mobile Appln Framework MVC- Model view Controller VC- View Controller VL- View Link VO- View Object WC- WebCenter WS- Web Service
  • 33. Launching JDeveloper  To launch JDeveloper:  Select Start > All Programs > Oracle > Oracle Home > Oracle JDeveloper Studio > Oracle JDeveloper Studio  Starting from the command line or a shortcut pointing to jdev.exe in the  <JDev Home>jdevbin directory  You can specify flags:  For the user directory:  -J-Dide.user.dir=<path>  For editor windows: -noreopen
  • 34. Selecting Developer Role Select a developer role, when you launch JDeveloper.
  • 35. Development Environment (IDE) Preferences Access the Preferences window by selecting Tools > Preferences
  • 36. Windows in JDeveloper JDeveloper features that facilitate ease of application development include following windows:  Applications  Data Control Panel  Database  Structure  Editors (code or visual)  Log and Debugger  Components  Resources (IDE and Application)  Properties  Other Windows
  • 38. Applications Window Has expandable, minimizable panels to display: Projects Application resources Data controls Recently opened files
  • 39. Database Window The Database Navigator: Shows both IDE and application connections Enables you to:  Create, Manage and Delete connections  Open SQL Worksheet  View database elements  Filter the display
  • 40. Structure Window A hierarchical tree view of the selected document, object or source code The ability to:  View in different ways  Navigate (go to the source)
  • 42. Log Window  Displays JDeveloper messages: such as logging and compilation  Has one or more tabs: a Messages tab and additional tabs depending on what is occurring  Has context menu to clear, wrap, save output, search, etc..  Displays standard output (such as System.out.println() messages)
  • 43. Components Window Display the components available to drag to visual editor Search for components Display the favorites and recently used components Display components in icon or list view
  • 44. Resources Window Contains two types of resources: Catalogs Connections Provides single searchable  view of and access to  many types of resources Facilitates sharing resources among developers Toolbar: Create/Import or Search
  • 47. Work with Windows Following actions can performed with windows: Close / Open Maximize / Restore Float / Dock Split / Unsplit Resize Reposition
  • 48. Requirement to Build an Application To build an application in JDeveloper, you need to define: An application One or more projects A database connection, if required by application Use of other connection, resource and features as required
  • 49. Create New ADF Application 2 3 1 1 1 1
  • 50. Use Application Overview Page The Application Overview page shows details about the application’s:  Java Files  Page Flows  Managed Beans  Web Tier  Business Components  Binding Files  Offline Database It enables you to:  Create new objects  Delete objects  Edit objects
  • 51. The Application Overview Checklist  The Applications Overview Checklist is designed to guide users through typical steps in building and application.
  • 53. Create Database Connections  Two types:  IDE:  Available to be added to any application  Create in Database Navigator or Resource Palette  To add to an application, drag to Application Resources or to an application in Database Navigator  Application:  Owned by a specific application  Create in Database Navigator or Application Resources
  • 54. Refactoring in JDeveloper Rename objects, such as associations and view links Move objects or packages to a different package Change all references throughout the application
  • 55. Advantages of JDeveloper  Single stack for all Apps development Portal (WC), BPEL, BI & Wireless Development Service-Oriented Development Event-Driven Development  Productivity With Choice - Supports choice of Development platforms (OS) Data sources Application servers Development approaches (MDA / declarative / hand-coding) Technology stacks
  • 56. Advantages of JDeveloper cont.…  Standard, Open and Extensible Support industry standards Integrate Open Source Utilities Open Extension API (JSR 198)  Better productivity Declarative and Visual Full development lifecycle One tool for Java, Web Services, XML, DB and more  Modeling UML, Database visual design, Java Class modeler, etc.
  • 57. DB Development Support for additional schema objects (create, update, visualize and generate…) Support for views (visualize with relationships to tables) Object types, PL/SQL packages, procedures, functions Sequences, synonyms, expression based indexes System Defined Types: SDO_Geometry, XMLTypes… Foreign database support for DB2, Informix, MySQL, SQL Server and Sybase Visual reconcile tool for the generation of scripts
  • 58. Integrated Development Environment Design Business Processes Design Routing Rules Build & Assemble Service Components Set Up Facts & Dimensions for BAM Design Event Flows (CEP) Design Business Rules Design Page Flows Drag & Drop Page Regions Drag & Drop Portlets Drag & Drop DHTML Components Design Page Templates Configure Customization & Personalisation MEP Support Integration with ADE Activity Guide Control Flexfields & Save For Later Controls Seed Data UI and Extraction Database Schema Development UI Development SOA/EDA Development Apps Development JDeveloper 12c – Declarative Model Driven Development
  • 59. Lesson Summary Overview of JDeveloper Confusing Terminologies and Abbreviations Create an ADF Application, Projects and DB Connections Explore JDeveloper and examine Application Artifacts Explore and Work with Windows of JDeveloper Use Help Centre and Refactor JDeveloper Artifacts Setup Integrated Development Environment (IDE) preferences Advantages of JDeveloper
  • 61. Lesson Agenda Exploring HR System ER Diagram Examining Training Lab Application Create an offline Database Diagram Add new offline DB Schema objects PLSQL Integration
  • 62. JOBS P N JOB_ID VARCHAR2 (10 BYTE) N JOB_TITLE VARCHAR2 (35 BYTE) MIN_SALARY NUMBER (6) MAX_SALARY NUMBER (6) REGIONS P N REGION_ID NUMBER (4) N REGION_NAME VARCHAR2 (30 BYTE) 0..1 0..* 1..* 0..1 0..* 0..1 0..* EMP_MANAGER_FK JHIST_JOB_FK DEPT_LOC_FK LOC_C_ID_FK COUNTR_REG_FK HR System ER Diagram COUNTRIES P N COUNTRY_ID CHAR (2 BYTE) COUNTRY_NAME VARCHAR2 (40 BYTE) F REGION_ID NUMBER 0..1 EMP_JOB_FK 1 1..* LOCATIONS P N LOCATION_ID NUMBER (4) STREET_ADDRESS VARCHAR2 (40 BYTE) POSTAL_CODE VARCHAR2 (12 BYTE) CITY VARCHAR2 (30 BYTE) STATE_PROVINCE VARCHAR2 (25 BYTE) F COUNTRY_ID CHAR (2 BYTE) 1 0..* 0..* 0..1 JHIST_DEPT_FK 0..1 0..* DEPARTMENTS P N DEPARTMENT_ID NUMBER (4) N DEPARTMENT_NAME VARCHAR2 (30 BYTE) F MANAGER_ID NUMBER (6) F LOCATION_ID NUMBER (4) DEPT_MGR_FK 0..1 0..* EMPLOYEES P N EMPLOYEE_ID NUMBER (6) FIRST_NAME VARCHAR2 (20 BYTE) N LAST_NAME VARCHAR2 (25 BYTE) U N EMAIL VARCHAR2 (25 BYTE) PHONE_NUMBER VARCHAR2 (20 BYTE) N HIRE_DATE DATE F N JOB_ID VARCHAR2 (10 BYTE) SALARY NUMBER (8,2) COMMISSION_PCT NUMBER (2,2) F MANAGER_ID NUMBER (6) F DEPARTMENT_ID NUMBER (4) F GENDER_ID NUMBER (10) EMP_DEPT_FK 1 JHIST_EMP_FK 1..* JOB_HISTORY P F N EMPLOYEE_ID NUMBER (6) P N START_DATE DATE N END_DATE DATE F N JOB_ID VARCHAR2 (10 BYTE) F DEPARTMENT_ID NUMBER (4) GENDERS P N GENDER_ID NUMBER (10) GENDER_NAME VARCHAR2 (20 BYTE) 0..1 0..* EMPLOYEES_GENDERS_FK1
  • 78. ADF Business Rules in PL/SQL
  • 79. Typical Environment Background environment: A PL/SQL package that encapsulates insert, update, and delete access to an underlying table A companion database view for read access
  • 80. Controlling Entity Posting Order to Avoid Constraint Violations Performing DML on more than one entity object can present problems.  Because of database (DB) constraints, the order in which the operations are performed is important.  Primary key values must be inserted before foreign key references to avoid DB violation.  When you commit a transaction, entity object changes are processed in chronological order.  When you insert a new Employee row and then an associated new Department row, the new employee fails at the database level due to the EMP_DEPT_FK foreign key constraint.
  • 81. Lesson Summary Exploring HR System ER Diagram Examining Training Lab Application Create an offline Database Diagram Add new offline DB Schema objects PLSQL Integration
  • 82. 4 Building Business Service with Default ADF Business Components
  • 83. Lesson Agenda Describe tech-stack of ADF Business Components (BC) Understand types of Objects of ADF BC Functionality of ADF BC Creating and examining ADF BC Examining Configuration Files of ADF BC Test ADF BC using ADF Model Tester Overview of ADF BC Exposing ADF BC as Business Service
  • 84. Tech-stack of ADF Metadata Services JDeveloper Model (JSR227) View Controller Business Services Relational Data XML Data Packaged Apps Legacy Data Data Services ADF Faces JSF/ADFc/Taskflow ADF Model ADF BC JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View ViewController/ User Interface Project Model/ Service Project Presentation Layer v m bc BAM BPL JSF
  • 85. Tech-stack of ADF Business Components (BC) Model (JSR227) View Controller Business Services Data Services JSF/ADFc/Taskflow ADFm Model ADF BC Services JSP Struts ADF Swing Swing Office ADFdi EJB Session Beans Web Services POJO Toplink Queries Toplink Mapping EJB Finders Java Classes EJB Entity Beans Web / Wireless Rich Client / Desktop Relational Data XML Data Legacy Data Packaged Apps JDBC ADF BC View Object ADF BC Entity Object Business Services & Service Data Objects Data Query Business Objects Data Persistence Business Objects Metadata Services JDeveloper ADF Faces JSF DepartmentEO EmpDeptFkAS EmployeeEO DepartmentVO EmployeeVO Employee SummaryVO
  • 86. Types of Objects of ADF BC DepartmentEO DepartmentVO EmployeeVO Employee SummaryVO EmployeeBy EmailVO Department1 Employee3 Employee2 Employee Summary1 EmployeeBy Email1 applyManagerVO Criteria() Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances EmpDeptFkAS EmpDeptFkVL View Objects and View Links Entity Objects and Associations EmployeeEO Department2 ADF Business Components Business Domain Components Data Model Components Data Model XML Java XML Java XML Java Nested AM Row Set Iterator Service Layer
  • 87. Types of Objects of ADF BC cont.…  Types of Objects of ADF Business Components (BC)  Business Domain Components  Entity Object (Data Persistence Business Object)  Java  PL/SQL  Association  Data Model Components  View Object (Data Query Business Object)  Read only  Updateable  View Link  Application Module  Business Service  Service Data Object
  • 88. Functionality of ADF BC Reading / Retrieving data Caching data Writing / Persisting data Managing relationships Managing transactions
  • 89. Building a ADF BC The basic steps to create a Business Components model are: Create a connection to a database Create an application workspace Create Entity objects based on database tables Create View objects to support a client application Create an Application module to publish data access methods Test the Business Components
  • 90. Configuration Files of ADF BC bc4j.xcfg <ModelProjectName>.jpx adf-config.xml (.adfMTA_INF - application)
  • 91. Create Default ADF BC You can create ADF Business Components by: Creating a business components diagram Using the wizards
  • 92. Generated Artifacts of HRSystem ADF BC
  • 93. JOBS P N JOB_ID VARCHAR2 (10 BYTE) N JOB_TITLE VARCHAR2 (35 BYTE) MIN_SALARY NUMBER (6) MAX_SALARY NUMBER (6) REGIONS P N REGION_ID NUMBER (4) N REGION_NAME VARCHAR2 (30 BYTE) 0..1 0..* 1..* 0..1 0..* 0..1 0..* EMP_MANAGER_FK JHIST_JOB_FK DEPT_LOC_FK LOC_C_ID_FK COUNTR_REG_FK HR System ER Diagram COUNTRIES P N COUNTRY_ID CHAR (2 BYTE) COUNTRY_NAME VARCHAR2 (40 BYTE) F REGION_ID NUMBER 0..1 EMP_JOB_FK 1 1..* LOCATIONS P N LOCATION_ID NUMBER (4) STREET_ADDRESS VARCHAR2 (40 BYTE) POSTAL_CODE VARCHAR2 (12 BYTE) CITY VARCHAR2 (30 BYTE) STATE_PROVINCE VARCHAR2 (25 BYTE) F COUNTRY_ID CHAR (2 BYTE) 1 0..* 0..* 0..1 JHIST_DEPT_FK 0..1 0..* DEPARTMENTS P N DEPARTMENT_ID NUMBER (4) N DEPARTMENT_NAME VARCHAR2 (30 BYTE) F MANAGER_ID NUMBER (6) F LOCATION_ID NUMBER (4) DEPT_MGR_FK 0..1 0..* EMPLOYEES P N EMPLOYEE_ID NUMBER (6) FIRST_NAME VARCHAR2 (20 BYTE) N LAST_NAME VARCHAR2 (25 BYTE) U N EMAIL VARCHAR2 (25 BYTE) PHONE_NUMBER VARCHAR2 (20 BYTE) N HIRE_DATE DATE F N JOB_ID VARCHAR2 (10 BYTE) SALARY NUMBER (8,2) COMMISSION_PCT NUMBER (2,2) F MANAGER_ID NUMBER (6) F DEPARTMENT_ID NUMBER (4) EMP_DEPT_FK 1 JHIST_EMP_FK 1..* JOB_HISTORY P F N EMPLOYEE_ID NUMBER (6) P N START_DATE DATE N END_DATE DATE F N JOB_ID VARCHAR2 (10 BYTE) F DEPARTMENT_ID NUMBER (4)
  • 94. Diagram of HRSystem Business Service
  • 95. Object Instance of HRSystem Business Service
  • 96. Testing ADF BC with ADF Model Tester
  • 97. Overview of ADF BC  Maps to a data source, such as database and defines reusable logical and persistable objects (in Java & XML)  Provides data interaction and business logic execution, implemented in xml meta data (not code)  Enable wizard-based or visual development  Declarative business rules & validation  Predefined Java methods for any events  JDeveloper generates these Java objects  No need to write any JDBC code
  • 98. Bridging the Gap by ADF BC SQL Tables, rows Primary keys Foreign keys Transactions GB, TB •Java •Classes, instances •Memory references •Associations & Links •Shared heap •100s of MB
  • 99. Order of Execution of ADF BC DB Entity Object View Object Application Module Order of execution DB
  • 100. Implementation Architecture of ADF BC Provides metadata-driven components with optional Java code Is based on standard Java and XML Implements popular design patterns Organizes components into packages Provides prebuilt code in two main packages: oracle.jbo oracle.jbo.server Works with any application server or database
  • 101. Exposing Business Service ADF Business Service: Abstracts service implementation from clients: ADF BC, EJB, Web services, TopLink, Java classes ADF Faces, JSP, mobile Provides declarative data binding: Implements JSR 227 Uses Expression Language (EL) Separates view from business service Creates data control from application module
  • 102. ADF BC as Business Service Java (Co-Located Mode) UDDI LDAP JAAS JDBC JAX-R Database Schema Business Objects Application Module Logical Data Model Entity Objects Business Object Instances View Objects Security and Identity Management Identity Mgmt. JAAS Business Service Repository WSIL WSDL, XSD Design Time Publish Events & Services Business Events Java, XML (Batch Mode) SSO RBAC Table Table Table Physical Data Model Business Services Service Data Objects
  • 103. Services – Data Access Patterns  Data Access Patterns  Local Services  ADF BC application modules  Bound into user interfaces  Called from other ADF BC AM's  Local Services - Remote Data Sources  ADF BC application modules  Shared AM, VO & EO logic  Remote services can back data  Remote Services  ADF BC application modules running remotely  Third-party services  Web Service and SDO interfaces
  • 104. Local Services Desktop AM 1 JSR 227 AM 2 DB Middle Tier VO1 EO1 Java • Bind to UI using JSR 227 • Written using standard ADF BC Java APIs • Accessed from other AM's using ADF BC Java API • Accessed from third-party clients using WS & SDO Data Tier VO2 EO2 S D O Third-Party WS
  • 105. Local Services - Remote Data Desktop AM 1 AM 2 Middle Tier VO1 EO1 Java • Bind to UI using JSR 227; Third-party using WS & SDO • Written & accessed using standard ADF BC Java APIs • VO/EO data 'switchable' from native to remote service • All AM, VO & EO code, logic, caching, etc.. reusable • Must know ahead of time that data source is 'remotable' VO2 EO2 Third-Party Data Tier WS/FSB WS JSR 227 S D O
  • 106. Remote Services Desktop AM 1 JSR 227 AM 2 Middle Tier VO1 EO1 • Remote service can be remote AM or third-party • Same programming model for both (WS using SDO) • No shared code when switching from AM to third-party • Must know ahead of time that service is 'remotable‘ • Annotate and abstract WS calls using ESB VO2 EO2 S D O Third-Party DB Data Tier SDO S D O WS/ESB WS WS
  • 107. Class Diagram of ADF BC Objects
  • 108. Exposing the Application Module to the User Interface Oracle ADF Model:  Abstracts service implementation from clients: EJB, WS, ADF BC, TopLink, Java classes JSP, mobile  Provides declarative data binding: Implements JSR 227 Uses Expression Language (EL) Separates view from Business Service Creates data control from AM
  • 109. Lesson Summary Architecture of ADF BC Types of Objects – EO, AS, VO, VL & AM Functionality Creating and examining Configuration Files Test ADF BC using ADF Model Tester Exposing ADF BC as Business Service
  • 110. 5 Persisting Data using Entity Objects
  • 111. Lesson Agenda Describe tech-stack of Entity Objects (EO) Explain data persistence mechanism of entity objects Describe entity object attribute mapping Overview and features of Entity Objects Create and Examine EO from DB tables, views or synonyms Examine Attribute Settings Synchronize an EO with table structure changes Entity associations and types
  • 112. Tech-stack of Entity Object (EO) ADF Business Components DepartmentEO Business Services Relational Data / App Schema EmployeeEO EmpDeptFkAS Entity Objects and Associations Business Domain Components
  • 113. Persisting Data using Entity Objects  Entity Objects - Persist Data EmployeeEO Salary Range Should Between 0 to 99999 Entity objects Attributes Validation Rule EmployeeId FirstName LastName Salary EMPLOYEES table in database EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ... App Schema
  • 114. Entity Object Attribute Mapping Every table column maps to an entity object attribute EMPLOYEES table in database EmployeeId FirstName LastName Salary … EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ... EmployeeEO in ADF BC App Schema
  • 115. Ingredients of an Entity Object
  • 116. Overview of Entity Object “Entity object definitions” correspond to database tables Entity object definitions are templates for “entity object instances,” which correspond to table rows Java Based Performs insert/updates automatically PL/SQL Based All DML operations are PL/SQL procedures We need to provide implementations for insert/update/delete functions
  • 117. Features of Entity Object Fundamental Java object which interacts with the database Represents a single row of a database table or other data source Contain attributes representing the database columns Encapsulate attribute level and entity level validation logic Can contain custom business methods Handle database caching
  • 118. Creating EO from Tables, Views or Synonyms When an entity object is created, JDeveloper:  Interrogates the data dictionary for information  Infers primary key, or creates one from RowID  Creates implicit validators for database constraints  Creates the XML component definition file (<EO_name>.xml)  Creates optional Java files if selected, such as entity object class <EO_name>Impl.java  Generates associations based on foreign keys, if applicable (<Association_name>FkAS.xml)
  • 119. Examining Attribute Settings Attributes Type Properties  Updatable, mandatory, etc.. Control Hints  Label, Tooltip Text, Format Mask, etc..
  • 120. Examine Attribute Settings cont.… Name: A valid Java identifier Description: Description of the attribute for documentation Type: A Java data type Property Set: Named property set to apply to attribute. A property set is a version of an existing domain that is XML-only (no Java) and does not enforce a data type Polymorphic Discriminator: To identify the attribute as a discriminator column for polymorphic entity objects Subtype Value: Discriminator value for the subtype
  • 121. Examine Attribute Settings cont.… Effective Date: Effective date properties for the attribute. These options are available only if the attribute type is Date. (used for a point of time snapshot to answer such questions as what an employee’s salary was on January 30, 2004.) Start Date: Start attribute of an effective dated entity object End Date: End attribute of an effective dated entity object Sequence Flag: Stores a flag indicating the most recent change in the sequence for an effective dated entity object Sequence: Stores a sequence of changes for an effective dated entity object
  • 122. Examine Attribute Settings cont.…  Updatable: The view attribute setting is based on the entity attribute setting and can made more restrictive Always: Makes an attribute updatable While New: Makes an attribute updatable before an entity is first posted Never: Makes an attribute read-only  Persistent/ Transient: Attribute is persistent to be used in generating a table; or transient  Mandatory: Selected by default for columns with NOT NULL constraints
  • 123. Examine Attribute Settings cont.…  Primary Key: Selected by default for columns with PRIMARY KEY constraints  Queryable: Attribute can occur in the WHERE clause of a view object (selected by default except for LOBs)  Precision Rule: Validator is applied by the framework at runtime to enforce the maximum precision and scale of the data type. If selected, the validation is performed by the entity. If not selected, the validation is not performed by the entity and may result in invalid precision/scale errors from the database when the transaction is committed
  • 124. Examine Attribute Settings cont.… Refresh on Insert: Retrieves value from the DB after an insert Refresh on Update: Retrieves value from the DB after an update Change Indicator: Indicates, if the column is a change indicator, such as a timestamp, to be used to indicate that a row has been changed by another transaction or can be locked. If no columns are specified as change indicators, ADF BC does a column-by-column comparison
  • 125. Examine Attribute Settings cont.…  Track Change History: To log changes to the database, only if  implemented authorization using JAAS/JAZN,  the selected attribute is persistent,  not selected Primary Key, Mandatory or Discriminator, and  the attribute is Char, Character, String, Date, Timestamp or Number  The following types of history column are available:  created on: To use the column to log the date on which the row was first created. The attribute type must be Date or Timestamp  modified on: To use the column to log the date on which the row was last modified. The attribute type must be Date or Timestamp  created by: To use the column to log the user who created the row. The attribute type must be Char, Character, or String  modified by: To use the column to log the user who last modified the row. The attribute type must be Char, Character, or String  version number: To use this column to log the number of times the row has been changed. The attribute type must be Number
  • 126. Examine Attribute Settings cont.…  Column Name: Maps to the name of the table column  Column Type: Maps to the SQL type of the table column  Default Value: This value is not propagated from the default value, if any, in the database table  a Literal  an Expression or  SQL (only for transient attribute): Based on SQL expression  Refresh Expression Value: Displayed for transient attributes only. Groovy expression is used to set the condition  Generate Unique Constraint: Generates a UNIQUE constraint and defines the attribute to be unique. For example, every employee have a unique email id
  • 127. Examine Attribute Settings cont.… Sequence Name: The sequence name shown on the Sequence tab is applicable only at design time when you use the Create Database Tables feature. The sequence indicated here will be created along with the table on which the entity object is based. This field is not available for all attribute types Start At: Integer value you want the sequence to start at, the default value is 1. This field is not available for all attribute types
  • 128. Synchronizing an EO with Table Structure Changes
  • 129. Generate Database Tables from EO Right-click package and select Create Database Objects. In the Create Database Objects dialog box, select objects to create.
  • 130. Entity Association Types  Association (non-dependent) Entities are related but not completely dependent Either end of the association can exist without the other Either can be deleted without deleting the other  Composition (dependent) Destination entity is completely dependent on source entity Source entity owns destination entity No destination entity can be created without the owning entity existing first Source entity cannot be deleted without deleting all its associated destination entities JobEO EmployeeEO DepartmentEO LocationEO 0..1 1 M * D M * D EmpJobFkAS DeptLocFkAS
  • 131. Features of Entity Associations Consist of a master (source) and a detail (destination) entity Defines a relation between the two entities Enable access to data in related entity objects May be based on database constraints May be independent of database constraints Are used in defining validations and LOV metadata Source (Master) Destination (Details) Association DepartmentEO EmployeeEO * EmpDeptFkAS
  • 133. Lesson Summary Architecture of Entity Objects (EO) Describe EO Functionalities of EO Create and Examine EO from DB tables, views or synonyms Examine Attribute Settings Synchronize an EO with table structure changes Entity associations and types
  • 134. 6 Querying Data using View Objects
  • 135. Lesson Agenda Describe Tech-stack of View Objects (VO) Understand types of VOs Overview of VO Explain the features of VO Link two VOs to create master-detail view objects Create various types of View Objects and Links
  • 136. Tech Stack of VO: Flow ADF Business Components DepartmentEO DepartmentVO EmployeeVO Employee SummaryVO EmployeeBy EmailVO Department1 Employee3 Employee Summary1 EmployeeBy Email1 applyManagerVO Criteria() Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances EmpDeptFkAS EmpDeptFkVL View Objects and View Links Entity Objects and Associations EmployeeEO Data Model Business Domain Components Data Model Components XML Java XML Java XML Java Nested AM Row Set Iterator Employee2 EmpDeptFkVL1
  • 137. Tech Stack of VO: Data EmployeeVO EmployeeEO EmployeeId FirstName LastName Salary Entity object EmployeeId FirstName LastName Salary EMPLOYEES table in database EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ... App Schema 101 Steven EmpId First Nam King Last Nam 85000 Salary Steven King First Name Last Name Updatable View Object Select first_name, last_name from employees where email = :p_email EmployeeByEmailVO Read-only View object Read-only User Interface Updatable User Interface
  • 138. Ingredients of a View Object
  • 139. Types of VOs  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 140. Types of VOs: SQL Query  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 141. Read Only VO based on SQL Query: Overview ADF Business Components EmployeeByEmailVO EmployeeByEmail1 Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances SQL Query Read Only View Object
  • 142. Read Only VO based on SQL Query: Data View Object Select first_name, last_name from employees where email = :p_email EmployeeByEmailVO Steven King FirstName LastName EMPLOYEES table in database EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ... App Schema Read-only User Interface
  • 143. Read Only VO based on SQL Query: Mapping Every query column maps to a view object attribute Those attributes are visible to the application EmployeeId LastName DepartmentId DepartmentName SQL query view object from multiple tables
  • 144. Read Only VO based on SQL Query: Features  Read-only access to data  Based on SQL query, one or more tables  Have only SQL-Only attributes  Can contain transient (calculated) attributes  Provides a row set Client can scroll through this rowset but cannot make any changes to it  Normally used to populate LOVs, pop lists etc.  Cannot perform insert/update operations on the data  Do not use entity objects at all  But much faster
  • 145. Types of VOs: Updatable VO (Single Entity)  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 146. Updatable VO based on Single EO: Overview ADF Business Components EmployeeVO Employee2 Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances Entity Based Updatable View Object EmployeeEO Entity Object
  • 147. Updatable VO based on Single EO: Data View Object EmployeeVO EmployeeEO EmployeeId FirstName LastName Salary Entity Object EmployeeId FirstName LastName Salary EMPLOYEES table in database EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ... App Schema 101 Steven EmpId First Nam King Last Nam 85000 Salary Updatable User Interface
  • 148. Updatable VO based on Single EO: Retrieving Data  The view object queries the database directly  Data retrieved by the query is saved to the Entity Object’s cache. (View Object instead of caching data themselves, stores in Entity Object instances.)  Nonpersistent attributes are stored and retrieved from the view object’s cache Database View object instance Data Data Data Data rows Data Data Data View rows SQL query Data Data Data Entity object instances Data retrieval Entity object View object 12*salary (transient) 1 2 3
  • 149. Updatable VO based on Single EO: Updating Data  The view object updates the entity object’s cache  The entity object instances write back (commits) to the database  Entity object definitions can specify validation rules Database View object instance Data Data Data Data rows Data Data Data View rows Data Data Data Entity object instances DML Commit
  • 150. Types of VOs: Join VO (Multiple Entities)  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 151. Join VO based on Multiple EO: Overview EmployeeSummaryVO EmployeeSummary1 Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances Multiple Entity Based Join View Object EmployeeEO Entity Objects Referenced or Updatable DepartmentEO ADF Business Components
  • 152. Types of VOs: Referenced Entity  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 153. Referenced (Read-only) EmpDeptFkAS Join VO based on Referenced EO: Overview View object DepartmentEO EmployeeEO EmployeeId FirstName LastName Entity objects EMPLOYEES EMPLOYEE_ID FIRST_NAME LAST_NAME DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME DepartmentId DepartmentName EmployeeSummaryVO EmployeeId FirstName DepartmentId DepartmentName Relational Data / App Schema LastName 101 Steven Emp Id First Nam King Last Nam 10 Dpt Id IT_PROG Dpt Name 1 M * D
  • 154. Join VO based on Referenced EO: Setting
  • 155. Join VO based on Referenced EO: Features Join View Object includes reference entity object Reference Entity is most commonly used way to get information from other entity for display purpose Reference entity is displayed in read-only mode
  • 156. Types of VOs: Updatable Entities  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 157. Relational Data / App Schema Join VO based on Updatable EO: Overview View object DepartmentEO EmployeeEO EmployeeId FirstName LastName EMPLOYEES EMPLOYEE_ID FIRST_NAME LAST_NAME DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME DepartmentId DepartmentName EmployeeListVO EmployeeId FirstName DepartmentId DepartmentName LastName 101 Steven King Last Nam 10 Dpt Id IT_PROG Dpt Name Updatable Updatable Emp Id Emp Nam Entity objects EmpDeptFkAS 1 M * D
  • 158. Join VO based on Updatable EO: Settings
  • 159. DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EmployeeDetailVO Entity Objects encapsulate business logic for related tables in the database. Join VO based on Updatable EO
  • 160. VOs use SQL to Project, Join, Filter, and Sort business data as appropriate for a given task at hand. A VO comprises a SQL statement and some metadata which indicates how columns in the SELECT list map to Entity Object attributes. The developer has complete control over the content of the SQL for hand-tuning or adding complex sub-selects as needed. DEPT DEPTNO DNAME LOC SELECT D.DEPTNO, D.DNAME, E.ENAME, E.SAL, E.EMPNO FROM DEPT D, EMP E WHERE D.DEPTNO = E.DEPTNO ORDER BY E.SAL DESC EmployeeDetailVO Dept DeptNo DName Loc Emp EmpNo EName HireDate Sal DeptNo EMP EMPNO ENAME HIREDATE SAL DEPTNO Join VO based on Updatable EO
  • 161. Unlike other “pure object” approaches, VOs know that the database is the best at efficiently processing queries. Rather than adding extra object layers between the query and the database, a VO sends its SQL statement directly to the database. SELECT D.DEPTNO, D.DNAME, E.ENAME, E.SAL, E.EMPNO FROM DEPT D, EMP E WHERE D.DEPTNO = E.DEPTNO ORDER BY E.SAL DESC Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept DeptNo DName Loc Emp EmpNo EName HireDate Sal DeptNo EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO
  • 162. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING KING 5000 7839 16 20 RESEARCH FORD 3000 7902 16 20 RESEARCH SCOTT 3000 7788 15 20 RESEARCH JONES 2975 7566 17 30 SALES BLAKE 2850 7698 17 10 ACCOUNTING CLARK 2450 7782 17 30 SALES ALLEN 1600 7499 17 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 Emp EO Cache 16 16 15 17 17 17 17 VO Cache After the database has returned the query results, the View Object partitions the attributes in the database result set into Entity Object- specific row caches based on the View Object’s EO “wiring” metadata.
  • 163. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING KING 5000 7839 16 20 RESEARCH FORD 3000 7902 16 20 RESEARCH SCOTT 3000 7788 15 20 RESEARCH JONES 2975 7566 17 30 SALES BLAKE 2850 7698 17 10 ACCOUNTING CLARK 2450 7782 17 30 SALES ALLEN 1600 7499 17 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 Emp EO Cache 16 16 15 17 17 17 17 VO Cache Attributes calculated in the query are cached in the VO’s row cache. Any EO attributes are “pointed to” by the VO row cache and referenced from their respective EO row cache.
  • 164. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING KING 5000 7839 16 20 RESEARCH FORD 3000 7902 16 20 RESEARCH SCOTT 3000 7788 15 20 RESEARCH JONES 2975 7566 17 30 SALES BLAKE 2850 7698 17 10 ACCOUNTING CLARK 2450 7782 17 30 SALES ALLEN 1600 7499 17 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 Emp EO Cache 16 16 15 17 17 17 17 VO Cache Again, unlike “pure object” approaches, only the attributes retrieved in the query are cached.
  • 165. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 Emp EO Cache 16 16 15 17 17 17 17 VO Cache When a client program, applet, or browser page attempts to change the value of the Sal attribute in the View Object... setSal(3456)
  • 166. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 Emp EO Cache 16 16 15 17 17 17 17 VO Cache The View Object delegates the request to the appropriate Entity Object in the cache. setSal(3456) setSal(3456)?
  • 167. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC Dept Deptno Dname Loc Emp Empno Ename Hiredate Sal Deptno EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 Emp EO Cache 16 16 15 17 17 17 17 VO Cache Entity Object attribute-level validation logic on “Sal” is fired to see if this change in Salary is permitted. setSal(3456) setSal(3456)? ?
  • 168. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache The validation logic on the Entity Object for its “Sal” attribute contains code which references the Emp EO’s HireDate attribute to calculate if the employee was hired after January 1st, 1990 to enforce a business rule. The “Sal” validation code does this with a call to getHiredate(). When an attempt is made to access an EO attribute which is not in the EO cache, the remainder of the EO’s attributes are “faulted” in from the database by PK or ROWID. setSal(3456) setSal(3456)? Dept Emp KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499
  • 169. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache This “partial fetch” optimization means that if a user browses hundreds of rows, and only changes one, significant memory savings can be had for not caching all attributes for all rows. setSal(3456) setSal(3456)? Dept Emp KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 09-DEC-9220 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499
  • 170. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache If validation succeeds, the value is allowed to be set on the EO cache, provided the row can be locked. setSal(3456) setSal(3456)? Dept Emp KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499
  • 171. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache The Entity Object automatically locks its corresponding row in the database with appropriate DML. View Objects can support optimistic locking as well. setSal(3456)? Dept Emp KING 5000 7839 FORD 3000 7902 SCOTT 3000 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 setSal(3456); 20 7788 3000 SELECT FOR UPDATE
  • 172. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache Since the lock can be acquired, the valid Sal attribute is set to 3456 as requested by the client. Note that the change is not yet in the database -- only in the EO cache so far. setSal(3456)? Dept Emp KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 ALLEN 1600 7499 setSal(3456); 20 7788 3000
  • 173. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache The client browses to another employee “CLARK” and changes his salary to 8765 through the user interface... Dept Emp setSal(8765); 20 7788 3000 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 09-JUN-91 10 ALLEN 1600 7499
  • 174. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache A validation error in the Emp EO causes the setSal() to fail. For example, perhaps Emp.Sal has been defined to only allow salaries greater than 8000 if the employee is a Vice President or higher. Dept Emp 20 7788 3000 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 09-JUN-91 10 ALLEN 1600 7499 Error! Salary exceeds the limit. Try Again... setSal(8765)
  • 175. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache The client resubmits CLARK’s salary change to 7499 through the user interface... Dept Emp 20 7788 3000 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 09-JUN-91 10 ALLEN 1600 7499 setSal(7499);
  • 176. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache Validation succeeds this time, and the value is allowed to be set on the EO cache, provided the row can be locked. Dept Emp 20 7788 3000 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 2450 7782 09-JUN-91 10 ALLEN 1600 7499 setSal(7499); setSal(7499)?
  • 177. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache CLARK’s row in the EMP table is locked appropriately, and the Sal is set in the cache to 7499. Dept Emp 20 7788 3000 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 7499 7782 09-JUN-91 10 ALLEN 1600 7499 setSal(7499); setSal(7499)? SELECT FOR UPDATE 7782 2450
  • 178. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache The end-user clicks on a button to Save her changes in the UI. The client program requests a Commit on the current JBO Session. Dept Emp 20 7788 3000 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 7499 7782 09-JUN-91 10 ALLEN 1600 7499 setSal(7499)? 7782 2450 Commit()
  • 179. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache Any new, updated, or deleted rows in the EO caches communicate their changes to the database. No client-written code is required in the Entity Objects or View Objects to achieve this database interaction. Dept Emp 20 7788 3456 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 7499 7782 09-JUN-91 10 ALLEN 1600 7499 7782 8765 Commit() UPDATE
  • 180. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache Finally, the database COMMIT ends the transaction. Dept Emp 20 7788 3456 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 7499 7782 09-JUN-91 10 ALLEN 1600 7499 7782 8765 Commit() COMMIT
  • 181. Join VO based on Updatable EO DEPT DEPTNO DNAME LOC EMP EMPNO ENAME HIREDATE SAL DEPTNO EmployeeDetailVO 10 ACCOUNTING 20 RESEARCH 30 SALES Dept EO Cache Emp EO Cache 16 16 15 17 17 17 17 VO Cache The client is happy. The application developer is happy. Dept Emp 20 7788 3456 KING 5000 7839 FORD 3000 7902 SCOTT 3456 7788 09-DEC-92 20 JONES 2975 7566 BLAKE 2850 7698 CLARK 7499 7782 09-JUN-91 10 ALLEN 1600 7499 7782 7499
  • 182. Internationalization of Business Services When an application is internationalized, the UI displays text based on a user’s browser settings  To use resource bundles for translatable strings you can:  Create one bundle per file or project  Translate and append _<locale> to the file name  Configure the UI
  • 183. Types of VOs: Static List  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 22)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 184. Read Only VO based on Static List Static List Read Only View Object
  • 185. Overview of VO “View object definitions” contain SQL queries and act as templates for “view object instances” Retrieve data from the database Manage caches of data
  • 186. Features of VO  Enable you to have a view of data that is specific to one part of your application  Encapsulates database queries  Can be based on a SQL statement, static values, any number of entity objects or populated programmatically  Are used for joining, filtering, projecting and sorting business data  Provides an iterator through which one can browse through all the rows  Handle view object cache  Provides access to associated entity objects if any
  • 187. Examining Attribute Settings Can be based on EO attribute Select statement Transient (e.g. calculations) Can define default values Based on literal values Expressions
  • 188. Examine Attribute Settings  Name: Name of the attribute. By default it is based on the entity attribute name. A dropdown displays the list of attributes defined by the base entity object. Selecting an entity object attribute from the dropdown remaps the view object attribute to the selected entity object attribute and therefore changes more than just the attribute name. Remapping a view object attribute using this dropdown may be useful for making temporary changes while testing the application, but otherwise has little value at application design time. It is a valid Java identifier.  Description: Description of the attribute for documentation
  • 189. Examine Attribute Settings cont.…  Type: Attribute's data type. This is not modifiable here. If you want to change the type, you must do so in the entity object  Property Set: Property sets are named collections of properties or hints that can be used by attributes and bindings  Polymorphic Discriminator: Select if this is a discriminator column for a polymorphic view object. The attribute you select distinguishes which view row interface to use Subtype Value: a value that matches the attribute value for which you expect the base view object's view row interface to be used. For example, in a PersonList view object, you would mark the PersonTypeCode attribute as the discriminator attribute and supply a default subtype value of person
  • 190. Examine Attribute Settings cont.…  Effective Date: Displays the setting from the entity object attribute if effective date is enabled Start Date / End Date: Indicates whether the attribute is the Start or End attribute of an effective dated entity object Sequence Flag: Is mapped to a column or SQL Sequence: Is mapped to a column or SQL  Updatable: The view attribute setting is based on the entity attribute setting and can made more restrictive Always: Makes an attribute updatable While New: Makes an attribute updatable before an entity is first posted Never: Makes an attribute read-only
  • 191. Examine Attribute Settings cont.…  Persistent: Attribute is persistent to be used in generating a table  Transient: Attribute is persistent to be used in generating a table  Mandatory: Selected by default for columns with NOT NULL constraints  Primary Key: Selected by default for columns with PRIMARY KEY constraints  Queryable: Attribute can occur in the WHERE clause of a view object (selected by default except for LOBs)
  • 192. Examine Attribute Settings cont.…  Precision Rule: Used as a precision rule  Refresh on Insert: The entity object inserts a new row in the database, the entity object retrieves the value of this attribute from the corresponding database field  Refresh on Update: The entity object posts changes to an existing database row, the entity object retrieves the value of the attribute from the corresponding database field  Change Indicator: Indicates, column is a change indicator such as a timestamp. ADF BC will use change indicators to determine whether a row has already been changed by another transaction or can be locked. If no columns
  • 193. Examine Attribute Settings cont.…  Track Change History: To log changes to the database, only if  implemented authorization using JAAS/JAZN,  the selected attribute is persistent,  not selected Primary Key, Mandatory or Discriminator, and  the attribute is Char, Character, String, Date, Timestamp or Number  The following types of history column are available:  created on: To use the column to log the date on which the row was first created. The attribute type must be Date or Timestamp  modified on: To use the column to log the date on which the row was last modified. The attribute type must be Date or Timestamp  created by: To use the column to log the user who created the row. The attribute type must be Char, Character, or String  modified by: To use the column to log the user who last modified the row. The attribute type must be Char, Character, or String  version number: To use this column to log the number of times the row has been changed. The attribute type must be Number
  • 194. Examine Attribute Settings cont.…  Column Name: Maps to the name of the table column  Column Type: Maps to the SQL type of the table column  Generate Unique Constraint: Generates a UNIQUE constraint and defines the attribute to be unique. For example, every employee have a unique email id  Sequence Name: The sequence name shown on the Sequence tab is applicable only at design time when you use the Create Database Tables feature. The sequence indicated here will be created along with the table on which the entity object is based. This field is not available for all attribute types  Start At: Integer value you want the sequence to start at, the default value is 1. This field is not available for all attribute types
  • 195. Types of VOs: Master Detail VOs (View Link)  Read Only VO (No Entity) Static List (JDev demo) SQL Query Programmatic (Lesson 9)  Updatable VO (Single Entity)  Join VO (Multiple Entities) Referenced Entity (JDev demo) Updateable Entities (slides demo)  Master Detail VOs (View Link)
  • 196. Master-Detail VO based on Link: Overview EmployeeVO Department1 Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances EmployeeEO Entity Object DepartmentEO Employee3 DepartmentVO EmpDeptFkAS EmpDeptFkVL EmpDeptFkVL1 View Objects and View Links and Associations ADF Business Components Data Model
  • 197. Master-Detail VO based on Link: Mapping  View link definitions have “Source” and “Destination” attributes  These attributes specify the master-detail relationship Just like foreign key attributes specify a foreign key relationship  A view link definition works like an additional WHERE clause applied to the detail SELECT E.EMPLOYEE_ID, E.LAST_NAME FROM EMPLOYEES E EmployeeVO (Master) SELECT D.DEPARTMENT_ID, D.DEPARTMENT_NAME, D.MANAGER_ID FROM DEPARTMENTS D DepartmentVO (Detail) WHERE D.MANAGER_ID = :1 Destination attribute Source attribute
  • 198. Master-Detail VO based on Link: Example
  • 199. Master-Detail VO based on Link: Features Defines a relation between two VOs View link definitions relate a pair of view object definitions View link definitions specify master/detail relationships between the SQL queries Allows you to link master VO with detail VO using a foreign key Based on Association or a declarative join relationship between two VOs
  • 200. Comparing Join VOs with View Links (VL) Join view queries: Contain all attributes from main and referenced entities in a single row Use a WHERE clause to relate a key from the main table with a foreign key in referenced tables View link (VL) queries: Use a bind variable to relate detail records to key for selected master record Append WHERE clause with bind variable to the base SQL query for the source or destination view object
  • 201. Test VOs with ADF Model Tester
  • 202. Lesson Summary Architecture of VO Types of VOs Describe VO Functionalities of VO Link two VOs to create master-detail view objects Create various types of View Objects and Links as Hands-on Lab practices
  • 203. 7 Exposing Business Service through Application Module
  • 204. Lesson Agenda Describe tech-stack Overview of AM Explain features of AM Explain Data Model Describe the role of the ADF Model Create a Nested AM Explain how AM can manage: ADF BC Transaction Nested Application Module Shared Application Module Application Module Pooling Handling Application State
  • 205. Tech-stack of Application Module (AM) DepartmentEO DepartmentVO EmployeeVO Employee SummaryVO EmployeeBy EmailVO Department1 Employee3 Employee2 Employee Summary1 EmployeeBy Email1 applyManagerVO Criteria() Business Services Relational Data / App Schema Application Module HRSystemAM with View Object Instances EmpDeptFkAS EmpDeptFkVL View Objects and View Links Entity Objects and Associations EmployeeEO Department2 EmpDeptFkVL1 ADF Business Components Data Model Business Domain Components Data Model Components XML Java XML Java XML Java Nested AM
  • 207. Overview of AM  Represents a logical unit of work related to an end- user task  Encapsulates the active data model and business service methods for that task  It is the top-level container that contains view objects, view links, etc..  Represents a DB session and is associated with a dedicated JDBC connection  It can be nested under another AM  Root AM and all the nested AMs share the same transaction and same JDBC connection and root AM holds them
  • 208. Features of AM  Represents the data model that the client uses  Keeps track of all changes that affect data in the database  Provides transactional context for the application  Has one connection to the database  Enables you to gather data customized to a client interface so that data can be retrieved in one network round-trip  Can be easily reused in business logic tiers of other applications  Provides remotely accessible methods to implement application module behavior  Can contain other application modules, called nested application modules  Is deployable in multiple configurations / platforms without code changes
  • 209. AM Instances Each instance (user) of the application will get its own application module instance The application module instance contains view object instances View object instances use entity object instances to write
  • 210. The Data Model The view object instances in an application module instance are joined in master-detail relationships by “view link instances” The resulting tree is called the “data model” Master Detail Relationships allows to view data from related tables at same time
  • 211. Simple Data Model Instance of EmployeeVO Instance of DepartmentVO Instance of DeptMgrLink SELECT E.EMPLOYEE_ID, E.LAST_NAME FROM EMPLOYEES E SELECT D.DEPARTMENT_ID, D.DEPARTMENT_NAME, D.MANAGER_ID FROM DEPARTMENTS D WHERE D.MANAGER_ID = :current_employee_id
  • 212. Complex Data Model Master Instance of EmployeeVO Detail Instance of DepartmentVO Detail Instance of EmployeeVO Independent Instance of DepartmentVO
  • 214. Managing ADF BC Transaction by AM  Application modules: Handle transaction and concurrency support Use a single database connection Provide transaction context for updates, deletes, and inserts for all view objects in the application module, so all are committed or rolled back at once  For nested application modules, the outermost application module provides the transaction context for the others  No coding is required unless you want to modify the default behavior
  • 215. Nested Application Module Root AM provides transaction context, DB connection, and a single set of entity caches It combines VOs and service methods Example-2 Example-3 Example-1
  • 216. Nested Application Module cont.… UI UI UI PG3 UI Root AM Controller Model View Business Service AM Instances Nested AM
  • 217. Nested AM: Architecture of Root AM
  • 218. Shared Application Module  Shared AMs provide a reusable data service  They allow requests from multiple sessions to share a single application module instance  Any user session is able to access the same view instances contained in the shared AM  Shared AMs can be “application scoped” or “session scoped”  It is specified sharing in the Project Properties dialog box
  • 219. Application Module Pooling Enables users to share application modules Manages application state Provides the same instance or one with an identical state when requested by an application with managed state Available Referenced: I’d like to be used by User2 Unavailable: I’m busy right now! HRSystem Application Module Pool
  • 222. Handling Application State cont.… AM passivation saves transaction state in an XML document stored in database AM activation retrieves saved transaction state Passivation and activation are performed automatically when needed Saved state Passivation Activation
  • 224. Exposing Business Services with ADF Model Metadata Services JDeveloper Model (JSR227) View Controller Business Services Relational Data XML Data Packaged Apps Legacy Data Data Services ADF Faces JSF/ADFc/Taskflow ADF Model /Binding Context /Data Binding ADF BC JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View ViewController/ User Interface Project Model/ Service Project Presentation Layer v m bc BAM BPL JSF
  • 225. Estimating the Size of an AM Is it better to have one big application module or several little ones? An application module is a logical unit of work Let use cases drive application module decisions: Can be grouped by domain business objects involved Grouped by the user-oriented view of business data required Consider the possibility of reuse of the application module Consider service or transaction flow
  • 226. Create an Application Module In the New Gallery Business Tier, select ADF Business Components > Application Module to invoke the Create Application Module Wizard. Specify a name for  the application module and identify the  package where it should belong. Define the data model  for the application module by selecting  view objects from a tree of available view objects.
  • 227. Lesson Summary Architecture of AM Describe application modules Explain functionalities of AM Explain Data Model Describe the role of the ADF Model Create a Nested AM Explain how AM can manage: ADF BC Transaction Nested Application Module Shared Application Module Application Module Pooling Handling Application State
  • 229. Lesson Agenda How and where to use Groovy expressions Describe how to declaratively change data behavior Declaratively modifying entity objects, view objects and application modules Declaratively projecting, sorting and selecting data Restricting rows using where clause, parameterized where clause and structured where clause (ViewCriteria) Create view accessors and LOVs
  • 230. Introducing Groovy  Is a Java-like scripting language that is dynamically compiled and evaluated at run time  Enables to use declarative expressions, instead of writing Java code, for the following types of values in the ADF BC data model: Bind variables Calculated attributes Attribute default values View criteria View accessor bind variables Validation Validation message token binding
  • 231. Using Groovy Syntax - Example Java Groovy Expression ((Number)getAttribute("Sal") .multiply(new Number(0.10)) Sal * 0.10 ((Date)getAttribute("PromotionDate")) .compareTo((Date)getAttribute("HireDate")) > 0 PromotionDate > HireDate isEmployee() employee getEmployee() employee getEmpNo(int n) source.emp(5) checkEmployeeName() source.checkEmployeeName() checkEmployeeNo(int n) source.checkEmployeeNo(5)
  • 232. Using Groovy Syntax - Example  getAttribute("Sal"): Fetch the Sal attribute.  (Date)getAttribute("HireDate"): Casts HireDate attribute value to Date.  new TimeStamp(System.currentTimeMillis()): Creates new Timestamp object from the current system time in long.  newValue: Gets new value for the attribute in the attribute-level validator.  oldValue: Gets old value for the attribute in the attribute-level validator.  source: Refer to the current entity object.  rowSetAttr.sum(), rowSetAttr.count(),rowSetAttr.min(), rowSetAttr.max(), rowSetAttr.avg(): You can call the aggregate function on the ADF RowSet object. RowSet is a collection of rows returned through an association accessor.
  • 233. Using Groovy Syntax in ADF Reserved name adf gets objects from the framework:  adf.context: To reference the ADFContext object  adf.object: To reference the object on which the expression is being applied  adf.error: In validation rules, to access the error handler that allows the validation expression to generate exceptions (adf.error.raise) or warnings (adf.error.warn)  adf.currentDate: To reference the current date with time truncated  adf.currentDateTime: To reference the current date and time
  • 234. References for Groovy  Groovy Language, guides, examples: http://groovy.codehaus.org  ‘…BATDocs-TrainingReferenceL08-BAT Introduction to Groovy.pdf’  http://www.oracle.com/technetwork/developer-tools/jdev/introduction-to-groovy-128837.pdf
  • 235. Internationalization of Business Services When an application is internationalized, the UI displays text based on a user’s browser settings  To use resource bundles for translatable strings you can:  Create one bundle per file or project  Translate and append _<locale> to the file name  Configure the UI
  • 236. Editing Entity Objects Editors provide access to business component properties: EO Editor Property Inspector
  • 237. Customizing EO’s Default Behavior Declaratively customize EO’s default behavior: Customize attribute control hints: Example: HireDate – Simple Date Alternate key entity constraints Synchronize columns with trigger-assigned values Validate user input (Lesson 8 - Validation)
  • 238. Customizing EO’s Default Behavior Declaratively customize EO’s default behavior: Customize attribute control hints (JDev): Example: HireDate – Simple Date Alternate key entity constraints Synchronize columns with trigger-assigned values Validate user input (Lesson 8 - Validation)
  • 240. Customizing EO’s Default Behavior Declaratively customize EO’s default behavior: Customize attribute control hints (JDev): Example: HireDate – Simple Date Alternate key entity constraints Synchronize columns with trigger-assigned values Validate user input (Lesson 8 - Validation)
  • 241. Alternate Key Entity Constraints  Used for efficient uniqueness checks  Used for direct row lookups with findByKey()  Different from primary keys or unique keys
  • 242. Customizing EO’s Default Behavior Declaratively customize EO’s default behavior: Customize attribute control hints (JDev): Example: HireDate – Simple Date Alternate key entity constraints Synchronize columns with trigger-assigned values Validate user input (Lesson 8 - Validation)
  • 243. Synchronizing Columns with Trigger-Assigned Values  To synchronize when a database trigger updates a column, use Refresh On Update or Refresh On Insert  To use a database sequence to generate a primary key: Set data type of attribute to DBSequence Updatable is While New Refresh On Insert is selected automatically Provide Sequence Name and Start at
  • 245. Customizing VO’s Default Behavior  Define attribute control hints: Eg. HireDate – Simple Date, AnnualSalary -- Width  Perform calculations: Add transient attribute: Eg. AnnualSalary – 12*salary  Projection: Restrict the columns retrieved by a query:  Eg. select FIRST_NAME, LAST_NAME from employees (EmpSqlQueryVO)  Sorting: reorder of queried rows using ORDER BY clause:  Eg. select * from employees ORDER BY LAST_NAME (EmpSqlQueryVO)  Selection: Restrict the rows retrieved by a query:  Where clause: Eg. select * from employees WHERE email = ‘SKING’  Parameterized where clause: Eg. select * from employees WHERE email = :p_email  It uses bind variable. Sample EmployeeByEmailVO.  Structured/ Named where clause (ViewCriteria)  Parameterized structured/ named where clause: Eg. p_email -- EmpSqlQueryVOCriteria  Define a list of values (LOV): Eg. EmployeeSummaryVO-JobId -- JobVVO
  • 246. Defining View Object Control Hints Same as for entity objects Overrides EO control hint settings; use in cases such as: The same data must be displayed differently in different views OR The VO uses the same attribute twice as in a recursive relationship Can also be used for transient attributes defined at the VO level
  • 248. Projecting and Reordering Use the Attributes tab of the editor to delete or reorder attributes. Query changes to reflect the new SELECT clause.
  • 249. Sorting the Order of Queried Rows To change the order, perform the following steps: 1. Click the Query tab of the view object editor. 2. Click Edit in the Query section of the panel. 3. Click Edit in the Edit Query dialog box. 4. In the Order By dialog box, select the columns for sorting the rows retrieved by the query.
  • 250. Selection: Using Structured/Named Where Clause: View Criteria Defines complex query criteria at design time Specifies the execution mode
  • 251. View Criteria: Example None, one or more of View Criteria may be applied
  • 252. Selection: Role of View Criteria in Search View criteria can be created and saved as named definitions Named view criteria definitions appear under Named Criteria node in the Data Controls panel
  • 253. Defining View Accessors (LOV) View accessors are used for validation and LOVs You create them on the View Accessors page of EO or VO editor
  • 254. Using List of Values Are defined on view object attributes (JobId) Use view accessors as a data source: For attributes mapped to an entity object attribute:  Use the view accessor that is used by the entity object attribute’s Key Exists validator  Extend the view accessor at the view object level for UI hints or bind expressions if required (JobVVO) For transient attributes, defined as a new view accessor
  • 255. Retaining and Reusing a View Link Accessor Row Set  Enables caching of the view link accessor RowSet object  Avoids overhead of creating new detail RowSet objects  May be advisable when the application makes numerous calls to the same view link accessor attributes  Can be implemented declaratively in the Tuning section of the General tab for the view object that is the source for the view link
  • 256. Customizing AM’s Default Behavior The Application Module editor has the following tabs:  General: Set tuning parameters and define custom properties  Data Model: Refine the data model  Java: Create Java classes and expose methods to the client interface  Web Service: Enable Web Service support  Configurations: Create or modify sets of configuration parameters
  • 257. Application Module Pool Parameters You control the pool with the parameters: initpoolsize: The initial number of instances Poolmaxavailablesize: Maximum inactive instances Poolminavailablesize: Minimum inactive instances Poolmaxinactiveage: Maximum time an instance can be inactive before being flagged for removal poolmonitorsleepinterval: Amount of time between high-water triggers
  • 258. Modifying the Locking Behavior of an AM Default locking behavior is optimistic optimistic locking is recommended for Web applications Change configuration: Set jbo.locking.mode to optimistic or pessimistic
  • 259. Lesson Summary How and where to use Groovy expressions Explain how to declaratively change data behavior Declaratively modify entity objects, view objects and application modules Declaratively Projecting, Sorting and Selecting data Restricting rows using where clause, parameterized where clause and structured where clause (VC) Create view accessors and LOVs
  • 261. Lesson Agenda Use the declarative validation options Categories & Subcategories of Validations in BC Triggering validation execution Failure handling Using Groovy expressions in validation
  • 262. Validation Options for ADF Applications Categories of validations User Interface – (Lesson 16) Business Services (ADF BC) Database (PL/SQL) Managing of validations Model (JSR227) View Relational Database Data Services Business Service
  • 263. Categories of Validations in ADF BC Categories of validations:  User interface  Business services (ADF BC) Single Attribute  Use Case: Validate Item Id  Triggered when attributes are set Cross Attribute (Entity Level Validations)  Use Case: Validate Status and Sub- status Combination  Triggered because of page submit and before a transaction is committed Transaction Level  Use Case: Create an expense with a set of expense lines. Sum of the expense lines should not cross a threshold value  Executed only once for all entities in the transaction of the same type, rather than once per entity. Cross Entity – Uncommon scenario  Use Case: Before closing SR, validate if its tasks are closed.  Unrelated entities refer each other during the validation phase  Database (PL/SQL)
  • 264. Categories of Validations in ADF BC Categories of validations: User interface Business services (ADF BC) Declarative Validation: Built-in Rules Declarative Validation: Custom Rules Programmatic Validation: Global Rules Domains: Prevalidated Custom Datatypes Database (PL/SQL)
  • 265. Categories & Subcategories of Validations in BC  Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator  Declarative Validation: Custom Rules  Method validator  Programmatic Validation: Global Rules  Domains: Pre-validated Custom Datatypes
  • 266. Declarative Validation: Built-in Rules  Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator  Declarative Validation: Custom Rules  Method validator  Programmatic Validation: Global Rules  Domains: Pre-validated Custom Datatypes
  • 267. Attribute vs Entity level Validator Declarative validation enforces both entity- and attribute-level validation, depending on where the rules are defined  Attribute level Validation:  Attribute-level validation rules are enforced when the user changes the value of the related attribute  Limitations: Binding does not happen at the view accessor level  Entity level Validation:  Entity-level validation rules are enforced when a user tries to commit pending changes or navigates between rows  If the validity of one attribute is dependent on one/more other attributes, then best practices indicates that you should enforce this rule using entity validation, not attribute validation  Entity object validators are triggered whenever the entity, as a whole, is dirty
  • 268. Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator
  • 269. Declarative Validation: Built-in Rules: Collection Validator  Use case: Total salary of all employees  Performs validation based on aggregate functions (sum, average or count of an attribute value) over all rows in a table  Is defined at the entity level  To define a Collection validator, specify:  Operation: sum, average, count, min, or max  Accessor: association defined for the entity  Attribute: on which operation performed  Operator: not equals, less than, greater than, etc..  Compare With: litral, query, attribute or expression  Enter Literal Value (if using a literal)
  • 270. Declarative Validation: Built-in Rules: Unique Key Validator  Use case: Employee Id/ Email/ Phone Number is Unique  Ensures that the attribute always has a unique value if present is defined at the entity level  Ensures that primary key values are always unique  Can also be used for alternate keys  Upon failure, throws TooManyObjectsException
  • 271. Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator
  • 272. Declarative Validation: Built-in Rules: Compare Validator Use case: Hire Date to be less than or equal to Current Date Compares an attribute to a value To define a Compare validator, specify: Attribute (if entity level) Operator Compare With
  • 273. Declarative Validation: Built-in Rules: Key Exists Validator Ensure that a key value exists Checks cache first
  • 274. Key Exists Validator: Entity Vs View Accessor Use Case: Validate Employees and Departments Validate Jobs Validation Target Type: Entity: If the two tables are related and there exists a association between the two View Accessor: Tables are not related or the result set comes from a query
  • 275. Declarative Validation: Built-in Rules: Length Validator Use case: The phone number field is not less than 10 characters Compares the character or byte length of an attribute to the specified value To define a Length validator, specify: Attribute (if EO level) Operator Comparison Type
  • 276. Declarative Validation: Built-in Rules: List Validator Use case: Validate JobId Compares an attribute against a list of values Ensures that value is in (or not in) a list defined by: Literal Values Query Result View Object Attribute View Accessor Attribute
  • 277. List Validator: Query Result vs View Object vs View Accessor  Query Result vs View Object vs View Accessor  Use Cases:  Validate DepartmentId  Validate Jobs  List Type:  Query Result  Cannot have bind variables and dynamic VO is created based on SQL (Performance issue)  View Object  Cannot have bind variables  View objects are designed to be reused in any application. They should not be based on a query filtering criterion. Doing so would prevent them from being reused in other application modules and end up with creating multiple VO.  View Accessor - Recommended  Declarative representation of VOs that are available for validation purpose in the EO layer  Can specify View Criteria, Bind Variables
  • 278. List Validator vs Key Exists Validator  Use Case: Validate Jobs (List Validator) Validate EmployeeByEmail (Key Exists Validator)  Validation Rule Type: List Validator should be used typically when  The query results are small as the results are cached  There are no bind variables in the query  Query does not have to be executed again in the same transaction Key Exists Validator List should be used typically when  The query uses a bind value in the query and hence needs to be executed every time as needed  The bind value is required in the query as otherwise the result set maybe quite large
  • 279. Declarative Validation: Built-in Rules: Range Validator Use case: Salary range should be between 0 to 99999 Compares an attribute to a range of values To define a Length validator, specify: Attribute: Although you can define at the entity or attribute level, the Range validator pertains to an attribute Operator: Between or Not Between Range: Minimum and maximum values
  • 280. Declarative Validation: Built-in Rules: Regular Expression Validator  Use Case: Validate email address, URL value  The expression validator is similar to the method validator, except that the code is written in Groovy expression language  Capable of calling another java method with in Groovy expression  To define Regular Expression validator, specify:  Attribute  Operator  Predefined Expressions  Enter Regular Expression  Expression Qualifiers
  • 281. Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator
  • 282. Declarative Validation: Built-in Rules: Script Expression Validator To define a Groovy expression: Omit braces {} Use newValue for new value of current attribute Write code to return true or false and/or call adf.error.raise or adf.error.warn Can use aggregate functions on RowSet Can use ternary operator Click Test to check syntax
  • 283. Declarative Validation: Custom Rules  Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator  Declarative Validation: Custom Rules  Method Validator  Programmatic Validation: Global Rules  Domains: Pre-validated Custom Datatypes
  • 284. Declarative Validation: Custom Rules: Method Validator  Use Case: Validate HireDate  Extend declarative rules for entities or attributes  Call Java methods in your entity object (not in a separate class as a global rule is)  Are called automatically during validation cycle  Custom entity method with signature  "boolean validateXXX()"  Should be used only if declarative approach is not available  Used to implement complex validations and for derivations  Must:  Be defined as public  Return a boolean value  Be named like validateXXX()
  • 285. Programmatic Validation: Global Rules  Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator  Declarative Validation: Custom Rules  Method validator  Programmatic Validation: Global Rules  Domains: Pre-validated Custom Datatypes
  • 286. Programmatic Validation: Global Rules Custom global validation rules are available to assign declaratively to any business components by using the following steps: Create a Java class that implements the JboValidatorInterface interface in the oracle.jbo.rules package Modify the code for the validation rule Assign the rule to a business component object
  • 287. Global Validation Rule: Creating Java Class  Use Case: Total Salary of all employees in a department
  • 288. Global Validation Rule: Examining the Generated Skeleton Code public class CompareDates implements JboValidatorInterface { private String description = "Returns true if date1 is not after date2"; public CompareDates() { } public boolean validateValue(Object value) { // Todo: write code to validate return true; // return validated result } public void validate(JboValidatorContext ctx) { if (!validateValue(ctx.getNewValue())) { throw new ValidationException("model.CompareDates validation failed"); } } public String getDescription() { return description; } public void setDescription(String str) { description = str; } }
  • 289. Global Validation Rule: Modifying the Code public class CompareDates implements JboValidatorInterface { private String description = "Return true if date1 is not after date2"; private String earlierDateAttrName = ""; private String laterDateAttrName = ""; public void validate(JboValidatorContext ctx) { if (validatorAttachedAtEntityLevel(ctx)){ EntityImpl eo = (EntityImpl)ctx.getSource(); Date earlierDate = (Date)eo.getAttribute(getEarlierDateAttrName()); Date laterDate = (Date)eo.getAttribute(getLaterDateAttrName()); if (!validateValue(earlierDate,laterDate)) { throw new ValidationException("model.CompareDates validation failed"); } } else { throw new RuntimeException("Rule must be at entity level"); } } private boolean validateValue(Date earlierDate, Date laterDate) { return (earlierDate == null) || (laterDate == null) || (earlierDate.compareTo(laterDate) <= 0); } private boolean validatorAttachedAtEntityLevel(JboValidatorContext ctx) { return ctx.getOldValue() instanceof EntityImpl; } } 1 3 4 2
  • 290. Domains: Pre-validated Custom Datatypes  Declarative Validation: Built-in Rules  Defined only at the entity level:  Collection validator  Unique key validator  Defined at the entity or attribute level, but pertain to an EO attribute:  Compare validator  Key Exists validator  Length validator  List validator  Range validator  Regular Expression validator  Defined at the entity or attribute level, to validate the EO or the attribute:  Script Expression validator  Declarative Validation: Custom Rules  Method validator  Programmatic Validation: Global Rules  Domains: Pre-validated Custom Datatypes
  • 291. Domains: Creating Custom-Validated Datatypes  Domains are Java classes that extend the basic data types (String, Number, Date, and so on)  You can create your own data types that encapsulate specific validation rules  Use domains for more complex validation:  Format of a phone number  Validity of a URL  Validity of an email address  Checksum of digits of a credit card number  Validation is done by the domain constructor  Domain is not bound to a particular entity or attribute
  • 292. Domains: Steps  Create the domain  Add validation code to the validate() method in the domain’s Java file  Edit an entity and change the type of an attribute to the domain URL Domain appears in the list of types.
  • 293. Domains: Code Validation  The validate() method is called by the domain’s constructor: (mData is a private String variable containing the string to be validated.)  Example: URLDomain verifies that an attribute is a valid URL protected void validate() { try { // Make sure the user entered a valid URL java.net.URL u = new java.net.URL(mData); } catch (java.net.MalformedURLException e){ throw new oracle.jbo.domain.DomainValidationException ("Invalid URL"); } } }
  • 294. Triggering Validation Execution  The Validation Execution tab enables you to specify: When validation should occur The conditions governing validation execution Which attributes trigger validation Entity validation Rule Attribute validation Rule
  • 295. Specifying Validation Order  Changed attributes are validated when they lose focus  Changed entities are validated at commit time  In compositions, child entities are validated before parent entities  You can control execution order of validation within attributes or an entity  You can specify validation at the transaction level for some validators
  • 296. Failure Handling Use the Failure Handling tab on the Validation Rule page of the entity object editor or attribute editor to: Specify error message failure severity Insert Groovy variables into error messages Click Select Text Resource to store error messages as translatable strings
  • 297. Failure Handling: Error Message Failure Severity There are two failure severity levels for error messages: Error Informational Warning
  • 298. Failure Handling: Storing Error Message as Translatable Strings 1 2
  • 299. Failure Handling: Groovy Support Use Groovy expressions in validation error messages: You indicate a variable by surrounding a name with braces {} Message tokens are added automatically You provide message token expressions: source.hints. <attr>.label for labels <attr> for values
  • 300. Groovy Expressions for Validation  Groovy Expression Type Validation  In addition to the existing Groovy debugging support within JDeveloper, developers can now ensure the quality of their groovy expressions with type checking that occurs, by default, during project compilation  You use the Script Expression validator or Compare validator when using Groovy for validation
  • 301. Key Guidelines for Using Validation  Validate both in UI and Server Layers to serve multiple channels (Web Services)  Reuse VO for Validation and LOV  Groovy Expressions: Java-like scripting code stored in the XML definition of an entity object Do not use for complex validations Code completion not available  Adding code in ValidateEntity Method Avoid if possible Extra care should be taken by the developer to bundle exceptions. Framework takes care of it for declarative validations
  • 302. Lesson Summary Use the declarative validation options Categories & Subcategories of Validations in BC Triggering validation execution Failure handling Using Groovy expressions in validation
  • 304. Lesson Agenda  Evolution of web tier from HTML, Servlets, JSPs to JSF  Overview of Java Server Faces and it’s architecture  Discuss JSF UI components  Understand navigation using JSF Controller  Describe the purpose of managed and backing beans  Explain the JSF life cycle  Introduce how ADF Faces augments the JSF  Overview of ADF Faces rich functionalities  Overview of ADF Faces rich components
  • 305. Evolution of J2EE Web UIs Enabling the World Wide Web with HTML and HTTP Using Java as a language for web development Describing Servlets Describing Java Server Pages (JSP) Evolution of J2EE Web Tier Comparing JSF against traditional JSP
  • 306. The Web (WWW) with HTML HTML: A markup language for defining Web pages HTTP: A stateless request/response protocol for serving Web content, such as HTML pages Web server Browser client HTTP request HTTP response HTML document HTML files
  • 307. Web Development Web server Application server Presentation Servlets, JSP pages (JSPs), JavaServer Faces (JSF) Enterprise JavaBeans (EJB), CORBA Client Data Business logic
  • 308. Servlets Servlets: Are written in Java Extend the Web server Can be used to provide:  Back-end functionality  User interface Web server Browser client request HTTP response HTML document HTML files Other Request type? Web container Servlet
  • 309. Java Server Pages (JSP) JSP: Combines HTML and JSP tags Is saved as .jsp or .jspx Is compiled to a servlet on the first request Is recompiled only when changed on the server Enables servlet functionality with less programming
  • 310. Evolution of J2EE Web Tier Each is built on the previous layer Progressive levels of abstraction Higher level programming Servlets JSP JSF
  • 311. A simple JSP using JSF tag library <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <body bgcolor="white"> <f:view> <h:form id="helloform"> <h2>What is your name?</h2> <h:inputText id="username" value="#{UserNameBean.userName}" validator="#{UserNameBean.validate}"/> <h:commandButton id="submit" action="success" value="Submit"/> </h:form> </f:view>
  • 312. Applications Pages UI Components Markup Java Http Requests Ease of Development Lower Level JSF vs. Traditional JSP Product UI Events Developer JSF JSP
  • 313. Overview of Java Server Faces and ADF Faces  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components (L11-L18)  Navigation using ADF Controller (L13)  Managed and Backing Bean (L15)  Life Cycle and Helper Objects (L16) Features
  • 314. Overview of Java Server Faces (JSF)  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 315. Tech-Stack of JSF  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 316. Tech-Stack of ADF Metadata Services JDeveloper Model (JSR227) View Controller Business Services Relational Data XML Data Packaged Apps Legacy Data Data Services ADF Faces JSF/ADFc/Taskflow ADF Model /Binding Context /Data Binding ADF BC JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View ViewController/ User Interface Project Model/ Service Project Model Presentation Layer v m bc BAM BPL JSF
  • 317. Skins Render Kits UI Component Tree 1. UI Component is rendered through Renderer class 2. Expression Language Value Binding is used to access managed bean also know as a "backing bean" 3. Managed bean accesses J2EE persistence layer faces-config.xml trinidad.xml 1. EL accesses “bindings” object to value bind UI components 2. ADF “bindings” object is set through ADF Filter in web.xml 3. Bindings object accesses ADF Binding container, which then accesses DataControl 4. Business Services provide access to various data sources ADF Model /Binding Context /Data Binding Tech-Stack of View Layer View Controller Business Services ADF Faces Components ADF “binding” object ADF BC JSF Components Struts Swing Component ADFdi EJB POJO Toplink Portlet BI XML Web Rich Client / Desktop Relational Data XML Data Legacy Data Packaged Apps ADF Binding Container / ADF Bindings ADF Data Controls Data Services Wireless Industrial Faces Servlet / Front Controller ITS XML XML Swing L&F HTML Renderer WML Renderer Telnet Swing Renderer SVG ADF Faces Model (JSR227) Metadata Services JDeveloper Managed Bean ADF Faces Expr. Language J2EE Persistence JSF Page
  • 318. Skins Render Kits UI Component Tree 1. UI Component is rendered through Renderer class 2. Expression Language Value Binding is used to access managed bean also know as a "backing bean" 3. Managed bean accesses J2EE persistence layer faces-config.xml trinidad.xml Tech-Stack of JSF View Controller JSF UI Components Tree EJB POJO Toplink Portlet BI XML Web Relational Data XML Data Legacy Data Packaged Apps Data Services Wireless Faces Servlet / Front Controller XML XML HTML Renderer WML Renderer SVG Model (JSR227) Metadata Services Managed Bean Expr. Language J2EE Persistence JSF Page 1. JSF UI Components 2. Navigation / JSF Controller 3. Managed and Backing Beans 4. Life Cycle and Helper Objects
  • 319. Functionalities of JSF  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 320. JSF Functionalities: Overview Navigation UI Component View Renderer Backing bean Validator Converter Message Action method EventListener Event Model objects generates selects executes specialized outcome contains updates generates generates generates verifies value consumes manipulates displays translates value Contained in
  • 321. JSF Functionality: JSF Components  Java Server Faces (JSF):  Tech-Stack / Architecture  Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components Are basic building blocks of a JSF application  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects  Features  ADF Faces (extends JSF):  Tech-Stack / Architecture  Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects  Features
  • 322. Components: Tag Libraries  Java Server Faces (JSF):  Tech-Stack / Architecture  Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components Are basic building blocks of a JSF application  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects  Features  ADF Faces (extends JSF):  Tech-Stack / Architecture  Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects  Features
  • 323. Components: Tag Libraries Server-side component tag libraries: Encapsulated in base UI Component tag libraries  Core – For application tasks  Validation, Datatype conversion  HTML – For rendering basic HTML  Input fields, menus, tables button Can be invoked directly or in JSP using these tag libraries  Example: UIInput can be invoked in a JSP with <h:inputText ..>
  • 324. Components: Tag Libraries cont.… Can represent simple to complex User Interface components ranging from a button or input field to a complete page Provide functionality, definition or behavior Can be nested Use helper objects: validators, converters, listeners/events Can be associated to Model data objects through Value Binding Are extendable Developers can create new, custom components
  • 325. Components: Render Kits  Java Server Faces (JSF):  Tech-Stack / Architecture  Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components Are basic building blocks of a JSF application  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects  Features  ADF Faces (extends JSF):  Tech-Stack / Architecture  Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects  Features
  • 326. Components: Renderer Kits  Renderer kits: Library of Renderers Basic HTML RenderKit is part of the specification (reference implementation) Enable the same component to be rendered differently depending on the client
  • 327. Components: Renderers  Java Server Faces (JSF):  Tech-Stack / Architecture  Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components Are basic building blocks of a JSF application  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects  Features  ADF Faces (extends JSF):  Tech-Stack / Architecture  Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects  Features
  • 328. Components: Renderers  Renderers: Converts components to and from a specific markup language Display UI components in a technology understood by the output device Display in different forms based on invocation  Example: UIOutput -> text label, date label.. When an item has focus, its highlighting looks different depending on the client
  • 329. Components: Renderers JSF Multiple Renderers Option buttons: When an item has focus, its highlighting looks different depending on the client
  • 330. JSF Functionality: Navigation using JSF Controller  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 331. Navigation: Traditional In traditional navigation, a button or hyperlink is hard coded to navigate to a specific page:  Hard-coded button navigation <body> <form action="myNewPage.html"> <button type="button"/> </form>  Hard-coded hyper link navigation <body> <a href="http://myNewPage.html"> Go To My New Page</a> </body>
  • 332. Navigation: Overview  Java Server Faces uses its own controller for page navigation NavigationHandler evaluates navigation case and routes to new page Supports page forward and page re-directs  Navigation Cases Basic Navigation  Based on static string outcome  Based on dynamic outcome Navigation as the result of an action  Navigation cases can be defined based on the method returning the outcome string  Navigation rules are defined in the faces-config.xml, that govern page flow myNewPage firstPage.jsp myNewPage.jsp success firstPage Button
  • 333. Navigation: Example A command UI component can be bound to an action: <h:button action="#{mybean.navAction}"/>  mybean: The logical name of a managed bean (MyBean.java) with an action method, navAction(), which returns a string firstPage Button
  • 334. JSF Functionaly: Managed Beans  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 335. JSF Functionality: Managed Beans  Managed Beans:  Facilitate the UI logic of the application  Kind of like Struts Form beans and Actions combined  Encapsulates business logic, data and properties of components  Hold presentation and controller logic  Store state  example: authenticated user information  Execute Java routines when, for example, a user clicks a button  Define handler for Event Listeners  Add any code needed by UI  Are optionally created or used  Backing beans: Are a specialized type of managed beans that:  contain accessors for UI components  Have a one-to-one relationship with a page  Note: ADF BC applications define business logic mainly in the model layer, not the UI layer
  • 336. JSF Functionality: JSF Life Cycle  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4) A basic JSF application consists of:  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 337. Product code (state management, events, etc..) JSP LIFECYCLE JSP - Formal Phases Servlet URL parsing Client / Browser/ Wireless Render JSP Response
  • 338. The root component broadcast events to execute action listener and action methods JSF Life Cycle: Phases Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true Component Tree restored or created ~ Submitted form values stored in component. ~ Component values converted Component values validated ~ Component values bound to backing bean properties ~ Component can update model Component Tree is created from backing bean properties
  • 339. JSF Life Cycle: Overview Life Cycle and Helper Objects:  Request processing is managed by FacesServlet, which creates the FacesContext object  When a client makes a request for the page, the life cycle starts  During the life cycle, JSF implementation builds the view (tree of UI components) while considering the state saved from the previous postback  When the client performs a postback of the page, JSF implementation must perform life-cycle steps:  Conversion  Validation
  • 340. Features of JSF  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 341. Features of JSF Is a server-side, component based UI technology, (not markup and abstracts away from HTML) Is a standard J2EE Web UI framework Simple yet fully extendable provided by any vendor Supports automatic event and state handling Simplifies Web development Insulates the application developer from UI implementations Declarative definition—more robust and extensible
  • 342. Features of JSF cont.… Choice of UI technology Scale up (rich clients) Scale down (mobile devices) Has a diverse client base (not just HTML) Clear separation of presentation and behavior Supports existing views and controllers Designed to be leveraged by tools
  • 343. Overview of Java Server Faces and ADF Faces  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 344. Key Characteristics of Rich Web UIs Rich Web UIs include the following characteristics: Increased responsiveness over traditional Web applications Asynchronous communication with the server Behaviors not available in HTML alone
  • 345. Overview of ADF Faces  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 346. Tech-Stack of ADF Faces  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 347. Tech-Stack of ADF Metadata Services JDeveloper Model (JSR227) View Controller Business Services Relational Data XML Data Packaged Apps Legacy Data Data Services ADF Faces JSF/ADFc/Taskflow ADF Model /Binding Context /Data Binding ADF BC JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View ViewController/ User Interface Project Model/ Service Project Model Presentation Layer v m bc BAM BPL JSF
  • 348. Skins Render Kits UI Component Tree 1. UI Component is rendered through Renderer class 2. Expression Language Value Binding is used to access managed bean also know as a "backing bean" 3. Managed bean accesses J2EE persistence layer faces-config.xml trinidad.xml 1. EL accesses “bindings” object to value bind UI components 2. ADF “bindings” object is set through ADF Filter in web.xml 3. Bindings object accesses ADF Binding container, which then accesses DataControl 4. Business Services provide access to various data sources ADF Model /Binding Context /Data Binding Tech-Stack of View Layer View Controller Business Services ADF Faces Components ADF “binding” object ADF BC JSF Components Struts Swing Component ADFdi EJB POJO Toplink Portlet BI XML Web Rich Client / Desktop Relational Data XML Data Legacy Data Packaged Apps ADF Binding Container / ADF Bindings ADF Data Controls Data Services Wireless Industrial Faces Servlet / Front Controller ITS XML XML Swing L&F HTML Renderer WML Renderer Telnet Swing Renderer SVG ADF Faces Model (JSR227) Metadata Services JDeveloper Managed Bean ADF Faces Expr. Language J2EE Persistence JSF Page
  • 349. Skins Render Kits UI Component Tree 1. UI Component is rendered through Renderer class 2. Expression Language Value Binding is used to access managed bean also know as a "backing bean" 3. Managed bean accesses J2EE persistence layer faces-config.xml trinidad.xml Tech-Stack of JSF View Controller JSF UI Components Tree EJB POJO Toplink Portlet BI XML Web Relational Data XML Data Legacy Data Packaged Apps Data Services Wireless Faces Servlet / Front Controller XML XML HTML Renderer WML Renderer SVG Model (JSR227) Metadata Services Managed Bean Expr. Language J2EE Persistence JSF Page 1. JSF UI Components 2. Navigation / JSF Controller 3. Managed and Backing Beans 4. Life Cycle and Helper Objects
  • 350. Skins Render Kits UI Component Tree 1. UI Component is rendered through Renderer class 2. Expression Language Value Binding is used to access managed bean also know as a "backing bean" 3. Managed bean accesses J2EE persistence layer faces-config.xml trinidad.xml 1. EL accesses “bindings” object to value bind UI components 2. ADF “bindings” object is set through ADF Filter in web.xml 3. Bindings object accesses ADF Binding container, which then accesses DataControl 4. Business Services provide access to various data sources ADF Model /Binding Context /Data Binding Tech-Stack of ADF Faces View Controller Business Services ADF Faces Components ADF “binding” object ADF BC JSF Components Web Relational Data XML Data Legacy Data Packaged Apps ADF Binding Container / ADF Bindings ADF Data Controls Data Services Wireless Faces Servlet / Front Controller XML XML HTML Renderer WML Renderer SVG Model (JSR227) Metadata Services JDeveloper Managed Bean ADF Faces Expr. Language J2EE Persistence JSF Page
  • 351. Functionalities of ADF Faces  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 352. Functionalities of ADF Faces  200+ featured Rich UI Components (Lessons 12, 14, 18 and 19)  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (L 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (Lesson 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Validators & Converters  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (Lesson 20)  ADF Model support out-of-the-box (Lesson 21)
  • 353. ADF Faces Functionality: ADF Faces Components  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 354. ADF Faces Functionality: ADF Faces Components  Layout Components: (L 12)  Headers, Layout, Grouping, Spacing, etc..  Navigation Control Components: (L14)  Button, Link, Train, Navigation, etc..  Menu and Toolbar explorer-type containers: (L 14)  Menu, Toolbar, Toolbox, etc..  Secondary Windows Layout: (L 14)  Popup, Dialog, Window, etc.  Text and Selection Components: (L18)  Output, Input, LOV, etc..  Data Views: (L 18)  Table, Tree, List, Carousel, Calendar, etc.  Advance Data Visualization Components (L 18)  Chart, Graph, Gauge, NBox, Pivot Table, Map, Gantt, Timeline, Hierarchy Viewer, Sunburst, Diagram, etc..  Data Query Components (L 19)  Query and Quick Query ADF Faces components generally fall into the following categories:
  • 355. ADF Faces Components cont.…  Layout Components: (Lesson 12)  Core Structure and Page Management Components  Document, Form, Inline Frame, Template and Facet Definition  Interactive Containers (Show/Hide Capabilities) and Headers Components  Panel Accordion, Panel Tabbed, Panel Drawer, Panel Springboard, Panel Box, Panel Header, Show Detail Header, Show Detail and Show Detail Item  Page Layout Containers  Panel Grid, Panel Stretch Layout, Panel Splitter Layout, Masonry Layout, Panel Border Layout, Panel Form Layout, Panel Dashboard and Panel Collection  Grouping Containers  Panel Group Layout and Group  Spacing Components  Spacer and Separator  Miscellaneous Containers  Deck, Decorative Box, Panel List, Grid Cell and Grid Row
  • 356. ADF Faces Components cont.… Navigation Control Components: (Lesson 14) Button, Link, Breadcrumb, Navigation Pane, Navigation Item, XML Menu Model and Train Menu and Toolbar explorer-type containers: (Lesson 14) Menu Bar, Menu, Menu Item, Toolbar and Toolbox Secondary Windows Layout: (Lesson 14) Popup, Dialog, Panel Window and Note Window
  • 357. ADF Faces Components cont.…  Text and Selection Components: (Lesson 18)  Output Components  Output Text, Message, Image, Icon, Media, Progress Indicator, Status Indicator and Carousel  Input Components  Input Text, Input Number, Form, Rich Text Editor, File Upload, Color Chooser, Date Chooser and Code Editor  Selection  Boolean selection: Select Boolean Checkbox, Select Boolean Radio  Single Selection: Select One Radio, Select One Listbox, Select One Choice  Multiple Selection: Select Many Checkbox, Select Many Listbox, Select Many Choice, Select Many Shuttle, Select Order Shuttle, Slider (range)  List-of-Values (LOV) Components  Input List of Value and Input Combobox List of Value
  • 358. ADF Faces Components cont.…  Data Views: (Lesson 18) Collection-Based Components  Table, Tree, Tree Table, List View and Carousel Specialty Display Components  Calendar Component  Advance Data Visualization Components: (Lesson 18) Graph, Chart, Gauge, NBox, Pivot Table, Pivot Filter Bar, Geographic Map, Thematic Map, Gantt Chart, Timeline, Hierarchy Viewer, Tree Map, Sunburst and Diagram  Data Query Components: (Lesson 19) Query and Quick Query
  • 359. ADF Faces Rich Components Demo ADF Faces Rich Client (UI Components) Demo: https://docs.oracle.com/middleware/1221/adf/develop-faces/GUID- EE22FD96-2723-4F07-95A9-04931E42C365.htm
  • 360. ADF Functionality: Navigation using ADF Controller  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 361. ADF Functionality: Navigation using ADF Controller  Is built on top of the JSF navigation model  Handles page flow  Promotes page reuse through abstraction  Increases flexibility and manageability  Is the place for code execution, such as programmatic interaction with the model and business service  Supports application tasks  Input validation  State management  Security  Declarative transaction control  Provides declarative Back button control
  • 362. ADF Faces Functionality: ADF Life Cycle  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean (Lesson 16)  Life Cycle and Helper Objects Features
  • 363. The root component broadcast events to execute action listener and action methods JSF Life Cycle: Phases Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true Component Tree restored or created ~ Submitted form values stored in component. ~ Component values converted Component values validated ~ Component values bound to backing bean properties ~ Component can update model Component Tree is created from backing bean properties
  • 364. ADF Faces Functionality: ADF Life Cycle Phases
  • 365. JSF and ADF Life Cycle Phases JSF Phases ADF Phases Events Restore View JSF Restore View before(JSF Restore View) after(JSF Restore View) Init Context before(Init Context) after(Init Context) Prepare Model before, after Apply Request Values JSF Apply Request Values before, after Process Validations JSF Process Validations before, after Update Model Values JSF Update Model Values before, after Validate Model Updates before, after Invoke Application JSF Invoke Application before, after Metadata Commit before, after Render Response JSF Render Response before, after Only after navigation Init Context before, after Only after navigation Prepare Model before, after Prepare Render before, after
  • 366. Features of ADF Faces  Java Server Faces (JSF): Tech-Stack / Architecture Functionalities / Concepts (4)  JSF UI Components  Server-side component Tag Libraries  Render Kits  Renderers  Navigation using JSF Controller  Managed and Backing Beans  Life Cycle and Helper Objects Features  ADF Faces (extends JSF): Tech-Stack / Architecture Functionalities / Concepts (23+)  ADF Rich UI Components  Navigation using ADF Controller  Managed and Backing Bean  Life Cycle and Helper Objects Features
  • 367. Features of ADF Faces  Built to the Java Server Faces (JSF) 2.0 and later specification  Integrated declarative development with Oracle JDeveloper  Integration with other Oracle ADF technologies  Server-side Push and Streaming (Active Data Service)  User-driven Personalization  Limited need for developers to write JavaScript  Supports AJAX, SVG, Flash, and Custom Components  Runtime Drag and Drop  Caching  Help and Hints
  • 368. Lesson Summary  Evolution of web tier from HTML, Servlets, JSPs to JSF  Overview of Java Server Faces and it’s architecture  Discuss JSF UI components  Understand navigation  Describe the purpose of managed and backing beans  Explain the JSF life cycle  Introduce how ADF Faces augments the JSF  Overview of ADF Faces rich functionalities  Overview of ADF Faces rich components
  • 369. Functionalities of ADF Faces (Reference for Lessons 11 to 21)  200+ featured Rich UI Components  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (L 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (Lesson 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (Lesson 20)  ADF Model support (Lesson 21)
  • 370. ADF Faces Functionality: ADF Faces Components (Reference for Lessons 12, 14, 18 & 19)  Layout Components: (L 12)  Headers, Layout, Grouping, Spacing, etc..  Navigation Control Components: (L14)  Button, Link, Train, Navigation, etc..  Menu and Toolbar explorer-type containers: (L 14)  Menu, Toolbar, Toolbox, etc..  Secondary Windows Layout: (L 14)  Popup, Dialog, Window, etc.  Text and Selection Components: (L18)  Output, Input, LOV, etc..  Data Views: (L 18)  Table, Tree, List, Carousel, Calendar, etc.  Advance Data Visualization Components (L 18)  Chart, Graph, Gauge, NBox, Pivot Table, Map, Gantt, Timeline, Hierarchy Viewer, Sunburst, Diagram, etc..  Data Query Components (L 19)  Query and Quick Query
  • 371. 11 Getting Started with Rich User Interface
  • 372. Lesson Agenda Examine configuration files Internationalizing the User Interface Changing look and feel using ADF Faces skins Ways to add components to the page Use of facets
  • 373. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (Lesson 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (Lesson 20)  ADF Model support (Lesson 21)
  • 374. Internationalization of an Application Internationalization is the support for multiple locales Localization is the process in which support for a specific locale is added ADF Faces components provide automatic translation (into more than 30 languages)
  • 375. Resource Bundles  Resource bundles are simple properties files that contain the translatable strings used in an application  Translation strings can be parameterized to dynamically include strings like exceptions or counter  You do not need to load the base resource bundle on each page of your application hrdemo.browserTitle=HRDemo Beispielanwendung hrdemo.about=Über dieses Beispiel hrdemo.copyright=u00a9 Deepak Bhagat, 2017 hrdemo.contact=Kontakt UIResources_de.properties hrdemo.browserTitle=HRDemo Sample Application hrdemo.about=About this demo hrdemo.copyright=u00a9 Deepak Bhagat, 2017 hrdemo.contact=Contact Us UIResources.properties
  • 376. Steps to Internationalize an Application Create a base resource bundle containing all text strings that are not part of the components themselves Create a localized resource bundle for each locale supported by the application Register the locales with the application Use the resource bundle on your page
  • 377. Automatically Create Resource Bundles Set project properties to create a resource bundle automatically
  • 378. Automatically Create a Text Resource 1 3 4 2
  • 379. Use Resource Bundle Use <f:loadBundle …> to reference the resource bundle Only the name of the default resource bundle needs to be specified. Translations are looked up by appending _<language code> to the name Translatable strings are referenced by their key in the resource bundle <f:view> <f:loadBundle basename="oracle.srdemo.view.resources.UIResources" var="res"/> <af:document title="#{res['srdemo.browserTitle']}"> … </f:view>
  • 380. Steps to Internationalize an Application Create a base resource bundle containing all text strings that are not part of the components themselves Create a localized resource bundle for each locale supported by the application Register the locales with the application Use the resource bundle on your page
  • 381. ADF Faces Skins ADF Faces skins: Allows to display own look and feel Provide a global style sheet for an application Use a CSS file to set styles Use a resource bundle for text Included skins: alta skyros blafplus-medium blafplus-rich fusion simple
  • 382. ADF Faces Skins Usage alta skin skyros skin
  • 383. Add UI Components to the Page You can create components on a page by: Dragging a component from the Component Palette Using the context menu in editor or Structure window Dragging a data element from the Data Control panel
  • 384. Use of Component Facets Facets are:  Placeholders for subcomponents  Similar to detail elements  Used to specify subordinate elements such as toolbars, headers, or footers  Displayed with the component
  • 385. Using Facets If you have a complex layout that you want to achieve but can imagine other people needing it, there is probably something already that provides it Use the right component for the task Some components even provide specialized facets to help automate the layout for you, e.g. see: panelCollection panelHeader panelFormLayout
  • 386. Configuration Files General Configuration Files:  web.xml  (J2EE)  trinidad-config.xml  (JSF Skinning)  faces-config.xml  (JSF)  Similar to struts-config.xml  Contains two main types of components  Managed Beans  Navigation Model  adf-settings.xml  (ADF faces Settings)  adfc-config.xml  (ADF Faces)  adf-config.xml  (ADF Faces)  weblogic-application.xml  (WLS specific deployment descriptor)
  • 387. Custom Configuration Files  adf-faces-config.xml ADF faces configuration  adf-faces-skins.xml Skins  adf-faces-impl.jar and adf-faces-api.jar Component libraries  adfshare.jar Common library for ADF databinding  af.tld and afh.tld Tag libraries
  • 388. web.xml File  Web.xml  Standard J2EE deployment descriptor  Registers JSF Servlet (FacesServlet)  ADF Filter  ADF Resources Servlet  ADF Bindings Filter  Context param to identify CPX file
  • 389. faces-config.xml File  faces-config.xml  JSF configuration file  Configure JSF resources  Navigation Rules  Managed Beans  Converters  Validators  LifeCycle (ADFPhaseListener)  Renderer  Can have multiple faces-configs (param in web.xml)
  • 390. Lesson Summary Examine configuration files Internationalizing the User Interface Changing look and feel using ADF Faces skins Ways to add components to the page Use of facets
  • 391. 12 Planning Pages using Layout Components
  • 392. Lesson Agenda Use complex layout components Add additional functionalities to layout components Determine active geometry management Use dynamic page layout
  • 393. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 394. ADF Faces Functionality: ADF Faces Components  Layout Components: (12) Core Structure and Page Management Components Interactive Containers (Show/Hide Capabilities) and Headers Components Page Layout Containers Grouping Containers Spacing Components Miscellaneous Containers  Navigation Control Components: (14)  Menu and Toolbar explorer-type containers: (14)  Secondary Windows Layout: (14)  Text and Selection Components: (18)  Data Views: (18)  Advance Data Visualization Components (18)  Data Query Components (19)
  • 395. Planning Pages using Layout Components Panel Accordion Disclosed=many showDetailItem Disclosed=true InflexibleHeaight=297 Text=“Location-Departments” showDetailItem Disclosed=true Text=“Quick Search” Panel Tabbed showDetailItem Text=“Employee List” showDetailItem Text=“Employee Search” BATHRSystemIndex.jsf 1. Panel Splitter – vertical splitterPosition=135 2. Panel Splitter – horizontal splitterPosition=220 Employee List
  • 396. Overview of Layout Components Layout Components:  Core Structure and Page Management Components  Document, Form, Inline Frame, Template and Facet Definition  Interactive Containers (Show/Hide Capabilities) and Headers Components  Panel Accordion, Panel Tabbed, Panel Drawer, Panel Springboard, Panel Box, Panel Header, Show Detail Header, Show Detail and Show Detail Item  Page Layout Containers  Panel Grid, Panel Stretch Layout, Panel Splitter Layout, Masonry Layout, Panel Border Layout, Panel Form Layout, Panel Dashboard and Panel Collection  Grouping Containers  Panel Group Layout and Group  Spacing Components  Spacer and Separator  Miscellaneous Containers  Deck, Decorative Box, Panel List, Grid Cell and Grid Row
  • 397. Layout Components: Core Structure Form Creates an HTML <form> element Inline Frame  Creates an inline iframe tag
  • 398. Layout Components: Interactive Containers Panel Accordion Used in conjunction with showDetailItem components to display as a panel that can be expanded or collapsed
  • 399. Layout Components: Interactive Containers Panel Tabbed Used in conjunction with showDetailItem components to display as a set of tabbed panels If you want the tabs to be used in conjunction with navigational hierarchy, for example each tab is a different page or region that contains another set of navigation items, you may instead want to use a navigationPane component in a navigational menu
  • 400. Layout Components: Interactive Containers Panel Drawer (New 12c Feature) Used in conjunction with showDetailItem components to display as a set of tabs that can open and close like a drawer
  • 401. Layout Components: Interactive Containers Panel Springboard (New 12c Feature) Used in conjunction with showDetailItem components to display as a set of icons, either in a grid or in a strip. When the user clicks an icon, the associated showDetailItem contents display below the strip
  • 402. Layout Components: Interactive Containers Panel Box Titled box that can contain child components. Has a toolbar facet Panel Header Contains child components and provides a header that can include messages, toolbars, and help topics
  • 403. Layout Components: Headers Components Show Detail Header Can hide or display contents below the header. Often used as a child to the panelHeader component Show Detail Hides or displays content through a toggle icon
  • 404. Layout Components: Headers Components Show Detail Item Used to hold the content for the different panes of the panelAccordion or different tabs of the panelTabbed component
  • 405. Layout Components: Page Layout Containers Panel Border Layout Can have child components, which are placed in its center, and also contains 12 facets along the border where additional components can be placed. These will surround the center
  • 406. Layout Components: Page Layout Containers Panel Form Layout Positions input form controls, such as inputText components so that their labels and fields line up vertically. It supports multiple columns, and contains a footer facet
  • 407. Layout Components: Page Layout Containers Panel Dashboard Layout Provides a columnar display of child components (usually panelBox components)
  • 408. Layout Components: Page Layout Containers Panel Collection Layout Used in conjunction with collection components such as table, tree and treeTable to provide menus, toolbars, and status bars for those components
  • 409. Layout Components: Page Layout Containers Panel Grid Layout Used in conjunction with gridRow and gridCell components to provide an HTML table-like layout where you define the rows and cells, and then place other components as children to the cells
  • 410. Layout Components: Page Layout Containers Panel Stretch Layout Contains top, bottom, start, center, and end facets where you can place other components
  • 411. Layout Components: Page Layout Containers Panel Splitter Layout Divides a region into two parts (first facet and second facet) with a repositionable divider between the two. You can place other components within the facets
  • 412. Create Resizable Panes: Panel Splitter
  • 414. Layout Components: Page Layout Containers Masonry Layout Provides a dynamically-sized grid of child components
  • 415. Layout Components: Grouping Containers Panel Group Layout Groups child components either vertically or horizontally. For JSP pages, used in facets when more than one component is to be contained in a facet (Facelet pages can handle multiple children in a facet)
  • 416. Layout Components: Grouping Containers Group Groups child components without regard to layout unless handled by the parent component of the group. For JSP pages, used in facets when more than one component is to be contained in a facet (Facelet pages can handle multiple children in a facet)
  • 417. Layout Components: Spacing Spacer Creates an area of blank space Separator Creates a horizontal line between items
  • 418. Layout Components: Miscellaneous Containers Deck Provides animated transitions between its child components, using the af:transition tag Decorative Box Creates a container component whose facets use style themes to apply a bordered look to its children. This component is typically used as a container for the navigationPane component that is configured to display tabs
  • 419. Layout Components: Miscellaneous Containers Panel List Renders each child component as a list item and renders a bullet next to it. Can be nested to create hierarchical lists
  • 420. Layout Components: Additional Functionalities Once you have added a layout component to your page, you need to add functionality such as responding to events  Templates: Once a layout is created, it can be saved as a template. When template is modified, all pages that consume the template will automatically reflect the changes  Themes: Themes add color styling to some of layout components, such as the panelBox component  Skins: Can change look & feel, icons and other properties of layout components using skins  Localization: Instead of entering values for attributes that take strings as values, you can use property files. These files allow you to manage translation of these strings
  • 421. Layout Components: Additional Functionality cont.…  Accessibility: Input components can be made accessible  Using parameters in text: For text displayed in a component to contain parameters, use the ADF Faces EL format tags to resolve at runtime  Events: Layout components fire both server-side and client-side events that can be handled and execute some logic  User customization: Some of the components have areas that can be expanded or collapsed, such as the component showDetailHeader. The state of the component (expanded or collapsed) can be saved when the user leaves the page, by configuring
  • 422. Geometry Management and Component Stretching Only the following components can stretch: *if configured to stretch  decorativeBox*  deck  inputText*  panelAccordion*  panelBox*  panelCollection  panelDashboard*  panelGridLayout*  panelHeader*  panelSplitter*  panelStretchLayout*  panelTabbed*  region  showDetailHeader*  table*  tree*  treeTable*  panelGroupLayout (scroll/vertical)
  • 423. Geometry Management and Component Not Stretching The following layout components cannot stretch: panelBorderLayout panelFormLayout panelGroupLayout (default/horizontal) panelLabelAndMessage panelList showDetail tableLayout
  • 424. Geometry Management: Panel Collection Component  The panelCollection component is one of the ADF layout components  It is used in conjunction with collection components, such as table, tree, and treeTable  It provides additional capabilities to the components that are placed inside it: Provides default menus and toolbar buttons to tables, trees, and treeTables Allows for multisorting of columns, the ability to hide/wrap columns, and to freeze a column while scrolling other columns
  • 425. Geometry Management: Panel Collection Component cont.… Use panelCollection for table with menus and toolbars: A panel component that aggregates collection components like table, treeTable and tree to display standard/application menus, toolbars and statusbar items
  • 426. Active Geometry Management Active geometry management and component stretching Determines how best to make use of available screen real-estate The framework  Notifies layout components of browser resize activity  Layout components in turn resize their children This allows certain components to stretch or shrink, filling up any available browser space
  • 427. Active Geometry Management cont.… Table Inside a Component That Does Not Stretch Its Child Components
  • 428. Relation of styles and stretching  What does being stretched mean for styles? When a Renderer stretches a child component, the root element of that child will have an inlineStyle injected The injection is at the beginning of the inlineStyle Trying to override the dimensions of a stretched child is asking for trouble  What priorities do styles/skin have? inlineStyle beats styleClass The further right inside of an inlineStyle wins In a .css file, the lower the definition wins if there is equal weight but if another definition is more specific, it wins (see W3C CSS spec for specificity rules on how to rank specificity)
  • 429. Reviewing Layout Basics In HTML, some elements can be stretched while some can flow Those that have no official W3C standard for stretching are interpreted differently across web browsers, e.g.: % means different things:  Direct parent element  Some ancestor element  The browser viewport  Nothing (e.g. inside of an auto-width HTML table cell)
  • 430. Reviewing Layout Basics cont.…  Changing styles (e.g. inlineStyle or styleClass) can impact the ability for a component to stretch or flow  Don’t modify styles; instead solve problems using a declarative approach to insulate you from browser-specific issues  In ADF Faces, the HTML limitations translates to:  Whether the component supports being stretched by an ancestor  Whether the component must flow on its own  Whether the component supports stretching its children  Whether the component must let the children flow  Third-party components need this info documented  The outer shell of components can be stretchable ones  The inner island(s) of components must be flowing  Cannot stretch components in a flowing island
  • 431. Stretching and Flowing  Browsers are unreliable; not robust:  Some things can stretch others must flow  % dimensions mean different things  Don’t be a slave to the browsers, avoid inlineStyle like the plague!  Highly recommended that you build your layouts like this:  Use a stretchable outer frame  Inside this frame, have flowing islands (e.g. scrollable areas)  Do not attempt to stretch something vertically in a flowing island!  Need custom styling?  Find a declarative approach (theme, hint, other attribute)  e.g. make the page dark blue with af:document’s theme="dark"  Use the styleClass attribute  Organizations can use a custom skin (to change how a component looks or just to make custom global selectors)
  • 432. Stretching and Flowing cont.… W3C CSS Box model makes it hard to combine margins, borders and padding with width and height dimensions of elements (See diagram) Workarounds include nesting multiple components to achieve desired effect
  • 433. How to avoid using inlineStyle; When to use it…  inlineStyle, contentStyle, and labelStyle are powerful but evil, use them as a last resort but preferably not at all!  These are less declarative, harder to maintain, contribute more to the page's raw HTML size, and may not even be needed if one or more of the following are used:  Use themed decorativeBox components to organize your page into layers (in ATG, this is what the UI Shell must do)  Use a custom skin for consistently modified appearances if the existing skin doesn't provide all that you need  For instance-specific alternative styling, use the styleClass attribute. Keep the corresponding style definitions in an easy-to-maintain location such as in a custom skin, in the metaContainer facet of the document component, or as close to the top of the page as possible for optimal performance
  • 434. Use case: series of boxes Variation 1 of 6 - Flowing
  • 435. Use case: series of boxes Variation 2 of 6 - Stretch the 1st box
  • 436. Use case: series of boxes Variation 3 of 6 - Stretch the 2nd box
  • 437. Use case: series of boxes Variation 4 of 6 - Stretch the 3rd box
  • 438. Use case: series of boxes Variation 5 of 6 - Stretch all evenly
  • 439. Use case: series of boxes Variation 6 of 6 - Stretch 1st 2 evenly
  • 440. Fusion Template Basic Page Layouts The Fusion Design Surface already has the 4 basic PageLayouts as backgrounds: Regional and Contextual panes open Only Contextual pane open Only Regional pane open Neither pane open 1 3 2 4
  • 441. Resizing Content Panes - 1 Starting Point The BG_… page you want to use
  • 442. Resizing Content Panes - 2 1 2 Drag the edge top corner of a layer  In this case the splitter is moving with the edge of the Content Layer it since the splitter is glued to the left layer  If the splitter needs to be moved the controls for the splitter are on the left side (1). It has connection points on the right the other region needs to be snapped/glued to (2).
  • 443. Resizing Content Panes - 3 Drag the other regions edge to snap to the first region moved.
  • 444. Building a Page Layout - 1 Starting Point
  • 445. Building a Page Layout - 2 Drag out a Global Layer
  • 446. Building a Page Layout - 3 Drag out a Level 1 tab snapping the left edge to the left edge of the Global Layer
  • 447. Building a Page Layout - 4 Drag out the right control point to make the tabs the length of the Global Layer
  • 448. Building a Page Layout - 5 Drag out a Primary Layer and snap it to the left edge of the Global Region
  • 449. Building a Page Layout - 6 Drag out the Primary Layers right-side control point to the Global Layers right edge
  • 450. Building a Page Layout - 7 Snap the Primary Layers bottom control point until it snaps to the bottom of the Global Layer
  • 451. Building a Page Layout - 8 Drag out a Level 2 Tab and snap it to the left edge of the Primary Layer
  • 452. Building a Page Layout - 9 Drag out the Level 2 tab’s right-hand control point to the right edge of the Primary Layer
  • 453. Building a Page Layout - 10 Drag out a Content Layer, snapping its left edge to the left edge of the Primary Layer
  • 454. Building a Page Layout - 11 Drag the Content Layers bottom control point until it snaps to the bottom of the Global Layer
  • 455. Building a Page Layout - 12 Right-click the Content Layer and turn off the Offset Left The Offset left and right provide space for splitters between Content Layers. Since this will be a Regional Content pane and there will be no splitter on the left.
  • 456. Building a Page Layout - 13 CTRL+Drag to duplicate the Content Layer until it’s left edge snaps to the right edge of the existing layer.
  • 457. Building a Page Layout - 14 Drag the new layers right-hand control point to the desired width
  • 458. Building a Page Layout - 15 CTRL+Drag the left-most Content Layer to duplicate it on the right
  • 459. Building a Page Layout - 16 After resizing it, right-click the layer and turn off the Offset Right since this is an open Contextual Region
  • 460. Building a Page Layout - 17 Drag out a Splitter and snap it to the gap between the first two content layers
  • 461. Building a Page Layout - 18 Drag the splitter’s bottom control point to snap to the bottom of the Global Layer
  • 462. Building a Page Layout - 19 CTRL+Drag the Splitter to duplicate it
  • 463. Building a Page Layout - 20 Pick up the splitter by it’s top control point and snap it to the right-hand gap
  • 464. Adding a Page Header  Drag Page Header shape onto page, snapping the left side to the top corner of the Content region  Drag right corner to snap to right of Content region  Double-click to edit name  Right-click header and set options 1 3 2 4
  • 465. Adding a Subheader - 1 Starting Point
  • 466. Adding a Subheader - 2 Drag out Sub Header onto page, snapping left edge to edge of Content Layer  Subheaders have offsets so that they snap into place with the proper spacing around them, which is why the control points are not on the geometry
  • 467. Adding a Subheader - 3 Drag the Subheaders right-side control point till it meets the edge of the container
  • 468. Adding a Subheader - 4 Drag the bottom control handle to make extra space for the form
  • 469. Adding a Subheader - 5 Double-click the header to edit the name and other attributes
  • 470. Adding a Subheader - 6 You’re ready to fill it with a form, table or other content
  • 471. Adding Level 3 Tabs - 1 Starting Point
  • 472. Adding Level 3 Tabs - 2 Drag out a Level 3 Tab Container snapping its upper left connection point to the bottom of the header  Subheaders have offsets so that they snap into place with the proper spacing around them, which is why the control points are not on the geometry
  • 473. Adding Level 3 Tabs - 3 Drag out the containers right control point to the right edge of the region
  • 474. Adding Level 3 Tabs - 4 Drag out a Level 3 tab snapping the left edge to the top of the container
  • 475. Adding Level 3 Tabs - 5 Drag out the tabs right control point to the edge of the container
  • 476. Adding Level 3 Tabs - 6 The bottom control point can be dragged to resize the container to the desired size for the content
  • 477. Adding Level 3 Tabs - 7 If the region will be taller then a screen’s height then you can add the bottom tabs by CTRL+Dragging the top tab down to snap to the bottom of the container
  • 478. Adding Level 3 Tabs - 8 The bottom tabs need to be flipped so they appear under the container. This can be done using the right-click context menu
  • 479. Performance impacts Not everything relating to layout can be conveyed using styles; some components use JavaScript: “auto” in panelStretchLayout facet dimensions columnStretching in af:table JavaScript manipulation can reduce browser layout and resize time 5-10% on average. New rendering and JavaScript engines are narrowing the gap, e.g. Safari and now Firefox 3 are drastically better than Internet Explorer and Firefox 2
  • 480. Dynamic Layouts Dynamic page layout is made possible by using: Partial page rendering (PPR) – (Lesson 16) Expression Language (EL) – (Lesson 21)
  • 481. Lesson Summary Use complex layout components Add additional functionalities to layout components Determine active geometry management Use dynamic page layout
  • 483. Lesson Agenda Features of task flows Differentiate between bounded and unbounded task flows List and discuss task flow activities Explain static and dynamic regions How to extract a task flow How to convert task flow to use page fragment How to convert to unbounded task flow
  • 484. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 485. Designing User Interface and Flows Panel Accordion showDetailItem showDetailItem Panel Tabbed showDetailItem showDetailItem BATHRSystemIndex.jsf LocationDeptartmentTF EmployeeQuickSearchTF EmployeeListTF EmployeeSearchTF EmployeeCreateTF EmployeeDetailTF EmployeeListPF EmployeeSearchPF EmployeeUpdateTF EmployeeDetailPF LocationDeptartmentPF QuickSearchPF EmployeeCreatePF EmployeeUpdatePersonPF EmployeeUpdateJobPF EmployeeUpdateConfirmPF Region TF Call Page Fragment
  • 486. Features of ADF Task Flows ADF task flows are logical units of page / process flows that:  Can be either unbounded or bounded  Offer advantages over JSF page flows An application can be broken into a series of tasks (with visual repn.) An application can contain nodes other than pages Navigate between activities, other than pages Have a shared memory scope Parameter/context passing Event firing & handling Automatic transaction management Dropped into a page as a Region Exposed remotely as a Portlet Behavior (Trains)
  • 487. Additional Functionalities of ADF Task Flows Following are the additional functionalities:  Task flows can invoke managed beans  Task flows are reusable  Task flows can be secured by defining the privileges that are required for someone to use it  You can extend the functionality that your task flows implement by writing custom code  Make sure when you write custom code that you do not import packages that are marked internal, as in the following example: import oracle.adfinternal.controller.*;
  • 488. Types of Task Flows Un Bounded Entry Points Bounded Entry Points Exit Points Exit Points
  • 489. Features of Unbounded Task Flows Unbounded task flows often serve as the entry point to an application, and have the following characteristics:  First entry on task flow stack—the outermost task flow  No well-defined boundary or single point of entry Use an unbounded task flow if your application has multiple points of entry  Can be used to define the “top level” flow of an application  Bookmarkable pages  ADF Application by default creates a unbounded task flow named adfc-config.xml
  • 490. Implementing Unbounded Task Flows The unbounded task flow source file is adfc-config.xml The editor contains four tabs to show different views: Diagram Overview Source History You can easily test the task flow functionality in the unbounded task flow, and convert to bounded when it is functioning correctly
  • 491. Features of Bounded Task Flows Bounded task flows:  Are modular blocks of task flow functionality for reuse, with the following characteristics: Single point of entry Well-defined boundary pageFlow Memory scope Declarative transaction management Declarative Back button support  Consist of: Activities  Example: View, Router, etc.. Control flows between activities Ability to accept input parameters and to return values On-demand metadata loading Fragment reuse through task flow templates or regions
  • 492. Comparing Unbounded and Bounded Task Flows Unbounded Bounded First entry on task flow stack Added to task flow stack when called No well-defined boundary or single point of entry Single point of entry, with zero or more exit points Cannot be used as a region on a page Can be used as region on page with page fragments Does not accept parameters Accept parameters and return values Not securable on its own; uses page security Can be secured separately from pages Cannot manage transactions or save for later Declarative transaction management, save for later Cannot be called (from other task flow) Must be called to be invoked Can be bookmarked Not bookmarkable Can directly run on browser Cannot directly run on browser
  • 493. Types of Task Flow Activities and Components
  • 494. Types of Task Flow Activities and Components Icon Component Name Description View Displays a JSF page or page fragment. Multiple view activities can represent the same page or same page fragment Method Call Invokes a method, typically a method on a managed bean. A method call activity can be placed anywhere within an application's control flow to invoke application logic based on control flow rules Task Flow Call Calls a bounded task flow from the unbounded task flow or another bounded task flow
  • 495. Types of Task Flow Activities and Components cont.… Task Flow Return Identifies when a bounded task flow completes and sends control flow back to the caller. (Available for bounded task flows only) Router Evaluates an EL expression and returns an outcome based on the value of the expression. For example, a router in a credit check task flow might evaluate the return value from a previous method call and generate success, failure, or retry outcomes based on various cases. These outcomes can then be used to route control to other activities in the task flow Wildcard Control Flow Rule Represents a control flow case that can originate from any activities whose IDs match a wildcard expression. For example, it can represent a control case from-activity-id containing a trailing wildcard such as foo*
  • 496. Types of Task Flow Activities and Components cont.… Control Flow Case Identifies how control passes from one activity to the next in the application URL View Redirects the root view port (for example, a browser page) to any URL- addressable resource, even from within the context of an ADF region Parent Action Allows a bounded task flow to generate outcomes that are passed to its parent view activity. Typically used for a bounded task flow running in an ADF region that needs to trigger navigation of its parent view activity Save Point Restore Restores a previous persistent save point, including application state and data, in an application supporting save for later functionality. A save point captures a snapshot of the Fusion web application at a specific instance. Save point restore enables the application to restore whatever was captured when the save point was originally created
  • 497. Using View Activities  One of the primary types of task flow activities is the view  A view activity displays a JSF page or page fragment  Page fragment:  is a JSF document that renders as content in another JSF page  Page fragments are typically used in bounded task flows that can be added to a JSF page as a region  Must not contain the af:document, af:form, f:view, head, body and html because JSF page already has it  Has .jsff extension  Page:  Can contain many fragments  Extension .jsf or .jspx
  • 498. Defining Task Flow Return Activity When you return from a called task flow, the task flow return activity specifies the outcome that is returned to the caller
  • 499. Using Routers Router activities:  Use expressions that evaluate to true or false  Define from-outcomes based on the value of the expression
  • 500. Router - Example Use the router activity in a task flow to declaratively route control to activities based on logic specified in an EL expression An EL expression evaluating to either true or false, for example, #{scope.user==“ALEN"}
  • 501. Defining ADF Control Flow Rules  Define flow through activities, such as views (pages)  Are stored in task flow configuration files  Can be defined by using:  The visual editor (Navigation Modeler)  The .xml console (Configuration Editor)  The .xml file directly  The Structure window  Are invoked by:  Command components (button and link)  Tabs or breadcrumbs  Trains
  • 502. Control Flow - Example
  • 503. Using Wild Cards To define a global (for all pages) control flow rule, drag a wildcard control flow rule to the page:
  • 505. Make View Activities Bookmarkable  Saving a view activity as a bookmark is available only in unbounded task flows  You can: Designate in Property Inspector at design time Designate at run time with the ViewBookmarkable() method Optionally specify:  URL parameters  Method to invoke before view is rendered Use the redirect option for a view activity instead of making it bookmarkable
  • 506. Check for Dirty Data Checking for Dirty Data Add this method in your ViewObjectImpl and expose it using client interface Call this method in your view layer whenever you need to find the dirty state of a VO by creating a method binding like #{bindings.isDirty.execute} Further modify this method to return the states as described in point 1 above, by iterating through rows
  • 507. Exception Handling  During execution of a task flow, exceptions can occur that may require some kind of exception handling, for example:  A method call activity throws an exception  A user is not authorized to execute the activity  Can designate one activity in a bounded or unbounded task flow as an exception handler to handle exceptions
  • 508. ADF Regions – Static and Dynamic Regions are created when you drag and drop a bounded task flow on a page Static Regions Dynamic Regions Fixed Visibility Visible based on custom logic Creates Task flow binding on page Creates Multi-task flow binding
  • 509. Create Bounded Task Flow You can create a bounded task flow by doing one of the following: Using the  New Gallery  OR Extracting part  of an existing  task flow
  • 511. Extracting a Task Flow You can create a bounded task flow by : Using the New Gallery or Extracting part of an Existing task flow
  • 512. Converting a Bounded Task Flow to use Page Fragments To use a bounded task flow containing pages as a region, convert it to a task flow with page fragments
  • 513. Converting to Unbounded Task Flow You can convert bounded task flows to unbounded:
  • 514. Lesson Summary Features of task flows Differentiate between bounded and unbounded task flows List and discuss task flow activities Explain static and dynamic regions How to extracting a task flow How to converting task flow to use page fragment How to converting a task flow
  • 515. 14 Interactively Controlling with Navigation Components
  • 516. Lesson Agenda List of Navigation Components Implement Buttons and Links Use Breadcrumbs and Navigation Panes Define Trains Implement explorer type containers like Menu and Toolbars Use secondary Windows like Popup, Dialog and Windows Performing navigation Add Accessibility compliance using Access Key
  • 517. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 18)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 518. ADF Faces Functionality: ADF Faces Components  Layout Components: (12)  Navigation Control Components: (14)  Button,  Link,  Breadcrumb,  Navigation Pane,  Navigation Item,  XML Menu Model and  Train  Menu and Toolbar explorer-type containers: (14)  Menu Bar,  Menu,  Menu Item,  Toolbar and  Toolbox  Secondary Windows Layout: (14)  Popup,  Dialog,  Panel Window and  Note Window  Text and Selection Components: (18)  Data Views: (18)  Advance Data Visualization Components (18)  Data Query Components (19)
  • 519. Overview of Navigation Components  Navigation components allow users to drill down for more information, to navigate to related pages or windows, and to perform specific actions on data and navigate at the same time  The common forms of navigation components are buttons and links, most of which can be used on their own and a few that can only be used in conjunction with other components  Some components render navigable items such as tabs and breadcrumbs for navigating hierarchical pages and keeping track of the user's current location in the page hierarchy. Navigation components can provide navigation with or without server-side actions
  • 520. Using Button Button: ADF Faces provides button component that can be used for navigation Depending on use case, you can configure this component to navigate directly to another location, to submit requests, and fire ActionEvent events The button component can render images, along with optional text
  • 521. Using Link Link: A link can be set to either launch an action or navigate to destination The link can contain a textual value holder, like output text or image
  • 522. Using Breadcrumbs Breadcrumb component is used in hierarchical site layouts to indicate the path back to the root page of the hierarchy with links You can define: Breadcrumbs explicitly Links using the XML Menu Model Breadcrumb links (Navigation Items)
  • 523. Using Explicitly Defined Breadcrumbs Breadcrumbs: Use the af:breadCrumbs component Links: Use the af:NavigationItem component Use static values: <af:breadCrumbs> <af:commandNavigationItem text=“Home”/> <af:commandNavigationItem text=“Employee Data”/> <af:commandNavigationItem text=“Add New Employee”/> </af:breadCrumbs> Can also use EL for dynamic values
  • 524. Using Navigation Pane Navigation Pane creates a series of navigation items representing one level in a navigation hierarchy You can either: Define navigation levels explicitly Or Bind to XML Menu Model
  • 525. Overview of XML Menu Model XML Menu Model: Represents navigation for a page hierarchy in XML format Contains the following elements: menu groupNode itemNode sharedNode Home Benefits Employee Data Insurance Paid Time Off Health Dental Level 0 (root_menu) Level 1 (home_menu) Level 2 (benefits_menu) Level 3 (insurance_menu)
  • 526. Defining Sequence of Steps (Train) The Train component: is a specialized type of task flow with linear steps indicates the location of the current page within a multi-step process. Each step is represented as a train stop Navigation buttons rendered by af:trainButtonBar Creating the task flow for a train Navigation items rendered by af:train
  • 527. Skipping Train Stop Controlled by the skip property of the train stop: If true, users cannot navigate to that train stop Typically set to an expression that evaluates to true or false, such as managed bean method or property Step 1 of train Step 2 of train Step 3 of train
  • 528. Using Menus for Navigation Menu bar:  Menu bars allow you to organize menus, buttons, and other simple components in a horizontal bar  When a user clicks a menu in the bar, the menu drops down and the user can select from the menu items  You can group menu bars and toolbars in a toolbox
  • 529. Using Menus for Navigation cont.… Menu: Menu components are used to create menus that allow users to add or edit items, search data, change the view, or launch help
  • 530. Using Menus for Navigation cont.… Menu items: Provide the vertical (drop-down) selections Like toolbar buttons, can: Display differently when selected Perform navigation
  • 531. Printable Page Behavior <af:button text="Printable Page"> <af:showPrintablePageBehavior/> </af:button>
  • 532. Using Toolbar, Toolbar Buttons and Toolboxes Toolbars contain other components Toolbar buttons have special properties. (If you use toolbar buttons, always put them on a toolbar.) Toolboxes contain multiple toolbars You can stretch one component on a toolbar Overflow buttons are automatic
  • 533. Menus & toolbars  af:toolbox wrapper for menu bars and toolbars af:group - use one per row  af:toolbar af:commandToolbarButton af:group - separators between groups of items  af:menuBar af:menu - nest for submenus  af:commandMenuItem  af:goMenuItem af:group - separators between groups of items
  • 534. Menu and Toolbar Components: Additional Functionalities Once you have added a menu and toolbar components to your page, you need to add functionality such as responding to events  Invoking functionality: ADF Faces offer tags that can be used with menu command components to invoke functionality, such as downloading a file or resetting submitted values  Table menus: You can create menus and toolbars that display above a table and work only on that table (as opposed to the whole application)  Context menus: You can create menus that launch in a popup when a user right- clicks an item in the UI. For more information, see How to Create a Context Menu  Using parameters in text: You can use the ADF Faces EL format tags if you want text displayed in a component to contain parameters that will resolve at runtime
  • 535. Menu and Toolbar Components: Additional Functionalities cont.…  Events: You can use command menu components to launch action events. For more information about events, see Handling Events  Accessibility: You can use specific attributes on the menu components to create shortcuts that allow users to open menus using a keyboard  Localization: Instead of entering values for attributes that take strings as values, you can use property files. These files allow you to manage translation of these strings  Skins: You can change the look and feel of menus (such as the icon used to display a selected menu item), along with some basic functionality (such as the maximum number of menu items that display) by changing the skin
  • 536. Types of Pop-ups Panel Window: Displays its children in a window that is similar to a dialog, but does not support events. Popup Dialog: Displays its children inside a dialog and delivers events when the OK, Yes, No or Cancel actions are activated. Note Window: Displays read-only information associated with a particular UI component. Menu: Displays a context menu for an associated component.
  • 537. Creating Pop-up Menus Popup: The popup component is an invisible container control whose contents will be used in popup windows, such as context menus, note windows, dialogs and popup selectors These types of "popup windows" are within the same browser window and using layers of HTML to simulate an external browser window
  • 538. Popup Menus: Additional Functionalities Once you have added a popup component (or related components) to your page, you may find that you need to add functionality such as accessibility and localization  Using parameters in text: You can use the ADF Faces EL format tags if you want the text displayed in a component to contain parameters that will resolve at runtime  Events: The dialog component renders ADF Faces button components. You can also use a button component in conjunction with the showPopupBehavior tag to launch a popup. The button component used in conjunction with the showPopupBehavior tag delivers ActionEvent events when activated  Messages: Popup dialogs and secondary windows are frequently used to provide different levels of help information for users
  • 539. Popup Menus: Additional Functionalities cont.…  Localization: Instead of directly entering text for labels in the popup dialogs, menus, and windows that you create, you can use property files. These files allow you to manage translation of the text strings  Skins: You can change the look and feel of the components that you use to create popup dialogs, menus, and windows by changing the skin  Accessibility: You can make your popup dialogs, menus, and windows accessible  Dialog framework: If your application uses the full Fusion technology stack, note that the dialog framework is integrated with ADF Controller for use with ADF task flows  Touch Devices: ADF Faces components may behave and display differently on touch devices  Drag and Drop: You can configure your components so that the user can drag and drop them to another area on the page
  • 540. Creating Context Menus To create a context menu, use the af:showPopupBehavior operation
  • 541. Additional Functionalities of Navigation Components Once you have added a navigation component to your page, you need to add functionality such as responding to events Using parameters in text: ADF Faces EL format tags can be used to display text in a component to contain parameters that will resolve at runtime Events: Components fire both server-side and client-side events that the application react to by executing some logic Partial page rendering: ADF Faces navigation components can be used to trigger partial rerendering of components on a page
  • 542. Additional Functionalities of Navigation Components cont.…  Accessibility: Navigation components can be accessible  Localization: Instead of directly entering text for labels, can use property files. These files allows to manage translation of the text strings  Skins: Can change the look and feel of navigation components by changing the skin  Touch Devices: ADF Faces components may behave and display differently on touch devices  Drag and Drop: Can configure components so that the user can drag and drop them to another area on the page
  • 543. JSF Navigation Rules Page Flow Editor Navigation Rules Overview Navigation Rules Thumb View
  • 544. JSF Navigation JavaServer Faces uses its own controller for page navigation NavigationHandler evaluates navigation case and routes to new page Supports page forward and page re-directs Navigation Cases Basic Navigation  Based on static string outcome  Based on dynamic outcome Navigation as the result of an action  Navigation cases can be defined based on the method returning the outcome string
  • 545. How Navigation Targets are Determined  Pluggable class that handles navigation  Navigation is based on navigation cases defined in faces-config.xml  Determine <from-view> element to use  Exact ViewId match (“/app/public.jsp”)  Wildcard ViewId match (“/app/*”)  Default ViewId match (“*”)  Determine navigation to case lookup  Elements specifying both from-action and from-outcome  Elements specifying only from-outcome  Elements specifying only from-action  Elements where both elements are null
  • 546. Programmatic Navigation  JavaServer Faces pages are virtual component trees  Navigation cases in JavaServer Faces set a new tree root, the ViewRoot  You can programmatically navigate to any page that exist for a JSF application  Example code performed in backing bean  Note: Programmatic Navigation ignores J2EE security constraint defined for a page in the web.xml FacesContext currentContext = FacesContext.getCurrentInstance(); ViewHandler vh = currentContext.getApplication().getViewHandler(); UIViewRoot uroot = vh.createView(currentContext,"/app/HRMain.jsp"); FacesContext.getCurrentInstance().setViewRoot(uroot);
  • 547. Conditional Navigation Bind command action to Managed Bean or Backing Bean Return value defines navigation case No navigation occurs if navigation case doesn’t exist public String commandButton2_action() { boolean isManager = FacesContext.getCurrentInstance(). getExternalContext().isUserInRole("manager"); if (isManager){ return "managerview" } return "employeeview"; }
  • 548. Perform Navigation in ADF Control flow rules are defined in the task flow A component fires an action event to generate a String outcome corresponding to the control case from-outcome The event listener responds by executing navigation
  • 549. Accessibility ADF Faces components have built-in accessibility that work with a range of assistive technologies, including screen readers ADF Faces accessibility audit rules provide direction to create accessible images, tables, frames, forms, error messages, and popup windows using accessible HTML markup
  • 550. Using Access Key  Use for input, command, and go components  Set component attributes:  accessKey (input, command, or go component):  <af:goLink text="Home" accessKey="h">  textAndAccessKey (command or go components):  <af:commandButton textAndAccessKey="&amp;Home"/>  labelAndAccessKey (input components):  <af:inputSelectDate value="Choose date" labelAndAccessKey="D&amp;ate"/>  valueAndAccessKey (input components):  <af:outputLabel for="someid" valueAndAccessKey="Select Dat&amp;e"/>  <af:inputText simple="true" id="someid"/>  Can define same access key for multiple components
  • 551. Lesson Summary List of Navigation Components Implement Buttons and Links Use Breadcrumbs and Navigation Panes Define Trains Implement explorer type containers like Menu and Toolbars Use secondary Windows like Popup, Dialog and Windows Performing navigation Add Accessibility compliance using Access Key
  • 552. 15 Ensuring Reusability in Web Applications
  • 553. Lesson Agenda Explain the benefits of reusing components Create and use a resource catalog Create and use ADF libraries Use a bounded task flow as a region Create a page fragment and use it in a bounded task flow Create and use a page template and task flow template Create a declarative component and use it on a page
  • 554. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 555. Benefits of Reusability Designing code to be reused has the following benefits: Increased developer productivity Fewer bugs—debug once Consistency: In functionality In look and feel Easier maintainability Rapid adaptability
  • 556. Designing for Reuse  Guidelines: Use naming conventions to:  Avoid naming conflicts  Facilitate identifying the component functionality Standardize storage by agreeing on:  Type of repository needed  Storage and organization  Access methods  Make components available for reuse by using: Resource catalog ADF library
  • 557. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 558. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 559. Using a Resource Catalog  Enables application developers to find and incorporate shared resources, such as libraries containing ADF BC Model Objects, validators, message bundles, and so on, that were created by other members of the team  Provides a federated view of the resources from one or more otherwise unrelated repositories in a unified search and browse UI  Enables you to store libraries comprising a common repository that can be used by the developers building any client application  Ensures that all application developers use the same business model without any discrepancies
  • 560. Using a Resource Catalog Creating a catalog: Adding resources to a catalog:
  • 561. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 562. Reusing Components through Library ADF Library enables you to reuse components: Package them into ADF Library JAR files Add them to a resource catalog Add the library to a project to use its components
  • 563. Removing an ADF Library from Project Removed by Using Resource Palette Using Project Properties
  • 564. Restricting BC Visibility in Libraries Set Library Private property for a business component to true if you do not want consumers to see the object in the library JAR
  • 565. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 566. Features of Regions  Are reusable task flow that represents as part of a page  They have their own Navigation rules  They have their own Managed-beans  They have their own ADFm Page Definition  Each page within the region is a page-fragment (jsff)  All of this is provided by the ADF Controller. Very little is handled by View  Can share information and transaction boundaries with other page content BATHRSystemIndex.jsf DepartmentListPF.jsff EmployeeListPF.jsff Region-EmployeeList <af:region> Region-QuickSearch <af:region> QuickSearchPF.jsff
  • 567. Wrapping a Task Flow as a Region Drag a bounded task flow to the page as a region: The default activity is displayed at design time and is the initial activity that is displayed at run time:
  • 568. Regions – View Layer <af:region> tag creates a region component BATHRSystemIndex.jsf <af:region value=“#{…}”/> RegionModel processBeginRegion getViewId processEndRegion
  • 569. Regions – View Layer cont.…  Region Component Wraps all events coming from child fragment When event is delivered, sets up context If viewID changes during event delivery, UIRegion adds itself as a partial target BATHRSystemIndex <af:region/> Region EmployeeList.jsff Broadcast event Broadcast wrapper Queue wrapper Queue event Setup context Test for navigation Note: Region does not render any chrome, so the RequestContext.addPartialTarget method adds the parent component instead
  • 570. Regions – View Layer cont.… Features Automatically convert full page requests issued by the fragment into partial page requests To do this the region would have to:  Render some DOM and render a client component  Catch the bubbling ActionEvent on the client-side and turn it into a partial page event BATHRSystemIndex <af:region/> AdfDhtmlRegion Browse.jsff Client-side Queue event Client-side Queue action event Turn event into Partial page event
  • 571. Regions – Controller Layer Task Flow Region Model: Manages the region’s lifecycle Figures out the correct page fragment to render Manages the “bindings” EL variable, within the page fragment BATHRSystemIndex.jsf <af:region value=“#{bindings.region1.regionModel}”/> RegionModel = TaskFLowRegionModel processBeginRegion getViewId processEndRegion
  • 572. Regions – Controller Layer cont.…  Region xml file  Region navigation rules and managed beans are stored in an xml file that is read by the controller <af:region value=#{bindings. EmployeeListTF1.regionModel}”/> BATHRSystemIndex.jsf <taskFlow id=“EmployeeListTF1“ taskFlowId="/WEB-INF/…….. EmployeeListTF.xm#Emp...“/> BATHRSystemIndexPageDef.xml <adfc-config> <task-flow-definition id=“EmployeeListTF"> <default-activity>EmployeeList</default-activity> <view id=“EmployeeListPF"> <page>/EmployeeListPF.jsff</page> </view> <view id=“EmployeeDetailPF"> <page>/EmployeeDetailPF.jsff</page> </view> <control-flow-rule> <from-activity-id>EmployeeList</from-activity-id> <control-flow-case> <from-outcome>detail</from-outcome> <to-activity-id>EmployeeDetailTF</to-activity-id> </control-flow-case> </control-flow-rule> </task-flow-definition> </adfc-config> WEB-INF/EmployeeListTF.xml EmpList.jsff EmpDetail.jsff detail
  • 573. Regions – Controller Layer cont.… Each page/fragment has its own PageDefinition Any Databinding.cpx files that are packaged with the region are merged with the main DataBindings.cpx #{bindings…} HRSystemIndex <pageMap> <page path="/EmpList.jsff" usageId=“EmpListPageDef"/> <page path="/EmpDetail.jsff" usageId=“EmpDetailPageDef"/> <page path="/HRSystemIndex.jsf" usageId=“HRSystemIndexPageDef"/> </pageMap> <pageDefinitionUsages> <page id=" EmpListPageDef " path=“...pageDef. EmpListPageDef "/> <page id=" EmpDetailPageDef " path=“pageDef. EmpDetailPageDef "/> <page id=“HRSystemIndexPageDef" path="pageDef.HRSystemPageDef"/> </pageDefinitionUsages> Databinding.cpx #{bindings…} EmpList.jsff #{bindings…} EmpDetail.jsff HRSystemIndexPageDef.xml EmpListPageDef.xml EmpDetailPageDef.xml
  • 574. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 575. Features of Page Fragments Are built like regular pages Have page definition files like regular pages do Are not defined as a full web page Can be displayed within a page that contains other content Cannot contain af:document or f:view tags Cannot be run on their own
  • 576. Using a Page Fragment on a Page You can use a page fragment on a page by: Inserting the jsp:include tag:  The included page fragment uses the binding context of the consuming page  Page definition file for page fragment is not loaded (does not use bindings) Inserting a bounded task flow with page fragments as a region on your page  The page fragment can have its own binding context Modifying the page fragment affects all pages that use it (but check the overall layout of consuming pages)
  • 577. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 578. Features of Page Template Page templates:  Are reusable single page UI  Enable consistent look across pages or page fragments  Are built from standard ADF components  Cannot be nested  Use partial page refresh when navigating between pages that use the same template  Use three types of files:  Page-specific definition file (.jspx)  Definition file for all templates: pagetemplate-metadata.xml  Application or library file (.cpx)
  • 579. Contents in Page Templates Have custom attributes and facets Consists of af:pageTemplateDef af:xmlContent - define attributes and facets af:facetRef af:pageTemplate Tag in jspx to use the template
  • 580. Page Template Codes <af:pageTemplateDef var=“attrs“ definition=“Private”> <af:xmlContent> <afc:component> <afc:description/> <afc:display-name>EmployeeUpdateTemplate</afc:display-name> <afc:facet> <afc:facet-name>content</afc:facet-name> </afc:facet> <afc:attribute> <afc:attribute-name>title</afc:attrinute-name> <afc:attribute> </afc:component> </af:xmlContent> <af:panelGroupLayout id="pt_pgl1" layout="scroll"> <af:train id="pt_t1" value=“#{controllerContext.currentViewPort .taskFlowContext.trainModel}"/> </af:panelGroupLayout> </af:pageTemplateDef> EmployeeUpdateTemplate.jsf <af:pageTemplate id=“pt1" viewId=“…template/EmployeeUpdate Template.jsf"> <f:facet name=“content"> <af:attribute name=“title" value=“Employee Update Job"/> </f:facet> </af:pageTemplate> EmployeeUpdateJobPF.jsff  XmlContent  Mostly for design time use  Used by the runtime to type- convert attributes and validate required attributes
  • 581. Page Template Codes cont.… facetRef  This is the most complicated part of the pageTemplate implementation  The facetRef tags moves a component defined in the template usage into the template definition  The facetRef creates a new component which wraps the relocated component, because: Components inside the facetRef need to run in the context that they were defined in; not in the template context  The facetRef component restores the context to the outside context before lifecycle methods are run on the child
  • 582. Page Template Codes cont.… Events generated by components inside facetRef need to be delivered in the definition context and not template context  The facetRef component wraps each event that is queued <af:panelHeader text="#{attrs.title}"> <af:facetRef facetName=“content"/> </af:panelHeader> The facetRef must restore the relocated component prior to the jsf UIComponentTag execution because otherwise UIComponentTag will create a new facet component, and component bindings will fail
  • 583. Page Templates and Databinding Page Templates and Databinding:  <af:pageTemplate> supports a “value” attribute which can be used to pass in a nested/child pageDefinition into the pageTemplate  This nested/child pageDefinition will become the new “#{bindings}” EL variable for EL expressions inside the template  However, for EL expressions outside the template, the #{bindings} variable must only reference the parent pageDefinition
  • 584. Page Templates and Databinding cont.… <af:pageTemplate id=“pt1" viewId=“EmployeeUpdateTemplate.jsf“ value=“#{bindings.Child}”> <f:facet name=“content"> <af:outputText value=“#{bindings.Bar}"/> </f:facet> </af:pageTemplate> <af:pageTemplateDef var="attrs"> <af:panelHeader text="#{bindings.Header.label}"> <af:facetRef facetName=“content"/> </af:panelHeader> </af:pageTemplateDef> EmployeeUpdateTemplate EmployeeUpdateJobPFPageDef.xml Bar Child Nested Page Definition Header EmployeeUpdateJobPF.jsff
  • 585. Example: Page Templates Association of Business Object to Page  Example 1: Employee Update Job 1 displayed in Page A Employee Update Job 2 displayed in Page B  Example 2: Employee Update Person 1 displayed in Page X Employee Update Person 2 displayed in Page Y  Example 3: Employee Update Confirm 1 starts from Page M Employee Update Confirm 2 starts from Page N
  • 586. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 587. Task Flow Templates Reusable task flow definition Reuse by reference or as a copy Pre-defined input and output parameters Can contain common functionality and settings Exception handlers Task flow activity navigation outline Use of initializers and finalizers Visibility settings  URL accessible  Visible in ADF Library Behavior settings  Train  Task flow reentry  Critical  Data Control sharing
  • 588. Types of Reusable Components ADF supports reusing the following types of components: Resource catalog ADF library Task flows Regions & Task flow call Page fragments Page templates Task flow templates Declarative components Data controls Business components Application modules
  • 589. Declarative Components  Declarative Components use the same runtime component as PageTemplates  The design-time creates a new jsp tag handler class and hard codes the attribute and viewId information into this tag  The design-time adds registers this new tag in a tld that was created for the user’s namespace  The design-time packages up the tld and all supporting files (jsps, tag handler classes) into an ADF Library jar file  Declarative components do not support the “value” attribute <af:pageTemplate id=“pt1" viewId=“…template/EmployeeUpdateTemplate.jsf"> <f:facet name=“content"> <af:attribute name=“title" value=“Employee Update Job"/> </f:facet> </af:pageTemplate> pageTemplate Usage <foo:myTag id=“EmployeeUpdateTemplate" zip=“94065”> <f:facet name=“content"> <af:outputText value=“#{attrs.title}"/> </f:facet> </foo:myTag> Declarative Component Usage
  • 590. Features of Declarative Components Declarative components:  Are component definitions that are reusable across applications  When changed, affect all pages that use them  Are made up of any number of other components  Do not have data binding in their definition  Can be made available for reuse in the Component Palette  Are defined only at design time in: One .jspx file for each component One declarativecomp-metadata.xml file for all declarative components in a project
  • 591. Creating a Declarative Component The JSF Declarative Component dialog box: Is invoked with New > Web Tier > JSF/Facelets > ADF Declarative Component Creates the <af:componentDef> tag in .jspx file Creates metadata
  • 592. Using a Declarative Component on a Page To use a declarative component on a page: Deploy the component’s project as an ADF library JAR file Add the ADF library to your current project Select the ADF library from the Component Palette drop-down list Select the declarative component and drag it to your page, providing values for any attributes
  • 593. Deciding Which Reusable Component to Use  You can use a page template when you want: Similar page layout to be used on multiple pages Similar look on multiple pages  You can use a bounded task flow when you want to: Reuse a set of activities and control flows Use multiple page fragments in a region on a page Create a portlet from a set of activities and control flows  You can use a declarative component when you want to: Use a similar grouping of components on multiple pages or applications Select the component from the Component Palette
  • 594. Lesson Summary Explain the benefits of reusing components Create and use a resource catalog Create and use ADF libraries Use a bounded task flow as a region Create a page fragment and use it in a bounded task flow Create and use a page template and task flow template Create a declarative component and use it on a page
  • 595. 16 Working with Parameters, Scopes and Partial Page Refresh
  • 596. Lesson Agenda Use memory-scoped attributes to store values Pass values using parameters Render components using PPR
  • 597. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 598. Scopes, Parameters and PPR Panel Tabbed showDetailItem showDetailItem BAT_PSP_Index.jsf LocationDeptartmentTF EmployeeListTF EmployeeSearchTF EmployeeCreateTF EmployeeDetailTF EmployeeListPF EmployeeSearchPF EmployeeUpdateTF EmployeeDetailPF LocationDepartmentPF EmployeeCreatePF EmployeeDetailPF EmployeeUpdatePF Region TF Call Page Fragment
  • 599. ADF Faces Functionalities  Memory scopes  Scope define lifespan to instantiated ADF objects at runtime  Scope can be accessed as a java.util.Map from the ADFContext API  Parameter passing  Parameters can be passed across task flows, regions and pages  Partial page rendering (Ajax support)  When an event on one component causes only another component to be rendered  Many ADF Faces components have ajax-style functionality implemented natively  Example: The ADF Faces table component lets you scroll through the table, sort the table by clicking column header, mark a row or several rows for selection, and even expand specific rows in the table, all without requiring the page to be submitted to the server and with no coding needed
  • 600. Using Memory Scope Attributes  JSF scopes:  None  Application: The object is available for the duration of the application  Session: The object is available for the duration of the user session  Request: The object is available from the time an HTTP request is made until a response is sent back to the client  Additional ADF Faces scopes:  Page flow: The object is available for the duration of a single task flow’s lifetime  View: The object is available until the view ID for the current view activity changes. This scope can be used to hold values for a given page  Backing bean: Used for managed beans for page fragments and declarative components only. Is just like Request Scope. Each page can have multiple fragments or declarative components and we would want to separate the scope instances from each other.
  • 601. Using Memory Scope Attributes cont.… Why use scopes? Save state of model Enable passing values to other pages or phases in the same scope Can be accessed via EL or Java (except Backing Bean)
  • 602. Memory Scope Duration with a Called Task Flow
  • 603. Memory Scope Duration with a Region
  • 604. Accessing Memory Scoped Attribute Values You can access the scope attributes by using: EL: #{applicationScope.applicationScopeVar} #{sessionScope.sessionScopeVar} #{requestScope.requestScopeVar} #{pageFlowScope.pageFlowScopeVar} #{viewScope.viewScopeVar} #{backingBeanScope.bacingBeanScopeVar}
  • 605. Accessing Memory Scoped Attribute Values cont.… Java code to access memory scoped attribute values: import oracle.adf.share.ADFContext; ADFContext.getCurrent()  .getApplicationScope().get("applicationScopeVar");  .getSessionScope().get("sessionScopeVar");  .getRequestScope().get("requestScopeVar");  .getPageFlowScope().get("pageFlowScopeVar");  .getViewScope().get("viewScopeVar");
  • 606. Overview of Parameters You can use: Task flow call activity parameters Task flow parameters Region parameters View (page fragment/jsff) parameters Page (jsf) parameters You set the parameter values by using expressions (not by just entering a value) The goal is increased reusability of pages and task flows
  • 607. Use Task Flow Parameters  Task flow parameters are:  Input parameters to pass a value into a task flow  Defined in the .xml file for the task flow (You can use the Property Inspector for the task flow.)
  • 608. Job of the Task Flow Parameter Stores input value in a page-flow-scoped attribute:
  • 609. Pass a Value to a Task Flow  Define an input parameter on the task flow call activity  Define an input parameter on the called task flow
  • 610. Return Values to a Calling Task Flow To return a value, you must specify: Return value definitions on the called task flow Return values on the task flow call activity in the calling task flow Names must match
  • 611. Use Region Parameters Region parameters are: Input parameters to pass a value into a region on a page Stored in the binding container for the page Defined in the Structure window or Property Inspector for a page definition file:
  • 612. Job of Region Parameter Passes the value from the page to its task flow:
  • 613. Job of View Activity Parameter Populates the page-flow-scoped attribute expected by the page:
  • 614. Use Page Parameters Page parameters are: Output parameters to pass a value from a page Stored in the binding container for the page Defined in the Structure window or Property Inspector for a page definition file #{bindings.nameToPass}
  • 615. Job of the Page Parameter Receives a value and stores it in a parameter in the binding container:
  • 616. Develop a Page Independently of a Task Flow Page not aware of the task flow’s page-flow-scoped attribute:
  • 617. Passing a Value to a Region Page Fragment View activity parameter Task flow parameter Region parameter Page parameter Containing Page Region Task Flow View Activity/ Define in page def file Define in task flow .xml file
  • 618. Deciding the Usage of Parameter Parameters are designed to: Improve reusability Encapsulate functionality You can use more than one type of parameter to achieve these goals
  • 619. Features of Partial Page Rendering  Is enabled by ADF Faces  Enables redrawing only a portion of a page  Requires server round-trip: Rerenders only a portion of the server-side component tree Downloads only the appropriate fragment of HTML  Implements certain ADF Faces patterns Single component refresh Cross-component refresh  Can be enabled declaratively or programmatically
  • 620. Features of Partial Page Rendering cont.… PPR  AJAX Update the page without refreshing the whole page Common Examples LOV dialog – call pop-up LOV, return selected value into calling page Scrolling through a results table Expanding a tree control
  • 621. Partial Page Rendering Attributes Explicit PPR attributes: partialSubmit – Used by commandItems autoSubmit – Used by input items / lists etc. partialTriggers – All components
  • 622. PPR - partialSubmit Lets a link execute server code without posting the whole page In this case to pop up an informational page <af:link text=“Detail” action=“detail” useWindow="true" partialSubmit="true"/>
  • 623. PPR - autoSubmit  For a valueHolder such as a inputText or checkbox, posts the change to the as soon as it is made – e.g. on navigation out or selection  Common uses: Changing the UI based on a field value Instant validation <af:selectOneChoice value="#{bindings.ServiceRequeststatus.inputValue}" label="#{bindings.ServiceRequeststatus.label}" autoSubmit="true" id="status">
  • 624. PPR - partialTriggers  Refresh this item if that item changes / submits Includes extra UI elements in the PPR process that "need to know" about the change Example: If the value of field a changes to "X" disable this field  Partial Triggers attribute lists component ids that the component is "watching" A single component can watch multiple components Multiple components can watch a single component  Caution sometimes the parent container has to watch not the component itself e.g. menus
  • 625. Partial Triggers Example  Enable / disable date input when selectOneChoice value changes  Disabled is re-evaluated when selectOne changes <af:selectOneChoice value="#{bindings.ServiceRequeststatus.inputValue}" label="#{bindings.ServiceRequeststatus.label}" autoSubmit="true" id="status"> <af:selectInputDate value="#{bindings.assignedDate.inputValue}" label="#{bindings.assignedDate.label}" partialTriggers="status" binding="#{backing_SREdit.assignedDate}" disabled= "#{bindings.ServiceRequeststatus.inputValue==2}" validator="#{backing_SREdit.assignedDateValidator}">
  • 626. Conditional Rendering You can use EL for any of a component’s attributes Example of setting attributes with EL: <af:selectOneChoice value="#{bindings.CardTypeCode.inputValue}" label="#{bindings.CardTypeCode.label}" partialTriggers="PaymentType" rendered="#{bindings.PaymentTypeCode.inputValue == 'CC'}"> <f:selectItems value="#{bindings.CardTypeCode.items}"/> </af:selectOneChoice>
  • 627. Conditional Rendering cont.…  JSF components have a Rendered property that can be set with EL  Reference a method in a managed bean with EL to conditionally render a component #{sessionScope.sessionScopeVar=='3'}
  • 628. Enabling Automatic PPR To enable automatic PPR: Select a binding in the page definition file Set ChangeEventPolicy to ‘ppr’
  • 629. Lesson Summary Use memory-scoped attributes to store values Pass values using parameters Render components using PPR
  • 630. 17 Responding to Beans, Events and Listeners
  • 631. Lesson Agenda  Configure and use managed beans  Explain the different types of events  Handle action, value change and phase events using corresponding listener  Configure managed bean to contain listener  ADF Life Cycle Phases  Validate UI using Validators  Converters  Understand contextual events to coordinate regions  Programmatically call Partial Page Rendering
  • 632. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Managed and Backing Beans (L 17)  Event and Listener Handling (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 633. Adding UI Code Managed beans: Are configured in the adfc-config.xml or other task-flow.xml file Consist of Plain Old Java Objects (POJOs), Lists, and Maps Have a no-argument constructor Use lazy initialization by JavaServer Faces framework “as needed”
  • 634. Registering Existing Java Classes as Managed Beans Use the Overview tab of the task flow.
  • 635. Configuring Managed Beans Entry in HREmployeeListTF.xml: <managed-bean id="__1"> <managed-bean-name>employeeListBean</managed-bean-name> <managed-bean-class>…beans.HREmployeeListBean</managed-bean-class> <managed-bean-scope>backingBean</managed-bean-scope> </managed-bean>  Skeleton for new managed bean:
  • 636. Context Objects  FacesContext:  Is a static class that provides access to information such as application messages, renderer kits, ViewRoots, ExternalContext, and so on  Represents the current request that is processed  ExternalContext:  Provides access to the world outside JSF  ADFFacesContext:  Is a context object to support ADF Faces–specific functionality:  Partial page rendering (PPR)  Skinning  Oracle Help  Dialog framework support
  • 637. Referencing Managed Beans Use in Expression Language on JSF Page:  Use in Java code: <af:outputText binding="#{employeeListBean.mvRichOutputText}”/>
  • 638. Holding Values in Managed Beans Managed beans are optional and can be used to: Hold values Store state How? Managed properties Memory-scoped attributes
  • 639. Using Managed Bean Properties Managed bean attributes that are exposed through the getter and setter methods Configured in the .xml file of the task flow Possible values: Null Literal string Lists and Maps Value binding expression (EL)
  • 640. About Managed Beans Managed beans are optional and can be used to Store state (e.g. information about the authenticated user) Execute Java routine, e.g. on button pressed Define handler for Event Listeners Managed beans ≠ Backing Beans Backing beans contain getter/setter methods for UI components
  • 641. Relationships Between Managed Beans Managed beans can access other beans Beans in scope … Can access beans in scope … None Application Session Request None YES NO NO NO Application YES YES NO NO Session YES YES YES NO Request YES YES YES YES
  • 642. Map Example HashMap as managed bean <managed-bean> <managed-bean-name>MyBookmarksMap</managed-bean-name> <managed-bean-class>java.util.HashMap</managed-bean-class> <managed-bean-scope>application</managed-bean-scope> <map-entries> <map-entry> <key>Oracle Fusion Middleware</key> <value>http://oracle.com/middleware</value> </map-entry> <map-entry> <key>Oracle ADF</key> <value>http://oracle.com/adf</value> </map-entry> </map-entries> </managed-bean>
  • 643. Nested Properties  Nested values like “foo.bar” are not supported in managed properties  Work around: Use the combination of two managed beans <managed-bean> <managed-bean-name>myBean</managed-bean-name> <managed-bean-class>package.MyBean</managed-bean-class> <managed- bean-scope>session</mananged-bean-scope> <managed-property> <property-name>foo</property-name> <value>#{fooBean}</value> </managed-property> </managed-bean> <managed-bean> <managed-bean-name>fooBean</managed-bean> <managed-bean-class>package.FooBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>bar</property-name> <value>Hello World</value> </managed-property> </managed-bean>
  • 644. About Backing Beans  Backing Beans are Managed Beans, but Managed Beans are not necessarily Backing Beans  JavaBeans that are associated with (bound to) UI components in a page  Can be used to programmatically modify properties on UI components  Can have methods defined that associate functionality with components, e.g. Validation Event handling Navigation
  • 645. Creating Managed Beans 1. Double click on button and select backing bean or choose to create new managed bean 2. Browse for existing Java class or create new class 3. Search class 4. Select class 5. Create method 6. Bean automatically gets configured In <task_flow>.xml
  • 646. Automatic Backing Bean Creation in JDeveloper  JDeveloper “auto-binding” options  Don’t use auto-binding  Use auto-binding  Bind to existing Managed Bean  Auto-binding creates instance variable and accessor methods for each page UI component  Instance variable names are not meaningful  Refactor names through ID property in Property Inspector  Configures Managed Bean in faces-config.xml
  • 648. Motivation  There are two varieties of user interface events  Events that start back-end processing  Events that affect only the format of the user interface  JSF categorizes code that handles these as action controllers and event listeners  Action controllers handle main form submission  Fire after bean has been populated (see last section)  Fire after validation logic (see upcoming section)  Return strings that directly affect page navigation  Event listeners handle UI events  Often fire before bean has been populated  Often bypass validation logic  Never directly affect page navigation
  • 649. JSF Event Model  The JSF event model is based on the event model defined by the JavaBeans specification where the event is represented by a specific class  An event source object fires an event by calling an event notification method on event listener objects registered to receive the event, passing a reference to the event object as a notification method argument  Developers can write their own event listener implementations, or reference a backing bean method using Expression Language  Events are queued on the server and executed at the end of the “Apply Request Value” Phase
  • 650. Describing Types of Events  Action events Occur when a command component is activated, such as when a user clicks a button or a link Return a control flow outcome  Value change events Occur when the local value of a input component changes, such as when a user selects a check box Are used for managing UI elements  Phase events Execute as part of the JSF and ADF life cycle Can be used to augment standard behavior
  • 651. Other ADF Faces Server Events The Property Inspector of ADF Faces components displays appropriate event listeners:
  • 652. Types of Event Listeners  ActionListener  Fired by submit buttons, image maps, and hypertext links with attached JavaScript  <h:commandButton value="..." .../>  <h:commandButton image="..." .../>  <h:commandLink .../>  Automatically submit the form  ValueChangeListener  Fired by combo boxes, checkboxes, radio buttons, textfields, and others  <h:selectOneMenu .../>  <h:selectBooleanCheckbox.../>  <h:selectOneRadio .../>  <h:inputText .../>  Do not automatically submit the form
  • 653. Using Listeners  ActionListener was attached to button  Form was automatically submitted when clicked  ValueChangeListener is attached to combobox, listbox, radio button, checkbox, textfield, etc..  Form not automatically submitted  Need to add JavaScript to submit the form onclick="submit()" or onchange="submit()"  Event incompatibility between Netscape and IE  Netscape, Mozilla, and Opera fire the onchange events when the combobox selection changes, radio button is selected, or checkbox is checked/unchecked  Internet Explorer fires event after selection changes, but only when another GUI control receives the input focus  Older IE versions behave differently! Test on multiple browsers!
  • 654. Responding to Action Events  Command components raise action events  Code to respond to the action event can be in the backing bean or external class  Stub code is generated by JDeveloper on demand  The action is registered in the page source  Action events are called in the Invoke Application phase of the life cycle  Action methods are the last to execute after other listeners, such as valueChange events
  • 655. Action Listener  Listener is usually in the form bean class  But can be in separate class if you use FacesContext to get the request or session object and look up the form bean explicitly  Takes an ActionEvent as an argument  No return type (not String as in action controllers)  ActionEvent is in javax.faces.event  ActionEvent has a getComponent method that lets you obtain the UIComponent reference  From the UIComponent, you can get the component ID, renderer, and other low-level information  Sample code public void someMethod(ActionEvent event) { doSomeSideEffects(); }
  • 656. Creating Action Methods  To create an action method: Invoke the action binding editor Select an existing bean and a method, or create new  JDeveloper: If the bean does not exist, creates Java class and registers as a managed bean If the method does not exist, creates a method stub in the managed bean class Adds the method to the action property of component  Add your own code  Action methods return a String outcome
  • 657. Action Listeners Vs Action Method Action listeners differ from action methods:  Action listeners:  Contain code to respond to an action  Do not return a value  Execute after value change listeners  Action methods:  Are used for navigation  Return a String outcome  Execute last  Fired by submit buttons, image maps, and hypertext links with attached JavaScript  <h:commandButton value="..." .../>  <h:commandButton image="..." .../>  <h:commandLink .../>  Automatically submit the form
  • 658. Responding to Value Change Events Input components raise value change events Code for the value change listener can be in the backing bean or external class Stub code is generated by JDeveloper The value change event is registered in the page source Value change events are processed in the Invoke Application phase of the life cycle Value change events fire before action events
  • 659. Value Change Listener  Register a backing bean method with the component in the Property Inspector  Create method signature in backing bean  Select ValueChangeListener property in Property Inspector  The following markup gets created public void myComponent1ValueChange(ValueChangeEvent event){ Object src = event.getSource(); CoreSelectOne comp = (CoreSelectOneChoice) event.getSource()); … } <af:selectOneChoice value="#{bindings.(…)}" … valueChangeListener="#{backing_test2.myListBoxValueChanged}">
  • 660. Creating Value Change Listener Select the input component in the visual editor Edit the valueChangeListener property and select a bean and method, or create a new one JDeveloper: Creates the method in the managed bean if it does not already exist Adds the method to the valueChangeListener property in the page source Add your code
  • 661. Creating a Custom ValueChangeListener  Custom listeners provide the benefit of better code reuse  Create Java class that implements “ValueChange Listener” interface  Value Change Events are handled in Process Validations phase  Drop ValueChangeListener element from Component Palette JSF Core in to e.g. input textfield  Select ValueChangeListener tag element in Structure Pane and set “type” property to your custom Listener Class <h:inputText binding="#{backing_publicPageBean.messageTextInput}" id="messageTextInput" rendered="true"> <f:validateLength maximum="10" minimum="0"/> <f:valueChangeListener type="oracle.jsf.sample.MyValueChangeListener"/> </h:inputText>
  • 662. Using Value Change Listeners  ActionListener was attached to button  Form was automatically submitted when clicked  ValueChangeListener is attached to combobox, listbox, radio button, checkbox, textfield, etc..  Form not automatically submitted  Need to add JavaScript to submit the form onclick="submit()" or onchange="submit()"  Event incompatibility between Netscape and IE  Netscape, Mozilla, and Opera fire the onchange events when the combobox selection changes, radio button is selected, or checkbox is checked/unchecked  Internet Explorer fires event after selection changes, but only when another GUI control receives the input focus  Older IE versions behave differently! Test on multiple browsers!
  • 663. Event and Listener Execution Order Following is the order in which the events and listeners fire: Validator (managed bean method that performs validation on the component’s value) Value change listener (managed bean method to handle value- change events) Action listener (managed bean method to handle action events) Action method (managed bean method to return a logical outcome String that is used in navigation)
  • 664. ADF Faces Enhanced Event Handling ADF Faces adds to JSF event handling by providing: Partial page rendering (PPR) JavaScript
  • 665. Enabling PPR Programmatically Why? Need logic to determine whether a component should refresh Refresh should occur on only one of several events that a triggering component may fire (for example, on row selection in table, use a selection listener) How? Use the addPartialTarget method ADFFacesContext.getCurrentInstance().addPartial Target(employeeList.getMvRichOutputText());
  • 668. Characteristics of the Contextual Event Framework Contextual events: Provide a way to coordinate regions Can be invoked and consumed only by method action of a data control Producer and consumer may be the same or different data controls
  • 669. The root component broadcast events to execute action listener and action methods JSF Life Cycle: Phases Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true Component Tree restored or created ~ Submitted form values stored in component. ~ Component values converted Component values validated ~ Component values bound to backing bean properties ~ Component can update model Component Tree is created from backing bean properties
  • 670. JSF Life Cycle: Restore View Phase Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true A request comes in through the JSF servlet. The request is examined for the viewId to load; viewId is bound to a page. viewId is used by the framework to look up the components of the page. • If it is the first time a page is requested, the framework creates the component tree for this page. • If the page has been requested before, the component tree gets reassembled. The current viewId is saved in the viewRoot property of FacesContext.
  • 671. JSF Life Cycle: Apply Request Values Phase Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true The JSF components are retrieved from the JSF context. Component values are updated with the values in the request parameter. If a component’s immediate property is set to true, conversion occur within this step, and value change events fire.
  • 672. JSF Life Cycle: Process Validations Phase Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true The request parameter values are converted to the expected data types. Validation is performed for each component value, where immediate is not set to true. Value change events fire.
  • 673. JSF Life Cycle: Update Model Values Phase Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true Until this step, the request only updated the components, setting their submittedValue property. Now, the model (Managed Beans or in the ADF case, the binding container) is updated with the validated values.
  • 674. JSF Life Cycle: Invoke Application Phase Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true The Invoke Application phase manages any forms that the page submits and executes any business logic. It also processes any action events that are fired and evaluates any navigation actions that need to execute.
  • 675. JSF Life Cycle: Render Response Phase Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true The Render Reponse phase prepares the view for display.
  • 676. Using the immediate Attribute  This attribute is available as a property on UI components.  Components that have immediate set to true are evaluated in the Apply Request Values phase.  Use case: Enforce a component to be evaluated before others.  The life cycle continues if no error is found.  No updated model data is available.  To access user-provided input, call getSubmittedValue().  The developer has the option to short-circuit the JSF life cycle:  A ValueChangeEvent runs before validation is performed.  Use ValueChangeListener to call the Render Response phase.  Update the model manually only if needed.  Use case: Cancel button that should navigate to another page without submitting the data Restore View Render Response Apply Request Values Update Model Values Invoke Application Process Validations Initial request Postback Client/ Browser Process Events Process Events Process Events Process Events No View Available Immediate = true
  • 677. ADF Faces Functionality: ADF Life Cycle Phases
  • 678. JSF and ADF Life Cycle Phases JSF Phases ADF Phases Events Restore View JSF Restore View before(JSF Restore View) after(JSF Restore View) Init Context before(Init Context) after(Init Context) Prepare Model before, after Apply Request Values JSF Apply Request Values before, after Process Validations JSF Process Validations before, after Update Model Values JSF Update Model Values before, after Validate Model Updates before, after Invoke Application JSF Invoke Application before, after Metadata Commit before, after Render Response JSF Render Response before, after Only after navigation Init Context before, after Only after navigation Prepare Model before, after Prepare Render before, after
  • 679. Describing JSF and ADF Life-Cycle Roles  The JSF life cycle handles presentation: Submission of values on the page Validation for components Navigation Displaying the components on the resulting page Saving and restoring state  The ADF life cycle handles data: Preparing and updating the data model Validating the data at the model layer Executing methods on the business layer
  • 680. Life Cycle Controls Controls whether updates should occur Makes sure updates happen Causes validation of updates Handles Model events: create, update, delete, and any custom events Dispatches the action forward to the next page or action
  • 682. Phase Listener  Execute custom functions at a specific time during the request processing lifecycle  getPhaseId is called by the JSF framework to register the custom PhaseListener  PhaseListener is registered in faces-config.xml public class BATLifeCycleListener implements PhaseListener{ public PhaseId getPhaseId() { return PhaseId.ANY_PHASE; } public void beforePhase(PhaseEvent event) { System.out.println("START PHASE " + event.getPhaseId()); } public void afterPhase(PhaseEvent event) { System.out.println("END PHASE " + event.getPhaseId()); } }
  • 683. ViewHandler Pluggable mechanism to provide custom handling of the activities in the Render Response and Restore View phases of the request processing lifecycle This allows for implementations to support different response generation technologies, as well as alternative strategies for saving and restoring the state of each view Good place to add custom security handling Configured in faces-config.xml Custom ViewHandler can decorate default ViewHandler
  • 684. Example Usage of Phase Listener BATHRSystemLab_16 uses “BATLifecyclePhaseListener” to customize ADF error messages Localize error messages Suppress JBO-<error> prefix Raise custom exception for known error so that error stack is not further processed
  • 685. Register the Listener in faces-config.xml <lifecycle> <phase-listener>bat.ui.BATLifecyclePhaseListener</phase-listener> </lifecycle>
  • 686. JSF Lifecycle Example - Initial 1. Restore View UI Component Tree RichPanelHeader RichPanelGroupLayout RichPanelFormLayout RichInputText RichInputDate 6. Render Response
  • 687. JSF Lifecycle Example - Postback 1. Restore View 2. Apply Request Values richInputText.setSubmittedValue(“Steven”) richInputDate.setSubmittedValue(“04-12-2012”)
  • 688. JSF Lifecycle Example - Postback 1. Restore View 2. Apply Request Values 3. Process Validations •Validate and convert (if needed) name and date •Call richInputText.setValue() with converted value if valid •Clear submittedValue •Queue valueChange event (if applicable)
  • 689. 1. Restore View value=“#{viewScope.HelloBean.name} 2. Apply Request Values 3. Process Validations 4. Update Model •Call HelloBean.setName with component value •Call HelloBean.setDate with component value •Clear submitted and (local) component value value=“#{viewScope.HelloBean.date} JSF Lifecycle Example - Postback
  • 690. JSF Lifecycle Example - Postback 1. Restore View 2. Apply Request Values actionListener=“#{viewScope.helloBean.sayHello} 3. Process Validations 4. Update Model 5. Invoke Application •Call HelloBean.sayHello
  • 691. JSF Lifecycle Example - Postback 1. Restore View 2. Apply Request Values 3. Process Validations 4. Update Model 5. Invoke Application 6. Render Response
  • 692. Validation  We can add validation so that when a user edits or enters data in a field and submits the form, the data is validated against any set rules and conditions. If validation fails, the application displays an error message  ADF Faces provides the following types of validation:  UI component attributes  Default ADF Faces validators  Custom ADF Faces validators  Use ADF Faces validation to provide immediate feedback to users, instead of waiting for commit  You should always define equivalent validation at the business component level
  • 693. Validation Approaches  Manual validation  Use string properties for bean  Do validation in setter methods and/or action controller  Return null to redisplay form  Create custom error messages  Implicit automatic validation  Use int, double, etc.. bean properties. Or add required.  System redisplays form if there is conversion error  Use h:message to display field-specific error message  Explicit automatic validation  Use f:convertNumber, f:convertDateTime, f:validateLength, f:validateDoubleRange, or f:validateLongRange  System redisplays form if failure; use h:message again  Custom validators  Extend Validator, override validate, register in faces-config.xml
  • 694. Manual Validation  Setter methods convert from strings  Use try/catch blocks  Use application-specific logic  Action controller checks values  If values are OK  Returns normal outcomes  If values are missing or illegal  Stores error messages in bean  Returns null  Input Form  Displays error messages  Error message should be empty string by default  In h:outputText, use escape="false" if error messages contain HTML tags
  • 695. Implicit Automatic Validation  Define bean properties to be simple standard types  int, long, double, boolean, char, etc..  System attempts to convert automatically in same manner as with jsp:setProperty  I.e., Integer.parseInt, Double.parseDouble, etc..  If there is conversion error, form redisplayed  And error message stored  You can also add required attribute to any input element to indicate that empty values are errors  Use h:message to display error messages  h:message returns empty string if there is no message  h:message accepts styleClass for CSS style name  Add immediate attribute to bypass validation  E.g., for h:commandButton with logout or cancel operation
  • 696. Explicit Automatic Validation  Define bean properties to be simple types  int, long, double, boolean, char, etc..  Add f:validateBlah or f:convertBlah elements  System checks that fields follow restrictions  f:validateBlah attributes let you control format  If there is validation error, form redisplayed  And error message stored  Other approaches stay the same  You can still add required attribute to any input element to indicate that empty values are errors  Still use h:message to display error messages  h:message returns empty string if there is no message  Still add immediate attribute to bypass validation  E.g., for h:commandButton when implementing logout or cancel operation
  • 697. Example of Explicit Validation <h:form> <TABLE> <TR> <TD>User ID: <h:inputText value="#{bean.userID}“ id="userID"> <f:validateLength minimum="5" maximum="6"/> </h:inputText> </TD> <TD> <h:message for="userID“ styleClass="RED"/> </TD> </TR> <TR> <TD>Keyword: <h:inputText value="#{bean.keyword}“ id="keyword"> <f:validateLength minimum="3"/> </h:inputText> </TD> <TD><h:message for="keyword“ styleClass="RED"/></TD> </TR>
  • 698. Creating Custom Validation Method  Use validator attribute in the component on which you have to validate  The attribute takes a method name as an attribute  <h:inputText … validator=“#{somebean.validatorMethod}”/>  The validator method should have the following signature public void inputText_validator(FacesContext facesContext, UIComponent uiComponent, Object object) { // Add event code here... }  JDeveloper gives a way automatically creating the validator methods
  • 699. Custom Validation Components Create a class that implements the Validator interface (javax.faces.validator.Validator) Implement the validate method Register your custom validator in the faces-config.xml file Use the <f:validator/> tag in your JSPs
  • 700. UI Validation Managed beans: Are configured in adfc-config.xml or other task flow .xml file Consist of Plain Old Java Objects (POJOs), Lists, and Maps Have a no-argument constructor Use lazy initialization by JavaServer Faces framework “as needed”
  • 701. Input Validation  Use input validation to Avoid “garbage-in-garbage-out” applications Block bad user input Avoid attacks Avoid misuse of form fields  JavaServer Faces and ADF provide the following options for validation ADF binding validation JSF validator components Backing bean "coded" validation
  • 702. Additional ADF Faces Validators ADF Faces provides additional validators for Date RangeValidator RegularExpression Validator - (Example [^0-9]{1,10}) ByteLength Validator ADF Faces validators support client-side validation through Javascript <af:inputText value="#{bindings.DepartmentName.inputValue}”> <af:validateRegExp noMatchMessageDetail="Value not allowed" pattern="[^0-9]{1,10}"/> </af:inputText>
  • 703. Creating Backing Bean Validation in JDeveloper
  • 704. Backing Bean Validation Example Code public void validateDepartmentId(FacesContext facesContext, UIComponent uiComponent,Object object) { String expr = "[^0-9]{1,10}"/>"; Pattern p = Pattern.compile(expr); Matcher m = p.matcher((String)object); //write message if input is invalid if (!m.find()){ facesContext.addMessage("RegExError",new FacesMessage( FacesMessage.SEVERITY_ERROR, "InvalidValue Provided for Deptno",null)); facesContext.getApplication().getViewHandler(). restoreView(facesContext,"/Dept.jsp"); } }
  • 705. JSF Conversion javax.faces.BigDecimal javax.faces.convert.BigDecimalConverter javax.faces.BigInteger javax.faces.convert.BigIntegerConverter javax.faces.Boolean javax.faces.convert.BooleanConverter javax.faces.Byte javax.faces.convert.ByteConverter javax.faces.Character javax.faces.convert.CharacterConverter javax.faces.DateTime javax.faces.convert.DateTimeConverter javax.faces.Double javax.faces.convert.DoubleConverter javax.faces.Float javax.faces.convert.FloatConverter
  • 706. About Converters  All web input and output is a string  Converters translate objects into strings and vice versa  Values that cannot be converted cause an error message Standard errors are defined and can be overridden  Converters can be used as programmatic format masks  If no converter is explicitly defined for a component, the JSF framework will select one. Basic converters used in such a cases are:  BigDecimal  Big Integer  Short  Double  Character  Integer  Float  Long  Boolean  Byte
  • 707. ADF Faces Converters Converters provided by ADF Faces in addition to the JavaServer Faces converters:  ColorConverter Converts string values to colors and vice versa Uses RGB value codes  DateTimeConverter Converts an strings to and from java.util.Date objects Supports timezones through settings in adf-faces-config.xml. Timezone defaults to GMT  NumberConverter Extends JavaServer Faces NumberConverter functionality
  • 708. Custom Converters Implement the Converter interface (a.k.a. javax.faxes.convert.Converter) Implement the getAsObject method, which converts a field (string) into an object (for example, PhoneNumber) Implement the getAsString method, which converts an object (for example, PhoneNumber) into a string Register your custom converter in the Faces context Insert the converter into your JSPs with the <f:converter/> tag
  • 709. Step 1: Implement the Converter interface import javax.faces.convert.Converter; public class PhoneConverter implements Converter { ... } Step 2: Implement the getAsObject method public class PhoneConverter implements Converter{ public Object getAsObject(FacesContext context, UIComponent component, String value) { } } Step 3: Implement the getAsString method public String getAsString(FacesContext context, UIComponent component, Object value){ return value.toString(); } Custom Converters
  • 710. Step 4: Register custom converter with faces context <converter> <converter-id>suwega.PhoneConverter</converter-id> <converter-class>com.suwega.converters.PhoneConverter</converter-class> </converter> <converter> <converter-for-class>com.suwega.value.PhoneNumber</converter-for-class> <converter-class>com.suwega.converters.PhoneConverter</converter-class> </converter> Step 5: Use the converter tag in your JSPs <h:inputText id="phone" value="#{UserRegistration.user.phone}"> <f:converter converterId=“suwega.PhoneConverter" /> </h:inputText> Custom Converters
  • 711. Lesson Summary  Configure and use managed beans  Explain the different types of events  Handle action, value change and phase events using corresponding listener  Configure managed bean to contain listener  ADF Life Cycle Phases  Validate UI using Validators  Converters  Understand contextual events to coordinate regions  Programmatically call Partial Page Rendering
  • 712. 18 Binding Model Layer with Business Services and Databound View
  • 713. Lesson Agenda Explain output, input, selection and List Of Values components Implement data bound components like table and trees Bind method call Stretch data view components Data visualization components
  • 714. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 715. ADF Faces Functionality: ADF Faces Components  Layout Components: (12)  Navigation Control Components: (14)  Menu and Toolbar: (14)  Secondary Windows Layout: (14)  Text and Selection Comps: (18) Output Comps* Input Comps* List-of-Values (LOV) Comps*  Data Views: (18) Collection-Based Comps* Specialty Display Comps*  Advance Data Visualization Comps* (18)  Data Query Components (19) Chart Graph Gauge NBox Pivot Table Map Gantt Timeline Hierarchy Viewer Sunburst Diagram *Comps = Components
  • 716. ADF Faces Components  Text and Selection Components:  Output Component  Output Text, Message, Image, Icon, Media, Progress Indicator, Status Indicator and Carousel  Input Component  Input Text, Input Number, Form, Rich Text Editor, File Upload, Color Chooser, Date Chooser and Code Editor  Selection  Boolean selection: Select Boolean Checkbox, Select Boolean Radio  Single Selection: Select One Radio, Select One Listbox, Select One Choice  Multiple Selection: Select Many Checkbox, Select Many Listbox, Select Many Choice, Select Many Shuttle, Select Order Shuttle, Slider (range)  List-of-Values (LOV) Component  Input List of Value and Input Combobox List of Value
  • 717. ADF Faces Components cont.… Data Views: Collection-Based  Table  Tree  Tree Table  List View  Carousel Specialty Display  Calendar Component Data Visualization: Graph Chart Gauge NBox Pivot Table Pivot Filter Bar Geographic Map Thematic Map Gantt Chart Timeline Hierarchy Viewer Tree Map Sunburst Diagram
  • 718. Output Components With output components, you can: Display text, messages, icons and images Play audio and video files
  • 719. Output Components Output Text: The outputText component can be used as a child to many other components to display read-only text When you need the text to be formatted, you can use the outputFormatted component
  • 720. Output Components Message: Messages can typically be divided into two types: Error messages that display when an error occurs in the application, for example when a user enters incompatible information Informational messages to display more detailed information
  • 721. Output Components Image: Use the image component to display images Icons: Renders an icons
  • 722. Output Components Media: The media component displays media content such as audio, video or image in a player embedded in the user agent
  • 723. Output Components Progress Indicator: It can be used to give users an understanding that there is a back end task in progress Status Indicator: Used to display a busy/idle status indicator that displays the status of ppr activity
  • 724. Output Components Carousel: (12c feature) Displays a spinning series of items based on rows of a collection model
  • 725. Output Components: Additional Functionalities Once you have added these components to your page, you may find that you need to add functionality such as drag and drop and accessibility Using parameters in text: You can use the ADF Faces EL format tags if you want text displayed in a component to contain parameters that will resolve at runtime Conversion: In some cases, a value may need to be converted to a string in order to display
  • 726. Output Components: Additional Functionalities cont.… Drag and drop: You can configure a page so that a user can drag and drop output components or values of output components, to another area on a page Localization: Instead of entering values for attributes that take strings as values, you can use property files. These files allow you to manage translation of these strings Skins: You can change the look and feel of output components by changing the skin
  • 727. Input Components Input components accept user input in a variety of formats. The most common formats are text, numbers, date, and selection lists that appear inside a form and are submitted when the form is submitted. The entered values or selections may be validated and converted before they are processed further
  • 728. Input Components Input Text: the inputText component is the basic input component for entering values Input Number: There are two types of input number components:  Input Number Spinbox: Used to enter numbers and it has a spinbox to quickly increment or decrement the number  Input Number Slider: The inputNumberSlider component has one marker and allows the user to select one value from the slider
  • 729. Input Components Rich Text Editor: An input control for richly formatted text
  • 730. Input Components File Upload: The inputFile component is a component that can be used to upload a file. It supports displaying a label, text and messages Color Chooser: The inputColor component allows users to pick a color from a palette
  • 731. Input Components Date Chooser: The inputDate component presents a text input field for entering dates and a button for picking dates from a popup calendar
  • 732. Input Components Code Editor: The af:codeEditor component provides an in-browser code editing solution and enables the user to display and edit program code at runtime in the Fusion web application
  • 733. Input Components: Selection components Selection Components: The selection components allow the user to select single and multiple values from a list or group of items The select components are categorized into three types as shown in the following list:  Boolean Selection  Single Selection  Multiple Selections
  • 734. Selection components: Boolean Selection Boolean selection: Components of this type provide a user with two states: either true or false selectBooleanCheckbox  The selectBooleanCheckbox component value must always be set to a boolean and not an object  selectBooleanRadio  The selectBooleanRadio component displays a boolean choice, and must always be set to a boolean. Unlike the selectBooleanCheckbox component, the selectBooleanRadio component allows you to group selectBooleanRadio components together using the same group attribute
  • 735. Selection components: Single-Selection Single selection: Components of this type present multiple values and expect a single value to be selected In order to present multiple options, these components have to nest f:selectItems, f:selectItem or af:selectItem You can also create items programmatically by creating a list of javax.faces.model.SelectItem
  • 736. Selection components: Single-Selection The components that are included in this category:  selectOneRadio  This component to create a list of radio buttons from which the user can select a single value from a list  selectOneListbox  This component allows the user to select a single value from a list of items displayed in a shaded box  selectOneChoice  It creates a menu-style component, which allows the user to select a single value from a dropdown list of items
  • 737. Selection components: Multiple Selection Multiple selections Like single selection components, these components present multiple values and expect multiple values to be selected The components that are included in this category are:  selectManyCheckbox  It is used to create a list of checkboxes from which the user can select one or more values
  • 738. Selection components: Multiple Selection  selectManyListbox  It allows the user to select many values from list of items  selectManyChoice  This component creates a menu-style dropdown component, which allows the user to select multiple values from a dropdown list of items
  • 739. Selection components: Multiple Selection  selectManyShuttle  It allows user can select a single item or multiple items to shuttle between the leading (Available values) list box and the trailing (Selected values) list box  selectOrderShuttle  This component additionally includes up and down arrow buttons that the user can use to reorder values in the Selected values list box
  • 740. Input Components: Additional Functionalities Once you have added an input component or form to your page, you may find that you need to add functionality such as validation and accessibility  Using parameters in text: You can use the ADF Faces EL format tags if you want text displayed in a component to contain parameters that will resolve at runtime  Client components: Input components can be client components  JavaScript APIs: All input components have JavaScript client APIs that you can use to set or get property values  Events: Input components fire both server-side and client-side events that you can have your application react to by executing some logic
  • 741. Input Components: Additional Functionalities cont.…  Can add validation and conversion to input components  Can display tips and messages, as well as associate online help with input components  There may be times when you want the certain input components to be validated before other components on the page  If other components on the page to update based on selections, make from a selection component  Use the scrollComponentIntoViewBehavior tag with the richTextEditor component to allow users to jump to specific areas in the component  Can change the icons used for required and changed notifications using skins  Can make your input components accessible
  • 742. List-of-Values (LOV) Components  ADF Faces provides two list-of-values (LOV) input components that can display multiple attributes of each list item and can optionally allow the user to search for the needed item  These LOV components are useful when a field used to populate an attribute for one object might actually be contained in a list of other objects, as with a foreign key relationship in a database  Example: suppose you have a form that allows the user to edit employee information. Instead of having a separate page where the user first has to find the employee record to edit, that search and select functionality can be built into the form
  • 743. List-of-Values (LOV) Components cont.… Input List Of Value:  The inputListOfValues component uses the ListOfValues model you implemented to access the list of items Input Combobox List Of Value:  It allows a user to select a value from a dropdown list and populate the LOV field, and possibly other fields, on a page
  • 744. List-of-Values Components: Additional Functionalities Once you have added a list-of-value component to your page, you may find that you need to add functionality such as validation and accessibility Client components: Components can be client components JavaScript APIs: All list-of-value components have JavaScript client APIs that you can use to set or get property values Events: List-of-value components fire both server-side and client-side events that you can have your application react to by executing some logic
  • 745. List-of-Values Components: Additional Functionalities cont.…  You can add validation and conversion to list-of-values components  You can display tips and messages, as well as associate online help with list-of-values components  There may be times when you want the certain list-of-values components to be validated before other components on the page  You may want other components on the page to update based on selections you make from a list-of-values component  You can change the appearance of the components using skins  You can make your list-of-values components accessible
  • 746. List-of-Values Components: Additional Functionalities cont.…  Instead of entering values for attributes that take strings as values, you can use property files. These files allow you to manage translation of these strings  The LOV components use the query component to populate the search list  Other list components, such as selectOneChoice, also allow users to select from a list, but they do not include a popup dialog and they are intended for smaller lists  If your application uses ADF Model, then you can create automatically bound forms using data controls (whether based on ADF Business Components or other business services)
  • 747. Defining a List You can define a list: At the model layer In the UI
  • 748. Select a Date Date attributes are automatically created as af:inputDate components:
  • 749. Data Views: Collection-based Components Collection-based Components: These components can be used to iterate through and display collections of structured data Instead of containing a child component for each record to be displayed, and then binding these components to the individual records, these components are bound to a complete collection, and they then repeatedly render one component by stamping the value for each record Example: an outputText component
  • 750. Collection-based Components Table: Table is used to display tabular data. It also supports selection (both single and multiple), sorting and record navigation
  • 751. Using Tables ADF Faces table component adds to JSF table by providing Column sorting and reordering Column resize Column move Data filtering Row selection (single or multiple rows) There are many formatting options for ADF tables
  • 752. Setting Table Attributes Type Description Attribute(s) Setting(s) Grid Lines (table attribute) Lines separating cells verticalGridVisible horizontalGridVisible true or false Banding (table attribute) Alternating background colors rowBandingInterval columnBandingInterval Number of rows or columns you want to be in each band Column or row headers Labels for columns or rows header facet or headerText attribute Text to display in header rowHeader column attribute true or false Column groups Common label for group of columns To group columns, nest af:column tags, using the outer af:column tag as the group, and the inner tags as the columns within the group. Column formatting Align, wrap, width, height Align nowrap width, height start,end,left, right, center, true or false number or % Row selection Selection of single or multiple rows rowSelection single or multiple
  • 753. Collection-based Components Tree: Tree component displays hierarchical data, such as organization charts or hierarchical directory structures In data of these types, there may be a series of top-level nodes, and each element in the structure may expand to contain other elements
  • 754. Collection-based Components Tree Table: Display hierarchical data in a table Combine features of trees and tables
  • 755. Using Table Model Methods in a Selection Listener You can do the following programmatically: Make row current: setRowIndex() or setRowKey() Access data in the current row: getRowData() Obtain number of rows: getRowCount() Determine whether you are at the end of the table: isRowAvailable()
  • 756. Using Tree Model Methods in a Selection Listener You can do the following programmatically: Determine whether a row has children: isContainer() Access children of current row: enterContainer() Revert to parent collection: exitContainer()
  • 757. Collection-based Components List component: Instead of using a table with multiple columns, you can use the listView and listItem components to display structured data in a simple table-like format that contains just one column The listView component with a listItem component
  • 758. Organizing Items  Organizing labels & fields: af:panelFormLayout Specify the # of columns and rows per column Can configure labelWidth and fieldWidth Typically contains af:input* and af:select* components For other kinds of content, use af:panelLabelAndMessage if:  Don’t have a label, or  Need multiple fields per label Use af:group if you need to separate sections  Bulleted or ordered lists af:panelList
  • 759. Collection-based Components: Additional Functionalities Once you have added a collection-based component to your page, you may find that you need to add functionality such as validation and accessibility  Customizing the toolbar: You can customize the toolbar included in the panelCollection component, which provides menus, toolbars, and status bars for the table and tree table components  Geometry management of the table width: If the table is a child to a component that stretches its children, then this width setting will be overridden and the table will automatically stretch to fit its container  Active data: If your application uses active data, then you can have the data in your tables and trees update automatically, whenever the data in the data source changes  Accessibility: You can make your components accessible
  • 760. Collection-based Components: Additional Functionalities cont.…  Events: Collection-based components fire both server-side and client-side events that you can have your application react to by executing some logic  Partial page rendering: You may want a collection-based component to refresh to show new data based on an action taken on another component on the page  Personalization: Users can change the way the component displays at runtime (for example the user can reorder columns or change column widths), those values will not be retained once the user leaves the page unless you configure your application to allow user customization  Automatic data binding: If your application uses the Fusion technology stack, then you can create automatically bound tables and trees based on how your ADF Business Components are configured
  • 761. Specialty Display Components Calendar: Calendar component provides the user the ability to view a calendar and the activities by day, week, month or list views
  • 762. Data Visualization Components (DVT) Data Visualization Component: ADF Data Visualization components provide significant graphical and tabular capabilities for displaying and analyzing data
  • 763. Using Data Visualization Components Common features: Design time creation by using: Data Controls panel JSF visual editor Property Inspector Component Palette Live data preview at design time Support for data binding Chart NBox
  • 764. Gauge Graph Hierarchy Viewer Data Visualization Components: Examples 13 - 38 Geographic map Pivot table Gantt chart
  • 765. Data Visualization Components: Examples Pivot Filter Thematic Map Time Line Tree Map Sunburst Diagram
  • 766. Data Visualization Components: Additional Functionalities Once you have added a data visualization component to your page, you may find that you need to add functionality such as validation and accessibility  Partial page rendering: You may want a data visualization component to refresh to show new data based on an action taken on another component on the page  Personalization: Users can change the way the data visualization components display at runtime, those values will not be retained once the user leaves the page unless you configure your application to allow user customization  Accessibility: By default, data visualization components are accessible. You can configure your application pages with data visualization components to be accessible to screen reader users
  • 767. Data Visualization Components: Additional Functionalities cont.…  Touch devices: When you know that your ADF Faces application will be run on touch devices, the best practice is to create pages specific for that device  Skins and styles: You can customize the appearance of data visualization components using an ADF skin that you apply to the application or by applying CSS style properties directly using a style-related property (styleClass or inlineStyle)  Placeholder data controls: If you know the data visualization components on your page will eventually use ADF data binding, but you need to develop the pages before the data controls are ready, then you should consider using placeholder data controls, rather than manually binding the components. Using placeholder data controls will provide the same declarative development experience as using developed data controls
  • 768. AJAX with PPR Additional event types include AJAX events:
  • 771. Run and Test the Page Run the page Test the functionality
  • 772. Lesson Summary Explain output, input, selection and List Of Values components Implement data bound components like table and trees Bind method call Stretch data view components Data visualization components
  • 773. 19 Querying Data with Search Components
  • 775. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 776. ADF Faces Functionality: ADF Faces Components  Layout Components: (12)  Navigation Control Components: (14)  Menu and Toolbar explorer-type containers: (14)  Secondary Windows Layout: (14)  Text and Selection Components: (18)  Data Views: (18)  Advance Data Visualization Components (18) Data Query Components (19) Query and Quick Query
  • 777. Query Search Component Query: The query component provides the user the ability to perform a query or personalize saved searches Advanced mode query with dynamically added search criterion
  • 778. Creating Query Search Form Drag a named criteria from the Data Controls panel:
  • 779. Modifying Query Behavior You can set properties that affect query behavior: On the model’s view criteria On the query in the UI
  • 780. Quick Query Component Quick query: Has a selectable list of attributes to search on Has a single search criterion input field Can have a link to more advanced search capabilities, with switching implemented in a managed bean
  • 781. Query Components: Additional Functionalities Once you have added a query or quick query component to your page, you may find that you need to add functionality such as validation and accessibility  All query components have JavaScript client APIs that you can use to set or get property values  You can display tips and messages, as well as associate online help with query components  You can change appearance of the components using skins  You can make your query components accessible  Instead of entering values for attributes that take strings as values, you can use property files. These files allow you to manage translation of these strings  If your application uses ADF Model, then you can create automatically bound search forms using data controls (whether based on ADF Business Components or other business services)
  • 782. Schematic Representation of a Query Process
  • 785. Lesson Agenda Describe ADF BC transaction handling Implement task flow transaction control Handle transaction exceptions Define response to the browser’s Back button Enable the save for later functionality
  • 786. Functionalities of ADF Faces  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (Lesson 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20)  ADF Model support (Lesson 21)
  • 787. Handling Transactions with ADF BC Application modules handle transaction and concurrency support No coding is required unless you want to customize the default behavior For nested application modules, the outermost application module provides the transaction context for the others
  • 788. Default ADF Model Transactions
  • 790. Sharing Data Controls Data control scopes:  Shared (default): Called flow shares data control (AM) instances with calling flow <data-control-scope> <shared/> </data-control-scope>  Isolated: Called flow has unique instance of data controls (AM) <data-control-scope> <isolated/> </data-control-scope>
  • 791. Transaction Scope Transaction Scope: With isolated data control scope each TF has own transaction With shared data control scope, transaction is shared by default, but can be changed using Transaction setting
  • 792. Using Data Control and Transaction Scopes Limits reuse options! Isolated transactions needed for dynamic tabs Shared transaction needed for child region
  • 793. Handling Transaction Exceptions You should designate an exception handling activity on transactional task flows Can be any activity type, such as: View: To display a message Router: To call a method depending on the type of exception
  • 794. Designating an Exception Handler Activity
  • 795. Transaction Support Features of Bounded Task Flows
  • 797. Enabling Explicit Save for Later Save for later task flow Contains button that performs save for later Calls createSavePoint to add a save-point-id Contains field for user to enter save-point-id to pass to restore activity Restores application state and data to what was captured in save-point-id
  • 798. Enabling Implicit Save for Later To enable implicit save for later: Change a setting in adfc-config.xml Mark the task flow as critical
  • 799. Restoring Save Points A Save Point Restore activity: Restores the state of the application Deletes the savepoint from its persistence store Optionally performs additional logic with a Save Point Restore Finalizer Is required in applications that are responsible for restoring save-point-id (not necessarily the same application that was saved for later)
  • 800. Setting Global Save for Later Properties Set properties in the adfc-config.xml file: savepoint-expiration savepoint-manager savepoint-datasource enable-implicit-savepoints
  • 801. Create and CreateInsert The Create operation performs the following code: // 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); In addition, the CreateInsert operation performs: // insert new row into view object's default rowset yourViewObject.insertRow(newRow);
  • 802. Defining Response to the Back Button The Task Flow Reentry property determines whether the user can return to an exited task flow by clicking the browser’s Back button: reentry-allowed: OK reentry-not-allowed: Throws exception reentry-outcome-dependent: Depends on the outcome from exited task flow
  • 803. Lesson Summary Describe ADF BC transaction handling Implement task flow transaction control Handle transaction exceptions Enable the save for later functionality Define response to the browser’s Back button
  • 805. Lesson Agenda Importance of model Types of data controls Types of data bindings ADF Configuration files Data binding using Expression Language (EL) ADF binding class hierarchy Refresh Binding Executables
  • 806. ADF Faces Functionalities  Internationalization (Lesson 11)  Skinning (Lesson 11)  Active Geometry Management (L 12)  Advance Page Flow and Task Flow (Lesson 13)  Navigation (Lesson 14)  Accessibility (Lesson 14)  Reusability using Templating and Declarative Component (L 15)  Memory Scopes (Lesson 16)  Parameter Passing (Lesson 16)  Partial Page Rendering (Ajax support) (Lesson 16)  Event and Listener Handling (L 17)  Managed and Backing Beans (L 17)  Enhanced Lifecycle (Lesson 17)  Drag and Drop Data Binding (L 18)  Advance Databound Search Capability (Lesson 19)  Transaction Management (L 20) ADF Model support out-of- the-box (21)
  • 807. Client-Server Architecture Server Relational Data Legacy Data Data Services ADF Swing Swing Office EJB POJO Toplink Hibernate Tuxedo Client
  • 808. Model View Controller (MVC) Architecture Model View Controller Relational Data XML Data Packaged Apps Legacy Data Data Services JSF JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View JSF/OAFwk ADF BC Server
  • 809. The Need for a Standard There is no standard way to bind data from any user interfaces to any business services Developers create their own integration layers Vendors have implemented different solutions Integrating components from different vendors requires learning and coding
  • 810. Tech-Stack of ADF Metadata Services JDeveloper Model (JSR227) View Controller Business Services Relational Data XML Data Packaged Apps Legacy Data Data Services ADF Faces JSF/ADFc/Taskflow ADF Model /Binding Context /Data Binding ADF BC JSP Struts ADF Swing Swing Office ADFdi EJB Web Services POJO Toplink Hibernate Portlet BI XML Web / Wireless Rich Client / Desktop User Actions Modify View ViewController/ User Interface Project Model/ Service Project Model Presentation Layer v m bc BAM BPL JSF
  • 811. Benefits of the Standard Client code contains no references to the business service Better design practice Code is more maintainable Decouples presentation layers and business service layers Allows tools to build application using declarative implementation of metadata service without code generation Allows implementation of support for any business service and any user interface
  • 812. ADF Faces ADF Binding Layer Model (JSR227) Business Services Application Module/ Services Data Control /Binding Context ADF BC Binding Container / Bindings View Controller /Data Binding ADFm  Provides public interfaces of business services  Gives access to service layer  Defines all the bindings for a page by connecting UI components to data or actions and data control  Created automatically when a data- bound component is added to a page  Maps pages to page definitions  Declares data control usages  Binds page components to data without writing any code
  • 813. ADF Faces Types of Data Controls Model (JSR227) Business Services Data Control /Binding Context Binding Container / Bindings View Controller /Data Binding ADFm Data Control Data Control Data Control Data Control Web Services (REST/SOAP) EJB POJO URL ADF BC BI Essbase BAM Data Control Data Control Data Control
  • 814. Default Data Control Functionality Data Control Type Supports Transactions? Supports Sorting? Supports Updates? ADF BC Yes Yes Yes EJB No Yes Yes Java Bean No Yes No Web Services No No No URL No Yes No
  • 816. Types of Bindings Model (JSR227) Business Services Application Module/ Services /Binding Context ADF BC View ADFm #{Binding Expression} Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding … … … … … ADF Faces/ JSF/ JSFF/ JSPX Binding Container / /Data Binding #{bindings.DepartmentName.hints.label} Data Control Bindings
  • 817. Types of Bindings: Source View Model (JSR227) Business Services Application Module/ Services /Binding Context ADF BC View ADFm <af:inputText value=“#{bindings.DepartmentName.inputValue}” label =“#{bindings.DepartmentName.hints.label}” ADF Faces/ JSF/ JSFF/ JSPX Binding Container / /Data Binding Data Control <executables> <iterator id="Department1Iterator" DataControl="HRSystemAMDataControl" Binds="Department1"/> </executables> <bindings> <attributeValues IterBinding="Department1Iterator“ id="DepartmentName"> <AttrNames> <Item Value="DepartmentName"/> </AttrNames> </attributeValues> ... </bindings> Bindings
  • 820. ADF Faces ADF Configuration and Metadata Files Model (JSR227) Business Services Application Module/ Services Data Control /Binding Context ADF BC Binding Container / <pagename>.jsf /.jspx* <pagename>PageDef.xml* View Controller /Data Binding ADFm ViewController/ User Interface Project (<ViewController>.jpr) Model/ Service Project (<Model>.jpr) <ApplicationModuleName>.xml bc4j.xcfg DataControls.dcx DataBindings.cpx <Model>.jpx web.xml adfc-config.xml faces-config.xml (ADFBindingFilter) trinidad-config.xml <task-flow-definition>.xml adfm.xml Web Configuration Files Data Binding Files Data Control Files Presentation Layer Application Configuration Files adf-config.xml ADF Configuration Files adf-settings.xml * Denotes multiple files of this type may exist in the project  Solid lines indicate hierarchy of metadata --> Dotted lines indicate references to objects in the ADF binding context Metadata Services JDeveloper Bindings
  • 821. ADF Faces ADF Binding Control: Run Time Model (JSR227) Business Services Application Module/ Services Data Control /Binding Context ADF BC Binding Container <pagename>.jsf /.jspx* <pagename>PageDef.xml* View Controller /Data Binding ADFm <ApplicationModuleName>.xml bc4j.xcfg DataBindings.cpx web.xml(ADFBindingFilter) adfm.xml Web Configuration Files Data Binding Files Data Control Files * Denotes multiple files of this type may exist in the project  Solid lines indicate hierarchy of metadata --> Dotted lines indicate references to objects in the ADF binding context / Bindings
  • 822. ADF Binding Control: File Hierarchy web.xml <filter> <filter-name>adfBindings</filter-name> </filter> adfm.xml <MetadataDirectory> … </MetadataDirectory> DataBindings.cpx <Application > </Application> <pagename>.jsf /.jspx* <af:xxx </af:xxx> <ApplicationModuleName>.xml bc4j.xcfg <BC4JConfig> </BC4JConfig> <pagename>PageDef.xml* <pageDefinition> </pageDefinition> <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class> <DataBindingRegistry path=".../DataBindings.cpx"/> <dataControlUsages> <BC4JDataControl id=“<amname>“ Configuration=“<AM>Local”…/> </dataControlUsages> <pageDefinitionUsages> <page id="<pagename>PageDef" path=“<pkgname>“/>… </pageDefinitionUsages> <AppModuleConfigBag> <AppModuleConfigname=“<AM>Local”>… <ViewUsage Name=“<voname>” ViewObjectName=“<ViewObject>”/> value="#{bindings.<Attribute>.inputValue}“ columns="#{bindings.<Attribute>.hints.displayWidth}" label="#{bindings.<Attribute>.hints.label}“ <executables> <Iterator id=“<voname>Iterator” Binds=”<voname>”/> … </executables> <bindings> <… <IterBinding=“<voname>Iterator”>… /> … </bindings > Model (JSR227) Business Services View Controller
  • 824. Creating Page Definition Bindings  In the Bindings section, click on the + icon.  The Insert Item wizard opens and will list all the bindings options for the page definition file as shown in the following screenshot:  Click on the action item; this will open a Binding for Action palette.  Select the EmpDirectoryModuleDataControl option; this will populate the Operation section with the Commit operation.  Click on the OK button and binding creation is complete.
  • 826. Architectural View Of The Use Case Implementation
  • 828. ADF Binding Validation  Validator is declaratively added to ADF attribute  Validation rule is enforced on server
  • 829. Control Hints and Validation  Declarative validation rules for data controls and bindings Consistent interface for common validation Extensible for complex application validation Metadata based  Control hints for data controls and bindings, including: Labels Date and currency formatting
  • 830. ADF Binding Using Expression Language (EL) JavaServer Faces pages can create value bindings to the ADF binding container (pageDef) using EL accessing the “bindings” object The “bindings” object is created by the ADF servlet filter that is defined in the web.xml file The ADF servlet filter is mapped to *.jsf, *.jsff, *.jsp and *.jspx file types #{bindings.DepartmentName.inputValue}
  • 831. Expression Language (EL) and Bindings  Databinding expressions are written using EL  Evaluated at runtime to determine what data to display  ADF EL expressions typically have the form:  #{bindingVariable.BindingObject.propertyName} Refers to the binding object in the container of the current page It is an ID for the bindingObject in the container of the page (PageDefinition) It sets the values for the binding Objects at runtime <af:inputText value=“#{bindings.DepartmentName.inputValue}” label=“#{bindings.DepartmentName.hints.label}” required=“#{bindings.DepartmentName.mandatory}”/> EL Expression example:
  • 832. Using Expression Language (EL) Use Expression Builder to declaratively create EL expressions.
  • 833. Immediate EL Syntax: ${}  It is evaluated immediately.  It can be used only within template text or as the value of a JSP tag attribute. <fmt:formatNumber value="${sessionScope.cart.total}"/>  Code example: The JSP value attribute references the EL that gets the total price from the session-scoped bean named cart. The JSP engine evaluates the expression, converts it, and passes the returned value to the tag handler.  Immediate evaluation expressions are always read-only value expressions. The example can only get the total price from the cart bean; it cannot set the total price.
  • 834. Deferred EL Syntax: #{}  It is evaluated at other phases of the page life cycle as defined by the technology that uses the expression (JSF). <h:inputText id="name" value="#{customer.name}" />  Code example: The JSF value attribute references the EL that points to the name property of the customer bean.  First request: #{customer.name} is evaluated during the Render Response phase of the life cycle. EL gets the value of name from the customer bean, as is done in the immediate evaluation.  Postback: JSF evaluates the expression at different phases of the life cycle, during which the value is retrieved from the request, validated, and propagated to the customer bean.  Deferred EL can be value expressions that can be used to read and write data.
  • 837. Class Files in Programmatic Approach Model (JSR227) /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container / /Data Binding Data Control oracle.adf.model.BindingContext bctx = BindingContext.getCurrent(); oracle.adf.model.binding.DCBindingContainer bctr = bctx.getCurrentBindingsEntry(); oracle.adf.model.binding.DCIteratorBinding itrb = bctr.findIteratorBinding("ViewObject1Itr"); oracle.binding.OperationBinding oprb = bctr.getOperationBinding(oprName); oracle.adf.model.binding.DCControlBinding valb = bctr.getControlBinding(valuename); oracle.adf.model.binding.DCDataControl dc = bctr.findDataControl(“MyAMDataControl”); Bindings * 1 1 * 1 * 0..* 1 0..* 1 1 * * 1
  • 838. ADF Binding Class Hierarchy BindingContext BindingContainer DCDataControl DCBindingContainer DCIteratorBinding DCControlBinding ControlBinding JUIteratorBinding JUControlBinding OperationBinding AttributeBinding getCurrentBindingsEntry() 1 * 1 * 1 * 1 * 1 * 1 * 1 * 0..* 1 0..* 1 0..* 1 0..* 1 findDataControl() findIteratorBinding() getOperationBinding() getControlBinding() getAttributeBindings() findCtrlBinding() getDataControl() getApplication() getDCIteratorBinding() getIteratorBinding() Prefix Package DC* oracle.adf.model.binding JU* oracle.jobo.uicli.binding Others oracle.adf.model or oracle.binding /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container /Data Binding Data Control Bindings /
  • 839. ADF Binding Class Hierarchy cont.… JUControlBinding JUCtrlTreeBinding JUCtrlListBinding JUCtrlHierBinding JUCtrlRangeBinding JUCtrlAttrsBinding JUCtrlValueBinding JUCtrlActionBinding Prefix Package DC* oracle.adf.model.binding JU* oracle.jobo.uicli.binding Others oracle.adf.model or oracle.binding /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container /Data Binding Data Control Bindings / DCControlBinding
  • 840. ADF Binding Class Diagram
  • 841. Programmatic Approach of Binding /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container /Data Binding Data Control Bindings /
  • 842. Programmatic Approach of Binding /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container /Data Binding Data Control Bindings /
  • 843. Programmatic Approach of Binding cont.… /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container /Data Binding Data Control Bindings /
  • 844. Programmatic Approach of Binding cont.… /Binding Context ADFm Value bindings  Attribute binding  List binding  Table binding  Tree binding Iterator bindings  Iterator  Method iterator  Accessor iterator  Variable iterator Action bindings  Operation binding  Method binding Binding Container /Data Binding Data Control Bindings /
  • 845. JUCtrlActionBinding Implements actions on BC4J RowIterator to which this control is bound. This class supports the following actions:  ACTION_EXECUTE Executes the ViewObject query.  ACTION_NEXT Moves the currency to the next row.  ACTION_PREVIOUS Moves the currency to the previous row.  ACTION_FIRST Moves the currency to the first row.  ACTION_LAST Moves the currency to the last row. mAction = action;  ACTION_RESET Resets the currency to the beginning of the RowIterator.  ACTION_REMOVE_CURRENT_ROW Removes the current row in this iterator.  ACTION_CREATE_INSERT_ROW Creates a new row and insert it into this iterator before the current row.  ACTION_COMMIT_TRANSACTION Commits all changes in the current BC4J application module session into database.  ACTION_ROLLBACK_TRANSACTION Rolls back any changes in the current BC4J application module session.
  • 846. Specify When to Refresh Binding Executables Refreshing the iterator reconnects the binding with the RowSetIterator object. Refreshing the invoke action binding invokes the action. You can set the Refresh property to determine when to refresh
  • 847. Specify Whether to Refresh Binding Executables Set RefreshCondition to an EL expression evaluating to true (default) or false. Example: A search page that initially shows no data has iterator binding with settings:  RefreshCondition="#{!adfFacesContext.isInitialRender}" (false when page is first rendered) Refresh="renderModel"
  • 848. Task Flow and ADF Life Cycle  Regions are refreshed when the parent page is displayed.  Bindings are refreshed based on property values.  Even components that are not initially displayed are initialized.  EL expression values of the RefreshCondition attribute are evaluated during the Prepare Render phase of the life cycle. default: The region is refreshed only once. ifNeeded: The region is refreshed only if there has been a change to the task flow binding parameter values.  If the “bindings” variable is used within the EL expression, the context refers to the binding container of the parent page.
  • 849. Declarative Control over Individual Page Life Cycle  Executables: Iterator bindings invokeAction  Refresh attribute values: ifNeeded: Fires both during the Prepare Model and Prepare Render phases prepareModel: Fires only during the Prepare Model phase renderModel: Fires only during the Prepare Render phase  RefreshCondition expression: Boolean expression, which controls whether the executable should fire at all
  • 850. Lesson Summary Importance of model Types of data controls Types of data bindings ADF Configuration files Data binding using Expression Language (EL) ADF binding class hierarchy Refresh Binding Executables
  • 852. Lesson Agenda Using business component client APIs Implement programmatic modifications Implement method validation Generate Java classes for business components Add service methods to an application module Handle transactions Create a test client
  • 853. Types of Programmatic Customization of ADF Business Component Use ADF Business Component APIs Programmatically customizing entity object (EO) Programmatically customizing view object (VO) Programmatically customizing application module (AM) Programmatically accessing business component objects from Java client
  • 854. Types of Programmatic Customization: Business Component APIs Using ADF Business Component APIs Programmatically customizing entity object (EO) Programmatically customizing view object (VO) Programmatically customizing application module (AM) Programmatically accessing business component objects from Java client
  • 855. Using ADF Business Component APIs  Provides prebuilt code in two main packages: oracle.jbo.server oracle.jbo  Server interfaces in the oracle.jbo.server package include: Entity Object  Client interfaces in the oracle.jbo package include: Application Module View Object Row (But NOT Entity)
  • 856. Relationship among ADF BC Objects
  • 857. Set Of Defines Query to Produce Class Diagram of ADF BC EntityDefinition ApplicationModule ViewCriteriaRow RowSetIterator Key ViewCriteria RowSet Row ViewObject StructureDef AttributeHints AttributeDef Entity Key Transaction Table Rows Set Of Can Be Filtered Using Query by Example Iterates Rows in Group Of Uses Transaction Contains Data Model Instances Identified By HasUIHints Identified By Represents Row in and Encapsulates Validation For Manages Associated To Linked To RELATED_TO Uses Attributes From 1 0..1 1 1 1 * 1 * * * * * * 1 0..1 * 0..1 * 0..1 * 1 * 1 1 1 * 0..1 * Defines Mapping To Delegates Storage and Validation To 0..1 *
  • 858. File Structure of ADF BC Application Module --------------------------- Data Model View Object XML Definition XML Definition Entity Object XML Definition Custom AMImpl AM Base Class Custom VOImpl VO Base Class EO Base Class Custom EOImpl DB DB DB 1 * References Extends References Extends References Extends ADF Business Components oracle.jbo.server.ApplicationModuleImpl oracle.jbo.server.EntityImpl oracle.jbo.server.ViewObjectImpl
  • 859. XML-Only Component on a Framework Extension Class The ComponentClass attribute is read at run time to identify the Java class.
  • 860. Custom Java Component on a Framework Extension Class The YourServiceImpl class inherits its base behavior from the CustomAppModuleImpl framework extension class
  • 861. Types of Programmatic Customization: Entity Objects Use ADF Business Component APIs Programmatically customizing entity object (EO) Programmatically customizing view object (VO) Programmatically customizing application module (AM) Programmatically accessing business component objects from Java client
  • 862. Ingredients of an Entity Object
  • 863. Programmatically Customizing Entity Object (EO) Default metadata - <EntityObjectEO>.xml Java classes (generate) Programmatically customizing default behavior (within EO) Business rules Override methods Programmatic operations (from outside EO) Placement of entity operations CRUD operations
  • 864. Programmatically Customizing EO: Default Metadata  Default metadata - <EntityObjectEO>.xml  Java classes (generate)  Programmatically customize default behavior (within EO) Business rules Override methods  Programmatic operations (from outside EO) Placement of entity operations CRUD operations
  • 865. Programmatically Customizing EO: Java Classes  Default metadata <EntityObjectEO>.xml  Java classes (generate)  Programmatically customize default behavior (within EO) Business rules Override methods  Programmatic operations (from outside EO) Placement of entity operations CRUD operations
  • 866. Generating Entity Java Classes To generate a Java class: On the business component editor’s Java page, click Edit Select the classes to generate Select Classes Extend… to extend custom base class
  • 867. Generated Entity Java Classes  <EntityEO>Impl.java:  Is the entity class  Represents a row  Provides getter and setter methods  <EntityEO>CollImpl.java:  Represents the cached set of rows from the entity  Is not usually necessary for the user to modify or override methods in this class  <EntityEO>DefImpl.java:  Is the entity definition class  Represents the whole entity  Can be used to modify the entity definition
  • 868. Programmatically Customizing EO: Default Behavior  Default metadata - <EntityObjectEO>.xml  Java classes (generate)  Programmatically customizing default behavior (within EO) Business rules Override methods  Programmatic operations (from outside EO) Placement of entity operations CRUD operations
  • 869. Programmatically Customizing Default Behavior Programmatically customizing default behavior (within EO) Business rules  Method Validation Override base class methods Examples:  initDefaults() to initialize PK with DBSequence  remove() and doDML() to delete a row  beforeCommit(), validateEntity(), etc.
  • 870. Programmatically Customizing Default Behavior: Business Rules Programmatically customizing default behavior (within EO) Business rules  Method Validation Override base class methods Examples:  initDefaults() to initialize PK with DBSequence  remove() and doDML() to delete a row  beforeCommit(), validateEntity(), etc.
  • 871. Business Rule: Method Validation 1 2 3
  • 872. Programmatically Customizing Default Behavior: Override Methods Programmatically customizing default behavior (within EO) Business rules  Method Validation Override base class methods Examples:  initDefaults() to initialize PK with DBSequence  remove() and doDML() to delete a row  beforeCommit(), validateEntity(), etc. …
  • 873. Override Method: Some Useful Methods Operation Explanation setAttribute(): For example, if the attribute is Empno, the setter will be setEmpno(). This method is used to set the attribute information for an entity object. getAttribute(): For example, if the attribute is Empno, the setter will be getEmpno(). This method is used to get the attribute value of an entity object. create() This is used to create a new entity object. initDefaults() The defaulting logic for an entity object can be added to this method. validateEntity() This method is used to validate an entity. beforeCommit() Logic that has to be applied before committing the record is added in this method. afterCommit() Logic that has to be applied after committing the record is added in this method. remove() This method is used to remove an entity object. doDML() This method is used to perform operations based on the DML operations INSERT, UPDATE, and DELETE.
  • 874. Override Method: Assigning Primary Key using a Database Sequence In EmployeeEOImpl.java override the initDefaults() method Programmatically assigning values from database generated sequence to primary key
  • 875. Override Method: Updating Deleted Flag Instead of Deleting Rows Overriding the remove() and doDML() methods: // In <EntityObjectEO>Impl.java public void remove() { setDeleted("Y"); super.remove(); } protected void doDML(int operation, TransactionEvent e) { if (operation == DML_DELETE) { operation = DML_UPDATE; } super.doDML(operation, e); }
  • 876. Programmatically Customizing EO: Operations Default metadata - <EntityObjectEO>.xml Java classes (generate) Programmatically customizing default behavior (within EO) Business rules Override methods Programmatic operations (from outside EO) Placement of entity operations CRUD operations
  • 877. Programmatic Operations on EO  Programmatic operations (from outside EO) Placement of entity operations CRUD operations  Read (Find) entity object  By primary key  By traversing association from » Master entity to detail entity » Detail entity to master entity  Through view object  Update (modify) entity object  Delete (remove) entity object  Create (add) entity object
  • 878. Programmatic Operations on EO Programmatic operations (from outside EO) Placement of entity operations CRUD operations  Read (Find) entity object  By primary key  By traversing association  Through view object  Update (modify) entity object  Delete (remove) entity object  Create (add) entity object
  • 879. Programmatic Operations on EO: Placements Code to manipulate an entity object is typically placed outside it, in Another entity object class A service method of an application module class (though VO) Java clients accessing business components such as entity object, view object or service methods
  • 880. Programmatic Operations on EO: CRUD Ops  Programmatic operations (from outside EO) Placement of entity operations CRUD operations  Read (Find) entity object  By primary key  By traversing association from » Master entity to detail entity » Detail entity to master entity  Through view object  Update (modify) entity object  Delete (remove) entity object  Create (add) entity object
  • 881. Reading EO: Find by Primary Key
  • 882. Reading EO: Traverse Association: Iterate Master to Detail Hierarchy  The source entity’s EntityImpl contains associated row iterator  Example: get names of all employees in current department EmployeeEO getDepartment1() setDepartment1() getEmpLastName() DepartmentEO getEmployee1() getDeptName() 1 M * D EmpDeptFkAS
  • 883. Reading EO: Traverse Association: Iterate Detail to Master Hierarchy  The destination entity’s EntityImpl contains the source entity  Example: EmployeeEOImpl contains getDepartment1() and setDepartment1()  Get the department name of the associated department EmployeeEO -------------------------- getDepartment1() setDepartment1() getEmpLastName() DepartmentEO ------------------------ getEmployee1() getDeptName() 1 M * D EmpDeptFkAS
  • 884. Reading EO: Find EO through View Object
  • 885. Updating an Existing EO Row Find entity object by one of the above four find by approaches Set one or more attributes to new values, Using the EntityImpl class, setAttribute() method Example:
  • 886. Deleting an Existing EO Row Find entity object by one of the above four find by approaches Call remove() method Example:
  • 887. Creating a New EO Row Find entity object by one of the above four find by approaches Call createRow() method Example using destination/ child entity
  • 888. Creating a New EO Row
  • 889. Programmatically Customizing EO: Summary Read by Primary Key Read through Association Read through View Object Update Delete Create EO Yes Yes No Yes Yes Yes VO (services) No No Yes Yes Yes Yes Java Client - EO Yes Yes No Yes Yes Yes Java Client - VO No No Yes Yes Yes Yes Java Client – Services No No Yes Yes Yes Yes
  • 890. Types of Programmatic Customization: View Objects Use ADF Business Component APIs Programmatically customizing entity object (EO) Programmatically customizing view object (VO) Programmatically customizing application module (AM) Programmatically accessing business component objects from Java client
  • 891. Ingredients of a View Object
  • 892. Programmatically Customizing View Object (VO)  Default metadata - <ViewObjectVO>.xml  Java classes (generate)  Programmatically customizing default behavior (within VO) Business rules Override methods Examine VO methods  Programmatic operations (from outside VO) Placement of view object operations CRUD operations  Programmatic customization of default sorting and selection (from outside VO) Order by (sorting) Where clause Parameterize where clause Structure where clause (view criteria)
  • 893. Programmatically Customizing View Object (VO): Default Metadata  Default metadata - <ViewObjectVO>.xml  Java classes (generate)  Programmatically customizing default behavior (within VO)  Programmatic operations (from outside VO)  Programmatic customization of default sorting and selection (from outside VO)
  • 894. Programmatically Customizing View Object (VO): Java Classes Default metadata - <ViewObjectVO>.xml Java classes (generate) Programmatically customizing default behavior (within VO) Programmatic operations (from outside VO) Programmatic customization of default sorting and selection (from outside VO)
  • 895. Generating View Object Java Classes To generate a Java class: On the business component editor’s Java page, click Edit Select the classes to generate
  • 896. Generated View Object Java Classes  <ViewobjectVO>Impl.java:  Is the view class  Provides methods to manage the row set  <ViewobjectVO>RowImpl.java:  Is the view object row class  Is instantiated for each record returned by the query  Provides attribute accessors  <ViewobjectVO>DefImpl.java:  Is the view definition class  Represents the whole view  Can be used to modify the view definition
  • 897. Programmatically Customizing View Object (VO)  Default metadata - <ViewObjectVO>.xml  Java classes (generate)  Programmatically customizing default behavior (within VO) Business rules Override methods Examine VO methods  Programmatic operations (from outside VO)  Programmatic customization of default sorting and selection (from outside VO)
  • 898. Programmatically Customizing Default Behavior: Business Rule Programmatically customizing default behavior (within VO) Business rules  Only for transient attributes that are not read-only Override methods Examine VO methods
  • 899. Programmatically Customizing Default Behavior: Override Methods Programmatically customizing default behavior (within VO) Business rules Override methods Examples:  remove() to delete a row  beforeCommit(), validate(), etc. Examine VO methods …
  • 900. Programmatically Customizing Default Behavior Programmatically customizing default behavior (within VO) Business rules Override methods Examine VO methods
  • 901. Examining VO Methods: Lifecycle Callback
  • 902. Updatable VO based on Single EO: Sequence Diagram
  • 903. Examining View Object Methods Rowset is an interface representing a scrollable range of rows, of which one may be designated as the current row. Some of its methods include the following:  executeQuery(), to execute the view object's query and populate its row set of results  getEstimatedRowCount(), to count the number of rows a view object's query would return  createRowSetIterator(java.lang.String name): Creates an iterator for the row set  getApplicationModule(): Gets the row set’s Application Module  getMasterRowSetIterators(): Returns all controlling masters of this row set
  • 904. Examining View Object Methods cont.…  getName(): Gets the row set’s name  getViewObject(): Gets the view object that contains the row set  getWhereClauseParams(): Gets the bind-variable values to be used with the view object’s query condition  setWhereClauseParam(int index, java.lang.Object value): Specifies a single bind-variable value to use with the view object’s query condition, and executes the query  setWhereClauseParams(java.lang.Object[] values): Specifies the bind- variable values to use with the view object’s query condition, and executes the query
  • 905. Examining View Object Methods cont.… The RowSet interface implements the RowIterator interface, which enables access to the row set. Some of its methods include the following:  createRow(): Creates a new Row object, but does not insert into the rowset  findByEntity(int eRowHandle, int maxNumOfRows): Finds and returns view rows that use the entity row, identified by the entity row handle, eRowHandle  findByKey(Key key, int maxNumOfRows): Finds and returns view rows that match the specified key  first(): Designates the first row of the row set as the current row  getRow(Key key): Accesses a row through a unique key  hasNext(): Tests for the existence of a row after the current row
  • 906. Examining View Object Methods cont.…  hasPrevious(): Tests for the existence of a row before the current row  insertRow(Row row): Adds a row to the row set, before the current row  last(): Designates the last row of the row set as the current row  next(): Steps forward, designating the next row as the current row  removeCurrentRow(): Removes the current Row object from the row set  previous(): Steps backward, designating the previous row as the current row  reset(): Clears the “current row” designation and places the iterator in the slot before the first row  setCurrentRow(Row row): Designates a given row as the current row
  • 907. Examining View Object Methods cont.… In addition to the RowSet and RowIterator interfaces, ViewObjectImpl implements the ViewObject interface, containing the following methods:  applyViewCriteria(ViewCriteria criteria): Applies the view criteria to this view object  createRowSet(java.lang.String name): Creates and names a row set for the view object  createViewCriteria(): Creates a “Query by Example” view criteria object  findViewLinkAccessor(ViewLink vl): Finds the view link accessor attribute  getOrderByClause(): Retrieves the current ORDER BY clause of the view object’s query statement  getQuery(): Retrieves the view object’s query statement
  • 908. Examining View Object Methods cont.…  getViewCriteria(): Gets this view object’s view criteria  getViewLinkNames(): Retrieves the names of the view object’s View Links  getWhereClause(): Retrieves the current WHERE clause of the view object’s query statement  isReadOnly(): Tests if the view object is read-only  setOrderByClause(java.lang.String expr): Sets the ORDER BY clause of the view object’s query statement  setWhereClause(java.lang.String cond): Sets the WHERE clause of the view object’s query statement The ViewObjectImpl class also implements some listener interfaces and contains many methods of its own, so there are several opportunities for programmatic manipulation. For a complete description of all methods that you can use for a view object, see Javadoc
  • 909. Programmatically Customizing View Object (VO) Default metadata - <ViewObjectVO>.xml Java classes (generate) Programmatically customizing default behavior (within VO) Programmatic operations (from outside VO) Placement of view object operations CRUD operations Programmatic customization of default sorting and selection (from outside VO)
  • 910. Programmatic Operations on VO  Programmatic operations (from outside VO) Placement of view operations CRUD operations  Read (Find) view object  By foreign key  By traversing links from » Master view to detail view » Detail view to master view » Retain and reuse a view link accessor row set  Update (modify) view object  Delete (remove) view object  Create (add) view object
  • 911. Programmatic Operations on VO  Programmatic operations (from outside VO) Placement of view operations CRUD operations  Read (Find) view object  By foreign key  By traversing links from » Master view to detail view » Detail view to master view » Retain and reuse a view link accessor row set  Update (modify) view object  Delete (remove) view object  Create (add) view object
  • 912. Programmatic Operations on VO: Placements Code to manipulate a view object is typically placed outside it, in Another view object, Service method of an application module, or Java clients accessing business components
  • 913. Programmatic Operations on VO: CRUD Ops  Programmatic operations (from outside VO) Placement of view operations CRUD operations  Read (Find) view object  By key (findByKey)  By traversing links from » Master view to detail view » Detail view to master view » Retain and reuse a view link accessor row set  Update (modify) view object  Delete (remove) view object  Create (add) view object
  • 914. Reading VO: Find by Key and Update
  • 915. Reading VO: Traverse Links Links may be traversed in either direction ViewRowImpl contains associated row iterator For example, DepartmentVORowImpl contains the method: public oracle.jbo.RowIterator getEmployee() Use the methods of RowIterator to move from row to row and to get individual attribute values
  • 916. Reading VO: Iterate Master-Detail Hierarchy
  • 917. Reading VO: Retain and Reuse a View Link Accessor Row Set Generate a Java class for the source view object Override the create() method Add setViewLinkAccessorRetained(true) Call reset() each time you reuse the RowSet object
  • 918. Creating a New VO Row
  • 919. Programmatically Customizing View Object (VO)  Default metadata - <ViewObjectVO>.xml  Java classes (generate)  Programmatically customizing default behavior (within VO)  Programmatic operations (from outside VO)  Programmatic customization of sorting and selection (from outside VO) Order by (sorting) Where clause Structured where clause (view criteria) Parameterize clauses (use of named bind variable)
  • 920. Programmatic Customization of Sorting and Selection  Programmatic customization of sorting and selection (from outside VO)  Getting handle of view object instance  Default order by (sorting)  Dynamic order by (sorting)  Default where clause  Dynamic where clause  Default structured where clause (view criteria)  Dynamic structured where clause (view criteria)  Default Parameterize clause (use of named bind variable)  Dynamic Parameterize clause (use of named bind variable)  Execute view object query  Using query results
  • 921. Programmatic Customization of Sorting and Selection cont.…  Getting handle of view object instance  get<ViewObject> - Inside service method of AM  findViewObject() - In Java client  Example:  ViewObject vo = getLocation1(); // Inside service method of AM  ViewObject vo = am.findViewObject(“Location1”) // In Java client  Default order by (sorting)  Programmatic execution of view object query (shown later), with order by clause executes the default order by  Dynamic order by (sorting)  setOrderBy() overrides or sets order by on VO query at runtime  Example: vo.setOrderBy(“CITY”);
  • 922. Programmatic Customization of Sorting and Selection cont.…  Default where clause  Programmatic execution of view object query (shown later), with where clause, executes the default where clause  Dynamic where clause  setWhereClause() is used to set where clause dynamically at runtime  Example: vo.setWhereClause(“POSTAL_CODE like ‘733%’");  Default structured where clause (view criteria)  First get the view criteria manager using getViewCriteriaManager()  Next get the view criteria from it’s manager using getViewCriteria()  Next apply it to the view object using applyViewCriteria()  Example:  ViewCriteriaManager vcmanager = vo.getViewCriteriaManager();  ViewCriteria vc = vcmanager.getViewCriteria("LocationVOCriteria");  vo.applyViewCriteria(vc);
  • 923. Programmatic Customization of Sorting and Selection cont.… Dynamic structured where clause (view criteria) First create view criteria using createViewCriteria() Next create view criteria row using createViewCriteriaRow() Next add criteria items to the row using setAttribute() Next add the row to the view criteria Next apply the view criteria to the view object using applyViewCriteria()
  • 924. Programmatic Customization of Sorting and Selection cont.… Example:  ViewCriteria vc = vo.createViewCriteria();  ViewCriteriaRow cityRow = vc.createViewCriteriaRow();  ViewCriteriaRow stateRow = vc.createViewCriteriaRow();  cityRow.setAttribute(“City", “= ‘DALLAS’");  cityRow.setAttribute(“City", “= ‘AUSTIN’");  stateRow.setAttribute(“StateProvince", “= ‘TEXAS’");  vc.addElement(cityRow);  vc.addElement(stateRow);  vo.applyViewCriteria(vc);
  • 925. TIP: Architecture of View Criteria
  • 926. Programmatic Customization of Sorting and Selection cont.…  Default Parameterize clause (use of named bind variable) setNamedWhereClauseParam() is used to assign values at run time to named bind variables of parameterized where clause and view criteria Example: vo.setNamedWhereClauseParam("p_manager_id", “103”)  Dynamic Parameterize clause (use of named bind variable) defineNamedWhereClauseParam() is used to add at run time to named bind variables of dynamic where clause and dynamic view criteria with bind variables Example:  vo.setWhereClause(“COUNTRY_ID = :p_countryId");  vo.defineNamedWhereClauseParam(“p_countryId", null, null);  vo.setNamedWhereClauseParam(“p_countryId", “US”);
  • 927. Programmatic Customization of Sorting and Selection cont.…  Execute view object query executeQuery() executes query with all clauses (if any, like order by, where clause, view criteria, bind variable, etc..) Example: vo.executeQuery();  Using query results After getting handle to view object, applying sorting, selecting (where and view criteria) and execution of view object’s query, row set of results are populated RowSet, RowSetIterator and Row uses hasNext(), next() to iterate through the query result sets Example: Refer Iterating Master-Detail Hierarchy section
  • 928. Execute a View Object: Sequence Diagram
  • 929. Change WHERE or ORDER BY Clause at Run Time ID FIRSTNAME 201 Michael 202 Pat 203 Susan LASTNAME Hartstein select FIRST_NAME, LAST_NAME from EMPLOYEES order by FIRST_NAME ViewObject vo = am.findViewObject(“Employee1"); vo.setWhereClause(“FIRST_NAME < 'Su'"); vo.setOrderBy(“LAST_NAME"); Mavris First Name Last Name Michael Pat Susan Hartstein Fay Mavris First Name Last Name Pat Michael Fay Hartstein EmployeeNamesVO Relational Data / App Schema Fay
  • 930. Types of Programmatic Customization: Application Module Use ADF Business Component APIs Programmatically customize entity object (EO) Programmatically customize view object (VO) Programmatically customize application module (AM) Programmatically accessing business component objects from Java client
  • 932. Programmatically Customizing AM  Default metadata <AppModuleAM>.xml bc4j.xcfg  Java classes (generate)  API  Service Methods Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester)  Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking  Configuration Properties
  • 933. Programmatically Customizing AM: Default Metadata  Default metadata <AppModuleAM>.xml bc4j.xcfg  Java classes (generate)  Service Methods Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester)  API  Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking  Configuration Properties
  • 934. Programmatically Customizing AM: Default Metadata Default metadata <AppModuleAM>.xml  Includes detailed metadata about the view objects included bc4j.xcfg
  • 935. Programmatically Customizing AM: Default Metadata Default metadata <AppModuleAM>.xml bc4j.xcfg:  Contains all the configuration and connection details
  • 936. Programmatically Customizing AM  Default metadata <AppModuleAM>.xml bc4j.xcfg  Java classes (generate)  Service Methods Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester)  API  Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking  Configuration Properties
  • 937. Generate Application Module Java Classes To generate a Java class: On the business component editor’s Java page, click Edit Select the classes to generate
  • 938. Generated Application Module Java Classes Supporting Java classes: <AppMod>Impl.java: Contains all the methods and behaviors that affect each application module instance <AppMod>Def.java: Contains methods to be used by all instances of the application module
  • 939. Programmatically Customizing AM: Service Methods  Default metadata  Java classes (generate)  Service Methods (Facade Pattern) Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester)  API  Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking  Configuration Properties
  • 940. Adding Service Methods to an Application Module Service methods: Are useful for:  Code that is not dependent on a specific view  Performing operations across view object instances  Managing transactions  Dynamically changing the data model Can be called from the client, requiring very little data manipulation in the client itself Are implemented in the application module’s class Are added by:  Adding code to the Java class  Publishing to the client interface
  • 941. Implementing the Service Method  Add the Java code for the method to the HRSystemAMImpl.java file public void applyLocationVOCriteria() { ViewObject vo = getLocation1(); ViewCriteriaManager vcmanager = vo.getViewCriteriaManager(); ViewCriteria vc = vcmanager.getViewCriteria("LocationVOCriteria"); vo.applyViewCriteria(vc); vo.executeQuery(); }
  • 942. Publishing the Service Method To publish the service method to clients: Open the Application Module Editor and click the Java page Click the Pencil icon to edit the Client Interface Shuttle the method you want to publish to the Selected list
  • 943. Test Services using ADF Model Tester Show the AM Select the method. Set Parameter values Click Execute Observe results
  • 944. Programmatically Customizing AM: API Default metadata Java classes (generate) Service Methods Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester) API Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking Configuration Properties
  • 945. Some Common API Operation Explanation createViewObject() This method is used to create a view object for an application module. findViewObject(String) This method will find the view object added to an application module. The String parameter will represent the view object's name. getTransaction() This method is used to get the current transaction object. beforeRollback() All operations that have to be done before rolling back the transaction are done in this method. beforeCommit() All operations that have to be done before committing the transaction go in here.
  • 946. Programmatically Customizing AM: Transactions Default metadata Java classes (generate) Service Methods Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester) API Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking Configuration Properties
  • 947. Accessing Transaction  Transaction and DBTransaction are interfaces that define database transactions  Use the methods in these interfaces to access an application module’s transaction  Example: // In service method  getDBTransaction().commit(); // Commit the transaction // In Java client  ApplicationModuleImpl am;  am.getTransaction().commit(); // Commit the transaction
  • 948. Committing Transactions Post phase 1. Validate pending changes 2. Post updates to the database Commit phase Commit the transaction
  • 951. Customizing the Post Phase  Override the entity object’s postChanges() method  Example: For a deleted entity, mark the database row instead of deleting the data public void postChanges(TransactionEvent e) { if (getPostState() == Entity.STATUS_DELETED) { // Custom code to mark database rows, such as // by updating a Deleted flag in the record } else { super.postChanges(e); } }
  • 952. Customizing the Commit Phase  Implement a TransactionListener  Implement beforeCommit() and afterCommit()  Add your listener to the transaction’s list of event subscribers  Alternatively, override the entity object’s beforeCommit() or afterCommit() methods  Example:  In EmployeeEOImpl, print notification that record is committed: @Override public void afterCommit(TransactionEvent transactionEvent) { System.out.println("Record committed for " + getFirstName() + " " + getLastName()); super.afterCommit(transactionEvent); }
  • 953. Programmatically Customizing AM: Transactions Default metadata Java classes (generate) Service Methods Add Implement  EO and AS  VO and VL Publish Test (using ADF Model Tester) API Transactions Access transaction Commit transaction  Post Phase  Commit Phase Locking Configuration Properties
  • 954. Programmatically Customizing AM: Configuration Properties Property Description Default Value jbo.ampool.initpoolsize The number of application module instances created when the pool is initialized. 0 jbo.ampool.minavailablesize The minimum number of available application module instances that the pool monitor should leave in the pool during the resource cleanup operation. 5 jbo.ampool.timetolive How long to wait before the application module in the pool becomes a candidate for removal. 3600000 ms jbo.load.components.lazily Determines whether to load components definitions lazily. false
  • 955. Programmatically Customizing AM: Configuration Properties Property Description Default Value jbo.dofailover Enable eager passivation of the pending transaction state each time an application module is released to the pool in managed release (stateful) mode. This needs to be turned ON for high availability. false jbo.max.cursors The maximum number of cursors the business components may have open. The framework will clean up free JDBC statements as the number of cursors approaches this number. 50 jbo.recyclethreshold Maximum number of application module instances that attempt to preserve session affinity for the next request. 10
  • 956. Types of Programmatic Customization: Java Client Use ADF Business Component APIs Programmatically customizing entity object (EO) Programmatically customizing view object (VO) Programmatically customizing application module (AM) Programmatically accessing business component objects from Java client
  • 957. Implementing Java Client Programmatically accessing business component objects from Java client: Access AM Access service methods Access and modify VO Access and modify EO Access transaction
  • 958. Creating a Test Client  If you want to test custom code, you can create a test client program. Create a Java class  The file opens in the editor to show the skeleton code  Place the cursor on a blank line inside the body of the main() method and enter the characters bc4jclient, and then press Ctrl + Enter to expand the code template
  • 959. Creating a Test Client cont.…  Need to modify names in generated skeleton code to reflect your AM package name such as module.HRSystemAM and HRSystemAM Local Change the VO instance name in the call to findViewObject() to be the one you want to work with such as Employee1
  • 960. Invoking Service Method from UI Panel Accordion showDetailItem showDetailItem Panel Tabbed showDetailItem showDetailItem BATHRSystemIndex.jsf LocationDeptartmentTF EmployeeQuickSearchTF EmployeeListTF EmployeeSearchTF LocationDeptartmentPF QuickSearchPF Region TF Call Page Fragment showDetailItem EmployeeFilterTF EmployeeFilterPF EmployeeListPF EmployeeSearchPF EmployeeDetailTF EmployeeCreateTF EmployeeUpdateTF Method Call applyViewCriteria… defineDynamicWhereClause… defineDynamicViewCriteria… router
  • 961. Invoking Service Method from UI contd…
  • 962. Display Message FacesContext fctx = FacesContext.getCurrentInstance(); FacesMessage fm = new FacesMessage("Message text"); fm.setSeverity(FacesMessage.SEVERITY_WARN); fctx.addMessage(null, fm);
  • 963. Lesson Summary Use business component client APIs Implement programmatic modifications Generate Java classes for business components Override class methods Add service methods to an application module Handle transactions Create a test client
  • 965. Lesson Agenda ADF supported application servers ADF deployment diagram Building and deploying ADF ADF build setup Deployment profile types Deployment to cloud service Create various deployment profiles Deploy and run an ADF Application
  • 966. ADF Supported Application Severs Application Servers ADF 12.2.1.0.0 ADF 12.1.3.0.0 ADF 11.1.2.0.0 ADF 11.1.1.7.0 Fusion Middleware (WLS) 12.2.1 12.1.3 11.1.2 11.1.1.7 GlassFish 4.1 (Essentials) 3.1 (Essentials) 3.1.2 (Essentials) Not Supported WebSphere Not Supported Not Supported 7.0.0.13 7.0.0.13 JBoss Not Supported Not Supported Not Supported Not Supported Tomcat Not Supported Not Supported Not Supported Not Supported Java Cloud Service - SaaS Extension Not Supported Not Supported 14.1 Java Cloud Service Not Supported Not Supported 14.1
  • 967. ADF Application [EAR = JAR + WAR] ADF Deployment Diagram Business Service [JAR] View Controller [WAR] …
  • 968. Building and Deploying ADF Application Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration
  • 969. The Act of "Building" Software The act of building software from source code includes Checking out code Compiling and linking code Dependency management and build orders Packaging code into deployable artefacts Deployment Running tests Creating automated documentation and release notes
  • 970. Building and Deploying ADF Application Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration
  • 971. JDeveloper Build Setup Setting up an ADF build process requires the following: Configuring JDeveloper deployment profiles Choosing and configuring tools to build the application Catering for dependency management & build order Configuring WLS deployment plans & post build modifications
  • 972. Building and Deploying ADF Application Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration
  • 973. JDeveloper Deployment Profiles  Define & include options for how applications and code are: Packaged as deployment artifact: JARs, WARs, EARs, ADF Library JARs etc Specific deployment platforms: WLS deployment descriptors And much more depending on the deployment profile type....  Used by JDeveloper or ojdeploy to build the artifact  Removes grunt work of assembling & generating artifacts yourself  Within JDeveloper define 1 or more at the application or project level
  • 974. JDeveloper Deployment Profiles Types  Application Deployment Profile Types  Project Deployment Profile Types  ADF Mobile for Android  ADF Mobile for iOS  EAR files  MAR files  ADF Library JAR file  ADF Mobile feature archive  Business Components archive file  Business Components EJB Session Bean  Business Components Service Interface  Client JAR files  EJB JAR files  Extension JAR file  JAR file OSGi  bundle RAR file  Shared Library JAR file Taglib JAR file  WAR files
  • 975. Project Properties – Deployment Profiles
  • 976. Application Properties – Deployment Profiles
  • 977. Deployment Profile Types Project Deployment Profile Types WAR Files ADF Library JAR Business Component Service Interface Application Deployment Profile Types EAR Files MAR Files
  • 978. Deployment Profile Types  Project Deployment Profile Types  WAR Files  ADF Library JAR  Business Component Service Interface  Application Deployment Profile Types  EAR Files  MAR Files Java EE Web ARchives  Contains web components. e.g. JSPs, JSFs, HTML, servlets and other resources  + deployment descriptors (e.g. web.xml)  Use when you want to create/ deploy a Java EE web application to a Java EE server
  • 979. Deployment Profile Types  Project Deployment Profile Types  WAR Files  ADF Library JAR  Business Component Service Interface  Application Deployment Profile Types  EAR Files  MAR Files  Oracle proprietary Java ADF archive  Contains reusable ADF components: ADF task flows, declarative components, task flow templates, model projects  + hidden generated deployment descriptors (e.g. task-flow- registry.xml)  Some limitations compared to JAR archive such as inability to filter content  Use when you want other ADF applications to reuse the ADF Library JARed components
  • 980. Deployment Profile Types  Project Deployment Profile Types  WAR Files  ADF Library JAR  Business Component Service Interface  Application Deployment Profile Types  EAR Files  MAR Files  For publishing ADF BC objects as SDOs  Generates both client proxy JAR for consumers to use and server JAR
  • 981. Deployment Profile Types  Project Deployment Profile Types  WAR Files  ADF Library JAR  Business Component Service Interface  Application Deployment Profile Types  EAR Files  MAR Files Java EE Enterprise ARchives  For deploying one or more applications or modules to Java EE server  Contains 1 or more WAR, EJB JAR and client JAR files  + deployment descriptions (e.g. weblogic-application.xml)  Includes options for deploying security artifacts to WebLogic Server
  • 982. Deployment Profile Types  Project Deployment Profile Types  WAR Files  ADF Library JAR  Business Component Service Interface  Application Deployment Profile Types  EAR Files  MAR Files Metadata ARchive file  For deploying seeded customizations or base metadata for MDS repository in application server
  • 983. Deployment Profile Types Consider defining naming standards for the deployment profiles, the default profile names can be messy. Don’t leave outdated or unused deployment profiles against the applicaIons an d p rojects, it's hard for the next programmer to know which one to use.
  • 984. Building and Deploying ADF Application Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration
  • 985. Build Tools & Options  Manually/by hand – Not recommended!  Within JDeveloper – Only suitable for development  Via ojdeploy Via command line Via Ant script  Inline or outside JDeveloper including command line or CI engine Via ojserver Via Maven (JDev 12c)  Via Oracle Developer Cloud Services (and Hudson and ojdeploy)
  • 986. Build Tools & Options – ojdeploy Compilation and intelligent ADF post compilation processor Badly named – “builds” not “deploys” "Headless" JDeveloper version Called via command line or Apache Ant Calls the inline build function in JDeveloper Builds one artifact at a time Requires file system access to source code Requires a full-blown JDeveloper install to operate
  • 987. Build Tools & Options – ojdeploy Features Validates ADF metadata XML files Generates ADF specific metadata files (e.g. task-flow-registry.xml) Edits detail of connection manager (connections.xml) Compiles and generates files for ADF BC & ADF Security Creates Oracle deployment artifacts (e.g. ADF Libraries and MAR files) Every check & automation the JDeveloper inline build tool does, ojdeploy does too
  • 988. Build Tools & Options – ojdeploy  Pros Understands JDeveloper application artifacts Beyond compilation ensures health of your ADF project Automagical  Cons Requires full check of source code, no version control intelligence Requires a full JDeveloper install on your build server Start/stop cycle is slow Blackbox implementation No inbuilt dependency management intelligence
  • 989. Oracle Developer Cloud Services Developer Develop A turnkey development platform securely hosted in the cloud Collaborate Integrated tools to manage and track tasks, builds, and documentation Deploy Automatic deployment to Oracle Java Cloud Service or your local infrastructure Standards-based Git, Hudson, Maven
  • 991. Oracle Developer Cloud Services  Currently supports (Jan 2017) JDev/ADF 12.2.1.2.0  Must use Git for source control  Modify build.xml/build.properties to work with Cloud environment Still uses ojdeploy  Push local/developer Git repository changes to cloud repository Or other 3rd party Git repository e.g. GitHub  Built via Hudson Job Extracts code from Git repository Calls build.xml Creates deployment artifact
  • 992. Building and Deploying ADF Application Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration
  • 993. Build Tools & Options - Dependency Management To build in the correct order dependencies must be configured JDeveloper projects record the libraries they're dependent on But is locked up in the associated/undocumented .jpr file JDeveloper provides no useful dependency management assistance Supplement JDeveloper with a dependency management tool Manual Apache Ant scripts Apache Ivy Apache Maven
  • 994. Build Tools & Options - Dependency Management  Hardcoded Ant scripts for small projects are okay Simply wont scale to large projects – scripts become impossible to maintain  Dependency management tools provide assistance with Define and track the modules, versions and dependencies Library repositories Allows developers share versioned modules Through publish/retrieve mechanism Define dependencies and transient (indirect) dependencies Conflict resolution on dependencies
  • 995. Post Build Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration
  • 996. Building and Deploying  Upon deployment of the artefacts may be necessary to modify it  Such as modifying configuration files for different dev/test/prod environments  e.g. these web.xml settings should be set/unset per environment <context-param> <param-name>oracle.adf.view.rich.ASSERT_ENABLED</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT</param-name> <param-value>true</param-value> </context-param>  2 options  WLS deployment plans  Ant scripts
  • 997. Building and Deploying ADF Application Building Source Code ADF Build Setup Pre Build: Deployment Profiles Build Tools & Options Dependency Management Post Build: WLS Deployment Plans & Build Modifications Continuous Integration (CI)
  • 998. The Discipline of Continuous Integration CI dictates software builds are not just limited to building your application for deployment and use Includes: Regular run sanity checks testing integrity of your code after check-ins Run periodic tests Provide early feedback to developers Don't confuse a CI engine with the actual build tool itself. A CI engine is typically a scheduling tool that kicks off the build tool
  • 999. Hudson  There are plenty of CI engines available  Oracle recommends Hudson  Hudson was inherited by Oracle from Sun  Was donated to the Eclipse Foundation in 2012  Jenkins was an open source fork of Hudson  Oracle recommends Hudson over Jenkins Ongoing support from Oracle Removed IP concerns over internal code Used internally by Oracle and Oracle's Developer Cloud Services extensively Widening supports for ADF applications
  • 1000. The CI Maturity Model No Build Server Nightly Builds Nightly Builds and Basic Automated Tests Metrics Sophisticated Testing Methodologies Automated Acceptance Tests and More Automated Deployment Continuous Deployment
  • 1001. Conclusion  Building your applications isn't a 1 click affair  Consider your Deployment profiles and options Build tools Post build modifications  Introduce a process and document it  Plan to introduce tools to assist you with dependency management  Make continuous integration a central mantra of your development efforts
  • 1002. Lesson Summary ADF Supported Application Servers ADF Deployment Diagram Building And Deploying ADF ADF Build Setup Deployment Profile types Deployment to Cloud Service
  • 1004. Lesson Agenda Authentication and Authorization ADF Security Architecture Configuring the Application to use ADF Security Defining Users in the Identity Store Defining Application Roles Implementing Security on Task Flows and Pages Testing ADF Security
  • 1005. Authentication and Authorization Authentication: Is this user allowed to access this application? Authorization: Is this user’s role allowed to access this resource? Resource 2 Resource 1 Resource 3 Resource 4 Resource 5 Resource 6 Application
  • 1008. Oracle Platform Security Service (OPSS)
  • 1010. Lesson Summary Authentication and Authorization ADF Security Architecture Configuring the Application to use ADF Security Defining Users in the Identity Store Defining Application Roles Implementing Security on Task Flows and Pages Testing ADF Security
  • 1011. 25 Debugging and Troubleshooting ADF Applications
  • 1012. Lesson Agenda Troubleshooting Business Services and User Interfaces JUnit, ADF Model Tester and Java test client Design-time code validation Tools for logging and diagnostics JDeveloper Debugger JDeveloper Profiler and FileMon Sources of help
  • 1013. Troubleshooting Business Service (BS) Test a business service in isolation from views or controllers: ADF Model Tester Java test clients Using Tools and Utilities: Use JUnit to build unit tests  Is an open source regression-testing framework  Run repeatable tests to verify Java code  Assertions for testing expected results  http://www.junit.org
  • 1014. Test Java Code with JUnit JUnit is an open source regression-testing framework. It is useful for creating tests to verify Java code. JDeveloper’s JUnit extension provides wizards for creating test components. More information and examples: SRDemo sample application Toystore sample application JDeveloper online documentation http://www.junit.org
  • 1015. Unit Test with JUnit JUnit makes it easy for developers to write and run repeatable tests. Its features include: Assertions for testing expected results Test fixtures for sharing common test data Test suites for organizing and running tests Graphical and textual test runners
  • 1016. Troubleshooting BS and View Controller (VC)  Using design-time code validation Java, XML, JSPX  Using logging and diagnostics Display debug message, Java logging, ADF logging, ADF ODL  Debugging through source (using JDeveloper Debugger) - lab Breakpoints, watches, evaluate EL, quick Javadoc, access ADF source library  Tools and Utilities JDeveloper Profiler, Audit Profiles, FileMon  Obtaining Help Online Help, Javadoc, Support, Forums, Blogs, Internet Search
  • 1017. Troubleshooting BS and View Controller (VC)  Using design-time code validation Java, XML, JSPX  Using logging and diagnostics Display debug message, Java logging, ADF logging, ADF ODL  Debugging through source (using JDeveloper Debugger) Breakpoints, watches, evaluate EL, Javadoc, access source library  Tools and Utilities JDeveloper Profiler, Audit Profiles, FileMon  Obtaining Help Online Help, Javadoc, Support, Forums, Blogs, Internet Search
  • 1018. Using Design-Time Code Validation JDeveloper’s editors provide error cues and correction suggestions for files such as: Java XML  xsd JSPX  Syntax is checked and errors and warnings are flagged  Errors are visible in Design, Source and Bindings editors
  • 1019. Troubleshooting BS and View Controller (VC)  Using design-time code validation Java, XML, JSPX  Using logging and diagnostics Display debug message, Java logging, ADF logging, ADF ODL  Debugging through source (using JDeveloper Debugger) Breakpoints, watches, evaluate EL, Javadoc, access source library  Tools and Utilities JDeveloper Profiler, Audit Profiles, FileMon  Obtaining Help Online Help, Javadoc, Support, Forums, Blogs, Internet Search
  • 1020. Using Logging and Diagnostics  Displaying debug messages to the console http://localhost:7101/console weblogic/weblogic1 -Djbo.debugoutput=console/silent/file/adflogger (project properties > Run) -Djbo.debugoutput=adflogger -Djbo.adflogger.level=FINE  Java logging Use java.util.logging.Logger api (instead of System.out.println) Edit <Java_Home>/jre/lib/logging.properties:  Set java.util.logging.ConsoleHandler.level=FINE  ADF logging and Oracle Diagnostic Logging (ODL)
  • 1021. Using Logging and Diagnostics cont.… ADF logging and Oracle Diagnostic Logging (ODL) Use ADFLogger api (instead of System.out.println in Java source code) Use ODL Log Analyzer to view log entries of a log file ODL provide control over messages’  Logging level and  Module filter Edit logging.xml to control level or filter over messages; or Configure ODL Configuration to control level or filter over messages  Access ODL Configuration from Application Server Navigator or Log window
  • 1022. Java and ADF Logging Levels  Failure Reporting: SEVERE – Fatal or Unexpected errors or very important messages WARNING – Warning messages  Progress Reporting: INFO – Key flow steps or Informational run-time messages CONFIG – Configuration properties & environment setting messages FINE – Detail messages FINER – Greater detail messages FINEST – Greatest detail messages ALL – All level messages NONE – No message Configure logging to produce different levels of logging output:
  • 1023. Configure ADF Logging The Oracle Diagnostic Logging (ODL) configuration file (logging.xml) controls the loggers under the Oracle tree. You use the overview editor for Oracle Diagnostic Logging Configuration to configure the logging levels specified in the logging.xml file. You access the overview editor for Oracle Diagnostic Logging Configuration from the Application Server Navigator or from the Log window.
  • 1024. ODL Configuration Overview Editor You can: Choose to view ODL log levels or Java log levels for the logger types Add persistent or transient loggers Specify a handler for a logger
  • 1025. Create Log Configurations in JDeveloper ADF Model debugging configuration: Edit the project’s run configuration. Set Java options: -Djbo.debugoutput=adflogger - Djbo.adflogger.level=FINE
  • 1026. View ODL Logs You use the Oracle Diagnostic Log Analyzer to view the log entries of a log file. The log analyzer enables you to filter the entries by log level, entry type, log time, and entry content
  • 1027. Troubleshooting BS and View Controller (VC)  Using design-time code validation  Java, XML, JSPX  Using logging and diagnostics  Display debug message, Java logging, ADF logging, ADF ODL  Debugging through source (using JDeveloper Debugger)  Breakpoints, watches, evaluate EL, Quick Javadoc, access ADF source library  Tools and Utilities  JDeveloper Profiler, Audit Profiles, FileMon  Obtaining Help  Online Help, Javadoc, Support, Forums, Blogs, Internet Search
  • 1028. Using the JDeveoper Debugger Set Breakpoints,  Source, Exception, Method, Class, TF Activity, Executable, Binding Set watches, Evaluate EL using EL Evaluator, ADF Structure Window  Shows all items in current viewport ADF Data Window  Item selected in structure window  ADF Context  Scoped variable Stepping through the code, ADF source library, (source zip) JDeveloper Quick Javadoc The Debugger helps in pinpointing issues Debug problems using:
  • 1029. Types of Breakpoints Type Breaks when… Source A particular source line in a particular class in a particular package is run Exception An exception of the class (or a subclass) is thrown Method A method in a given class is invoked Class Any method is a class is invoked Watchpoint A given field is accessed or modified Task flow activities A particular task flow activity in task flow diagram Executables A particular executable in pageDef Bindings A particular binding in pageDef
  • 1030. Using Breakpoints Create groups of breakpoints Use conditional breakpoints. Examples: value instanceof oracle.jbo.domain.Date jobId.equalsIgnoreCase(“CLARK") i > 50 Use actions other than stop with breakpoints
  • 1031. Object Preferences Filter out the fields that are displayed in the debugger. Change the default value displayed in the debugger. Show expressions as details instead of fields. Customize types throughout the type hierarchy.
  • 1032. Use the EL Evaluator The Expression Language evaluator enables: Introspection of the values between the view and model Watches based on EL
  • 1033. Use Oracle ADF Source Code for Debugging Adding ADF source code enables you to: Access Java docs in the code editor Set breakpoints on Oracle code as well as your own Access symbolic names via Debug libraries
  • 1034. Set Up Oracle ADF Source Code for Debugging To use source code for debugging, you can: Add the source zip into the user library Add the library to a project
  • 1035. Set Breakpoints in Source Code To set a breakpoint in Oracle code, perform the following steps: Press Ctrl + – (the minus sign). Enter an Oracle ADF class name or its uppercase letters. Set breakpoints in the source file that JDeveloper opens.
  • 1036. Use Common Oracle ADF Breakpoints  ADF breakpoints are useful for debugging declarative functionality.  In the oracle.jbo package, you can set breakpoints on: JboException DMLException uicli.binding.JUCtrlActionBinding.doIt() server.ViewObjectImpl.executeQueryForCollection() server.ViewRowImpl.setAttributeInternal() server.EntityImpl.setAttributeInternal()
  • 1037. Debug <debug-output> element in adf-faces-config.xml <debug-output>true</debug-output> Context parameter in web.xml <context-param> <param-name> oracle.adfinternal.view.faces.DISABLE_CONTENT_COMPRESSION </param-name> <param-value>true</param-value> </context-param>
  • 1038. Debug Interactions with the Model Layer Controlled by two classes: oracle.adf.controller.faces.lifecycle.FacesPageLifecycle oracle.adf.controller.v2.lifecycle.PageLifecycleImpl Set breakpoints if encountering problems such as: Components not displaying correctly with complete data Validation errors not rendering properly
  • 1039. Correct Failures to Display Data To debug all executables: oracle.adf.model.binding.DCBindingContainer internalRefreshControl(int, boolean) To debug the method iterator: oracle.jbo.uicli.binding.JUMethodIteratorDef initSourceRSI() To debug an attribute binding: oracle.jbo.uicli.binding.JUCtrlValueBinding getInputValue()
  • 1040. Correct Failures to Invoke Actions and Methods Actions are ignored if an executable or its target binding is not executed. You can debug the action or method invocation by breaking on DCDataControl.invokeOperation(), which is the entry point for action and method execution. You can debug the invocation of coded methods by breaking on DCGenericDataControl.invokeOperation().
  • 1041. Debug Life Cycle Events: Task Flows Before a task flow’s input parameters are resolved: oracle.adfinternal.controller.activity. TaskFlowCallActivityLogic.getInputValues() Before a task flow is called: oracle.adfinternal.controller.activity. TaskFlowCallActivityLogic.execute() Before and after a task flow returns: oracle.adfinternal.controller.activity. TaskFlowReturnActivityLogic.execute()
  • 1042. Debug Life Cycle Events: Parameters and Methods  For debugging the ADF controller’s interpretation of the navigation routing: oracle.adfinternal.controller.engine. ControlFlowEngine.doRouting()  For debugging before the view activity’s input parameters are evaluated: oracle.adfinternal.controller. application.PageParameterPagePhaseListener .beforePhase()  For calling an ADF controller method action: oracle.adfinternal.controller.activity. MethodCallActivityLogic.execute()
  • 1043. Debug Life Cycle Events: Switching Between the Main Page and Regions To keep track of the context switching between the main page and regions, set a breakpoint in: oracle.adfinternal.controller.state. RequestState.setCurrentViewPortContext()
  • 1044. ADF Structure Window and ADF Data Window During debugging: ADF Structure window shows items in the current viewport ADF Data window shows data within:  The item selected in the ADF Structure window  The ADF context  Scoped variables
  • 1045. Troubleshooting BS and View Controller (VC)  Using design-time code validation Java, XML, JSPX  Using logging and diagnostics Display debug message, Java logging, ADF logging, ADF ODL  Debugging through source (using JDeveloper Debugger) Breakpoints, watches, evaluate EL, Javadoc, access source library  Tools and Utilities FileMon, Audit Profiles, JDeveloper Profiler  Obtaining Help Online Help, Javadoc, Support, Forums, Blogs, Internet Search
  • 1046. Using FileMon Is useful for troubleshooting CLASSPATH problems Shows path that an running application is looking in for classes and files Free Windows utility that can be downloaded from http://www.sysinternals.com
  • 1047. Using Audit Profiles An audit profile defines the rules, code assists, and metrics that will be used to analyze source code. Some audit profiles are predefined, but you can create your own. You modify an audit profile by enabling or disabling rules, code assists, and metrics, or by changing its configuration. Tools > Preferences > Audit
  • 1048. Using JDeveloper’s Profiler With the Profiler, you can: Monitor programs as they run Find bottlenecks and memory leaks Two types of profiling: CPU: Method processing times Memory: Allocation and freeing of data objects
  • 1049. Troubleshooting BS and View Controller (VC)  Using design-time code validation Java, XML, JSPX  Using logging and diagnostics Display debug message, Java logging, ADF logging, ADF ODL  Debugging through source (using JDeveloper Debugger) Breakpoints, watches, evaluate EL, Javadoc, access source library  Tools and Utilities JDeveloper Profiler, Audit Profiles, FileMon  Obtaining Help Online Help, Javadoc, Support, Forums, Blogs, Internet Search
  • 1050. Obtain Help Sources of help include: Online Help Javadoc Support (My Oracle Support) Forums Blogs Internet Search
  • 1051. Request Help  Post your request to the appropriate forum: Use a meaningful subject line. Describe exact steps to reproduce the problem. Include the exact error information (error number, exception) if you receive an error message. Include a stack trace if appropriate. Include a test case if possible. List technologies and product version numbers. Provide concrete examples rather than abstract descriptions. List the troubleshooting steps that you have tried and describe how they affected the problem.
  • 1052. Lesson Summary In this lesson, you should have learned how to use: Troubleshooting Business Components and View Controller Design-time code validation Tools for logging and diagnostics JDeveloper Debugger JUnit, JDeveloper Profiler and FileMon Sources of help
  • 1054. Lesson Agenda Entity Objects View Objects Association and View Link Application Modules Model / Binding Pages / View Layout Task Flows and Memory Scopes Designing for reuse Conform to PPR Guidelines Managed Beans Other general Java best practices
  • 1055. Entity Objects Define at least one EO key attribute per EO Define EO attribute labels for UI displayed attributes Ensure EO UI Hints and messages are internationalized Create error messages for EO mandatory and precision validators Do not access an AM from an EO Avoid using the EO validateEntity() method for validation Avoid EO attribute validation in accessors
  • 1056. View Objects  Create VO tailored to a specific usage  Use VO bind variables over dynamic SQL  Use view criteria over editing VO where clauses  Tune VO fetch size and access mode. (N+1)  Ensure to use VO accessor tuning  Reuse VO for Validation and LOV  Avoid use of VO expert mode  Avoid hardcoding VO queries with literals  Avoid calling getRowCount  Avoid defining circular list of value dependencies  Never use SELECT * for a VO query
  • 1057. Association and View Link Specify fetch size for association when needed Use Retain Association/View Link Accessor Avoid repeated calls to association or view link accessors Close unused RowSet
  • 1058. Application Modules Use optimistic locking Use view object typesafe getters Use application module JDBC data source only not JDBC URLs Use the Lazy Loading option Close callableStatement and preparedStatements Don’t import view or controller classes Don't hardcode human readable text
  • 1059. Model / Binding Do not use Refresh = “always” for the executable iterator binding. Do not leave any unused executables or binding entry in a page definition file. The RangeSize property must be set appropriately so that only the required rows are fetched to the middle tier.
  • 1060. Pages / View  Use JSPX XML compliant files rather than JSP  Use rendered=false over visible=false if possible  Consider command partialSubmit=true  Avoid inline HTML use  Avoid long component ID lengths (use short id)  Never rely on UI side validation only Validate both in UI and Server Layers  Don't hardcode human readable text  Do not prefix EL references to managed beans in request, session or application scope (Eg. #{requestScope.bindings.myBean})
  • 1061. Layouts InlineStyle, contentStyle, and labelStyle are powerful but evil use them as a last resort but preferably not at all! Avoid stretching vertically inside a non-stretched container Never specify a height value with percent units Never use the "position" style These results in inconsistent behaviour across browsers Minimize the use of components with stretchable behavior Go for the deferred child component creation if possible
  • 1062. When to use panelGroupLayout layout="scroll“ This tends to be abused Only use layout="scroll" if the panelGroupLayout component is stretched by its parent Consider alternatives: af:panelGroupLayout layout="vertical" af:group No component at all
  • 1063. Task Flows and Memory Scopes  Define a common task flow template  Use required parameters  Use bound methods on task flows rather than invokeAction executables in the pageDef  Use such variable or component that is calculated or persisted  Define task flow exception handlers  Avoid Session and Application scopes  Do not cache shorter living objects, due to high availability issue  Go for lazy loading of initialization of task flows whenever possible
  • 1064. Designing for Reuse Guidelines: Use naming conventions to:  Avoid naming conflicts  Facilitate identifying the component functionality Standardize storage by agreeing on:  Type of repository needed  Storage and organization  Access methods Make components available for reuse by using: Resource catalog ADF library Avoid unwanted regions in the page. It is recommended to have a maximum of 10 regions in a page Avoid task flow in a pop-up
  • 1065. Conform to PPR Guidelines Use PPR as much as possible Purposes of PPR: Improve application performance Improve the user experience PPR should not be used: When navigating to another page When response times may be long When multiple sections of the page need to be redrawn PPR may cause accessibility issues
  • 1066. Managed Beans  Limit custom code in bean accessors  Implement serialization for application, session, pageFlow and view scope beans  Only interact with BC custom methods through exposed client interface  Define application and session scope beans in adfc-config.xml  Define bounded task flow bean in their own .xml file  Utilize common utility class for common functions  Only create backing beans when actually needed  Avoid business logic in bean methods (delegate them to BC)  Avoid application and session scope variables, instead use pageFlow scope  Do not bind unnecessary component references into backing beans
  • 1067. Other General Java Best Practices  Ensure catch blocks do not swallow errors  Always reformat code  Only interact with the business model through the binding layer  Use the ADFLogger  Don't use System.exit(), System.out.* or System.err.*  Don't use internal ADF packages  Do not make ViewController do BC work. Do not call AM, VO or importing packages oracle.jbo, etc.  Don't hardcode human readable text
  • 1068. Tuning ADF Application To tune ADF application, refer to the chapter on Oracle Application Development Framework Performance Tuning in “Oracle Fusion Middleware Performance and Tuning Guide”
  • 1069. Lesson Summary Entity Objects Vie Objects Association and View Link Application Modules Model / Binding Pages / View Layout Task Flows and Memory Scopes Designing for reuse Conform to PPR Guidelines Managed Beans Other general Java best practices
  • 1071. Lesson Agenda ADF 12c New Features Projects in ADF
  • 1072. ADF 12c New Features JDeveloper IDE -3 ADF Business Components -2 ADF Model -1 ADF Controller -1 ADF View -1 ADF Faces -1 DVT -14
  • 1073. JDeveloper IDE  Oracle Public Cloud: upload database objects to your Database Cloud Service.  Background processing: Supports scheduling jobs for background processing and a UI to manage these jobs. For example creating/scanning indexes.  File Templates: Define custom file templates and invoke them from the gallery.  Show Empty Folders: New option to display empty folders in the Application navigator.  Common Issues Window: Any problems found with your application are now reported into a single, consolidated Issues window so you can see all your mistakes at glance!  Build on Save: A new preference allows to compile modified files automatically on saving.  Download and Apply patches from Update Center: Distribute critical patches through Check for Updates tool.  Windowing System:  Ability to drag-and-drop to reorder editor tabs  Ability to float editor windows outside of the IDE  Fully customizable toolbar  Drag-and-drop reshaping / resizing of docking areas  Ability to use editors in maximized state
  • 1077. Business Components  Support for offline databases: The user can create new offline database objects based on existing objects in a database. The user can also compare the two. New wizards make working easier.  Support for RowFinder feature: The Row Finder feature provides users a declarative means of using a View Criteria on a View Object. A use case is to use a Row Finder object to find a row (or a set of rows) in a single subordinate detail table based on a row in a master table.  Support for multiple required View Criteria: Multiple View Criteria can be created on a single View Object. In addition, one or more of them can be marked as required so that one can now have multiple mandatory View Criteria being used per View Object.  Groovy Debugging: One can set breakpoints and use the debugger to debug Groovy expressions.
  • 1078. Business Components contd…  REST Web Service Improvements:  Include children in describe: Clients can request information about the collection and nested resources using the new "includeChildren" query parameter. When a resource item is requested and includeChildren=true is provided, all children will be recursively included in the describe.  Expand multiple levels of children: The expand query parameter is enhanced to support multiple levels, for example: "app/rest/Accounts/12345?expand=Contacts,Contacts.Addresses" returns all contacts for the account and all addresses for the contacts.  Versioning of REST payload formats is now supported, enabling clients to continue working with older formats when backward incompatible changes are introduced.  Improved query capabilities: For richer querying support, the query parameter accepts a new SQL-like VC filter expression format that identifies the specific rows to retrieve from the resource. Example: (AssignedTo_Id is null) or ( (Priority <= 2) and (RecordName like 'TT-99%'))
  • 1079. ADF Model  Bean Data Control Improvements: Create Bean Data Control Wizard with new options for scrolling and range paging as well as defining a wrapper class for data control implementation code Declarative Lists of Values (LOV) Automatically call mergeEntity Support CreateInsert and CreateWithParameters operations  Web Service Data Control Enhancements: Support for all REST operations Create a Web Service Data control from RESTful service URL
  • 1080. ADF Controller  Pretty URLs: In this release, the ADF Controller state information is no longer included in the URL whenever possible.  Unauthorized Region Taskflow: Allows developer to specify a "fall- back" bounded task flow to be shown in case the user is not authorized to access the current one.  Recursive bounded task flows Support for calling bounded task flows recursively. In previous versions, the view layer did not detect that the view activity had occurred and did not re-render the region.
  • 1081. ADF View (ADF Faces, DVT) JSF 2.0 Support: Facelets Ajax Get Composite components Annotated managed beans New scopes Conditional navigation Add EL directly in page content EL methods with arguments System events
  • 1082. ADF View (ADF Faces)  Skyros and Alta Skin  Code Editor  Enable Runtime Skin Updates  Calendar support for 15min appointments and ability to zoom in  OutputFormatted supports header tags h1 to h6  Reorder Fields in Query  ADF No Longer Requires Special Accessibility Modes  af:inputDate now opens immediately on the client  Export to Excel / CSV Enhancements
  • 1083. ADF View (DVT)  Client Side Charting Solution Client Side Resizing Improved Server Scalability Rich Set of Features:  Over 30+ chart types  Redesigned zoom and scroll  Marquee zoom and selection  Redesigned Time axis  Hide and show series and ability to change layout with client side rescale  Improved data labeling
  • 1084. DVT - Panel Drawer
  • 1085. Treemap
  • 1091. Sunburst
  • 1092. Timeline
  • 1099. Projects Lab Solutions: Lab03 to Lab24 (excluding Lab15 & Lab16) Advance ADF Lab Solution: Lab28 Book ‘Developing Web Applications with Oracle ADF Essentials’ by Sten E. Vesterli. Chapter 5: Building Enterprise Application  Section ‘Example Application’ Oracle Fusion Order Demo (FOD) Samples Oracle Submit Samples
  • 1100. Lesson Summary ADF 12c New Features Projects in ADF
  • 1102. Lesson Agenda Following will be covered in Labs:  Custom View Criteria  Contextual Events  Traversing and deleting master- detail  Creating an Application Module base class  Programmatically calling EL, scopes and conditional display  Adding Router Activity  Programmatically handling confirm Dialog Yes and No  Programmatically invoking Popup  Programmatically closing Popup  Rendering Dynamic Region  Add Context Menu  Creating Data Control Method from Backing Bean  Programmatically adding PPR  Programmatically handling UI CRUD transactions
  • 1103. UI and Page Flow Design Panel Accordion showDetailItem showDetailItem Panel Tabbed showDetailItem showDetailItem HRSystemIndex.jsf HRLocationDeptartmentTF HREmployeeQuickSearchTF HREmployeeSearchTF HREmployeeCreateTF HREmployeeSearchPF HREmployeeUpdateTF HRLocationDeptartmentPF HREmployeeQuickSearchPF HREmployeeCreatePF HREmployeeListTF HREmployeeDetailTF HREmployeeListPF HREmployeeDetailPF HREmployeeDetailPF Dynamic Region HREmployeeSalaryGraphTF HRDeptManagerDetailTF Region TF Call HREmployeeUpdatePersonPF HREmployeeUpdateJobPF HREmployeeUpdateConfirmPF Page Fragment applyLocationVOCriteria
  • 1105. Contextual Event Panel Accordion Panel Tabbed HRSystemIndex.jsf HRLocationDeptartmentTF HREmployeeListTF PageDef PageDef HREmployeeListPF HRLocationDeptartmentPF Create data control Create data control Bindings 1 8 7 6 4 3 2 11 9 14 13 12 4 3 2 1 5 6 5 7 10
  • 1106. Characteristics of the Contextual Event Framework Contextual events: Provide a way to coordinate regions Can be invoked and consumed only by method action of a data control Producer and consumer may be the same or different data controls.
  • 1108. Using the Contextual Event Framework to Coordinate Page Regions
  • 1109. Using the Contextual Event Framework to Coordinate Page Regions: Step 1
  • 1110. Using the Contextual Event Framework to Coordinate Page Regions: Step 2
  • 1111. Using the Contextual Event Framework to Coordinate Page Regions: Step 3
  • 1112. Using the Contextual Event Framework to Coordinate Page Regions: Step 4
  • 1113. Using the Contextual Event Framework to Coordinate Page Regions: Step 5
  • 1114. Using the Contextual Events Tab to Define an Event
  • 1115. Using the Contextual Event Framework to Coordinate Page Regions: Step 6
  • 1116. Using the Contextual Event Framework to Coordinate Page Regions: Step 7
  • 1117. Using the Contextual Event Framework to Coordinate Page Regions: Step 8
  • 1118. Using the Contextual Events Tab to Map the Event
  • 1119. Using the Contextual Event Framework to Coordinate Page Regions: Step 9
  • 1120. The Active Data Service Framework
  • 1121. Lesson Summary  Custom View Criteria  Traversing and deleting master- detail  Creating an Application Module base class  Programmatically calling EL, scopes and conditional display  Adding Router Activity  Programmatically handling confirm Dialog Yes and No  Programmatically invoking Popup  Programmatically closing Popup  Rendering Dynamic Region  Add Context Menu  Creating Data Control Method from Backing Bean  Contextual Events  Programmatically adding PPR  Programmatically handling UI CRUD transactions
  • 1122. 29 Integrating ADF with Web Service
  • 1123. Developing ADF Applications with ADF Data Controls
  • 1124. Lesson Agenda  What is Web Service  Types of Web Service  REST versus SOAP  When to use  Create REST Web Service with ADF Business Service  Create SOAP Web Service with ADF Business Service  Consume REST Web Service (ADF)  Consume REST Web Service (Generic)  Consume SOAP Web Service
  • 1125. ADF Faces Types of Data Controls Model (JSR227) Business Services Data Control /Binding Context Binding Container / Bindings View Controller /Data Binding ADFm Data Control Data Control Data Control Data Control Web Services (REST/SOAP) EJB POJO URL ADF BC BI Essbase BAM Data Control Data Control Data Control
  • 1126. Types of ADF Integrations with WS Expose ADF as Web Service Expose ADF Business Service as REST Web Service Expose ADF Business Service as SOAP Web Service Develop ADF Application with ADF Data Controls Consume REST Web Service (ADF) Data Control Consume REST Web Service (Generic) Data Control Consume SOAP Web Service Data Control Consume EJB Data Control …
  • 1127. Types of ADF Integrations contd… Integrate ADF Application with Service Oriented Architecture (SOA) Mobile Application Framework (MAF) Cloud Service WebCenter (WC) PLSQL (Lesson 03 Extended Example) Business Intelligence (BI) …
  • 1129. What is Web Service A Web Service is a service offered by an electronic device to another electronic device, communicating with each other via the World Wide Web. Commonly used for integration Hides complexities between network
  • 1130. Type of Web Services  REST (REpresentational State Transfer) HTTP based (GET, POST, PATCH, DELETE …) Simple familiar Programmer friendly No Contract  SOAP (Simple Object Access Protocol) Relies on XML message format Requires WSDL document Requires Contract Enterprise Standard
  • 1132. REST Vs SOAP REST (REpresentational State Transfer) SOAP (Service Oriented Architecture Protocol) External Calls / Invoke Service URL path Calling RPC method Message Format JSON or XML Only XML inside a SOAP envelope Communication JSON or XML WSDL Performance High Performance, Scalability & Caching Low performance, scalability and no caching To Expose Business Logic Uses URI Uses Service Interface Call from JavaScript Easy to call Difficult to implement Error Handling Built-in Does not support Results Human readable Not Human Readable Transport Simple HTTP protocol Uses SOAP envelope to transfer over HTTP protocol
  • 1134. When to Use When to use REST Cloud-based and mobile applications Creating highly scalable stateless applications When to use SOAP Internet applications – More mature tooling B2B applications – Strong contract Exposing existing applications
  • 1135. REST is better than SOAP REST can be consumed by any client, even a web browser with Ajax and Javascript REST is lightweight Does not require XML parsing Consumes less bandwidth – no header for every message unlike SOAP REST is easier to learn than SOAP
  • 1136. Summary of HTTP Methods for RESTful APIs HTTP Method CRUD Entire Collection (e.g. /users) (all resources in a collection) Specific Item (e.g. /users/123) (a single resource) POST Create 201 (Created), ‘Location’ header with link to /users/{id} containing new ID. Avoid using POST on single resource GET Read 200 (OK), list of users. Use pagination, sorting and filtering to navigate big lists. 200 (OK), single user. 404 (Not Found), if ID not found or invalid. PUT Update/ Replace 404 (Not Found), unless you want to update every resource in the entire collection of resource. 200 (OK) or 204 (No Content). Use 404 (Not Found), if ID not found or invalid. PATCH Partial Update/ Modify 404 (Not Found), unless you want to modify the collection itself. 200 (OK) or 204 (No Content). Use 404 (Not Found), if ID not found or invalid. DELETE Delete 404 (Not Found), unless you want to delete the whole collection — use with caution. 200 (OK). 404 (Not Found), if ID not found or invalid. HEAD Read Header Retrieve all resources in a collection (header only) Retrieve a single resource (header only) OPTIONS any Return available HTTP methods and other options Return available HTTP methods and other options
  • 1137. Who's using SOAP / REST SOAP REST Amazon   EBay   Yahoo!  Google Maps  Google Search  Blogger (blogs)  PayPal  Del.icio.us  MSN Search  MS Office  SalesForce 
  • 1138. Using the Data Control Palette Methods Parameters Return values
  • 1139. Creating ADF Data Bindings Methods Parameters Return values ADF Command button ADF Output Text w/ Label ADF Input Text w/ Label
  • 1140. Creating ADF Data Bindings Note: Data Control Validation & UI Hints not available in 10.1.3.0
  • 1141. Customizing ADF Data Binding Properties Label property Text property
  • 1142. Web Service Provider Web Service can be Java Web Service, C, C++, C# Web Service EJB Web Service PL/SQL Web Service BC4J Web Service Any software component which adheres to the standards can be exposed as Web Service
  • 1143. SOAP Web Service Standards  WSDL – Web Service Definition Language  XML format published for describing Web services  Describes the public interface to Web Service, how to communicate to web service, protocol bindings and message formats required to interact with web service.  SOAP – Simple Object Access Protocol  Protocol for exchanging XML-based messages over a computer network, normally using HTTP  Providing a basic messaging framework  Different types of messaging patterns in SOAP, but by far the most common is the Remote Procedure Call (RPC) pattern, where one network node (the client) sends a request message to another node (the server), and the server immediately sends a response message to the client.  UDDI - Universal Description, Discovery, and Integration  A platform-independent, XML-based registry for businesses worldwide to list themselves on the Internet  Enabling businesses to publish service listings, discover other web services, define how the services or software applications interact over the Internet
  • 1144. Create SOAP Web Service ADF BC Web Service (Sample)  Create ADF BC Objects (Employee EO & VO Objects)  Create Application Module (EmployeeAM)  Expose Application Module as Web Service (EmployeeWebService)  Deploy the EmployeeWebService in WLS Server
  • 1145. Create SOAP Web Service Java Web Service  Create Java Class  Create Service Interface  Create WSDL  Deploy the Service in Server  Test the Service using SOAP messages
  • 1146. Building REST Web Services with ADF BC Oracle REST Standards include standards for Resource naming Resource URI Resource Metadata Resource Catalog Pagination Security Caching
  • 1147. Oracle REST API’s Use JSON Payload JavaScript Object Notation text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for many languages.
  • 1148. Oracle and JSON Schema  JSON Schema is WSDL + XSD for JSON Describes the available Resource URI’s, Request and Response MediaTypes, Resource metadata, etc. Not an industry standard (yet) Not yet widely adopted, though Google uses it Extensible Validation tools available  Oracle resource catalog will be based on JSON Schema with keyword extensions Oracle will add more metadata for Data Controls / UI Generation
  • 1149. REST support New ADF BC REST wizard to generate RESTful services using JSON New REST Data Control No longer part of URL Data Control
  • 1150. ADF BC Rest Services The resources are based on VO instances (and its accessors) and are defined by a Resource Definition File Resource Departments: Based on DepartmentVO and its accessor to EmployeeVO Resource Employees: Based on EmployeeVO Each resource definition provides two kinds of resources: Resource Collection Resource
  • 1151. ADF BC Rest – Resource Collection Departments http://server/application/rest/Departments Employees http://server/application/rest/Employees Employees in a "department context" http://server/application/rest/Departments/10/Employees
  • 1152. ADF BC Rest – Single Resource Department http://server/application/rest/Departments/10 Employee http://server/application/rest/Employees/103 Employee in a "department context" http://server/application/rest/Departments/10/Employees/103
  • 1156. ADF BC Rest - Expanding Links ?expand=EmployeesView
  • 1157. ADF BC Rest - No Links ?onlydata
  • 1158. ADF BC Rest - Pagination Request param ‘limit’ specifies range size Request param ‘offset’ specifies start index Example: /rest/Departments?limit=3&offset=0  Retrieves first three departments
  • 1159. ADF BC Rest – Collection Filtering Request param ‘query’ can specify “where clause” Examples: query={DepartmentName M*}  Returns departments starting with M query={DepartmentName *u*}  Returns departments containing an ‘u’ in the name query={DepartmentId < 40}  Returns departments with Id lower than 40
  • 1160. ADF BC Rest – Payload Filtering Request param ‘fields’ can specify comma-delimited list of attributes to include Example: /rest/Departments?fields=DepartmentName  Retutrns only DepartmentName in JSON payload
  • 1161. ADF BC Rest – Resource Catalog http:/server/application/rest/describe Lists all resources, attribute metadata, links, children, actions Describe can also be done for one specific resource http://server/application/rest/Departments/describe
  • 1162. New ADF Mobile REST Data Control Goal: Leverage ADF BC Rest Services Support CRUD operations and provide data control operations that allow the developer to easily use declarative bindings Use metadata exposed by the services' describe Support for links and relationships Support for paging
  • 1163. Lesson Summary  What is Web Service  Types of Web Service  REST versus SOAP  When to use  Create REST Web Service with ADF Business Service  Create SOAP Web Service with ADF Business Service  Consume REST Web Service (ADF)  Consume REST Web Service (Generic)  Consume SOAP Web Service
  • 1165. Lesson Agenda ADFBC and EJB Mapping Consume EJB Data Control
  • 1166. ADF BC and EJB Mapping ADF Business Components (BC) Enterprise Java Bean (EJB) Entity Objects Entities from Tables (Java POJOs) View Objects Named Queries (inside entity) Application Module Session Facade • Commit and Rollback • Persist and Update • DataModel VOs • Named Queries Data Control (automatically created) Data Control (manually created)
  • 1167. Lesson Summary ADFBC and EJB Mapping Consume EJB Data Control
  • 1168. 31 Integrating ADF with Service Orientated Architecture (SOA)
  • 1169. Lesson Agenda Service Oriented Architecture Key SOA Standards Oracle SOA Platform Orchestrating services Create, deploy a SOA service and test
  • 1170. IT System Runtime Architecture Orchestration Human interaction Policy evaluation Monitoring Rules Engine Assign Task Task Complete Human Workflow Service BPEL Process, Events, Alerts results facts Business Activity Monitoring Fusion Service Bus / XML Transformation .Net Apps Legacy Apps CRM ERP Fusion Applications (ADF) Relational Data/ Apps Schema Data Hub Legacy Data ADF BC Services Services Services Common business logic & data across multiple instances and applications Centralized & reliable messaging across infrastructure Combine re-usable services to meet changing requirements Centralized & secure data access across all applications Separate data persistence from business logic
  • 1171. Service Oriented Architecture (SOA) Orchestration Human interaction Policy evaluation Monitoring Rules Engine Assign Task Task Complete Human Workflow Service BPEL Process, Events, Alerts results facts Business Activity Monitoring Fusion Service Bus / XML Transformation Relational Data/ Apps Schema Common business logic & data across multiple instances and applications Centralized & reliable messaging across infrastructure Combine re-usable services to meet changing requirements Centralized & secure data access across all applications Separate data persistence from business logic Model (JSR227) View Controller Business Services ADF Faces Taskflow ADF BC ADF Model WebCenter SDO Services
  • 1175. Lesson Summary Service Oriented Architecture Key SOA Standards Oracle SOA Platform Orchestrating services Create, deploy a SOA service and test
  • 1176. 32 Integrating ADF with Mobile Application Framework (MAF)
  • 1177. Lesson Agenda Mobile Application Choices Native vs Web Hybrid Responsive Design Introduction of MAF History of MAF Prerequisites for MAF MAF Development Tools Non-Oracle Tools Needed Working with Emulator MAF Runtime Architecture MAF App Basic Creating MAF App
  • 1178. Mobile Application Choices Native Deploy “native” specific to iOS or Android (or other…) Web Deploy as web application; works on pretty much any browser Hybrid Vendor provided development environment that deploys to iOS or Android (or other…) but leverages open technologies like JavaScript, HTML5, and CSS
  • 1179. Native vs Web vs Hybrid  Here’s a great comparison  http://java.dzone.com/articles/state-native-vs-web-vs-hybrid
  • 1180. Responsive Whether apps are Native iOS/Android, Hybrid, or Web-based; our user’s devices come in all shapes and sizes Well-designed apps respond gracefully
  • 1181. Responsive Design Think flexibly; layouts should stretch and compress to fit different heights and widths Maximize layouts; larger devices should use the extra “real estate” – views should combine multiple sub-views to ease assembly Prepare for density differences (DPI); might require resources for different densities
  • 1182. Introduction to Mobile Application Framework  MAF is a hybrid mobile architecture  It is Single framework for both Android and iOS  Can build same apln. for both devices without using any platform-specific tool  It uses pre-installed HTML5, JavaScript, and CSS to render the UI  It’s Components are defined for Apache Cordova objects,  To access device features such as camera, contacts, GPS, e-mail, etc.  It uses Webservices and SQLLite DB for Data sources  It has a MVC framework  It’s Application can be deployed in the Device or Emulator  It is feely available as a plugin for both JDeveloper and Eclipse IDE’s
  • 1183. Market Place Oracle recently released results from a global study with staggering statistics:  1 in 6 employees have found ways to bypass their companies’ IT security and use personal mobile devices for work without their employer knowing  Only 18 percent of respondents believe their company effectively controls what can be done on a mobile device  67 percent of workers are using their own personal mobile devices for work  68 percent of workers said they would be happier working in a more mobile and flexible way  Sales for Oracle Mobile is about 60% more when compared to sales in previous year, the same for ADF is about 20%
  • 1184. History of MAF  Can migrate from Oracle ADF Mobile Applications to MAF  There is no need to worry about the configuration of the file that changes; it will all be performed by JDeveloper, automatically.  Added as a plugin to JDeveloper 11g and later as plugin for JDeveloper 12c  Extended security using O – Auth and Web SSO. Integration with Oracle Mobile Security provides high security for our application features.  Additional plugins, which allows us to extend our app’s functionality like barcode integration.
  • 1185. Comparing Oracle MAF with ADF Mobile
  • 1186. Prerequisites for MAF System should be of 64 bit with more than 4 GB RAM for better performance The application are built on JDeveloper, so have to install it Install the plugin for Oracle MAF Must have an understanding on Java
  • 1188. Non-Oracle Tools Needed  Java SDK  Android  Android SDK  Android Simulator  Intel HAXM (Hardware Accel. Exec. Manager)  iOS  Apple Developer account  Xcode  Oracle MAF Certification Matrix  http://www.oracle.com/technetwork/developer- tools/maf/documentation/maf241certmatrix-3746359.html
  • 1191. Working with Data in MAF Bindings and Data Controls MAF Model Layer Business Services (SOAP or WSDL) Managed Beans SQLLite (via JDBC) ADF BC Objects? – Coming in a later release
  • 1192. MAF User Interface Views Task Flows HTML5 + JavaScript + CSS – Touch, Gestures, Responsiveness Apache Cordova (PhoneGap) – Device Features
  • 1193. MAF App Basics App Project App Model App View
  • 1194. Creating MAF App 1) Watch User at Work 2) Design application (wireframe) to minimize interfaces and maximize impact 3) Determine data required for display, input, and output 4) Determine on-device features to use 5) Create MAF project 6) Add Features to app 7) Create main MAF Task Flow & Empty Views
  • 1195. Creating MAF App contd… 8) Create Data Controls and supporting Model components 9) Create and test UI a) Simple functionality? b) Ease of use? c) Get job done in few steps?
  • 1196. Creating MAF App contd… 10) Enable and test mobile features a) Visualizations b) Camera c) GPS d) Email e) Text f) Address Book g) Web Services 11) Prepare for Deployment 12) Deploy
  • 1197. Creating MAF App contd… 13) Deployment Steps a) Create Deployment Profile b) Deploy to Android Simulator c) Deploy to iOS Simulator d) Deploy to live Android e) Deploy to live iOS i. Deploy to file ii. Import file into iTunes iii. Sync with device 14) Test on all likely devices
  • 1198. Wrapping it Up Oracle Mobile Application Framework (MAF) is a toolset you can use today to build and deploy hybrid mobile apps MAF’s tooling insulates you against changes to standard libraries Creating MAF applications is relatively simple; building quality mobile apps will take some real design
  • 1199. Lesson Summary Mobile Application Choices Native vs Web Hybrid Responsive Design Introduction of MAF History of MAF Prerequisites for MAF MAF Development Tools Non-Oracle Tools Needed Working with Emulator MAF Runtime Architecture MAF App Basic Creating MAF App
  • 1200. 33 Integrating ADF with Cloud Service
  • 1201. Lesson Agenda What is Cloud Computing Cloud Service Models Cloud deployment models Elasticity Business Benefits of Cloud Technical Benefits of Cloud
  • 1202. What is Cloud Computing? Cloud computing allows application software to be operated using internet-enabled devices
  • 1204. Cloud Service Models contd…
  • 1206. Elasticity Power to scale Key Concept in Cloud Computing Solves Traditional Problems Scale-up (Vertical) Scale-out (Horizontal)
  • 1207. Business Benefits of Cloud Low up-front Investment In time Infrastructure Efficient Resource utilization Usage bases Cost Reduce time to market
  • 1208. Technical Benefits of Cloud Automation Auto-scaling Proactive scaling Efficient development lifecycle DR and Business Continuity
  • 1209. Lesson Summary What is Cloud Computing Cloud Service Models Cloud deployment models Elasticity Business Benefits of Cloud Technical Benefits of Cloud
  • 1210. 34 Integrating ADF with WebCenter
  • 1211. Lesson Agenda  What is WebCenter  Pillars of WebCenter  Key Benefits of WebCenter  What is WebCenter Sites  WebCenter Sites Architecture  What is WebCenter Portal Cloud  WebCenter Portal Architecture  What is WebCenter Content  WebCenter Content Architecture
  • 1212. What is WebCenter?  WebCenter is the enterprise Web 2.0 extentional framework, build on top of ADF to develop complete portfolio of Sites, Portal and Content Management  WebCenter Pillars: WebCenter Sites WebCenter Portal Cloud WebCenter Content  Implements the (run-time) customization and personalization requirements  Allows consumption of third party, external portlets  Provides many Web 2.0 Services and Community Workspaces
  • 1213. Key Benefits of Oracle WebCenter Supporting industry standards Enabling easy integration into an existing infrastructure Providing a single paradigm to build all UIs Extending existing Java EE and SOA applications Reducing development time
  • 1214. WebCenter Sites  To drive sales, marketing and loyalty, and to convert customers; marketers and business users: create, manage and moderate contextually relevant, targeted, media rich, social and interactive online experiences (dynamic websites) optimize customer engagement across multiple channels (web, mobile, social channel, etc.) manage large-scale global presences, with integration to enterprise application  Competes in the Web Experience Management market space  Example: Amazon
  • 1217. WebCenter Portal Cloud Organization create intranets, extranets, mash-ups, self-service enterprise portals (websites) and composite applications, with integrated collaboration and social services, like Portlets, RSS, Discussion forums, etc. Competes in the Mash-up and Self-Service Portal market space Example: Facebook, Vodafone, Verizon, Airtel
  • 1219. WebCenter Portal Architecture work environment for effective team collaboration
  • 1220. WebCenter Portal Framework  Content integration  JCR 170 support  Several content repositories  Portlets  Consumable portlets  Portlet containers for  JSR 168/PDK-Java  JSF-Portlet Bridge  Out-of-the-box portlets  Run-time customization
  • 1221. WebCenter Portal Services A complete set of complementary services that enables you to embed Web 2.0 communication and collaboration services directly into an ADF application
  • 1222. WebCenter Portal Spaces A prebuilt application that provides an online environment for social networking, communication, collaboration, and personal productivity Instant communities Team sites Portals
  • 1223. WebCenter Spaces Personal Space  Users have secure, individual workspace or dashboard.  It is highly personalizable with social feeds, email, tasks, tags, recent documents, and so on.  Users create pages, add content, and customize views using Oracle Composer. Business Role Pages  Secure team sites and community collaboration  Role-based views and access to information  Completely customizable  Easily embed ad hoc activities in a business process or application  Users can share and reuse Group Spaces as templates. Group Spaces  Role-based communication with user communities  Prebuilt templates that simplify linking pages and content to a specific enterprise role  All users in a given role easily kept up-to-date with relevant information.  Integrated with user’s Personal Space
  • 1224. WebCenter Portal Personal Space Sample
  • 1225. WebCenter Portal Group Space Sample
  • 1226. WebCenter Portal Composer  Run-time customization performed in the browser, in-place  Rich, intuitive user experience  Drag-and-drop  Typical operations:  Browse and add resources to pages  Rearrange page layout  Set page and component properties  Wire components together  Changes stored in MDS  Page creation API
  • 1227. WebCenter Portal Composite Applications and Mash-ups
  • 1228. Metadata Services (MDS)  Stores changes of ADF Faces pages  Separate XML documents  Only the changes are stored  Supports attribute modification and insert/remove/move/reparent of elements  Merges based on context when rendering a page  Deployed page becomes the base document.  Modifications come from MDS.  Offers layered customization  Provides a persistent store  File System  Database Schema
  • 1229. The Metadata Service Framework
  • 1230. WebCenter Portal – Other Key Features
  • 1231. What Is a Portlet? A remote Web component that renders information in HTML format Portlets Render dynamic content Provide their own user interface Allow customization and personalization Are reusable
  • 1232. Portlet Overview Register the producer, providing a URL endpoint for the portlet producer. Drag the portlet to the page.
  • 1233. WebCenter Content  Provides unified repository to store unstructured contents, documents, images, rich media, records, etc. has the capability of creating, and publishing business-user websites focused on targeted audiences  manage end-to-end content lifecycle from creation to archiving  automate business processes with prebuilt enterprise application integrations allow websites to dump files in and have them be accessible to business users or other WebCenter applications  Competes in the Enterprise Content Management market space  Example: provides contents to WC Sites and WC Portal
  • 1236. Lesson Summary  What is WebCenter  Pillars of WebCenter  Key Benefits of WebCenter  What is WebCenter Sites  WebCenter Sites Architecture  What is WebCenter Portal Cloud  WebCenter Portal Architecture  What is WebCenter Content  WebCenter Content Architecture