Sei sulla pagina 1di 19

On the Positive Side…

If we do not find
ADF 101- in a Nutshell anything pleasant, at least
Overview and Hands-on Lab we shall find something new.

Si nous ne trouvons pas des choses


Peter Koletzke agréables, nous trouverons du
Technical Director & Principal Instructor moins des choses nouvelles.
—Voltaire (1694-1778), Candide

Objectives Survey
• Understanding of the ADF development • Languages?
process – PL/SQL
– Lecture sections – Java
– Declarative and visual – Other
• Experience with ADF 12c (current version) • Tools?
– Hands-on lab – APEX
– Labs do not explain “why” or “what” – JDeveloper
• Lectures and book should help
– Eclipse, NetBeans
• About the book
– Developer Forms/Reports
– All 11g concepts in it apply to 12c
– Other
– Much longer hands-on
– You may need to adjust some steps
3 4
Agenda Oracle Application Development
Framework (ADF)
• A framework is a prebuilt service for solving a
• Intros: ADF, sample app, JDev particular problem – like access to the
database
– Code libraries and standards support the framework
• ADF Business Components – Implements code reuse and best practices
– An architecture with code libraries
• ADF is a meta-framework
• ADF Faces – A wrapper for other frameworks
– Available starting in JDeveloper 10g
– Provides a consistent developer experience
• ADF Model and ADF Controller • Pre-ADF available in OAF
Slides will be available on
– Oracle Application Framework (UIX/MVC)
Screenshots are
the NoCOUG and Quovera 11g unless • Based on Model-View-Controller
websites. marked as 12c design pattern (Java EE, SmallTalk)
5 6

ADF Architecture Which ADF Technologies to Use?


Application Client View Web Client
• An example: Fusion Applications (Oracle
ADFdi (Excel) ADF Mobile JSF
applications suite) uses ADF 11g
ADF JClient JSP ADF Faces RC
• Core technology stack used for Fusion Apps is:
– ADF Business Components
Controller – ADF Faces Rich Client
ADF
Struts JSF
Controller
– ADF Model
– ADF Controller
Model • Other high-level technologies
ADF Bindings or strategies also used
ADF Data Controls
– SOA, ESB, Business Rules,
WebCenter, BPM, BPA, BAM
Business Services – Need to consider those, too, Out of
scope
EJB Session
Beans
Web
Services
ADF Business
Components
Java
Classes
Essbase at the architectural level
8
ADF Essentials ADF Mobile
• No-license-fee version of ADF • Similar ADF principles and development
– Runs on the public domain app server, methods
Glassfish, not WebLogic Server – Business services
• Works in JDeveloper – Pages with components (amx)
• Works in Eclipse – Task flows
– Through Oracle Enterprise Pack for • Supports iOS and Android
Eclipse • Use local services like camera & contacts
• More information on OTN • OTN demo video and ADF Academy video
http://www.oracle.com/technetwork/developer-
tools/adf/overview/adfessentials-1719844.html
www.oracle.com/technetwork/developer-tools/
adf-mobile
9 10

Where Do The Core Technologies About the Hands-on Lab


End Up? • Sample app
– Required sections (A – L)
• Basic functions and techniques

Database access – Extra credit sections (M – R)


& SOA endpoints • More practice, more techniques
ADF • Work together
Faces ADF
BC • How to succeed
UI rendering Departments – Take your time
– Ask questions
ADF
Model – Read carefully Use the sticky arrows!
ADF Employees
Controller – Watch white board for corrections
Binding data – Use sample solutions – compare files
Page flow and task flow to items

Demo 1 11 12
JDeveloper Integrated Development Environment
Data Model
Toolbar
Application
Navigator JSP/HTML Visual Editor
Component
Palette

Data Control Code Editor


Palette

Log Window
Structure
Window

Property
Also on p. 39 of the lab Inspector
handout and in the sample
app’s UML project. 13

Application Navigator Structure Window


• Shows files that • Shows details of
are part of your work selected code
session – Shows HTML and
– Application XML structures
• Consists of a number
of project files – Shows Java elements
• Opening the application – Drag and drop
opens a number of files
• Open multiple
components to it
applications at a time – Use right-click menu
– Project to add components
• A number of files to the page
• The deployment unit
Demo 2
15 16
JSP/HTML Visual Editor XML Code Editor
• WYSIKOWYG • You can type in
development
code if needed
• Shows visual
aspects • Different views
• Drag and drop of the file
components to • Many, many
the editor features to assist
• Drag and drop with code entry
components on – Code insight
the editor
– Javadoc
Not BMW, Isuzu,
– Auto import Audi, Acura

17 18

Log Window Data Controls Panel


• Displays the Java “console” messages • Part of the navigator
– Displays compile messages window
– System print statements • A mechanism for
– Debug messages dragging components
– Configure in Tools | Preferences into the visual editor
– Dragged controls are
fully bound to data in the
Compiling OrderEntry.jpr ....
This class is really, really fun
Business Services layer
The speaker is a genius ...
And handsome, too.
• Uses same basic
Compilation successful. You are amazingly talented! components as the
Component Palette
19 20
Component Palette Property Inspector
• Drag from this palette into the • Standard way to code property values
visual editor • Entries here show in Code Editor
• Creates code in the Code • Properties accessible for any element
Editor
• Appropriate palettes for
different types of files
– For example, JSP files have
HTML, JSP, JSF palettes

21 22

JSF Navigation/Task Flow Diagram


New Gallery
• File | New
• Draw JSF pages • Starts
and notes up a
• Creates and edits wizard
the faces-config.xml • Use for
or adf-config.xml file all new
• This defines which files
pages are displayed
based on user
actions

23 24
Some Other UI Features Agenda
• Database Utilities
• Debugger • Intros: ADF, JDev, sample app
• UML Modelers
– Class Diagram • ADF Business Components
• For ADF BC, Java Classes, Web Services, Database objects
– Activity Modeler
• ADF Faces
– Use Case Diagram
– Sequence Diagram
• XML Schema Diagram
• ADF Model and ADF Controller
• Integrated WebLogic Server
• Software Configuration Management
25 26

ADF Business Components More About ADF BC


• ADF BC: an option in the Business • Various component types, e.g.:
Services layer of ADF
– View objects: define queries
• Persistence: storing data in a database
– View links: view object relationships
• O/R mapping: Translates relational
(database) thingies to object-oriented – Entity objects: define insert-update-
(Java) whatsits delete (“DML”)
• Handles JDBC mechanics – Application modules: Define the data
– Creates SQL and handles results models and the database transaction
• Primarily declarative • It does not create user interfaces
– XML source code to define the
use of framework classes

27 28
View Objects = SELECT Read-Only View Objects
• Retrieve data from the database • Each view object instance can execute
• Manage caches of data a SQL query and cache the results.
• View object definitions View object Data
Data
– Contain SQL queries instance Data
Data
View
rows
– Act as templates for view object instances
• View object instances SQL query
Database
Data retrieval
– The “thing” used in code Data
Data
– Technically, an object of the class Data
Data
Data
rows

29 30

ADF View Links Entity Objects = INSERT, UPDATE, DELETE

• View link definitions relate a pair of • Entity object definitions


– Correspond to database tables (or views)
view object definitions
– Templates for entity object instances, which
• Specifies a master/detail relationship correspond to table rows
between the SQL queries • Entity object instances
– Write data to the database
• Has a source and destination attribute
– Validate data before updates and inserts
– Like foreign key/primary key – Supply default values
relationship

31 32
Entity Object Instances Application Modules
• View object instances stores data in entity • Application modules represent the interface from business
components to the application
object instances - view rows point to it – The application always references the application module for data
– Each instance (user) of the application will get its own application
View object Data module instance
Data
instance Data • The application module instance contains the data model
SQL query Data
View
rows – View object instances
– View link instances for master-detail relationships
Database Data retrieval
Data
Data Data
Data Data
Data Dataobject
Entity
Data
Data instances
rows

33 34

A Data Model List-of-Values (LOV)


Instance of Independent Instance of
DepartmentsView EmployeesView • Defined for an view object attribute
SELECT D.DEPARTMENT_ID, SELECT E.EMPLOYEE_ID,
D.DEPARTMENT_NAME,
D.MANAGER_ID
E.LAST_NAME
FROM EMPLOYEES E
• Associate a query (view object) with the
FROM DEPARTMENTS D
attribute
Instance of
EmpDeptViewLink
• Set up is declarative
– Start in the view object editor

Instance of
• UI code will display this attribute
EmployeesView specially
SELECT E.EMPLOYEE_ID,
E.LAST_NAME
FROM EMPLOYEES E
– Pulldown list item loaded with values
– Popup list-of-values dialog
WHERE E.DEPARTMENT_ID = :1
Demo 3
35 36
VO Editor – LOV Subtab Create List of Values

At runtime

37 38

View Criteria
View Criteria in the DCP
• Used for queries
• View Object • Data Controls panel lists
Editor the defined criteria
– 11g Query page • You can drag and drop
– 12c View Criteria a view criteria onto
page a JSF page
• View Criteria
dialog
– Defines the
WHERE clause
declaratively • Components are added for each
– Bind variables attribute in the view criteria
are optional
39 40
Declarative Validation Rules Declarative Validation Benefits
• Simple rules written on the entity object • Quick validation on the app server side
• No Java coding!
• Method 1
• Add a friendlier message for ADF BC-level
– Attributes tab
errors (e.g., length)
– Validation
• Messages stored in a message bundle file
Rules subtab
that you can internationalize
• Method 2 • All UIs built from the entity object will contain
– Business the same validation
Rules tab – Like a trigger in the database
– Attribute or • You need to decide where to place
entity level business rules code
41 42

UI Hints Setting UI Hints


• A.k.a., control hints
• In the editor, Attributes tab, select
• UI definitions stored in the entity object
or view object definitions attribute and click the UI Hints tab in the
– Universal to all UIs created from those EOs
Property
or VOs Inspector
– Provides consistency • OR Use the
– “Set it and forget it” UI Hints
• Can put the hints on either EO or VO subtab
– Rule of thumb: use the entity object
UI hints whenever possible
– Override on view object level if
needed
43 44
Actual California State Laws Agenda
• California State
– It is a misdemeanor to shoot at any kind of game from a moving
vehicle, unless the target is a whale.
– Women may not drive in a house coat.
• Intros: ADF, JDev, sample app
– No vehicle without a driver may exceed 60 miles per hour.
• Baldwin Park, CA
– Nobody is allowed to ride a bicycle in a swimming pool.
• ADF Business Components
• San Francisco, CA
Sunshine is
– It is illegal to pile horse manure more than
six feet high on a street corner. guaranteed to • ADF Faces
• Carmel, CA the masses.
– Women may not wear high heels while in the
city limits. • ADF Model and ADF Controller
• Palm Springs, CA
– It is illegal to walk a camel down Palm Canyon Drive
between the hours of four and six PM.
www.dumblaws.com
45 46

ADF Faces Rich Client Overview ADF Faces RC Features


• Fits into the View layer of ADF – ADF Faces RC • Solid development support in JDeveloper
• Evolution: • Changeable “skins”
– ADF UIX  ADF Faces  Apache Trinidad – Common look-and-feel characteristics
– ADF Faces  ADF Faces RC – Skin editor in JDev 11.1.2 and beyond
• Built on top of JSF APIs
• Layout management features
• Deployable on any 1.2 implementation of JSF
• Support for pop-ups and dialogs
• Extensive set of properties
– Declarative access to application metadata
• ADF model support out-of-the-box Really
rich! – Properties can reference
• Data Visualization Tools (DVT)
dynamic values using
components
Expression Language
– Charts, Gantt, Pivot, Maps, Hierarchy
• Template support
47 48
Some Components Component Categories
• Atomic
af:inputText af:link (with icon)
af:button – User-facing components
• af:inputText
• af:selectOneChoice
af:inputListOfValues
– Operation components
• Action-oriented components
• af:showPopupBehavior
• Layout
af:commandMenuItem
– Organize the atomic components
– Offer various facets
af:selectOneChoice – Normal prefix is “panel” and suffix is “Layout”
• e.g., af:panelFormLayout
• Data Visualization Tools
– Graphs, Maps, Hierarchy Viewers, etc.
af:inputDate af:selectBooleanCheckbox
– dvt prefix, for example, dvt:graph

49 50

Component Properties Deep Dive Into af:table


With af:panelCollection
• All components have properties
– id, binding, rendered
– accessKey, disabled, readOnly
• Some are component-specific
– hAlign, columns, rows
– title, selected
• Example:
<af:commandButton text="No"
action="GlobalHome"/>
• Column grouping • Export to Excel
• Available in the Property Inspector • Row highlighting • Detach option
• Column moving • Column sorting & filtering
51 Demo 4 52
Some Interactivity Features AJAX in ADF Faces RC
• Appear mainly in the user interface • Asynchronous JavaScript and XML
components (such as text fields) ConvertNumber • Partial Page Rendering (PPR) in ADF Faces
sub-component
• Examples: Pattern =
– “Declarative AJAX”
– Converters; e.g., number format “###,###.##” • Much AJAX in ADF Faces is transparent
– Built into the components AJAX provides
a cleaner user
– Nothing special needs to be done interface!
– Validators; some are built in, e.g., required • You can setup non-default AJAX behavior
• Messages appear next to items using properties
– partialSubmit – used by command items
– autoSubmit – used by input items/lists, etc.
Required = true – partialTriggers – all components, sets up
RequiredMessageDetail = “You the “viewer” (listener)
must enter a value for {0}.”
53 54

AJAX Interactions – Total Pay Agenda


Recalculate
Id Raise • Intros: ADF, JDev, sample app
Value #{bindings.Raise.
Salary 0400 Total Pay 500
400
0 inputValue}

Raise 100
0
AutoSubmit true • ADF Business Components
Id TotalPay • ADF Faces
Value #{bindings.Salary
Id Salary .inputValue +
Value #{bindings.Salary.
bindings.Raise.in
putValue}
• ADF Model and ADF Controller
inputValue}
AutoSubmit false
AutoSubmit true
partialTriggers Salary Raise

55 56
ADF Model ADF Data Controls
• Business Services abstraction
• ADF Data Controls
– Makes Model components available to
– Provides list of components The Good News:
ViewController You don’t
or groups of components for normally write
a node in the data model – Automatically created with ADF BC data controls
– “Drop as” options – Can be created for other business services
– For non-ADF BC, defined in DataControls.cpx
• ADF Bindings
• Provide list of “Drop as” options that create
– Prebuilt connection from
the ADF BC to the UI pre-bound components
– Drag and drop action – Collection level (view object instance)
above does the work – Attribute level (view attribute)

57 58

Data Controls in JDeveloper Adding Bound Components


• Exposed in the Data
Controls panel (DCP)
– Automatically appears
when editing a JSF JSP
– OR CTRL-SHIFT-D
• Nodes for
– Data control
– Data collection
– Attribute
– Nested data collection
1. Drag-and-drop from the 3.Bound
– Named Criteria components
Data Controls panel
– Operation will be added
2. Select a “drop as” option
to the page
59 60
Collection “Drop As” Options Drop As Examples: Form and Table

Note the binding


expressions

61 Demo 5 62

ADF Bindings Common Binding Types


• Attribute
• Association of a business service data – For single attribute in a collection
element or action with a UI component • List
– For data-bound list elements
– Relatively automatic in Oracle Forms • List of Values
– Definitely not automatic in native Java EE – For view object lists of values
• Tree
• Binding normally takes a lot of coding – Hierarchical controls (master detail), tables, list views
• Table (or range)
– One-off solution is not the answer – For table components bound to collections (not used much
now)
– Need a framework to assist • Action
Data ADF Business Components Database – For standard operations like Commit
User Interface Bindings • Method
Employees EMPLOYEES – For custom methods “Drop As” options
• ID Susan • Boolean add these to the
• FirstName – For checkboxes page automatically
• LastName

63 64
Attribute Bindings and JSF Binding File
• The page definition (or PageDef) XML file
• You can access attribute bindings from stores binding definitions for the page
any component attribute – One PageDef file for each JSP
<af:outputText value="#{bindings.DepartmentId.inputValue}" /> – Called filenamePageDef
• Other attributes access properties on – For example; editEmployeePageDef.xml
the Model level object • Created when you drag a data control to
– Control hints or attribute properties (for the page the first time
example, label and width): – You can create the file manually
<af:inputText • Maintained as you drag or delete
value="#{bindings.PhoneNumber.inputValue}"
label="#{bindings.PhoneNumber.label}" components
columns="#{bindings.PhoneNumber.displayWidth}"/> – You can edit manually
65 66

Binding Code ADF Controller


In the JSF page file • Extension to standard JSF Controller functionality
<af:inputText value="#{bindings.DepartmentId.inputValue}"
label="#{bindings.DepartmentId.hints.label}" • Defines task flows
required="#{bindings.DepartmentId.hints.mandatory}"
columns="#{bindings.DepartmentId.hints.displayWidth}"
– Logic and page fragment components
maximumLength="#{bindings.DepartmentId.hints.precision}" – Embedded on the page in a region component
shortDesc="#{bindings.DepartmentId.hints.tooltip}"
id="it1"> • Benefits
</af:inputText>
– Page fragment re-use
– Executing code in a logic-defined flow
In the bindings PageDef file • “Task flow” not “page flow”
<bindings>
– Security
<attributeValues IterBinding="DepartmentsView1Iterator" – Exception handling and transaction
id="DepartmentId"> management
<AttrNames>
<Item Value="DepartmentId"/>
</AttrNames>
• Defined in a diagram
</attributeValues> – Like JSF but more components available

67 68
Sample ADF Controller Sample ADF Controller Code
Development <task-flow-definition id="dept-flow">
<default-activity>deptBrowse</default-activity>
<view id="deptBrowse">
exception handler <page>/deptBrowse.jspx</page>
</view>
<view id="deptEdit">
control flow case <page>/deptEdit.jspx</page>
router </view>
<control-flow-rule>
<from-activity-id>deptBrowse</from-activity-id>
<control-flow-case>
<from-outcome>toEdit</from-outcome> From
<to-activity-id>deptEdit</to-activity-id>
</control-flow-case> To
</control-flow-rule>
<router id="checkForExplicitID">
<case id="__6">
<expression>#{!empty pageFlowScope.employeeId}
</expression>
<outcome>byId</outcome>
</case>
<default-outcome>currentUser</default-outcome>
</router>
start point <method-call id="queryEmployeeById">
of the flow. <method>#{bindings.queryEmployeeById.execute}</method>
<outcome>
<fixed-outcome>queryEmployeeById</fixed-outcome>
</outcome>
69
</method-call>
Demo 6

Summary: ADF Core Technologies Final Voltaire Wisdom

The secret of being a bore


Database access is to tell everything.
& SOA endpoints
ADF
Faces ADF
BC Le secret d'ennuyer
UI rendering Departments est celui de tout dire.
ADF
ADF
Model
Employees —Voltaire (1694-1778), Sept
Controller
Binding data Discours en Vers sur l’Homme
Page flow and task flow to items

71 72
Summary Designer
Developer
Advanced
Forms & JDeveloper 3
• Books co-authored with Dr. Paul
Handbook Reports Handbook
Dorsey, Avrom Roy-Faderman, &
• Oracle is building Fusion Applications with an Duncan Mills
ADF core technology stack
• ADF offers a consistent developer ORACLE9i
JDeveloper
Handbook
ORACLE
JDeveloper 10g
Handbook
experience regardless of the technologies
• ADF Business Components provide access www.quovera.com
to the database and other data sources • Founded in 1995 as Millennia Vision
Corp.
• ADF Model connects ADF BC to ADF Faces • Profitable without outside funding
• Consultants each have 10+ years
• ADF Faces provide 150+, feature-rich item industry experience
and container components for JSF pages • Strong High-Tech industry background
• 200+ clients/300+ projects
• ADF Controller manages page flow • JDeveloper Partner
and task flow • More technical white papers and
presentations on the web site

73 74

Potrebbero piacerti anche