Best Practice Techniques

Download Report

Transcript Best Practice Techniques

A developer’s peek inside
JDeveloper
ADF Business Components &
ADF Faces
SAGE Computing Services
Customised Oracle Training Workshops
and Consulting
www.sagecomputing.com.au
Penny Cookson – Managing Director
Chris Muir – Senior Consultant
www.sagecomputing.com.au
Agenda
• What’s wrong with the Forms approach?
• What is ADF?
• ADF Business Components
– Entity Objects & View Objects
– Manipulating View Objects
– Attributes
• ADF Faces
– Page flow diagrammer
– Event driven UI model
• Learning resources
www.sagecomputing.com.au
What’s wrong with the Forms
approach?
JavaServer Faces
Encryption
Web ServicesWeb Anything
Mobile Computing
Any J2EE Server
SOA
Ajax
Standards
Java
Oracle
Any JDBC Database Javascript
Failover
Swing
BPEL
Platform Independence
Vendor Independence
Cake Rich Clients
Email Services
Scalability
JavaServer Pages
Just about anything exciting
happening in computing
FORMS Remand Centre
www.sagecomputing.com.au
A (Notorious) JDeveloper Quote
www.sagecomputing.com.au
What is ADF? ADF What?
Application Development Framework
… A comprehensive & complete MVC framework for
developers to assist building J2EE applications … Forms
provides you with a “black box” framework … ADF is a
“white box” and provides ultimate flexibility and power …
ADF Business Components
… ADF BC is one “persistent layer API” choice within ADF
… used for connecting to the database, model data and
store data in the Java mid-tier, and implement
sophisticated business logic and security
ADF Faces
… A feature rich set of web components based on an events
model similar to Forms, designed to abstract away from
the HTTP request-response fiasco and HTML overdetailed tag programming
www.sagecomputing.com.au
ADF Business Components
Entity Objects & View Objects
Entity
Objects
View
Objects
R/W
R/W
Database
User
Interface
R/O
DML Insert/Update/Delete
Validation
Security
Code re-use
SQL Queries
www.sagecomputing.com.au
Manipulating View Objects
Design Time
View Only Objects and
underlying SQL query
can be switched into
Expert Mode
www.sagecomputing.com.au
Manipulating View Objects
Runtime Manipulation
Bind Variables
Oracle Named
Oracle Positional
JDBC Positional
Set Binds
via Custom Code &
exposing Model Services
www.sagecomputing.com.au
EO/VO Transient Attributes
aka Calculated Items
Based on:
Simple
expressions
Sub-Queries
Function Calls
www.sagecomputing.com.au
Attribute Default Values
2 Approaches
Declarative:
EO/VO Attributes
Code:
Create method
The EntityImpl
www.sagecomputing.com.au
Attribute Formatting
2 Approaches
Declarative:
EO/VO Attributes
Control Hints
Code:
Create a RegExp
validation Domain
The DomainImpl
www.sagecomputing.com.au
Data Validation - declarative
2 Approaches
Declarative:
EO Validators
Can be both at
entity level or
Attribute level
www.sagecomputing.com.au
Data Validation - code
2 Approaches
Code:
EO Validators
Can be both at
entity level or
Attribute level
The EntityImpl
www.sagecomputing.com.au
DML Methods
Yes! There are equivalents of Core Forms Transactional Triggers.
The EntityImpl
protected void doDML(int operation, TransactionEvent e) {
if (operation == DML_INSERT) {
/* write PRE-INSERT trigger-like code here */
super.doDML(operation, e); /* Don't call the super and do something
else to write ON-INSERT trigger-like code */
/* write POST-INSERT trigger-like code here */
}
else if (operation == DML_UPDATE) {
/* write PRE-UPDATE trigger-like code here */
super.doDML(operation, e); /* Don't call the super and do something
else to write ON-UPDATE trigger-like code here */
/* write POST-UPDATE trigger-like code here */
}
else if (operation == DML_DELETE) {
/* write PRE-DELETE trigger-like code here */
super.doDML(operation, e); /* Don't call the super and do something
else to write ON-DELETE trigger-like code here */
/* write POST-DELETE trigger-like code here */
}
}
www.sagecomputing.com.au
Exposing Model Services
Custom Code
Exposing Custom Code – Model Services
Eg. Set View Bind Variable based on User Input
The AppModuleImpl
www.sagecomputing.com.au
Is Database PL/SQL dead?
No it’s not, it’s just hiding!
Invoking DB Stored Procedures and Functions
One of many ways
Callable statement
new Dev Guide
JDev Help
PLSQL
JPublisher
JDev Help
Expose as web service
www.sagecomputing.com.au
ADF Faces
Page Navigation
Page Navigation
1 - Create the
Navigation Rule
Piece of Cake
Easy to Build
Easy to Apply
Easy to Change
2 - Use the Rule
www.sagecomputing.com.au
Event Driven UI Model
Declarative Handling
Submittable
Component
Bound by
EL
ADF BC Binding
Object
Declarative
Binding
Methods
<< Event ------- Listener ------- Handler >>
Backing Bean
Method Handling
Submittable
Component
Bound by
EL
[injected]
ADF BC Binding
Object
Declarative
Binding
Methods
www.sagecomputing.com.au
Event Driven UI Model…
What’s the equivalent of the when-button-pressed trigger?
It’s just a few clicks away – xxxButton_action
2 – Create
BackingBean and
method
3 – ActionListener
refers BackingBean
method
4 – BackingBean
method ready for
code
1 - Select Button
and ActionListener
www.sagecomputing.com.au
Event Driven UI Model…
A Few more UI Listeners and Handlers
new Dev Guide
www.sagecomputing.com.au
UI Tidbits
EL (JSF Expression Language)
JSTL & JSP EL vs JSF EL
Tricks
Eg, re-usable label text
codelike expressions
enable/disable…
PPR (Partial Page Rendering)
AJAX style
The BACK Button
See Token Validation
www.sagecomputing.com.au
Complex UI Components
LOVs
Shuttles
Trees
Screenshots courtesy of Oracle’s SRDemo
www.sagecomputing.com.au
The Full Picture
Forms <=> ADF BC/ADF Faces
Forms
UI focused triggers
PL/SQL modules
Libraries
Transactional triggers …
ADF BC / ADF Faces
UI events + listeners
Backing beans
Application module services
BC framework methods…
www.sagecomputing.com.au
Learning Resources
•
Our 1 week JDeveloper course for Forms Programmers! ;)
•
ADF Developer’s Guide for 4GL/Forms Programmers
•
ADF Developer’s Guide for Java Programmers
•
SRDemo - like Toystore demo
•
OTN JDeveloper website – no really! Has many very important and good learning
resources.
•
Metalink - don’t dismiss Metalink as just Support. You may find condensed solutions
when compared to full blown Doco.
•
OTN JDeveloper Forums – JDev team answer questions on hour by hour basis
•
Blogs - don’t overlook blogs and read every day
Visit the JDev blog aggregator: http://thepeninsulasedge.com/adfblog
•
Don’t just stick to Oracle. JSF is a Sun & Java technology. There are plenty of other
good sites out there beyond Oracle’s.
www.sagecomputing.com.au
Thank You
For Your Attention
[email protected]
SAGE Computing Services
Customised Oracle Training Workshops
and Consulting
www.sagecomputing.com.au
www.sagecomputing.com.au