OA Framework
Sameer Saxena
Copyright © Oracle Corporation, 2001. All rights reserved.
Preface
•
•
•
•
About a Web Based Application.
MVC Pattern
Mapping to OA Framework
Demo
– Hello World
– Customer Search
– LOV
• OA FWK 5.10.C ( overview )
1-2
Copyright © Oracle Corporation, 2002. All rights reserved.
Design and Development Process
• Define JRAD/AOL metadata
• Create OAController objects
• Design and generate BC4J components
1-3
Copyright © Oracle Corporation, 2002. All rights reserved.
Architecture Overview
• BC4J - Java business components for representing
business logic
• AK - Declarative data for UIX
– Resides in database
• JRAD – Declarative data for UIX
– Resides in XML files
1-4
Copyright © Oracle Corporation, 2002. All rights reserved.
Model / View / Controller
Design Pattern
OA
Controller
AK
Repository
UIX
Beans
BC4J
XML
BC4J
Classes
JRAD
Repository
View
1-5
Copyright © Oracle Corporation, 2002. All rights reserved.
Model
OA Framework 5.6 / JRAD M2.5
Apps
Tools
Middle Tier
URL=OA.jsp?regionid=myPageRegion
OACore
JSP
HTML
Marlin
Renderers
Apache
Engine
Web Beans
• Create WebBeans
• Cache AK Data
• Customization Layering
• Instantiate AM’s, VO’s,
...
• Update VO’s
•Handle Events
- ProcessRequest
- ProcessFormData
- ProcessFormRequest
• Error Handling
Custom
Apps Code
AOL/J
Menu, Flex Fields, User,
Responsibility
UI Metadata
BC4J
• Query Data
• Dynamic UI Manipulation
• Task specific validation
• Error Handling
• Page Flow
1-6
Copyright © Oracle Corporation, 2002. All rights reserved.
FND
AK
OA Framework 5.7 / JRAD M3
Apps
Tools
Middle Tier
URL=OA.jsp?regionid=myPageRegion
JSP
HTML
Marlin
Renderers
Apache
Engine
Web Beans
OACore
• Create WebBeans
• Cache AK Data
• Customization Layering
• Instantiate AM’s, VO’s,
...
• Update VO’s
•Handle Events
- ProcessRequest
- ProcessFormData
- ProcessFormRequest
• Error Handling
Custom
Apps Code
AOL/J
Menu, Flex Fields, User,
Responsibility
JRAD
UI Metadata
MDS
• Caching
• Customization
• Translations
BC4J
• Query Data
• Dynamic UI Manipulation
• Task specific validation
• Error Handling
• Page Flow
1-7
FND
Copyright © Oracle Corporation, 2002. All rights reserved.
OA Framework 6.0 / JRAD M4
Apps
Tools
Middle Tier
URL=OA.jsp?regionid=myPageRegion
JSP
HTML
Marlin
Renderers
Apache
HTML Page
Engine
Web Beans
JRAD
• Create WebBeans
• Cache AK Data
• Customization Layering
• Instantiate AM’s, VO’s, ...
• Update VO’s
•Handle Events
- ProcessRequest
- ProcessFormData
- ProcessFormRequest
• Error Handling
Custom
Apps Code
AOL/J
Flex Fields, Responsibility
User, Menus
JRAD
UI Metadata
MDS
• Caching
• Customization
• Translations
BC4J
• Query Data
• Dynamic UI Manipulation
• Task specific validation
• Error Handling
• Page Flow
1-8
FND
Copyright © Oracle Corporation, 2002. All rights reserved.
Layered Reusability
•Each layer only “knows” about the layers below it.
•This allows reuse at any of the layer boundaries.
OAControllers
Application
Modules
View
Objects
dataflow up stack (pull)
Entity
Objects
dataflow down stack (push)
DB
1-9
Copyright © Oracle Corporation, 2002. All rights reserved.
Event Flow in OA Framework
• Two main events in OAController
– processRequest - used for HTTP GET (URL)
– processFormRequest - used for HTTP POST (Form
Submit)
• Form submits (button presses) are directed back to
the original OAController
• Several other events are available for overriding
default Framework behavior
1-10
Copyright © Oracle Corporation, 2002. All rights reserved.
HTTP GET Event Flow – Overview
1.
2.
3.
4.
5.
Get info and validate user
Fetch metadata
Validate Root AM
Instantiate BC4J and UIX objects
Walk UIX tree and call processRequest() on
controllers
6. Perform post processing for complex beans
7. UIX renders page
1-11
Copyright © Oracle Corporation, 2002. All rights reserved.
HTTP GET Event Flow
Fetch Metadata
• Check cache for metadata
• If not available go to JRAD repository
– Metadata is fetched through a separate static
connection
• At customer sites JRAD metadata will be in the
database
• Working from Jdeveloper you can work against XML
files, the database repository, or both
• Resolve personalizations against current context
1-12
Copyright © Oracle Corporation, 2002. All rights reserved.
HTTP GET Event Flow
Validate Root AM
• Instantiate the root BC4J Application Module (AM)
– AM associated with page is the root AM – holds the
connection
• Application Modules are pulled from AM pool if
available or may be new objects
– AM uses DBC info to create database connection (or
reuse existing connection)
• Validate session on root AM
• Validate function associated with page
1-13
Copyright © Oracle Corporation, 2002. All rights reserved.
HTTP GET Event Flow
Instantiate BC4J and UIX Classes
• Convert metadata to OA bean hierarchy
– OA beans are extensions of UIX beans
• Instantiate associated BC4J objects
• Place bound values on beans that require binding
• Cache bean hierarchy on root AM
1-14
Copyright © Oracle Corporation, 2002. All rights reserved.
Structure of a Web Bean
Dictionary
BaseMutableUINode
OAStyledTextBean
_indexedChildren
Key
Value
“text”
“Hello World”
“style”
“OraTipText”
_namedChildren
_attributes
Hello World
getAttributeValue
setAttributeValue
1-15
Copyright © Oracle Corporation, 2002. All rights reserved.
HTTP GET Event Flow
processRequest()
Walk UIX tree and instantiate controller classes
Call processRequest() on controllers
• Developers can query data for the UI
(vo.executeQuery) and set programmatic properties
Perform post-processing on complex beans
• OAPageLayoutBean and OATableBean for example
• This post-processing can be initiated from
processRequest() by calling prepareForRendering()
Places data binding objects on rendering context
1-16
Copyright © Oracle Corporation, 2002. All rights reserved.
Data Binding
WebBean
_attributes
Dictionary
viewUsage
VO1
viewAttr
Attr1
OADataBound
Value
RenderingContext
getAttributeValue
(context, “text”)
text
VO1
UIX
1-17
Copyright © Oracle Corporation, 2002. All rights reserved.
HTTP Post Event Flow
processFormData
• Walk UIX tree and call processFormData() on
controllers
• Apply form data back to underlying objects
– If a primary key is defined for the object, validate that
the data is being applied to the correct object –
required for back button support
– Throw state error if data is out of synch
1-18
Copyright © Oracle Corporation, 2002. All rights reserved.
Application Module Usage
• Root AM per page or multi-page transaction
• Release (check in) the AM if going to a new page
– retainAM=Y tells Framework to maintain all AMs
– ReleaseListener can be associated to the AM for the
same purpose
Incorrect use can cause inadvertent resource leaks
• Retain AM while displaying the same page
– Use OAPageContext.releaseRootApplicationModule
to release AM in this case
1-19
Copyright © Oracle Corporation, 2002. All rights reserved.
Development Environment
• JDeveloper (currently on NT) A complete EditCompile-Deployment IDE tool.
–
–
–
–
–
1-20
BC4J Wizards
JRAD plugin for metadata
Java and XML code
JRAD previewers
Development time testing with OC4J
Copyright © Oracle Corporation, 2002. All rights reserved.
JDeveloper Installation
http://incq187sc.idc.oracle.com:9090/admin/OIE/LocalJdevel
operSetUp.htm
1-21
Copyright © Oracle Corporation, 2002. All rights reserved.
Lets try it out….
• Hello World
• Customer Search
• LOV
1-22
Copyright © Oracle Corporation, 2002. All rights reserved.
FWK 5.10 C
Whats New ?
–
–
–
–
1-23
Advanced Tables
PPR ( Partial Page Refresh )
State Persistence Model (Passivation)
Personalization
Copyright © Oracle Corporation, 2002. All rights reserved.
Advanced Tables
Steps to declaratively implement Advance Table Bean :• To define a table, create a new region and set its Region Style
property to advancedTable.
• Properties on the new advanced table region :
– Width - Set the width of the table in pixels or as a percentage (by including
the percent symbol '%' after the value.) If you set the Width to 100%, the
Next and Previous links that allow you to navigate among the rows in a
table, remain visible above the table, without horizontal scrolling. This is
especially useful when you have a wide table that requires horizontal
scrolling.
– Empty Table Text - Specify alternate text that you want to display if the
table is empty. The default is "No data exists".
– Banding Type - Specify the type of banding for the table: noBanding,
columnBanding, or rowBanding. The default is noBanding.
– Banding Interval - If you specify row or column banding, you can specify a
number to indicate the banding interval. The default is 1. As an example, if
you specify rowBanding and the banding interval is 1, the table displays
an alternating gray band across every other row.
1-24
Copyright © Oracle Corporation, 2002. All rights reserved.
Steps to declaratively implement Advance Table Bean :• In the OA Extension Property Inspector, set the following optional
properties on the column containers
– Total Value -Set this property to True to enable totalling on this column.
– No Wrap - Specify whether the column content can wrap.
– Banding Shade - Specify whether column banding should be dark or light
in appearance.
– Alignment - Specify whether the column content alignment is textFormat
(Start), iconButtonFormat (Center), or numberFormat (Right). The default
alignment is textFormat.
– Grid Displayed - Specify whether the grid line to the left of the column
should be displayed.
– Width - Specify the width of the column in pixels or percentage.
1-25
Copyright © Oracle Corporation, 2002. All rights reserved.
Steps to declaratively implement Advance Table Bean :• Set the following common properties for all leaf items of a column:
– View Attribute- Enter the name of the view object attribute that provides
data for this column. The attribute should come from the same BC4J view
object specified for the advancedTable region.
– Read Only - Set this property to False if you want the column to be
updateable.
– Prompt - Set this property to display the prompt text for the leaf item if
the leaf item is a child of a container region that represents a composite
column. If the leaf item is not under a container, then this Prompt property
is ignored, because the prompt text in this case is derived from the
sortableHeader web bean.
1-26
Copyright © Oracle Corporation, 2002. All rights reserved.
1-27
Copyright © Oracle Corporation, 2002. All rights reserved.
1-28
Copyright © Oracle Corporation, 2002. All rights reserved.
Event Handling
The various table events are:
• Navigation - user selects the Next or Previous link to
navigate between different ranges of rows.
• Sorting - user selects a beveled column heading to sort
that column in ascending or descending order.
• Insertion of a new row - user selects the Add Another
Row button.
• Recalculate column Total - user selects the Recalculate
button to update the column total.
• Detail Disclosure - user selects the Hide or Show link to
collapse or expand the detail disclosure region.
• Table Control - user selects the Action/Navigation button
in the table Control bar.
1-29
Copyright © Oracle Corporation, 2002. All rights reserved.
Event Parameters
•SOURCE_PARAM - indicates the source of the event that is
generating the current browser request. This maps to the name
attribute of the web bean.
•EVENT_PARAM - indicates the event generated by a web bean (a
table, in this case). The possible events generated by a table are:
– GOTO_EVENT - when 'Next' or 'Previous' navigation links are
selected
– SORT_EVENT - when a column header is selected to sort that
column
– HIDE_EVENT - when the 'Hide' link of a detail disclosure is selected
– SHOW_EVENT - when the 'Show' link of a detail disclosure is
selected
– ADD_ROWS_EVENT - when the 'Add Another Row' button is
selected
– UPDATE_EVENT - when the total row 'Recalculate' button is selected
1-30
Copyright © Oracle Corporation, 2002. All rights reserved.
Event Parameters
•VALUE_PARAM - indicates a value that is relevant to a particular
event:
– When a detail disclosure Hide/Show is selected, the value parameter
contains the row index corresponding to the row whose Hide/Show
was selected.
– When the 'Next' or 'Previous' link of table navigation bar is selected,
the value parameter contains the index of the first row of the current
range. For example, when the row range 1-10 is displayed, the value
is 1 and when the row range 11-20 is displayed, the value is 11.
• SIZE_PARAM - indicates the number of rows currently displayed
in the table (relevant only to the navigation event).
•STATE_PARAM - indicates the current sort state (ascending or
descending) of the column on which sorting is invoked (relevant
only for the sort event).
1-31
Copyright © Oracle Corporation, 2002. All rights reserved.
Example to check for the "Add Rows" event:
If
(SOURCE_PARAM.equals(pageContext.getParamet
er(tableBean.getName()))
&&
ADD_ROWS_EVENT.equals(pageContext.getParame
ter(EVENT_PARAM)))
{
// your code comes here
...
}
1-32
Copyright © Oracle Corporation, 2002. All rights reserved.
Row Headers
To implement a row header, you
need only specify a value for the
Row Header View Attribute
property on the advancedTable
region in OA Extension
1-33
Copyright © Oracle Corporation, 2002. All rights reserved.
Column Span
You can use column span when you have a need to display
a column that contains "children" columns. A column span
is implemented in OA Extension as a columnGroup
container. A columnGroup can contain columns and other
columnGroups and encapsulates only the column header
and column header data for the columnGroup, and not for
the columns and columnGroups under it.
1-34
Copyright © Oracle Corporation, 2002. All rights reserved.
1-35
Copyright © Oracle Corporation, 2002. All rights reserved.
Steps to implement the column span :Step 1: Select the advanceTable region and choose New > columnGroup from the
context menu. Select the sortableHeader for this columnGroup and specify a
value for its Prompt property.
Step 2: Select the columnGroup you just created and choose New >
columnGroup from the context menu to create the next level of columns that
represent the seasons. Select the sortableHeader for this columnGroup and enter
the value Fall for its Prompt property (TWICE). Select the sortableHeader for this
columnGroup and enter the value Spring for its Prompt property.
Step 3: Select the columnGroup you created for 'Fall' in Step 2 and choose New >
column from the context menu. Select the sortableHeader for this column and
enter the value Sep for its Prompt property. Repeat for the other two months in
the 'Fall' columnGroup. Repeat this entire step to similarly create columns for
each month in the 'Spring' columnGroup.
Step 4: Select the advanceTable region and choose New > column from the
context menu. Select the sortableHeader for this column and specify a value for
its Prompt property. In the figure above, the value for the column without column
span is also set to Column Header.
1-36
Copyright © Oracle Corporation, 2002. All rights reserved.
Other New features in 11.5.10.C & 11.5.10.D
• Adding Rows (Available in 11.5.10D)
•Totalling (Available in 11.5.10D)
• Detail Disclosure
• Table-in-Table (Available in 11.5.10D)
( Formatting a Table , Full Table Formatting ,
Formatting , Row Formatting )
1-38
Column
Copyright © Oracle Corporation, 2002. All rights reserved.
Adding Rows
1-39
Copyright © Oracle Corporation, 2002. All rights reserved.
Detail Disclosure
1-40
Copyright © Oracle Corporation, 2002. All rights reserved.
1-41
Copyright © Oracle Corporation, 2002. All rights reserved.
1-42
Copyright © Oracle Corporation, 2002. All rights reserved.
Table-in-Table
1-43
Copyright © Oracle Corporation, 2002. All rights reserved.
FWK 5.10 C
Whats New ?
–
–
–
–
1-44
Advanced Tables
PPR ( Partial Page Refresh )
State Persistence Model (Passivation)
Personalization
Copyright © Oracle Corporation, 2002. All rights reserved.
Enhanced
Partial Page Refresh (PPR)
Developers can now declaratively enable PPR events
for selected components. For example, you can:
• Configure the selection of a poplist to cause related fields
to render, be updateable, be required or be disabled based
on the selected value.
• Configure the value change of a text field to set related
field values.
•Configure the selection of a master table's singleSelection
radio button to automatically query and display related rows
in a detail table.
The following components support developer-configured PPR events:
resetButton, link, singleSelection, messageCheckBox, messageTextInput,
messageChoice, button, selectionButton, submitButton
1-45
Copyright © Oracle Corporation, 2002. All rights reserved.
Support for Transaction Undo {5.10C}
The BC4J Transaction Undo feature lets you roll back
transaction data cached in middle tier BC4J objects to a
given snapshot (similar to the database rollback to
savepoint operation). This feature is currently recommended
for any use case where you initate a sub-transaction that
you want to be able to cancel without affecting the primary
transaction.
For example, if you allow a user to create a new item while creating a
purchase order, the user probably wants the ability to cancel the item
creation without losing all her work to create the purchase order.
1-46
Copyright © Oracle Corporation, 2002. All rights reserved.
… Queries….
1-47
Copyright © Oracle Corporation, 2002. All rights reserved.
Thank You ….
1-48
Copyright © Oracle Corporation, 2002. All rights reserved.