Sie sind auf Seite 1von 12

Oracle ADI JJg Primer

Introduction to the building


blocks o a lusion \eb
application

.v Oracte !bite Paer


.rit 200


OracIe ADF 11g Primer Page 2
Oracle ADl 11g Primer
UNDERSTANDING THE BUILDING BLOCKS OF AN APPLICATION
1o understand the building blocks o a lusion application, we can irst look at the
basic tasks that an application is responsible or undertaking.
Data access
Business logic implementation
User interace display ,presentation o data,
User interaction
Application ,page, low
In lusion, these basic tasks can be grouped into three distinct layers, the model,
iew and controller.

1he View Layer proides the user interace display to the application and raises
eents to the controller layer. 1he most basic and important component o the
iew layer is the page. 1he page is built in JDeeloper and is the ull web page that
is shown to the user. 1here are many other components o the iew layer that are
expanded upon below.
DeveIoper guides are shipped with
JDeveIoper for easy access. These guides
can be found from the JDeveIoper Start
Page or onIine on the OracIe TechnoIogy
Network.
OracIe ADF 11g Primer Page 3
1he Controller Layer manages the application low. 1he ADl Controller
processes user input, handles errors and decides what page the user should see.
1he key deinition that the controller layer uses to manage the application is the
task low. 1he task low is built in JDeeloper and is where the deeloper deines
an application task ,e.g. Create Lxpense Report, Lnter Budget,. 1he deinition o
the task includes the pages and logic that interact to allow a user to complete the
task. lor Create Lxpense Report, the 1ask llow may contain 3 pages ,Lnter
Lxpense Lines, Submit Lxpense Report and Conirm, and the logic that naigates
the user between the pages.
1he Model Layer is responsible or data access and business logic implementation.
In lusion the model layer is comprised o two important sub components. 1he
irst is the databinding acility that connects the iew layer to the data and business
serices layer. 1his databinding acility is called the data control and is the main
component o the ADl Model. 1he second is called by the data control and is
business serices. Application Module and ADl Business Components are the
key components o the business serices layer that are connected to the iew layer
by the data control. 1his separation allows or other business serices to be called
or or the data access and business serices to be implemented ater creation o the
iew layer.
VIEW LAYER
As highlighted earlier, the iew layer in its simplest orm could be a page with user
interace components ,e.g. table, input text, output text, and button, added to the
page and bound to the model layer. 1he user interace components o the page can
inoke the controller to naigate to other pages. loweer, ADl proides other
components o the iew layer that allow or the creation o rich and reusable user
interaces. 1hese components are described in this section.
Page
1he page is built in JDeeloper and is the ull web page that is shown to the user.
lor our Create Lxpense Report example, the deeloper may create three pages:
Lnter Lxpense Lines, Submit Lxpense Report and Conirmation.

As will be seen later in this document, application pages are likely to be more
sophisticated than this and will use more o the ADl eatures described below to
create rich and reusable user interaces.
Want hands on experience buiIding a
Fusion Web AppIication?
Use cue cards to guide you through the
steps of buiIding a Fusion Web
appIication. Cue cards can be found in
JDeveIoper both in the Start Page or under
the HeIp Menu.
OracIe ADF 11g Primer Page 4
Page Fragment
Page ragments are created and used ery much like pages. In act, to a deeloper
there is ery little dierence between how they would build a page in JDeeloper
ersus a page ragment. In our Create Lxpense Report example, the same three
pages can be created as page ragment deinitions instead o pages. 1he one major
dierence between pages and page ragments is that page ragments are not deined
as a ull web page. 1his allows page ragments to be used as a smaller part o a
larger web page. lor example, i you want the Create Lxpense Report task to be
displayed within a page that has other content displayed, you would create the
pages as page ragment deinitions. Because o this capability, it is likely most o
application tasks will be built with page ragments.

Page TempIate
Page templates are reusable, data-bound templates that can be used as a basis or
building pages and page ragments. I there are portions o a page that are
common across multiple pages, deelopers can create a page template or those
portions o the page and then use that page template as a basis or creating the
pages or page ragments that use the common unctionality. Page templates can
hae parameters that allow deelopers to conigure how the page template is used
,e.g. setting the title that appears in the header,. Page templates also deine areas on
the page ,acets, where content can be added by the deelopers when they create
their pages. 1hese acets can also contain deault content.
lor instance, i all application pages were to share a similar header ,with title, at the
top o the page, then a deeloper could create a page template that contains the
header and make the page template aailable to other deelopers building pages.
\hen other deelopers create their pages, they will base their pages on the header
template.

.
OracIe ADF 11g Primer Page 5

Region
A region is a powerul new eature in lusion that can be used within a page or page
ragment. A region can be considered synonymous with a portlet in regards to
unctionality and user behaior. loweer, regions will be used when you are
including the application unctionality in a local context and portlets will be used
when exposing the application unctionality or external usage.
As described earlier, a deeloper would create a task low or the Create Lxpense
Report task. 1his deinition would contain three pages, Lnter Lxpense Lines,
Submit Lxpense Report and Conirmation.

I deelopers want this task to be displayed to the user within a page that has other
content ,e.g. a worklist and a header,, they would use a region to wrap this task
low within their pages. Or rather, in JDeeloper, they would simply drop the task
low onto a page as a region.
OracIe ADF 11g Primer Page 6

1here are special requirements to use a task low as a region within a page. lor
instance the task low must be made up o page ragments instead o pages and the
task low must be a bounded task low ,see task low section or a description o
the dierences between bounded and unbounded task lows.,.
Components within regions can communicate with other regions on a page through
a publish-and-subscribe mechanism called the contextual eent ramework.
ContextuaI Event Framework
Many o application pages will be constructed in such a way that multiple pieces o
application content can be combined to create rich, modular, contextualized
applications. lor instance, i the user is entering expense lines in our Create
Lxpense Report example, it may be important to display the company's expense
policy and guidelines in another region o the page.
\hen a page contains multiple regions that need to work together to display
releant inormation to the user, the need to communicate between regions
becomes ery important. \hen the regions on a page share an ADl BC
application module their context will be synchronized automatically. loweer,
when the sources o data are not in the same application module, this
communication can be handled through an eent ramework called the Contextual
Lent lramework. 1he Contextual Lent lramework proides the page with the
ability to map eents that will be produced and consumed by the page's arious
regions.
OracIe ADF 11g Primer Page 7
ADF Rich CIient Components
ADl proides oer 100 components or deelopers to use to create rich user
interace pages and page ragments in lusion. 1hese components will be aailable
in a common palette within JDeeloper. 1hese components are classiied as
ollows.
Layout components
1able and tree components
LOV components
Input components
Naigation components
Output components
Query components
Data isualization components

DecIarative Component
Declaratie components combine the unctionality o multiple ADl components.
Declaratie components hae no business logic and are not data bound. An
important trait o a declaratie component is that the deeloper o the component
can hide attributes so they cannot be changed by the consumers. lor example, a
declaratie component could be created to group Okay` and Cancel` buttons,
and the deeloper can hide the label attribute so the consuming deeloper cannot
change Cancel` to Lxit`.
CONTROLLER LAYER
1he ADl Controller is a critical and necessary component to all o our web
applications. 1he controller manages the user interaction and application low that
has been deined by the deeloper in the task low.
Task FIow
1he task low is built in JDeeloper and is where the deeloper deines an
application task ,e.g. Create Lxpense Report, Lnter Budget,. 1he deinition o the
task includes the pages and logic that interact to allow a user to complete the task.
At design time, the pages and page ragments that make up a task are added to a
task low as actiities, in the case o pages and page ragments they are iew
actiities. So, when a user naigates rom one page to another within a task low,
they are transitioning rom one actiity to another. Actiities can be considered the
building blocks o the 1ask llows. 1here are other actiities besides iew actiities
that will be critical to deelopers in creating task lows. lor instance, i a deeloper
wanted to hae both Lnter Lxpense Line page and Update Lxpense Line page as
OracIe ADF 11g Primer Page 8
iew actiities in their task low and hae an initial actiity that would make the
decision as to what iew actiity to display to the user, they would add a dierent
type o actiity to their task low called a router actiity. A router actiity ealuates
a declaratie case statement and determines where to route the control low next.
1here are two types o task lows in lusion, bounded and unbounded task lows.
Both are described in more detail below.
Bounded Task FIow
Bounded task lows are one o two types o task lows and hae speciic
unctionality that has been added to support transactions and reuse. Bounded task
lows are the only type o task low that can be used as a region in a page. Most
application task lows will be bounded task lows because o the additional eatures
to support transactions. Some o those eatures include:
\ell-deined boundary with a transaction beginning and end
Single entry point and zero or more well-deined exit points
Memory scope ariables, called pagellowScope ariables, or passing data
between actiities within the task low
Declaratie support or transaction management
Able to begin a new transaction upon task low entry
Able to commit or rollback upon task low exit
Declaratie support or back button naigation
Able to pass input parameters rom the task low caller to store within the
pagellow scope
Able to return alues back to task low caller upon exit
Unbounded Task FIow
An unbounded task low contains actiities similar to a bounded task low, but
does not contain the well-deined boundary o a bounded task low nor a single
entry point. Unbounded task lows cannot be parameterized or deine transactional
and reentry characteristics, hence they are not able to be used within a page as a
region. Unbounded task lows are not callable rom BPLL and are not securable
objects. 1hereore, the unbounded task low will be used in a dierent way by
applications than the bounded task low. lor example, the Create Lxpense Report
task would be implemented as a bounded task low so that it could be used within a
region o a page. 1he page that contains the entire user interace with the header,
worklist and expense report task also needs to reside in a task low. 1his is likely
where the unbounded task low will it in. It is likely that this application page will
be added to the unbounded task low as a iew actiity and be callable rom the
menu naigation ia this unbounded task low.
OracIe ADF 11g Primer Page 9


Note, each web application will only hae one unbounded task low. 1hese may be
deined at design time across one or more indiidual physical iles. loweer, at
runtime these iles will be merged and loaded as one unbounded task low. Also,
unlike the bounded task low that has a single entry point, the iew actiities o an
unbounded task low can be set to bookmarkable so that you may hae a
bookmarkable URL to the application page reerenced by the iew actiity.
Task FIow TempIate
1ask low templates proide the ability to capture common task lows and behaior
or reuse across many dierent bounded task lows. 1wo mechanisms will be
proided: reuse by copy and reuse by reerence. Lxception handling is an area
where deelopers may make use o task low templates.
MODEL LAYER
1he model layer proides access to data as well as business logic implementation.
In lusion the model layer is comprised o two important sub components. 1he
irst is the databinding acility that connects the iew layer to the data and business
serices layer. 1his databinding acility is called the data control and is the main
component o ADl Model. 1he second is the business serices layer. Application
Module and ADl Business Components are the key components o the business
serices layer that are connected to the iew layer by the data control. 1his
separation allows or other business serices to be called or or the data access and
business serices to be implemented ater creation o the iew layer.
OracIe ADF 11g Primer Page 10

ModeI
Data ControI
Data controls proide or the ability to create data bound pages and page
ragments. 1hese data controls can be backed by many business serices such as
XML iles, \eb Serices or ADl Business Components. Data controls are created
in JDeeloper just like other common deinitions. loweer, to ease
implementation, when you build an application module in JDeeloper a
corresponding data control is automatically created or you or use within your
pages. 1o build your data bound pages, you simply drag and drop your data
control rom the data control pallette onto your page.
PIacehoIder Data ControI
Placeholder data controls can be used to create pages and page ragments in a UI
irst deelopment approach , where the data sources are connected ater the pages
hae been built.
Business Services
ADl-Business Components will be the main source o data access and business
logic in lusion applications. ADl Business Components, or ADl BC, includes the
ollowing key objects:
AppIication ModuIe
An Application Module is the transactional component that UI clients use to work
with application data. It deines an updateable data model and top-leel procedures
OracIe ADF 11g Primer Page 11
and unctions ,called serice methods, related to a logical unit o work related to an
end-user task. Application Modules contain View Objects.
1o simpliy application integration, you can enable a serice interace on any
Application Module. 1he serice interace is a programmatic API allowing third-
party applications to ind, create, update, and delete business inormation using
standard web serices protocols. All o the business alidation rules encapsulated in
your Lntity Objects are automatically enorced through this programmatic
integration API as well.
View object
A View Object represents a SQL query and simpliies working with its results.
SQL is used to join, project, ilter, sort, and aggregate data into exactly the "shape"
required by the end-user task at hand. 1his includes the ability to link a View
Object with others to create master,detail hierarchies. \hen end users modiy data
in the user interace, View Objects collaborate with Lntity Objects to consistently
alidate and sae the changes.
lor the UI layer, new View Objects and Application Modules will be created to
support the UI and the task lows.
Entity object
An Lntity Object represents a row in a database table and simpliies modiying its
data by handling all DML operations. It can encapsulate business logic or the row
to ensure business rules are consistently enorced. Lntity Objects can be associated
with others to relect relationships in the underlying database schema to create a
layer o business domain objects to reuse in multiple applications.


ADF 11 Primer
ApriI 2007
Author: Laura AkeI
Contributing Authors:

OracIe Corporation
WorId Headquarters
500 OracIe Parkway
Redwood Shores, CA 94065
U.S.A.

WorIdwide Inquiries:
Phone: +1.650.506.7000
Fax: +1.650.506.7200
oracIe.com

Copyright 2007, OracIe. AII rights reserved.
This document is provided for information purposes onIy and the
contents hereof are subject to change without notice.
This document is not warranted to be error-free, nor subject to any
other warranties or conditions, whether expressed oraIIy or impIied
in Iaw, incIuding impIied warranties and conditions of merchantabiIity
or fitness for a particuIar purpose. We specificaIIy discIaim any
IiabiIity with respect to this document and no contractuaI obIigations
are formed either directIy or indirectIy by this document. This document
may not be reproduced or transmitted in any form or by any means,
eIectronic or mechanicaI, for any purpose, without our prior written permission.
OracIe is a registered trademark of OracIe Corporation and/or its affiIiates.
Other names may be trademarks of their respective owners.