getting started with adf 11g - amis technology blog · pdf filegetting started with adf 11g...
TRANSCRIPT
Getting Started with ADF 11g
Getting started with ADF 11g
17th of November 2008
AMIS
Luc & Lucas
Getting Started with ADF 11g – 17th November 2008
Agenda
16.30 Intro JDeveloper 11g & ADF 11g
16.40 Thema 1 - RichFaces Componenten
17.00 Thema 2 - Reusability (task flows, templates)
17.20-18.15 opgave thema 1 en/of 2
18.15-19.00 Diner
19.00 Thema 3 - Declarative & Model Driven
19.20 Thema 4 - Data Visualization Components (richgraphs, maps, pivot table)
19.45 Opgave thema 3 en/of thema 4
21.00 Einde en borrel
Getting Started with ADF 11g – 17th November 2008
JDeveloper – Oracle‟s strategic IDE
XML
Web (HTML, CSS,
JavaScript)
Database
UML
Java
J(2)EE
TopLink/EclipseLink
ADF
With FMW 11gR1
SOA
WebCenter
Oracle Data Integrator
Application Life Cycle
Management
BPM?
CEP?
Getting Started with ADF 11g – 17th November 2008
Application Development Framework
JDeveloper 11g/ADF 11g production
Release October 8th, 2008
Browser Support: FF2, FF3, IE 7, Safari 3
• Chrome and IE 8 being tested
• Best performance on Safari, FF3 comes second
WebLogic 10.3 integrated
Application Server
Themes for ADF 11g
…
Getting Started with ADF 11g – 17th November 2008
Dogfood
Getting Started with ADF 11g – 17th November 2008
Requirements JDeveloper 11g/ADF 11g
Requirements from internal development teams
Easier entry, less steep learning curve
Higher productivity (for 8000+ not all J(2)EE hot shot
developers – many with 4GL/Forms background)
Maintainability for enterprise level applications
Team Collaboration
Rich, Web 2.0 User Experience
• Customizable per industry and organization
Enterprise 2.0 (Collaboration)
and SOA integration
Compliant with industry standards
such as J(2)EE
Getting Started with ADF 11g – 17th November 2008
JDeveloper 11g/ADF 11g
(even more) Declarative (4GL style) development
Lot of functionality can be Model driven: Complex Search
Forms, List of Values, Validations, (default) UI properties
95% no-code development
Visual Editor, Wizard and Property palette driven
High level of reusability
Page templates, Declarative Components, Task Flows &
Regions, ADF Libraries, Model based specifications
MDS (Meta Data Store) for design-time and run-time
customization
Skinning for tailor made look & feel
Getting Started with ADF 11g – 17th November 2008
ADF Faces RichClient
130+ AJAX enabled
components
Table, tree, shuttle, calendar
Splitter, Accordion, Tabs,
Detail Disclosure, Popup
Data Visualization Tags
Charts, Maps, Pivot Table, Gantt Chart, Hierarchy Viewer
Active Data Source –
Server to Client Push
Client Side actions
Drag & drop, context menu,
Popup, Show/Hide, validate
Getting Started with ADF 11g – 17th November 2008
Rich Clients though not necessarily only for Rich Customers
JDeveloper 11g (design time) is free
ADF Rich Faces will be donated to Apache MyFaces
Trinidad
ADF Controller (task flows, templates,…) is probably also to
be donated to Trinidad
Oracle considers removing the
run-time ADF license altogether
Getting Started with ADF 11g – 17th November 2008
JDeveloper 11g – the „Bulldog‟ release
Aligned with Fusion Middleware 11gR1 (H1CY2009)
Application Lifecycle Management
Tasks
Chat
Compare
Branch
Resolve
Much better
SVN integration
• And other
integrations
as well
Getting Started with ADF 11g – 17th November 2008
JDeveloper 11g – the „Bulldog‟ release
SOA Suite, ODI and WebCenter Design Time
Included again:
MDS (Meta Data Services)
Active Data Source
Hierarchy Viewer
ADF Desktop Integration
ADF Mobile
Essbase Data Control (Hyperion)
ADF to APEX Migrator
Getting Started with ADF 11g – 17th November 2008
ADF 11g – Themes for Today
RichFaces components
Web 2.0 out of the box
Reusability through Page Templates and Task Flows
Achieving reuse and common application wide look & feel
Declarative and Model Driven development
How ADF BC level definitions drive the UI
Data Visualization Tags
Library of integrated Charts, Gauges, Pivot Tables and Maps
Getting Started with ADF 11g – 17th November 2008
Agenda
Intro JDeveloper 11g & ADF 11g
Theme 1 - RichFaces Components
Thema 2 - Reusability (task flows, templates)
Hands-on Theme 1 & 2
Dinner
Theme 3 - Declarative & Model Driven
Theme 4 - Data Visualization Components
Hands-on Theme 3 & 4
Drinks
Getting Started with ADF 11g – 17th November 2008
Agenda
Intro JDeveloper 11g & ADF 11g
Theme 1 - RichFaces Components
Thema 2 - Reusability (task flows, templates)
Hands-on Theme 1 & 2
Dinner
Theme 3 - Declarative & Model Driven
Theme 4 - Data Visualization Components
Hands-on Theme 3 & 4
Drinks
Getting Started with ADF 11g – 17th November 2008
Page Templates
Specify the layout structure (of groups) of pages
For example: top bar, side bar, footer
Predefine placeholders for pages to inject their contents
Page can be based on template
It will provide the content for the
placeholders (seen as facets)
It can pass parameters to the
template – for example for the
title of the page or the page bread
crumb trail
Getting Started with ADF 11g – 17th November 2008
Page Page Template
<value>
Page + PageTemplate produce Result
MyTitle
MyTitle
Getting Started with ADF 11g – 17th November 2008
Page Page Template
<value>
Page + PageTemplate produce Result
TableView
TableView
Getting Started with ADF 11g – 17th November 2008
Page Page Template
<value>
Page + PageTemplate produce Result
TableView
TableView
Getting Started with ADF 11g – 17th November 2008
Page
Page Template
<value>
Changing a single template…
TableView
PageMyTitle
TableView
MyTitle
TableView
MyTitle
Getting Started with ADF 11g – 17th November 2008
Steps
Create a Page Template
Embed one or more facetRef elements for the holes to be
filled by the pages based on the template
Publish the template “API” – the input parameters it supports
Create pages based on the template
In these pages, provide content for the facets exposed by the
template
Provide values for input parameters supported by template
At any point in time:
change the template (reusing same facetRefs and parameters)
change the facet contents in any page
change template ref in a page (to template with same facets)
• Can be done dynamically
Getting Started with ADF 11g – 17th November 2008
Under the covers… in Page Template
Getting Started with ADF 11g – 17th November 2008
Under the covers… Page on template
Getting Started with ADF 11g – 17th November 2008
Purpose of Page Templates
Centrally specifying the overall structure and some of
the look & feel for all or specific types of pages
For detailed look & feel, use Skins
Similar to Tiles (frequently used with Struts) or SiteMesh
Can also be applied dynamically, depending on some
context settings
This allows a single page to be presented in different ways to
different users or under different conditions
Page Templates make maintenance of the overall layout
structure much easier
Getting Started with ADF 11g – 17th November 2008
Page Fragments
Snippets of JSF code can be stored in separate files: .jsff
For breaking up large, unwieldy pages
For reusing those page fragments – multiple times in the same
page and/or in different pages
Page Fragments do not have their own PageDefinition –
they use the BindingContainer of their host page
To include a Page Fragment:
<jsp:include page="/fragmentX.jsff"/>
Note: using a switcher or a rendered expression on a
container element you can dynamically determine whether to
include the fragment or not
Getting Started with ADF 11g – 17th November 2008
Bounded Task Flow
Page Fragments are fairly dull things to reuse: basically
copy/paste (include) of JSF fragments
No parameter passing
No logic inside or behind fragment
No data binding associated with fragment
No steps (flow) taken within the fragment
Bounded Task Flows remedy all these limitations – and
more
Reusable in any page as an embedded region
Getting Started with ADF 11g – 17th November 2008
Introducing the Bounded Task Flow
Stand alone module of potentially multiple activities
Displaying a View
Executing Application Logic (calling managed bean)
Calling another Task Flow
Handling navigation between activities (Router)
Have their own private memory scope: pageFlowScope
Some facilities available at Task Flow level
Transaction Management (even an autonomous transaction
for the bounded task flow)
Security
Exception Handling
Save Points (to restore to) aka “Save for Later”
Getting Started with ADF 11g – 17th November 2008
Challenges addressed by Task Flows
Larger than life faces-config files and diagrams
Implementing the same or very similar functionality over
and over again
Having to add data bindings to the PageDef for a page
embedding a (reusable) region with data dependencies
Implementing before-page logic
Organizing the work on very complex pages
Organizing work on large, complex applications
Reusing multi-page (multi-step) flows
Publish parts of ADF Applications as Portlets or
reusable „boxes‟ in WebCenter applications
Getting Started with ADF 11g – 17th November 2008
Bounded Task Flow: employee-form
Reusable bounded task flow
Input Parameter employeeKey stored in
#{pageFlowScope.empKey}
MethodCall to Action
Binding SetCurrentRowWithKey ( on Employee iterator)
• Using #{pageFlowScope.empKey}
View EmployeeForm shows
current record in the Employee
iterator
employeeKey
Getting Started with ADF 11g – 17th November 2008
Using the employee-form Task Flow
Bounded Task Flow
employee-form
Consumer
DeptEmp.jspx
employeeKey
Getting Started with ADF 11g – 17th November 2008
DeptEmp with embedded Task Flow
Getting Started with ADF 11g – 17th November 2008
Steps to embed Task Flow
Drag Task Flow to the embedding page
Task Flow binding is added to Page Definition
Wire up the input parameters
Values to pass into parameters is specified in Page Definition
Set refresh condition on Task Flow binding to ensure
synchronization
Getting Started with ADF 11g – 17th November 2008
Embedded Bounded TaskFlow in Popup
Create popup empdetails with panelWindow
Move the region inside the panelWindow
Add showPopupBehavior to the table
triggerType ContextMenu, refer to popup empdetails
Getting Started with ADF 11g – 17th November 2008
Unbounded Task Flow
There is another type of Task Flow: the Unbounded Type
To be used instead of bounded task flow To use ADF Controller features not offered by bounded task flows, such as
bookmarking view activities.
When the task flow will not be called by another task flow.
When the application has multiple points of entry
When you want to bookmark more than one activity on the task flow.
An unbounded task flow cannot declaratively specify parameters.
contain a default activity (an activity designated as the first to run in the unbounded
task flow)
In order to take advantage of completely declarative ADF
Controller transaction and reentry support, use a bounded rather
than an unbounded task flow.
Getting Started with ADF 11g – 17th November 2008
Agenda
Intro JDeveloper 11g & ADF 11g
Theme 1 - RichFaces Components
Thema 2 - Reusability (task flows, templates)
Hands-on Theme 1 & 2
Dinner
Theme 3 - Declarative & Model Driven
Theme 4 - Data Visualization Components
Hands-on Theme 3 & 4
Drinks
Getting Started with ADF 11g – 17th November 2008
Declarative and Model Driven
Underlying assumptions:
What is defined in the Model is easier reused throughout the
application (and across applications)
• Compare Table Display Properties in Oracle Designer
Specifying functionality in a declarative way is more
productive than having to manually program every aspect
• And has a less steep learning curve than real programming does
Consequences
Many aspects of the View (web tier) can be specified in the
Model (business tier)
• The ViewObject becomes exactly that: an object that describes the
View – rather than a data service offered to the View
• ADF BC is more equal than other business service technologies
Getting Started with ADF 11g – 17th November 2008
Overview of new, declarative & model driven functionality
Default values specified declaratively
Rather than through an overridden Entity create() method
Effective Date ViewObjects
Like a VPD policy filtering on period
Declarative View Criteria (multiple per ViewObject)
Bind variables calculated dynamically, model side (Groovy)
ViewObjects providing static data
Like Managed Beans can, but with all benefits of ViewObjects
Shared ApplicationModule for application wide (near-)
static data
ViewObject auto-refresh when database changes occur
Getting Started with ADF 11g – 17th November 2008
Default Values for Employee Attributes
Getting Started with ADF 11g – 17th November 2008
Calculating Attributes with Groovy
Groovy Expressions can be used for the derivation of
values of Calculated Attributes
Getting Started with ADF 11g – 17th November 2008
Static ViewObject
Getting Started with ADF 11g – 17th November 2008
Static ViewObject
Getting Started with ADF 11g – 17th November 2008
Declarative Validation
New validation rule types
Collection rules: Aggregation over Child Accessors
Validate against a dynamic (VO based) list of values
Groovy Expressions for complex logic, dynamically evaluated
Validation level – Entity or Transaction (!)
Only for KeyExist en MethodCall
Conditional Execution (only fire when…)
Triggering Attributes (only fire when change in …)
Specify severity (warning or error)
Specify messages
Validate Transient Attributes
Getting Started with ADF 11g – 17th November 2008
Using Groovy for Complex Validation
Getting Started with ADF 11g – 17th November 2008
Using Groovy for Complex Validation
Other aggregate
operators:
• Count
• Max
• Min
• Avg
Note: operator
can act on
expression like
“Sal!=0?Sal:0 + Comm!=0?Comm:0”
Getting Started with ADF 11g – 17th November 2008
Declarative List of Values
Which ViewObject to select the allowable values from
Which UI style of selection component: dropdown, radio, list, list
of values
Which attributes shown in the selection component
Which searchable attribute in query form for LOV
LOVs on Reference (lookup) Attribute (that is read-only!)
Declarative Auto-Complete
for inputTextListOfValues and inputComboboxListOfValues
Declarative cascading lists
Dynamically switch UI style of selection component
Selection Component supported in ADF BC Tester
Getting Started with ADF 11g – 17th November 2008
Associate LOV with VO Attribute
Create View Accessor to associate ViewObject with
EntityObject or ViewObject
Getting Started with ADF 11g – 17th November 2008
Associate LOV with VO Attribute
Create List of Values for Attribute
Go to the Attribute
tab in the VO editor
Click on the Add List
of Values icon
Select View Accessor
Select the List
Attribute to show
Getting Started with ADF 11g – 17th November 2008
See the effect in the ADF BC Tester
On the UI Hints Tab,
specify the Display Style
See the effect in
the ADF BC Tester
Getting Started with ADF 11g – 17th November 2008
Overcoming a repeating chore
ADF BC 11g understands what you are trying to do
when you create an LOV on a read-only lookup
attribute
Getting Started with ADF 11g – 17th November 2008
List of Values on Look Up Attribute
Add Entity Usage of
Dept to EmpView
Add Lookup Attribute
LkpDname
Add View Accessor for
DeptView to EmpView
Add List of Values to
LkpDname attribute
Note: a read only attribute!
Getting Started with ADF 11g – 17th November 2008
Defining List of Values on Lookup Att
On Attribute tab for LkpDname in ViewObject EmpView
Click on the Add List of Values icon
Select Dname as List Attribute
List Return Values is populated automatically:
LkpDname Dname
Deptno Deptno
Getting Started with ADF 11g – 17th November 2008
List of Values on read only attribute
Getting Started with ADF 11g – 17th November 2008
ViewCriteria – “Views on Views”
A ViewCriteria specifies a filter applied to a ViewObject
This filter can contain „fixed filter expressions‟ and „bind
variable based expressions‟
Bind Variables can have values derived from (Groovy)
Expressions
A ViewCriteria can be
specified in a ViewAccessor
• Drive LOV
• Do List validation
used to base a
Query Form on
Getting Started with ADF 11g – 17th November 2008
Create a ViewCriteria
ViewCriteria is
“named query”
One or more
Groups of
Criteria Items
Each links an
attribute to an
operator and a
value (literal) or
bind variable
Can filter „in
memory‟
Getting Started with ADF 11g – 17th November 2008
Model driven Query Form
Model can specify (through ViewCriteria):
Which search fields to display
Which (hidden) criteria to apply
Which operators to use for search fields
Whether to auto-query
Which „saved searches‟ the user can choose from
To show „Match All‟ and „Match Any‟ toggle
Whether a ViewCriteria is part of Basic or Advanced search
Whether the user can specify custom operators
Getting Started with ADF 11g – 17th November 2008
Specify Model based UI Hints to influence the Query Form look & feel
Getting Started with ADF 11g – 17th November 2008
Create Query Form from ViewCriteria
Create Query
Form (& result table)
by dragging
ViewCriteria to the
page
Run the page to see the query form in action
Getting Started with ADF 11g – 17th November 2008
Model Driven Query– Advanced Mode
User picked operators
Add search items at run
time
(add) Saved Searches
Basic/Advanced Mode
toggle
LOVs on Search Items
Defaults for search items
Getting Started with ADF 11g – 17th November 2008
Filter the Declarative List of Values
We want List of Values on Employees for Mgr attribute
Requirement to filter the list:
The current employee should not be in the list (as you cannot
be your own manager)
Only employees in the same department qualify as manager
Create ViewCriteria on EmpView
Bind variables excludeEmpno and requiredDeptno
Create ViewAccessor to the View and that ViewCriteria
from the View that will have the LOV
The ViewAccessor also specifies values for the binds
Create LOV for Mgr attribute, linked to ViewAccessor
Getting Started with ADF 11g – 17th November 2008
Specify View Criteria on EmpView
ViewCriteria on EmpView for Candidate Managers
Not the
empno
In the
deptno
Two bind
variables
Getting Started with ADF 11g – 17th November 2008
Create View Accessor for EmpView
Getting Started with ADF 11g – 17th November 2008
Refine ViewAccessor: link ViewCriteria
Select the ViewCriteria to access
Specify
values
for Bind
Variables
Getting Started with ADF 11g – 17th November 2008
LOV for Mgr Attribute in EmpView
Getting Started with ADF 11g – 17th November 2008
List of Qualifying Managers
The list on the Mgr attribute depends on Empno and
Deptno context
Getting Started with ADF 11g – 17th November 2008
Cascading Lists
One List depends on another: selecting a value from
one list filters the values in the other
For example: Continent => Country, Car Make => Model
Easy to implement:
Country Attribute is linked to List of Values using Country
ViewAccessor that takes the Continent Attribute as the value
• for bind variable bind_continentId (that filters CountriesView)
Continent field has autoSubmit=“true”
Country field has partialTriggers=“ContinentField”
1. change
2. refresh
Getting Started with ADF 11g – 17th November 2008
Agenda
Intro JDeveloper 11g & ADF 11g
Theme 1 - RichFaces Components
Thema 2 - Reusability (task flows, templates)
Hands-on Theme 1 & 2
Dinner
Theme 3 - Declarative & Model Driven
Theme 4 - Data Visualization Components
Hands-on Theme 3 & 4
Drinks
Getting Started with ADF 11g – 17th November 2008
Time for a drink…