Вы находитесь на странице: 1из 59

<Insert Picture Here>

Oracle Application Development Framework:


Oracle Fusion Applications Teams' Best Practices
Steve Muench
Oracle ADF Development Team
Best Practices Categories

Applications (Infra)Structure
View/Controller
Task Flows
List of Values (LOV)
Miscellaneous
Services
Performance
APPS (INFRA)STRUCTURE
Fusion Applications: Size of the Effort

~2500 developers, product managers, QA engineers


~ 3500 ADF libraries
“Model” ADF libraries contain ADFbc components (EO/VO/AM)
“UI” ADF libraries contain task flows, page defs, jsff, etc.
~ 200 SAR composites
1:1 between ADF library and JDeveloper project
1:1 between SAR composite and JDeveloper project
~ 40 workspaces ( == applications)
"SUPERWEB" projects aggregate many view/controller
projects into a single web context root via ADF libraries

© 2006 Oracle Corporation – Proprietary and Confidential


Continous Integration and the Build Loop
Detect Modification
(Transaction Merge)

Create
Label Oracle ADE
Custom
Publish
Publish Automation
Label
Results Infrastructure Schedule
Build

Schedule
LRG Test Run

ANT(build.xml)

BuildFarm
ojdeploy
Create Build Plan by Extracting Dependency Graph
from JDev Deployment Profile Discovery

Build.xml

Reference using ANT filesets JWS


JPR JPR
EAR WAR JAR
Execute Profiles
in OJDEPLOY

© 2006 Oracle Corporation – Proprietary and Confidential


Building and Testing Mechanics

 ojdeploy
 Enables automating use of JDeveloper deployment profiles
 ojserver
 Custom enhancements to use ojdeploy in a build farm
 Designed to be clusterable for scalability
 Centralized build reporting and summary
Dependency Aware JUnit TestRunner
TestRunner modeled after an osgi container
If it runs in JDev, it should be able to run on the test farm
LRG registration in build.xml files
Teams register LRGs to make them visible to the build farm
Fusion Applications: Pillars and Families

CRM FSCM HCM

Financials
Supply Chain Management
Projects
Procurement
Cross Pillar Component Sharing Example

CRM HCM

CRM
Service
Remote VOs
Interface Less Frequently
Refrenced Data and EOs
Accessed and/or Updated
Via Service Interface CRM
Read-Only
Public VOs
and EOs

High-Traffic Refrence
Data Replicated

CRM DB HCM DB
Service Based Entity Objects (and View Objects)
Model AMs, UI AMs, and Service AMs

Model projects contain core business logic


EOs, VOs for Validations and Lookups, Core "Model" AM
UiModel projects contain VOs needed for task flows
Reference EOs from ADF Library, task flow specific LOV VOs
"UI" AM has UI data model, delegates to (or nests) "Model" AM
Service projects contain VOs needed for services
"Service" AM has service VOs, delegates to (or nests) "Model" AM

"Hungarian" Notation for Components and Strict Package


Naming Standard Simplifies Understanding Structure
Project Categories Used to Tame Complex
Intra/Cross-Team Dependencies
Model / UiModel
Public PublicEntity, PublicView [read-only]
PublicModel, RemoteModel, PublicService [rw]
Protected ProtectedModel, ProtectedUiModel
Private Model, UiModel, Service

UI
Public PublicUi
Private Ui
VIEW/CONTROLLER
Use Backing Beans Only When Absolutely Required

Encapsulate all model manipulation code in custom


AM and/or VO methods & invoke them declaratively
Makes your app easier to regression test
UI components with EL-bound properties
can handle many dynamic UI use cases
Router activity can address most dynamic navigation
Only code that belongs in a backing bean is…
Complex, dynamic UI component manipulation
Complex conditional navigation
Even if you require backing bean code, invoke custom
AM or VO methods using action binding
Guarantees uniform error handling
Correct Way to Reference Application Module
from Backing Bean
Wrong Way to Reference Application Module
from Backing Bean (DON'T DO THIS!)
Avoid af:table's Documented Limitations
By Avoiding Mutable Primary Keys

Use sequence-populated "surrogate" key attribute


Supplement with "natural" alternative unique key
User still has impression that they are assigning the key
Reference entity usages' key attributes are not
required to be part of the view row key
Use Dynamic Regions to Defer Region Processing
Until Actually Displayed to the User

Embedding
Regions Inside
PopUp Windows
whitepaper on
OTN explains
details
Use Click-to-Edit Tables When Possible
When rows are infrequently edited in a table, set its
editingMode property to clickToEdit
Significantly smaller response, improved performance
Approach for Dislaying AutoRefresh View Object
Data from Shared Application Module in a Table

GRANT CHANGE NOTIFICATION TO <username>


Create view object with AutoRefresh=true
Add instance to App-scope shared application module
Set dataControlUsage to use Shared Config
Use af:poll to periodically visit the server
Override processDatabaseChangeNotification()
to note system time of last VO execute query
Simple optimization avoids page refesh if data hasn't changed
Demonstration

AutoRefresh View Object in Shared


Application Module
TASK FLOWS
Use Bounded Task Flows to Organize Units of Work

Initialize using methodCall activity that invokes built-in


operation or client-exposed custom AM/VO method
Main unit of granularity for ADF Security
InvokeAction Effectively Deprecated

In 10.1.3, page initialization logic was triggered…


InvokeAction in PageDef with properly-configured
Refresh and RefreshCondition
Relied on #{adfFacesContext.postback == false}
In 11g, there is no reliable postback flag for
pageFragment/region use cases
Use task flow methodCall activities instead now
Only use case InvokeAction still works is page
definition for page in an unbounded task flow
Can use #{adfFacesContext.initialRender == true}
Understand Task Flow Transactional Semantics

transaction = requires-transaction

data-control-scope = isolated
transaction = requires-existing-transaction
data-control-scope = isolated
transaction = requires-transaction

EmpModule DeptModule
Understand Task Flow Transactional Semantics
transaction = requires-transaction

data-control-scope = isolated
transaction = requires-existing-transaction
data-control-scope = shared
transaction = requires-transaction

EmpModule
DeptModule

Use 'No Save Point' = true if savepoint not needed


Demonstration

Transactional Task Flows


The following is intended to outline our general
product direction. It is intended for information
purposes only, and may not be incorporated into any
contract. It is not a commitment to deliver any
material, code, or functionality, and should not be
relied upon in making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.
Dynamic Tab Pattern – Design Time Template
Dynamic Tab Pattern – Runtime
Demonstration

Dynamic Tab UI Shell


LIST OF VALULES (LOV)
Use LOV Combobox with Smart Filter

LOV avoids initial query when data retrieved


Smart Filter limits data fetched for dropdown
Full query only when user accesses LOV dialog
Configuring
Smart Filter
for LOV Combo
Demonstration

LOV Combox with Smart Filter


Lookout for "Reference Dname" Antipatterns
Use Case
Allow user to use the lookup field description to find the code
For example, use the Dname to select an employee's Deptno
Best Practice
Add the reference entity usage for the lookup entity (Dept)
Define an LOV on the reference Dname attribute
Updateable entity usage's foreign key (Deptno) attribute
automatically included as a return item
Antipatterns to Avoid
Don't use a transient Dname attribute that accesses a
parameterized view accessor to lookup the description
Why? Causes one additional fetch per row in the result
Don't use a readonly selectOneChoice dropdown list
Why? Fetches all rows in the lookup table to display one
MISCELLANEOUS
Use at Least One (Selectively) Required
View Criteria Item
Prevent user from
doing "blind" query
Typically includes
your indexed columns
Use a Layer of Framework Extension Classes

EntityImpl

YourOrgEntityImpl

YourAppEntityImpl
Programmatically Modifying View Criteria Before
View Object Query Executes

Override getCriteriaClause(boolean forQuery)


Modify applied view criteria and/or
view criteria items before calling super
Use to Conditionally…
Apply supplementary filtering
Assign view criteria item values
Make Your Code Activation-Safe and
Verify By Testing That It Is

Override the
passivateState() and
activateState()
methods to save and
restore private
member fields or user
session data
Test by disabling
application module
pooling
Use Datasources

Now work outside


Java EE container
(Tester, JUnit, etc.)
If You Still Decide Not to Use Datasources…
Disable auto-generation of WLS datasource module
Prefer One View Object with Many View Criteria

No longer necessary to create separate VOs


that only differ by WHERE filter
Single, consistent row structure everywhere you use
it, regardless of which criteria are applied
Apply view criteria declaratively when defining view
accessors and AM data model instances
Prefer Declarative SQL Mode View Objects

SELECT list "pruned" at runtime based on data


required on current page
A "wide" VO with joined referenced information gets
"trimmed" to exclude unreferenced tables
"Selected In Query" property determines attributes
which should never be pruned
Demonstration

Query "Pruning" Using


View Objects with Declarative
SQL Mode
SERVICES
Expose Services for Signifant
Line of Business Objects
Enable all supported operations, typically
find, get, create, update, delete, merge, processXXX
Include only necessary attributes
Use service view object to shape the data
Hide individual attributes from the Service Data Object (SDO)
Target coarse-grained custom operations
Include nested child data using view linked VOs
Automatic if defined by composition (e.g. Headers, Lines)
Manual using custom property on association or view link
SERVICE_PROCESS_CHILDREN=true
Include alternate unique key if appropriate
Define LOVs on reference lookup attributes
Fine-Tuning Service Behavior

FindCriteria on find() method


Control exactly which attributes are returned
Use FetchSize and FetchIndex to "page" through data
ProcessControl on processXXX() method
ReturnMode: Full, Key, None
ExceptionReturnMode: Full, Key, None
Use AttributeList to avoid built-in lookup/apply
Use ServiceFactory to get Proxy
Demonstration

Service Interface
PERFORMANCE
Use Bind Variables

Literal Criteria turned into temp bind variables so you


don't have to create them yourself in view criteria
unless you need to populate their value in a view
accessor.
When you do use bind variables, be aware of the
"Ignore Null Values" setting since null bind variables
will then cause all rows to be queried
Always Consider Setting Appropriate Fetch Size
(Default FetchSize is One [1] Row)
25 good default for VOs used by table in UI
For batch processing can be higher
JDBC allocates memory for fetchSize x memory for one row,
so don't make it arbitrarily large
Can be set declaratively on…
View objects instances in AM data model editor
View accessors
To set fetch size on system-created…
View link accessor view object,
override ViewObjectImpl.createViewLinkAccessorVO()
Association accessor view object,
override EntityImpl.createAssociationAccessorVO()
Other Performance Tips

Use one data control (i.e. root AM) per page


Use nested AMs instead of separate root AMs
Exception for DataControlScope = isolated
Case-Sensitive View Criteria Items Need Indexes
CREATE INDEX idxname ON UPPER(DNAME)
Don't call getRowCount() since it fetches all rows
Use getEstimatedRowCount() Instead
Enable lazy loading of component metadata
jbo.load.components.lazily = true
Avoid Using List Validator for Large Lists
Fetches all rows, use 20 or 30 max
Consider Key Exists validator against view accessor instead
Learn More at OOW and Oracle Develop
Related Sessions and Hands-on Labs:
Date Session

Tue 5:30pm Ensuring Reusability in Oracle ADF: Designing for Data Model and Component Reuse
(Golden Gate 3)
Wed 1:00pm ADF Methodology Group Meeting (Moscone West, 3rd Floor, Overlook 1)

Oracle JDeveloper and ADF at the Demoground


Moscone West - W-114, W-116, W-109
ADF day at OOW Un-conference
Wed 9:00-5:00 Moscone West – Overlook 1
Win a Wii – visit Oracle Usability pod
In the Oracle Develop lobby
More Information on Oracle JDeveloper

http://oracle.com/technology/jdev
<Insert Picture Here>

Tutorials and How-To’s


Samples
Demos
Books and Training
Discussion forum
Blogs
More…
Middleware Lounge
At the Marriott Hotel

Free Amazon Web Services access


$35 credit for development time Workshops Daily
Daily workshops: “Developing in the Cloud” In the Middleware Lounge
Q&A with Amazon representatives and other experts • Daily, 11:30 AM
Introduction to Amazon Web
Services
• Monday 2:00 PM
Internet access Developing with WebCenter and
Oracle Content Management in
Wireless access Amazon Web Services
SunRay machines also provided • Tuesday 2:00 PM Developing with
WebCenter and Oracle Content
Recharging stations for your phone or laptop Management in Amazon Web
Services
• Wednesday 2:15 PM Developing
Free food and beverages with Oracle SOA Suite in Amazon
Web Services
Live Twitter feeds and blog updates
• Thursday 2:30 PM Developing
Watch keynotes and featured sessions while relaxing, with Oracle SOA Suite in Amazon
recharging, and checking email Web Services

Вам также может понравиться