Professional Documents
Culture Documents
Instructor Guide
Table of Contents
OAF Workshop - OAF Overview .................................................................................................................. 1-1
Oracle Applications Framework Workshop.................................................................................................. 1-2
Objectives ..................................................................................................................................................... 1-3
OA Framework Overview............................................................................................................................. 1-4
OA Framework Philosophy .......................................................................................................................... 1-5
Unified Platform for All Applications .......................................................................................................... 1-6
Physiology of an Application........................................................................................................................ 1-7
Technology Stack Overview ......................................................................................................................... 1-10
Functional Features ....................................................................................................................................... 1-11
Functional Features Core Services................................................................................................................ 1-12
Functional Features UI Services ................................................................................................................... 1-13
Functional Features Model Services ............................................................................................................. 1-18
Functional Features Standards Support......................................................................................................... 1-20
Functional Features Declarative MVC Architecture..................................................................................... 1-21
Business Benefits .......................................................................................................................................... 1-22
Schedule........................................................................................................................................................ 1-25
The Future..................................................................................................................................................... 1-27
The Future OAF Platform Available to Customers....................................................................................... 1-28
The Future Advanced Interactivity ............................................................................................................... 1-29
The Future Service Bean (EJB) Data Source ................................................................................................ 1-30
The Future Integration with BI Beans........................................................................................................... 1-31
Summary....................................................................................................................................................... 1-32
OAF Workshop - OAF Architecture............................................................................................................. 2-1
Oracle Applications Framework Workshop.................................................................................................. 2-2
Objectives ..................................................................................................................................................... 2-3
Objectives (continued) .................................................................................................................................. 2-4
Architectural Overview................................................................................................................................. 2-6
Architectural Overview Model ..................................................................................................................... 2-7
Architectural Overview View ....................................................................................................................... 2-8
Architectural Overview Controller ............................................................................................................... 2-9
Physiology of a Framework Application The Technology .......................................................................... 2-10
Physiology of a Framework Application The Technology ........................................................................... 2-14
Physiology of a Framework Application The Controller ............................................................................. 2-16
Physiology of a Framework Application The Model................................................................................... 2-21
Framework Technology ................................................................................................................................ 2-22
OA Framework Page..................................................................................................................................... 2-24
An Example of an OA Framework Page....................................................................................................... 2-25
An OA Framework Region ........................................................................................................................... 2-26
Controlling UI Behavior ............................................................................................................................... 2-28
Handling a GET Request .............................................................................................................................. 2-29
Handling a POST Request ............................................................................................................................ 2-30
The OAPageContext Object.......................................................................................................................... 2-31
Server Objects BC4J .................................................................................................................................. 2-33
Application Modules..................................................................................................................................... 2-34
Entity Objects................................................................................................................................................ 2-35
View Objects................................................................................................................................................. 2-36
Controlling Transactions............................................................................................................................... 2-37
Layered Re-use ............................................................................................................................................. 2-38
Applications Context .................................................................................................................................... 2-39
Handling a "GO" Button Press...................................................................................................................... 2-40
The Process ................................................................................................................................................... 2-41
The Controller............................................................................................................................................... 2-45
Copyright Oracle Corporation, 2002. All rights reserved.
OAF Workshop
OAF Overview
Chapter 1
Overview
Schedule:
Timing
60 minutes
Topic
Lecture
Objectives
Objectives
OA Framework Overview
OA Framework Overview
OA Framework Philosophy
OA Framework Philosophy
Physiology of an Application
Physiology of an Application
t
ha
W
do
u
yo
!
e!
se
Physiology of an Application
Physiology of an Application
ce
fa
r
s
Su n
e gio
h
t e
R
er of s
d
n hy em
U rc d It
a
ew er an
Vi Hi
A A
Physiology of an Application
Physiology of an Application
er ns
op gio
l
e e
ev f R
D
J o s
n h y te m
i
I
ith rc d
W ie r a a n
H
A
Web Server
Data Server
Oracle9iAS
HTTP Server and J2EE Container
Apache
OC4J
UI
Meta Data
Repository
Common Services
Portal
SSO
LDAP
BC4J:
UIX:
Application
Development
XML
& Java
XML
& Java
for data modelFramework
&
for user interface
Business Logic
OA Controller:
Oracle9i
JDeveloper
Java for flow and action events
Applications
Schema
Functional Features
Functional Features
Core Services
UI Services
Model Services
Standards Support
Declarative MVC Architecture
Functional Features
Core Services
Session Management
Authentication
Security
Logging & Auditing
Diagnostics
Functional Features
UI Services
Reusable UI Widgets
LOV
Table
HGrid
Tree
Train
Shuttle
Button
Tab
Choice list
Tip
Attachment
Hide/Show
Flex Field
etc.
Functional Features
UI Services
Functional Features
UI Services
Advanced UI Interactivity
Hide / Show
Smart Personalized Poplist
Partial Page Refresh (PPR)
Table Navigation, Sorting, Totaling, Row Insertion,
Detail Disclosure (row-level and cell-level)
Hide/Show Toggling
Populating LOV input
Functional Features
UI Services
Personalization Services
Multi-tiered personalizations:
Admin level:
Site, Organization and Responsibility
Single view at each level
User level
Several views per User
Just one click away personalization UI
Durable ~ survives upgrades
Portal integration / interoperability
Functional Features
UI Services
Others
Data Formatting
Dynamic date, currency and number formatting
Smart date interpretation
Printable view of a page
Export to Excel (csv format)
File upload / Attachments
Functional Features
Model Services
BC4J
Functional Features
Model Services
Passivation Services
Scalability (reclaim idle connections)
Save current state for later
Recover from failures
E
S!
UR ENT
T
FU CEM
N
HA
EN
Functional Features
Standards Support
Functional Features
Declarative MVC Architecture
Business Benefits
Business Benefits
Business Benefits
Business Benefits
Business Benefits
Business Benefits
Schedule
Schedule
Schedule
Schedule
The Future
The Future
The Future
OAF Platform Available to Customers
The Future
Advanced Interactivity
Keyboard Interaction
Speed keys & mnemonic keys
Smart cursor placement **
PPR dependent fields (remove the Go button)
Data Interaction
The Future
Service Bean (EJB) Data Source
The Future
Integration with BI Beans
Summary
Summary
OAF Workshop
OAF Architecture
Chapter 2
Architecture
Schedule:
Timing
90 minutes
Topic
Lecture
Objectives
Objectives
Objectives (continued)
Objectives
(continued)
Objectives (continued)
Objectives
(continued)
Architectural Overview
Architectural Overview
Controller
Model
View
Architectural Overview
Model
Model
Architectural Overview
View
MetaMeta-data
Flows
UI Objects
DB Objects
View
Architectural Overview
Controller
Controller
Cache
Meta Data
.XML
UIX
Bean Hierarchy
Cache
Meta Data
.XML
UIX
Bean Hierarchy
UIX
Renderers
Cache
Meta Data
.XML
UIX
Bean Hierarchy
UIX
Renderers
Cache
Meta Data
.XML
JSP/HTML
UIX
Bean Hierarchy
UIX
Renderers
Cache
Meta Data
JSP/HTML
Browser
.XML
Apply
Browser
sends
request
to
Controller
Controller
Apply
Browser
sends
request
to
Controller
1.
Controller
delegates data
processing to
Model
Controller
Apply
Model
Browser
sends
request
to
Controller
1.
Controller 2.
Controller
delegates data
processing to
Model
Determines next
page
Apply
Meta Data
Workflow
Model
Browser
sends
request
to
Controller
1.
Controller 2.
3.
Controller
delegates data
processing to
Model
Determines next
page
Invokes view to
present next
page
Apply
Meta Data
Workflow
View
Model
Application Module
(AM)
DML
Validations
Defaulting
Application Module
(AM)
.XML
Database
Tables,Views
PL/SQL
View Side
UIX
Bean Hierarchy
Framework Technology
Framework Technology
Framework Technology
Framework Technology
OA Framework Page
OA Framework Page
Header Bean
Submit button
Bean
Results table
Bean
An OA Framework Region
An OA Framework Region
Buttons
Fields
Images
Other Regions
Headers and so on
An OA Framework Region
An OA Framework Region
Controlling UI Behavior
Controlling UI Behavior
Application Modules
Application Modules
Entity Objects
Entity Objects
View Objects
View Objects
Controlling Transactions
Controlling Transactions
Layered Re-use
Layered Re-use
OAControllers
Application
Modules
View
Objects
Entity
Objects
DB
Applications Context
Applications Context
The Process
The Process
Controller
The controllers processFormRequest()
method is invoked when the GO button is
pressed.
The Process
The Process
Controller
processFormRequest() calls
initEmployeesQuery()
The Process
The Process
Controller
processFormRequest() calls
initEmployeesQuery()
Application Module
initEmployeesQuery()
Finds and instantiates
the view object
Calls the View Object
initQuery()
The Process
The Process
Controller
processFormRequest() calls
initEmployeesQuery()
Application Module
View Object
initEmployeesQuery()
initQuery()
The Controller
The Controller
State Management
State Management
Development
Deployment
OC4J
Apache / JServ
XDK 9i
XDK 2.0.2.9
JDBC 9.0.2
JDBC 8.1.7
Resources
Resources
www-apps.us.oracle.com/fwk
Tools:
JDEV_US IDE and BC4J issues
JDEVAPPS_US JRAD issues
Apps:
OACTECH_US High volume forum for all issues
around OA Framework. See archives and follow
template when posting a message.
OACNEWS_US Dedicated to news and
announcements on the tech stack
Summary
Summary
Summary (continued)
Summary
(continued)
Summary (continued)
Summary
(continued)
OAF Workshop
Early Adopter Program
Chapter 3
Schedule:
Timing
15 minutes
Topic
Lecture
Objectives
Objectives
EAP Background
EAP Background
EAP Objectives
EAP Objectives
Q1 CY2003
Approved candidates will receive:
EAP Qualifications
EAP Qualifications
OAF Workshop
Local Environment Setup
Chapter 4
Schedule:
Timing
15 minutes
Topic
Lecture
Objectives
Objectives
Pre-requisites
Pre-requisites
http://www-apps.us.oracle.com:1100/fwk/download/57/Jdev_57g_m36/
jdev903_debug.zip
Tutorial.zip
Extract Files
Extract Files
On Windows NT:
Right-click on My Computer, and choose
Properties.
Click on Advanced, then on Environment variables,
and then under User variables on the New button.
Click inside the User Variables box. For the Variable
Name field type JDEV_USER_HOME, and for the
Value field type c:\jdevhome\jdev
Click on Set, and then click the OK button to add
the new user variable.
On Windows 2000:
Right-click on My Computer, and choose Properties.
Click on Advanced, and then click on Environment
variables. Click the New button at the User
Variables box.
For the Variable Name field type
JDEV_USER_HOME. For the Variable Value field
type c:\jdevhome\jdev.
Click the OK button to add the new user variable.
Modify env.txt
Modify env.txt
Modify c:\jdevhome\jdev\myhtml\OA_HTML\env.txt
From:
FND_TOP=T:\\users\\dbc_files
JRAD_XML_PATH=T:\\users\\<YourName>\\jdev\\my
projects
JRAD_APPS=ak;fnd;dem;icx
To:
FND_TOP=c:\\jdevhome\\dbc_files
JRAD_XML_PATH=c:\\jdevhome\\jdev\\myprojects
JRAD_APPS=ak;fnd;dem
Download
http://www-apps.us.oracle.com:1100/fwk/
download/xweek/ap513dbs_dev115.dbc
To:
c:\jdevhome\dbc_files\secure
Extensibility Tutorial
Extensibility Tutorial
Summary
Summary
OAF Workshop
Personalizations and
Extensibility
Chapter 5
Schedule:
Timing
30 minutes
Topic
Lecture
Objectives
Objectives
Taxonomy
Taxonomy
Personalization
Declaratively tailoring UI look-and-feel, layout or
visibility of built-in content to suite a business
need or a user preference
Extensibility
Extending the functionality of an application:
Adding new content or business logic
Extending/overriding existing business logic
Personalization
Personalization
Personalization
Personalization
Definition
Personalization
Definition
Definition
Base Product
Page Definition
Examples of Personalization
Examples of Personalization
1. Run application
2. Enter search criteria and click on Go
3. Click on Save Search to save query
4. Create view definition
5. Execute and save personalizations
6. Review results
Extensibility
Extensibility
Flexfields
Workflow
Business Events
Extending and Creating Business Objects
New page(s)
New attribute(s)
Extend/over-ride defaults and validations
Customize page flow(s)
Use JDeveloper
IDE to create a
new page
Pass
information
between pages
through URLs
or middle-tier
state objects
Use Descriptive
Flexfields in the
traditional manner
(a) Extend the
underlying View
Object to include
more columns or to
add an additional
table
(b) Use
Personalization
Framework to
expose into the UI
New information
Use Workflow
Extend the OA Controller
Override Link Item definition
Override Function definition
Eventually workflow (and menus) will be used for navigation across transactions
while the JDev Controller will be used for navigation within a given transaction.
Visual Illustration
Visual Illustration
Enity.xml
EntityEO.java
VAM.xml
VAM.java
VVO.xml
VVO.xml
VVO.java
VVO.java
EntityExpert.java
MyEnity.xml
MyEntityEO.java
MyVAM.xml
MyVAM.java
VVO.xml
MyVVO.xml
VVO.java
MyVVO.java
MyEntityExpert
.java
Interoperability
Interoperability
Summary
Summary
OAF Workshop
Deployment
Chapter 6
Deployment
Schedule:
Timing
30 minutes
Topic
Lecture
Objectives
Objectives
Deployment Dependencies
Deployment Dependencies
FND_TOP
defines the location of the dbc file
XDisplay
XDisplay
XDisplay (continued)
XDisplay
(continued)
SSL / HTTPS
SSL / HTTPS
Apache Version
Apache Version
Apache Configuration
Apache Configuration
Apache
Apache
MinSpareServers 5
MaxSpareServers 5
StartServers 5
MaxClients 512
Diagnostics
Diagnostics
Summary
Summary
OAF Workshop
Performance and Scalability
Chapter 7
Schedule:
Timing
60 minutes
Topic
Lecture
Objectives
Objectives
Apache
On UNIX, Apache is process based (httpd), and
mods such as mod PL/SQL run within the process
address space of the httpd processes.
On Windows, Apache is multi-threaded
(Apache.exe).
Tune the number of processes and number of
clients (httpds.conf):
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 512
LogLevel warn
SSLLogLevel warn
<Directory "<physical_path_corresponding_to_the_alias_/OA_HTML/>">
#enable the generation of the Expires header for files under /OA_HTML/
ExpiresActive On
#expire images one month after last client access
ExpiresByType image/gif "access plus 1 month"
#expire stylesheets one week after the last client access
ExpiresByType text/css "access plus 1 weeks"
#expire javascript libraries one day after the last client access
ExpiresByType text/javascript "access plus 1 days"
</Directory>
Existing:
wrapper.bin=/d13/jdk/jdk1.3.1/bin/java
Change To:
Wrapper.bin=/d13/scripts/java.sh
java.sh:
=========
/d13/jdk/jdk1.3.1/bin/java -verbosegc $* >> /d2/logs/java.log
OA Framework Performance
OA Framework Performance
iExpenses Scalability
Response Time
10
9
8
7
6
5
4
3
2
1
0
Single JVM
4 JVMs
10
OA Framework Performance
OA Framework Performance
Network Traffic
Transaction
Frames App.frames
Bytes
AppTurns
TCPTurns
===============================================================================
General_Info(p1)
49
31
25,710
8
7
cc_txn(p2)
104
62
51,170
19
15
cc_txn_verify(p3)
103
69
55,770
21
16
Cash_txn_10lines
141
92
99,796
16
27
Review(p5)
116
74
77,651
13
25
Submit(p6)
47
28
20,671
9
7
Confirm_Submit(p7) 121
77
73,224
17
23
OA Framework Performance
OA Framework Performance
Middle-Tier Scalability &
Utilization
5
CPU Utilization
4
3
2
1
0
10
50
100
90
80
70
60
50
40
30
20
10
50
Users
OA Framework Performance
OA Framework Performance
Network Traffic
Page
Frames App.frames Bytes AppTurns
TCPTurns
=================================================================
PHP (List of Apps)
100
94
39,344
48
2
Applications Portal
88
72
42,476
31
6
APPS_JDBC_URL=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BA
LANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=ap201ops)(PORT=1526))(ADDRESS
=(PROTOCOL=TCP)(HOST=ap202ops)(PORT=1526)))(CONNECT_DATA=(SERVICE_N
AME=opsperf)))
Summary
Summary
OAF Workshop
Hands-on Lab
Chapter 8
The LabSolutions.jpr project contains all the code, including BC4J components and
declarative JRAD definitions, that comprise our solution to the exercises. You can run and view
our solution by expanding that project.
The solution document for this lab exercise contains explicit instructions for each step listed
below. If you need help, look for the corresponding step in the solutions document (or, if you're
working through this lab online, simply click the lesson step in this document to view the
corresponding solution). You should never have to guess at the correct implementation of an
exercise task.
The Lesson 3 Troubleshooting Guide includes common mistakes that students make with this
lab and suggests possible solutions.
Since each lesson exercise builds on the previous one, if you get stuck on this exercise and want to proceed to
Lesson 4 without finishing this one first, you can install a completed Lesson 3 exercise in your working directory. <
FOR HQ CLASS: Contact Sara Woodhull if you need this >
Warning Installing the Lesson 3 completed exercise implementation will overwrite any work
that you've done. If you want to save your Lesson 3 exercise work so you can revisit it later, we
suggest that you simply copy your jdev directory and name it something like jdev_lesson3
before unzipping the completed Lesson 3 exercise. When you're ready to resume the lab,
rename this saved directory to jdev and proceed (remember that you can have only 1 "jdev"
directory at a time).
TIP Save frequently! We remind you to do this at the end of each task, but suggest that you save
more often.
So we don't start with too big a job at once, we'll break the page construction into several discrete
tasks. For your first task, you'll build and run a page with just the "Employees" header and the
"Search" and "Results" subheaders as shown in Figure 1-1 below:
Figure 1-1: Task 1 Finished Product
Step 1.1 Create a project named TutorialLabs.jpr. This is where you'll be creating all of your work.
TIP Remember to select (Menu) Project > Show Categories for any projects you open. It is
far easier to manage and navigate a large project when the files are categorized.
Step 1.2 Modify the project settings for your TutorialLabs.jpr project as described in the Hello, World! exercise.
Step 1.3 Create an oracle.apps.dem.employee.server BC4J package for your UI-related objects.
TIP If a BC4J package already exists, you can add it to your project by opening the xml file
located at the end of the package path (for example, opening server.xml located in your
myprojects\oracle\apps\dem\employee\server directory).
Step 1.4 Create an oracle.apps.dem.schema.server BC4J package for your EO-related objects (you'll be adding
these in a later lesson).
Step 1.5 Add the predefined test_fwklabs.jsp file to your project. You'll find this file in your
jdev\myhtml\OA_HTML directory (for example if you're an Oracle Applications developer working off the central
NAP drives or Tarantella, this will be in T:\users\<your user id>\jdev\myhtml\OA_HTML).
Step 1.6 Create the root UI Application Module (AM) in the oracle.apps.dem.employee.server BC4J package
named EmployeeAM. Be sure to generate a Java file for this Application Module because we'll be adding code to
it in this exercise.
Step 1.7 Edit the root UI AM to specify the standard Applications passivation setting. Remember that the property
Name should be RETENTION_LEVEL, and the property Value should be MANAGE_STATE.
Step 1.8 Create the EmpSearchPG page and add it to the oracle.apps.dem.employee.webui package.
Warning You MUST use this name and package or your page will not run properly. In fact, if
any package, Java file or JRAD region, item names, etc. are specified in the exercise
instructions, you must match them exactly in your work.
Step 1.9 Modify the default page layout region for the EmpSearchPG page.
o
o
o
o
o
TIP When you first open the JRAD Property Inspector, the properties are listed in
alphabetical order. To organize them into meaningful categories (which we find to be
much more user friendly), select the Category icon in the Property Inspector toolbar as
shown below:
Step 1.10 Add your branding image. Use branding_tutorialapp.gif for the image. Be sure to
specify the source correctly.
Step 1.11 Add a "Search" region with the region header text set to Search. To comply with the
naming standards, please assign this region the JRAD ID SearchRN.
Step 1.12 Add a "Results" region with the region header text set to Results: No Search
Conducted (this is the default value; we'll set the post-search value programmatically later).
To comply with the naming standards, please assign this region the JRAD ID ResultsRN.
Step 1.13 Save and test your work. To run your JSP, select test_fwklabs.jsp, right-click and
select Run test_fwklabs.jsp from the context menu.
Your results should appear as shown above in Figure 1-1. (Note that, depending on
your environment's profile option settings, you might see "Personalize Region" links
throughout your page layout. This is normal and expected when a page is run in a
customizable mode. We'll learn more about this in Lesson 6. IF YOU DO SEE
PERSONALIZE LINKS -- DON'T PLAY WITH THEM AS YOUR EFFORTS AFFECT
EVERYONE IN THE CLASS).
In this section, you're going to add some region-level instruction text, two search criteria fields and a
"Go" button to your "Search" subheader region. When you're finished with this part of the exercise,
your UI should appear as shown in Figure 2-1 below:
Figure 2-1: Task 2 Finished Product
Step 2.1 Create region-level instruction text as a static styled text item. Use the predefined message
FWK_TBX_T_REGION_GENERAL (Application Short Name ICX). To comply with the naming standards, please
assign this item the JRAD ID SearchHelp and don't forget to set your CSS Class name properly for instruction
text.
TIP In Steps 2.2 and 2.3, you will need to select an attribute set in the JRAD Property
Inspector. To do this, place your cursor into the Attribute Set item property and select
the list of values button [...] to open the attribute set selection window. Click the Browse
button. In the Browse window, navigate to
/oracle/apps/fnd/framework/toolbox/attributesets and select the OK button. Finally,
select the Search button. You should now see a list of available attribute sets from
which to choose. In some cases, the attribute set list of values will not display until at
least 1 attribute set has been loaded to your project. If this happens, type the complete
Copyright Oracle Corporation, 2002. All rights reserved.
attribute set path as listed in the corresponding lab step for your first attribute set
reference. You should then be able to select additional attribute sets as described here.
Step 2.2 Create the Employee Name text input item (we'll change this to an LOV field in a later step; for now,
simply create a plain text input field). Use the attribute set
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/FullName and don't forget to set the
correct CSS Class name for a text field. Also, please assign this item the JRAD ID EmpName.
Step 2.3 Create the Employee Number text input item using the attribute set
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId, and don't forget to set the
correct CSS Class name for a text field. Also, please assign this item the JRAD ID EmpNum.
Step 2.4 Create the Go submit button item using the standard attribute set
/oracle/apps/fnd/attributesets/Buttons/Go. Verify that the prompt is set to Go, and set the JRAD ID to Go.
Step 2.5 Save and test your work. Your results should appear as shown above in Figure 2-1.
Step 3.1 Create the View Object (VO) in the oracle.apps.dem.employee.server BC4J package using the
following query. Also, be sure to generate Java files for both the View Object (we'll be adding code to this a bit
later) and the View Row (remember, for performance reasons we generate a *RowImpl.java class for every single
View Object we create regardless of whether we need to add code or not).
SELECT
emp.employee_id AS EMPLOYEE_NUMBER,
emp.full_name AS EMPLOYEE_NAME,
emp.email_address,
emp.manager_id,
emp2.full_name AS MANAGER_NAME,
emp2.email_address AS MANAGER_EMAIL,
flkp.meaning AS POSITION_DISPLAY,
emp.start_date,
emp.end_date,
emp.salary
FROM
fwk_tbx_employees emp,
fwk_tbx_employees emp2,
fwk_tbx_lookup_codes_vl flkp
WHERE
emp.manager_id = emp2.employee_id (+)
and emp.position_code = flkp.lookup_code
and flkp.lookup_type = 'FWK_TBX_POSITIONS'
Step 3.3 Add your VO to the root UI AM you created in Task 1, Step 1.6 above.
TIP Take careful note of the default View Usage name that BC4J creates when you add your
VO to the selected AM (BC4J creates this name by appending a "1" to your VO name). Leave
it or change it, your choice. In either case, know what the value is before creating your
"Results" table region in Task 4 below.
Step 3.4 Save your work. There is no need to test at this point since we haven't associated the View Object with
your UI.
In this section, you'll create the data table for your "Results" region and associate it with the View
Object you just created for this purpose. The finished region should appear as shown in Figure 4-1
below:
Figure 4-1: Task 4 Finished Product
TIP If you examine the "Results" region definition in the LabSolutions.jpr project, you'll note that
its child is a tableLayout region, and not a table. Why? The region reflects changes made in Lesson
4's exercise. For now, add your table directly to the "Results" region as described here.
Step 4.1 Add a "Results" data table based on the EmployeeSummaryVO that you created in Task 3. To do this,
select the "Results" region in the structure hierarchy, right-click and select New > Region Using Wizard from the
context menu.
TIP Whenever you need to create a new region whose items will bind to a View Object, the
"Region Using Wizard" tool is the fastest and most reliable way to do this since it ensures that
all your View Object bindings are correct.
Warning In JRAD M3.6, there is an issue that the region wizard gets confused if there are
multiple application modules with the same name, but in different packages, in a workspace
(bug #2524776). The symptom is that you may see more view objects than you have created
so far--these come from the LabSolutions project. The workaround is to remove
LabSolutions.jpr from your workspace temporarily while you use the region wizard.
o
o
o
Make absolutely sure that you DO NOT select the "Use this as Application Module Definition for this
region" checkbox in the wizard's Select a View Object for the Region page.
Set the JRAD ID to ResultsTable, and make sure you select the right item style for a data table.
Your table should include the items shown in the table below (the View Object Attribute names assume
you copied the SQL in Step 3.1 exactly). Note the JRAD IDs that you should use for these items which
include a qualifier to distinguish the "Results" employee name and number items from those we created in
SearchRN.
Finally, while you're in the Customize Properties page, change the Style of each attribute to
messageStyledText (all LOV table items should have this style).
TIP If you find the Customize Properties page in the wizard difficult to
use, you can change the attribute properties using the Property Inspector
pane after you leave the wizard.
JRAD ID
EmployeeNumber
ResultsEmpNum
EmployeeName
ResultsEmpName
PositionDisplay
PositionDisplay
ManagerName
ManagerName
Item
Prompt
Attribute Set
ResultsEmpNum
Number
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/EmployeeId
ResultsEmpName
Name
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/FullName
ManagerName
Manager
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/FullName
PositionDisplay
Position
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/Position
Step 4.4 Save and test your work. Your results should appear as shown in Figure 4-1 above, however, the LOV
icon will not display next to the Employee Name field until we configure the list of values in Task 5.
In this section, you'll create a list of values for the Employee Name field. The finished LOV should
appear as shown in Figure 5-1 below:
Figure 5-1: Task 5 Finished LOV
Step 5.1 Create a BC4J package named oracle.apps.dem.lov.server for your LOV-related objects (you will add
all the server-related LOV objects that you create in the ToolBox Tutorial labs to this package).
Step 5.2 Create an LOV Application Module named LabsLOVAM in the oracle.apps.dem.lov.server package.
Please do not generate an associated Java class as we have no code to add.
Step 5.3 Edit the root UI AM to specify the standard Applications passivation setting. Remember that the property
Name should be RETENTION_LEVEL, and the property Value should be MANAGE_STATE.
Step 5.4 Create your LOV View Object in the oracle.apps.dem.lov.server package. Please name it
EmployeeNamesVO and use the following query. Remember to generate a View Row Java class to comply with
the performance guidelines (you don't need to generate the View Object class since you won't be adding any
code).
email_address
FROM fwk_tbx_employees
WHERE end_date is null
Step 5.6 Add this LOV VO to the LOV AM you created in Step 5.2.
TIP Take careful note of the default View Usage name that BC4J creates when you add your
VO to the selected AM (BC4J creates this name by appending a "1" to your VO name). Leave
it or change it, your choice. In either case, know what the value is before proceeding.
JRAD ID
EmployeeNumber
EmpNum
EmployeeName
EmpName
EmailAddress
EmailAddress
o Make absolutely sure you don't associate an Application Module with the table region!
Step 5.10 Set the table region's item properties as follows:
o Each item should have the Style set to messageStyledText
o The user should be able to query on Employee Name and Employee Number in the LOV, but not the
Employee Email Address
o Make sure that the EmpNum item has a Number data type
o Please set the following prompts and attribute sets:
Item
Prompt
Attribute Set
EmpName
Name
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/FullName
EmpNum
Number
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/EmployeeId
EmailAddress
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/EmailAddress
Step 5.11 Modify the existing Employee Name item in SearchRN to make it an LOV text input field (you do this
by changing the Item Style to messageLovInput).
o
o
When you make this change, an inline LOV region (region style listOfValues) and a default LOV mapping
are created automatically for you.
Change the External List of Values property of this listOfValues region to
/oracle/apps/dem/lov/webui/EmployeesLovRN (again, be very careful to duplicate this text exactly
including the leading slash).
When you change this property, you will see a confirmation message asking if you want to remove the
default inline list of values. When you select the OK button to confirm the change, the inline LOV region is
removed and the new external LOV region appears in the structure hierarchy (grayed out because it is a
shared region).
Step 5.12 Define your LOV mappings to implement the following behavior: any value entered
in the Employee Name field should be used as criteria when the LOV displays (meaning it will
be used to automatically query the LOV) and it should return the LOV result to the same base
page item. Also, the Employee Number value should be returned as a result to the
Employee Number search field (this will be the second mapping).
Step 5.13 Save and test your work. Your base page (the "Employees" page) should appear as
shown in Figure 4-1 above. When you select the list of values icon, your LOV window should
appear as shown in Figure 5-1 above.
Warning You cannot run and test the LOV page directly. You must run your base page, and
then select the list of values icon to invoke the LOV.
Step 6.1 Edit the EmployeeSummaryVOImpl.java class to add an initQuery( ) method that takes the employee
name and employee number values as search criteria, determines what WHERE clause to build, binds the given
search criteria accordingly and executes a query.
o If you want to code this yourself but need an idea of how to proceed, please review
oracle/apps/fnd/framework/toolbox/tutorial/server/PoSummarySimpleExpVOImpl.java in the
Tutorial.jpr project. You can also look at our version of the lab solutions in
oracle/apps/fnd/framework/toolbox/labsolutions/server/EmployeeSummaryVOImpl.java.
o If you want to copy and paste the code without writing it yourself, please see Step 6.1 in the Lesson 3 Lab
Solution document.
o In any case, remember to add the appropriate import statements for the classes you
reference!
Warning Be particularly careful of classes like oracle.jbo.domain.Number that won't give
you a compile-time error if you fail to import the correct class because the compiler assumes
you're dealing with a java.lang.Number.
Step 6.2 Edit the EmployeeAMImpl.java class to add an initEmployeesQuery() method which will invoke the
initQuery() method in your EmployeeSummaryVOImpl.java class.
o Sample code: oracle/apps/fnd/framework/toolbox/tutorial/server/PoSummarySimpleExpVOImpl.java.
o ToolBox lab solutions code:
oracle/apps/fnd//framework/toolbox/labsolutions/server/EmployeeSummaryVOImpl.java.
o Also see Step 6.2 in the Lesson 3 Lab Solution document to copy/paste code.
Step 6.3 Create an EmployeeSearchCO controller in the oracle.apps.dem.employee.webui package and
associate it with the "Search" region.
TIP The fastest way to create a new controller and associate it with a region is to select the
region in the Structure panel, right-click and select "Set Controller > New Controller ..." from
the context menu.
Step 6.4 Edit the EmployeeSearchCO controller to override the processFormRequest() method so you can
handle the "Go" button press (which means passing the search criteria to the initEmployeesQuery() you created
in the root UI AM).
o Sample code: oracle/apps/fnd/framework/toolbox/tutorial/webui/Lesson3SearchCO.java
o ToolBox lab solutions code:
oracle/apps/fnd/framework/toolbox/labsolutions/webui/EmployeeSearchCO.java.
o Also see Step 6.4 in the Lesson 3 Lab Solution document to copy/paste.
Step 6.5 Save and test your work by selecting the "Go" button (note that your code will compile when you run it).
Your page should appear as shown in Figure 0-1 above, however, the "Results" region text will still display as
"Results: No Search Conducted."
For the final deliverable in this exercise, you'll change the default "Results: No Search Conducted"
subheader label to "Results: Employees" after a search has been performed.
Step 7.1 Edit the EmployeeAMImpl.java class to add a generic isVOQueried() method.
o Sample code: oracle/apps/fnd/framework/toolbox/tutorial/server/Lesson3AMImpl.java
o ToolBox lab solutions code:
oracle/apps/fnd/framework/toolbox/labsolutions/server/EmployeeAMImpl.java.
o Also see Step 7.1 in the Lesson 3 Lab Solution document to copy/paste.
Step 7.3 Edit the EmployeeResultsCO controller to change the "Results: No Search Conducted" default header
text to reflect the fact that a search has been conducted. We will do this by checking in the processRequest()
method whether the "Results" table's associated View Object has been queried (this will call the method we
added to our AM in Step 7.1)
o You can use the predefined message with the name name FWK_TBX_T_EMP_RESULTS_TEXT
(product short code is ICX) for the "Results: Employees" text.
o Sample code: oracle/apps/fnd/framework/toolbox/tutorial/webui/Lesson3ResultsCO.java
o ToolBox lab solutions code
oracle/apps/fnd/framework/toolbox/labsolutions/webui/EmployeeResultsCO.java.
o Also see Step 7.3 in the Lesson 3 Lab Solution document.
Step 7.4 Save and test your work by selecting the "Go" button to execute the search. Your page should appear as
shown in Figure 0-1 at the start of this lab.
Overview
For this exercise, you'll be implementing a simple "Search" and "Results" page as shown in Figure 01 below. Although this is similar to the purchase order "Search" page we studied in Lesson 3, we'll be
using a simpler entity (employees) so we can easily build on this exercise as we proceed through
subsequent lessons. Eventually, we'll add the ability to view, create and update employees.
Figure 0-1: Lesson 3 Lab Finished Product
Step 1.1 Create the TutorialLabs.jpr project. This is where you'll be creating all of your work.
o Right-click on the toolbox.jws workspace in the Navigator, and select "New Empty Project..." from the
context menu.
o Change the Directory Name field to your directory, T:\users\<your id>\jdev\myprojects
o Change the File Name field to TutorialLabs.jpr.
o Click the OK button to create your project and continue.
Step 1.2 Modify the project settings for your TutorialLabs.jpr project.
o Right-click on the TutorialLabs.jpr project in the Navigator, and select "Project Settings..." from the
context menu.
o In the Project Setting screen, choose Common > J2EE.
o Change the J2EE Web Application Name field to bb.
o Change the J2EE Web Context Root field to /.
o Click the OK button to exit Project Settings.
Step 1.3 Create the BC4J package for your UI-related objects.
Copyright Oracle Corporation, 2002. All rights reserved.
o
o
o
o
Right-click on the TutorialLabs.jpr project in the Navigator, and select "New Business Components
Package..." from the context menu to open the Business Components Package Wizard.
If the Welcome page appears, click the Next button.
Step 1 of 3: In the Package Name field enter oracle.apps.dem.employee.server. This will be the BC4J
package that contains your UI-related BC4J objects.
Click the Finish button.
Step 1.4: Create the BC4J package for your EO-related objects.
o Right-click on the TutorialLabs.jpr project in the Navigator, and select "New Business Components
Package..." from the context menu to open the Business Components Package Wizard.
o If the Welcome page appears, click the Next button.
o Step 1 of 3: In the Package Name field enter oracle.apps.dem.schema.server. This will be the BC4J
package that contains your EO-related BC4J objects.
o Click the Finish button.
Right-click the oracle.apps.dem.employee.server BC4J package in the Navigator, and select "New
Application Module..." from the context menu to open the Application Module wizard.
If the Welcome page appears, click the Next button.
Step 1 of 4: In the Name field enter EmployeeAM.
Click the Next button until you get to Step 4 of 4.
Step 4 of 4: Select the Generate Java File(s) checkbox.
Click the Finish button to create the AM.
Right-click the EmployeeAM Application Module in the Navigator, and select "Edit EmployeeAM..." from the
context menu.
Select the Properties page.
In the Name field enter RETENTION_LEVEL.
In the Value field enter MANAGE_STATE.
Click the Add button.
Click the Apply button.
Click the OK button to finish editing your AM.
Right-click on the TutorialLabs.jpr project in the Navigator, and select "New..." from the context menu.
From the New window, navigate down to Web Tier > JRAD Component > Page.
Click the OK button to continue.
In the Name field enter EmpSearchPG.
In the Package field enter oracle.apps.dem.employee.webui.
Warning You MUST use this name and package or your page will not run properly. In fact, if any
package, Java file or JRAD region, item names, etc. are specified in the exercise instructions, you
must match them exactly in your work
Step 1.9 Modify the default pageLayout region for the EmpSearchPG page.
o In the Structure pane open your EmpSearchPG page. Note that it created a region named, region1.
o Select that region, and change its properties as follows:
Property
Value
ID
PageLayoutRN
Region Style
pageLayout
Form
True
AutoFooter
True
True
Window Title
title
Employees
oracle.apps.dem.employee.server.EmployeeAM
TIP When you first open the JRAD Property Inspector, the properties are listed in
alphabetical order. To organize them into meaningful categories (which we find to be
much more user friendly), select the Category icon in the Property Inspector toolbar as
shown below:
Right-click the PageLayoutRN in the Structure pane, and select New ... productBranding from the
context menu.
Select the pageLayout Components item that was created, and change its properties as follows:
Property
Value
ID
ProdBrand
Source
/OA_MEDIA/branding_tutorialapp.gif
Value
ID
SearchRN
Region Style
defaultSingleColumn
True
Text
Search
Value
ID
ResultsRN
Region Style
defaultSingleColumn
True
Text
Value
ID
SearchHelp
Item Style
staticStyledText
Data Type
VARCHAR2
Display
True
OraInstructionText
Message Application
Short Name
ICX
Message Name
FWK_TBX_T_REGION_GENERAL
TIP In Steps 2.2 and 2.3, you will need to select an attribute set in the JRAD Property
Inspector. To do this, place your cursor into the Attribute Set item property and select
the list of values button [...] to open the attribute set selection window. Click the Browse
button. In the Browse window, navigate to
/oracle/apps/fnd/framework/toolbox/attributesets and select the OK button. Finally,
select the Search button. You should now see a list of available attribute sets from
which to choose. In some cases, the attribute set list of values will not display until at
least 1 attribute set has been loaded to your project. If this happens, type the complete
attribute set path as listed in the corresponding lab step for your first attribute set
reference. You should then be able to select additional attribute sets as described here.
Property
Value
ID
EmpName
Item Style
Attribute Set
/oracle/apps/fnd/framework/toolbox/attributesets/
FwkTbxEmployees/FullName
Data Type
VARCHAR2
Read Only
False
Display Length
40
Required
no
Display
True
Prompt
Employee Name
OraFieldText
Value
ID
EmpNum
Item Style
messageTextInput
Attribute Set
/oracle/apps/fnd/framework/toolbox/attributesets/
FwkTbxEmployees/EmployeeId
Data Type
NUMBER
Read Only
False
Display Length
15
Required
no
Display
True
Prompt
Employee Number
Copyright Oracle Corporation, 2002. All rights reserved.
OraFieldText
Value
ID
Go
Attribute Set
/oracle/apps/fnd/attributesets/Buttons/Go
Item Style
submitButton
Display
True
Prompt
Go
Step 3.3 Add your VO to the root UI AM you created in Task 1, Step 1.6 above.
o Right-click the EmployeeAM in the Navigator pane, and select "Edit EmployeeAM..." from the context
menu to edit your root AM.
o Navigate to the Data Model page.
o Select the EmployeeSummaryVO View Object in the Available Objects list and shuttle it to the Data
Model list.
o Click the OK button to finish adding your VO to your root AM.
TIP Take careful note of the default View Usage name that BC4J creates when
you add your VO to the selected AM (BC4J creates this name by appending a "1"
to your VO name). Leave it or change it, your choice. In either case, know what
the value is before creating your "Results" table region in Task 4 below.
TIP If you examine the "Results" region definition in the LabSolutions.jpr project, you'll note that
its child is a tableLayout region, and not a table. Why? The region reflects changes made in Lesson
4's exercise. For now, add your table directly to the "Results" region as described here.
o
o
o
o
o
o
o
o
o
Value
ID
ResultsTable
Region Style
table
Application Module
Definition Name
Display
True
100%
Number of Rows
Displayed
10
Item
Style
Display
Prompt
AttributeSet
ResultsEmpNum
messageStyledText
True
Number
/<base path>/EmployeeId
ResultsEmpName messageStyledText
True
Name
/<base path>/FullName
ManagerName
messageStyledText
True
Manager
/<base path>/FullName
Position
messageStyledText
True
Position
/<base path>/Position
o
o
o
o
o
o
Width
Please replace the <base path> variable in the table above with the following text:
oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees. When you do this, be VERY
careful with the slashes. For example, if we had room in the table to be explicit, the first attribute set
would be: /oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId
The ManagerName item Destination property set to mailto:{@ManagerEmail}.
Check that each item has its View Usage Name property set to EmployeeSummaryVO1 (you may need
to add the 1).
Check that each item has its View Attribute Name property set to the proper VO attribute name.
The ResultsEmpNum item Sortable property set to Ascending.
The ResultsEmpNum item Initially Sort this Column property set to first.
Change the Data Type property of the ResultsEmpNum item from VARCHAR2 to NUMBER.
Step 5.1 Create the BC4J package for your LOV-related objects.
o Right-click on the TutorialLabs.jpr project and select "New Business Components Package..." to open
the Business Components Package Wizard.
o If the Welcome page appears, click the Next button.
o Step 1 of 3: In the Package Name field enter oracle.apps.dem.lov.server. This will be the BC4J
package that contains your LOV-related BC4J objects.
o Click the Finish button.
o
o
o
o
o
o
TIP Take careful note of the default View Usage name that BC4J creates when
you add your VO to the selected AM (BC4J creates this name by appending a "1"
to your VO name). Leave it or change it, your choice. In either case, know what
the value is before proceeding.
Item
Style
EmpName
messageStyledText True
Name
EmpNum
messageStyledText True
Number
Query Prompt
AttributeSet
Please replace the <base path> variable in the table below with the following text:
oracle/apps/fnd/framework/toolbox/FwkTbxEmployees. When you do this, be VERY careful with the
slashes. For example, if we had room in the table to be explicit, the first attribute set would be:
/oracle/apps/fnd/framework/toolbox/FwkTbxEmployees/FullName
Change the Data Type property of the EmpNum item from VARCHAR2 to NUMBER.
Change the LOV Item property by selecting EmpNum field from the poplist.
Step 5.13 Save and test your work.
o Save your work ... (Menu) File > Save.
o Right-click the test_fwklabs.jsp file, and choose Run test_fwklabs.jsp from the context menu.
o Your base page (the "Employees" page) should appear as shown in Figure 4-1 above.
When you select the list of values icon, your LOV window should appear as shown in
Figure 5-1 above.
Warning You cannot run and test the LOV page directly. You must run your base
page, and then select the list of values icon to invoke the LOV.
parameters.copyInto(params);
setWhereClauseParams(params);
}
executeQuery();
} // end initQuery()
o
/*
** The following code is part of Lesson 3's exercise solution.
*/
// Pressing the Go button causes the search to be executed.
if (pageContext.getParameter("Go") != null)
{
String employeeName = pageContext.getParameter("EmpName");
String employeeNumber = pageContext.getParameter("EmpNum");
Copyright Oracle Corporation, 2002. All rights reserved.
OAApplicationModule am = pageContext.getRootApplicationModule();
Serializable[] parameters = { employeeName, employeeNumber };
am.invokeMethod("initEmployeesQuery", parameters);
// Now redirect back to this page so we can implement UI changes as a
// consequence of the query in processRequest(). NEVER make UI changes
in
// processFormRequest().
pageContext.setForwardURLToCurrentPage(null,
true, // retain the AM
ADD_BREAD_CRUMB_NO,
IGNORE_MESSAGES);
}
o
Step 6.5 Save and test your work by selecting the "Go" button (note that your code will compile when you run it).
Your page should appear as shown in Figure 0-1 above, however, the "Results" region text will still display as
"Results: No Search Conducted."
Step 7.4 Save and test your work by selecting the "Go" button to execute the search. Your page should appear
as shown in Figure 0-1 at the start of this lab.
OAF Workshop
Extensibility Hands-on Lab
Chapter 9
Lesson Goals
By the end of this tutorial, you should be able to the following:
Add additional attributes to the BC4J object that serves as the data source.
Add or change the attribute default values.
Extend (add or modify) the BC4J validation logic.
Substitute the extended BC4J object for the parent BC4J object to be used throughout the
application.
Adding additional attributes to the BC4J object that serves as the data source
In order to add additional attributes to the BC4J objects, follow these steps:
1. Analyze the page (PG) and the regions (RN's) associated with the page, to determine which
View Objects (VO's) are used. In the property inspector for the PG or RN, look at the View
Usage Name property. Also, look at the Application Module Definition Name property to
identify which Application Module (AM) the VO is contained in.
2. Once you analysis is complete, you will have the name of the VO you will extend. We will call
this the parent VO.
3. Create a new empty BC4J package to hold your Custom BC4J objects. (Note: This is created
like any other BC4J package, but we recommend putting custom into the directory path for this
package.)
4. Create an extended BC4J VO. The VO should be in the same package as the existing VO, and
you should preface the existing VO's name with CustomExistingVO. This VO is created the
same as any other VO, with the following exception. On the 1st screen of creating the VO,
there is a field labeled "Extends View Object". You will put the name of the parent VO from
which you are basing your extension.
5. After extending the new object from the parent, you can then add the new EO's that your
extended VO wishes to use.
6. Add the attribute(s) from the EO(s) to your extended VO.
7. Because this is an extended VO you set it as expert mode, and enter the SQL SELECT
statement directly. Make certain you TEST your new SELECT statement before moving to the
next step.
8. In the Java section of your VO creation, uncheck "View Object Class - Generate Java File"
checkbox. But! check the "View Row Class - Generate Java File" and "Generate
Accessors" checkboxes. (see Notes below)
9. Finish the generation of your VO.
Notes:
There is no need to have a redundant View Object Class Java file because there is no
business logic to add for this case. By default, BC4J framework will use the base View Object's
Java class. However, it is better to generate the View Row Class Java file because this class
allows BC4J framework to optimize the performance for attibute name lookup.
The Extends button in the Java section allows you to specify the super classes for the Java
files. When you extend the XML of the base View Object, the extended View Object Java
classes would extend the Java classes of the base View Object by default -- that is, the new
VOImpl would extend the parent VOImpl, and the new VORowImpl would extend the parent
VORowImpl. If you do not generate the Java files for the extended View Object, the Java files
of the base View Object will be used. However, if you press the Extends button upon View
Object creation, the super classes may not show the base View Object Java classes. But if you
see the auto-generated extended View Object Java classes after completing the View Object
creation wizard steps, you will notice that they correctly extend the base View Object Java
classes. If you then edit the View Object wizard for the extended View Object that was created,
the Java Extends button will show the correct super classes at that time. This is bug 2723937
(APPS: VO XML EXTENDS - JAVA CLASS DOES NOT SHOW CORRECT PARENT).
Copyright Oracle Corporation, 2002. All rights reserved.
In your new VORowImpl, check that there is a limited number of constants (i.e., protected
static final int variables). This number should be 1 more than the number of additional
attributes you added to your new VO. There should be 1 MAXATTRCONST and constants for
the VO attributes you added. If you see more than these three constants and if you are seeing
the parent VO' constants, you are encountering bug 2723934 (APPS: VO XML EXTENDS
PUTS IN REDUNDANT BASE VO ATTRIBUTES IN SUBCLASS ROWIMPL). The symptom of
this bug is that you get java.lang.ArrayIndexOutOfBoundsException when you later run the
page and when the page logic tries to get the attribute value. To correct this, simply remove
the redundant lines.
10. Substitute the new VO for the parent VO. We discuss the process for doing this in the section
titled, Substitute the extended BC4J object for the parent BC4J object to be used throughout
the application.
11. We have made the BC4J changes, now we need to connect this to its UI component.
UI Changes
Note: For this lesson, we create copies of the existing page XML files and modify the
copies. However, note that this mechanism does not work with upgrades. In other
words, if the original page XML files get upgraded, you will end up having to create
copies again and redo the modifications. In OA Framework 5.8 version, we plan to
introduce durable solution to this problem.
12. As we analyzed the BC4J object in Step 1, we also identified the PG and RN(s) used, and
where the XML definitions of those PG and RN(s) were stored.
13. Create a new directory for the files. For example, assume that the existing XML files are stored
in the ./myprojects/oracle/apps/fnd/framework/toolbox/tutorial/webui directory. You would then
create a ./myprojects/oracle/apps/fnd/custom/framework/toolbox/tutorial/webui for the new
XML files.
14. Copy the ..PG.xml file from the existing directory into the new directory, and rename it adding
Custom to the first part of the name. Also, copy the ..RN.xml file(s) from the existing directory
into the new directory, and rename it adding Custom to the first part of the name. We need to
modify both XML files because once we modify the shared region (RN), we need to have the
page (PG) use that new shared region (RN).
15. Add these two new XML files into your project.
16. Now click on the Custom..RN.xml. Add the new items to your UI. Set the View Usage Name
property to the parent VO. The BC4J substitution will take care of properly creating a
Custom..VO instance at runtime in place of the parent VO.
17. Custom..PG contains an RN region under the PageLayoutRN region. Change the Extends
value of the region to the path of the new Custom..RN.
18. Run the new Custom..PG.xml to test it (see the Notes below).
Notes:
Definition not found" or if the page renders a blank and incomplete table region with no
column header and data, you are hitting the substitution bug 2723829 (APPS: SUBSTITUTION
THROWS NOXMLFILEEXCEPTION DUE TO CLASS LOADING). See the Workaround for
bug 2723829.
When you rerun the page multiple times, you may get "Unable to Recover Previous State"
error page. This is due to an OC4J rerun bug 2653643 (SESSION CHANGED IN THE
MIDDLE OF A SESSION-RUN WHEN RE-RUN JSP OR JRAD XML). Workaround: Select
Run - Terminate from the JDeveloper menu to explicitly terminate the former process before
each rerun.
5.
6.
7.
8.
Note: We will place all our extended objects in oracle.apps.fnd.custom directory for this
lesson. You can replace the word "custom" with your own company name like "ford". Note that
all the Entity Objects (xxxEO) are packaged in oracle.apps.fnd....schema.server package, and
hence the extended Entity Objects will be placed under
oracle.apps.fnd.custom...schema.server.
Create a new empty BC4J package. We will add the new Custom EO to this package.
Create a new Entity Object, Custom..EO. In the "Extends Entity" field, select the parent EO.
For the rest of the steps, accept all the defaults and proceed until you get to Generate Default
View Object step. In Generate Default View Object step, uncheck the "Generate Default
View Object" checkbox as we do not need any new View Object for our extension. Then click
Finish.
Add the new defaulting logic by editing the Custom..EOImpl Java class. First, make sure that
it extends the parent EOImpl Java class. Then add the following code (create(AttributeList)
method) and compile the project:
/**
* Initializes a new purchase order header.
*/
public void create(AttributeList attributeList)
{
super.create(attributeList);
// Add or change the default values here.
// EXAMPLE: setPaymentTermsCode("NET_60");
}
You would also need to include the following import statement to make this class compile
successfully:
import oracle.jbo.AttributeList;
Note: The create(AttributeList) method is invoked when the Entity Object is created. We set
the default values in this method.
Copyright Oracle Corporation, 2002. All rights reserved.
9. Substitute the new EO for the parent EO. We discuss the process for doing this in the section
titled, Substitute the extended BC4J object for the parent BC4J object to be used throughout
the application.
10. Run the PG to test.
Note:
You would also need to include the following import statements to make this class compile
successfully:
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OAAttrValException;
import oracle.apps.fnd.framework.OAException;
Notes:
o
Attribute Level Validation: The attribute setter methods (e.g., setUnitPrice) are
invoked when the user-entered values are set in the EO. We overrode the attribute
setter method for the UnitPrice attribute present in the super class in the subclass.
Entity Level Validation: For a single attribute validation, you can override the attribute
setter method as illustrated in this lesson. If you want to perform cross-attribute
validation, then you need to override the validateEntity() method.
Attribute Level Exception vs. Entity Level Exception: For attribute level exceptions,
use OAAttrValException as illustrated in this lesson. For entity level exceptions, use
OARowValException.
Translated Messages for Exceptions: As pointed out in the comment of the code
above, a proper translated message with the message name should be seeded in the
message repository for the exception. Once, you seed the message with message
name = XXX, you should use that name (XXX) as the last parameter to the
OAAttrValException constructor call. OA Self-Service Framework will retrieve the
message text for the message name and display that. For this lesson, you can upload
the message for the message name, FWK_TBX_T_PO_PRICE_EXCEEDED to the
message repository using the files in the Lesson Solutions section.
7. Substitute the new EO for the parent EO. We discuss the process for doing this in the section
titled, Substitute the extended BC4J object for the parent BC4J object to be used throughout
the application.
8. Run the PG to test.
Substituting the extended BC4J object for the parent BC4J object
Once you finish creating the extended business objects, you would want those extended objects to be
used in place of the original base objects. This means that the BC4J framework should create an
instance out of the extended object definition rather than out of the base object definition. BC4J
framework uses factory methods with substitution rules to accomplish this. The existing
application code uses the factory method APIs provided by BC4J to construct business object
instances. The application code passes in the fully qualified XML file name to the factory method, and
then the BC4J framework returns the appropriate Java object at runtime. With the factory method,
BC4J framework can flexibily change the type of the object that gets returned to some other subclass
object types. But a set of rules must be specified to the BC4J framework to perform this swapping.
The BC4J Substitution feature allows you to specify these rules. You use Substitution to substitute
the extended business object for the base object to be used throughout the application. Here is how:
1. Right click on your project in the Navigator pane, and select Edit Business Components
Project (or right click on the project's .jpx and select Edit <project>).
2. Select the Substitutions section.
From the Available list, select the base object (e.g., PoSimpleSummaryVO) that you want to
replace.
From the Substitute list, select the extended object (e.g., CustomPoSimpleSummaryVO) that
you want as the substitute.
Then click Add. A new substitution rule will be added in the Substitutions list box.
This indicates that the extended object will be used in place of the parent object. You can also
update and remove the substitution rules with the Update and Remove buttons. Click OK to
apply the changes and exit.
3. After using the wizards to define the substitutions you want to make, the BC4J framework
enters this information in the project's .jpx file. The BC4J runtime does not typically read the
project's .jpx file. To make the runtime read the .jpx file, you must do the following:
i.
Make sure that the classpath contains the .jpx file.
ii.
Use the runtime system property -Djbo.project=Name where Name is the JPX file
name without the .jpx extension.
In JDeveloper, the classpath already contains the .jpx file when you compile the project.
Hence, you just need to specify the runtime system property.
Right click on your project and select Project Settings.
Then in Configurations | Development | Runner, add -Djbo.project=TutorialCustom to the
Java Options.
Give a space between the existing options like -mx256m and the new option, Djbo.project=TutorialCustom.
Copyright Oracle Corporation, 2002. All rights reserved.
Note: If you forget to add this jbo.project Java option, you will get exceptions like
"oracle.apps.fnd.framework.OAException: oracle.jbo.NoDefException: JBO-25002: Definition
SiteName of type Attribute not found". The reason is that the runtime environment does not pick up
substitution rules, and hence BC4J tries to find the new attribute from the base object and not the
extended object.
Known Bugs:
2723829 (APPS: SUBSTITUTION THROWS NOXMLFILEEXCEPTION DUE TO CLASS LOADING):
You may get oracle.jbo.NoXMLFileException if your JDeveloper deployed the BC4J classes in the
global application space and the local classes in the web application space. OA Self-Service
Framework typically recommends and uses this deployment strategy to optimize the JSP run
performance, which ends up uncovering this bug.
Workaround: Open the Project Settings for the project.
In Configurations | Development | Paths, set the Output Directory to
< your jdeveloper user home>\myglobalclasses
Note: JDeveloper 9i requires that all the projects in the workspace (.jws) to have the same output
directories. Hence, make the same changes for other projects in the workspace. For this lesson, we
need to make all the projects in toolbox.jws have the same output directories and then rebuild
Tutorial.jpr and TutorialCustom.jpr. When you try to change the paths, you may get the following
warnings.
Click OK.
Click Yes.
2. Adding additional attributes to the BC4J object that serves as the data source
We will extend lesson 7's Purchase Orders summary page to display the Supplier Site Name
information as well in the table display. See the extended lesson 7's Purchase Orders summary page
for the expected outcome of this extension.
BC4J Changes
1. Analyze what to change:
o The XML file for the Purchase Orders summary page is
myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui\PoSummaryL7PG.xml in
the Tutorial.jpr. Examine its page structure and properties in the Property Inspector.
Identify the following:
o The Page (PG) name and file.
o The Region (RN) name and file.
o The View Object (VO) name associated with the RN.
o The Application Module (AM) name associated to the VO.
2. Based on this analysis, we know that we need to extend the
oracle.apps.fnd.framework.toolbox.tutorial.server.PoSimpleSummaryVO to add
additional attributes.
3. Create an new empty BC4J package called,
oracle.apps.fnd.custom.framework.toolbox.tutorial.server.
4. Create an extended BC4J View Object, CustomPoSimpleSummaryVO that extends
PoSimpleSummaryVO in TutorialCustom.jpr. This View Object will add the SiteName
attribute in the oracle.apps.fnd.framework.toolbox.schema.server.SupplierSiteEO. Create
this VO beneath the BC4J package created in Step 3. Add the SupplierSiteEO to this
extended View Object to get the SiteName (supplier site name) attribute. Leave the Read Only
and Reference checkboxes checked as we are going to use this EO for read purpose only.
Add the SiteName attribute from the SupplierSiteEO to the View Object. In this step, we are
going to add the following two attributes from the SupplierSiteEO to this extended View Object:
SupplierSiteId -- we need this attribute because BC4J framework performs operations based
on the primary key of the Entity Object. Accept the default attribute settings. When you try to
move out of the Attribute Settings either upon View Object creation or edit time, you may get
the following popup dialog message:
Just press Yes. You get this message because the View Object contains some transient
attributes like SelectFlag that are not based on database columns or calculated attributes like
OrderTotal that are derived from the View Object SQL in the base View Object. Specify the
View Object query.
SELECT PurchaseOrderHeaderEO.HEADER_ID,
PurchaseOrderHeaderEO.DESCRIPTION,
PurchaseOrderHeaderEO.STATUS_CODE,
PurchaseOrderHeaderEO.SUPPLIER_ID,
PurchaseOrderHeaderEO.CURRENCY_CODE,
PurchaseOrderHeaderEO.CREATION_DATE,
SupplierEO.NAME AS SUPPLIER_NAME,
SupplierEO.SUPPLIER_ID AS SUPPLIER_ID1,
EmployeeEO.FULL_NAME AS BUYER_NAME,
EmployeeEO.EMPLOYEE_ID,
PurchaseOrderHeaderEO.BUYER_ID,
EmployeeEO.EMAIL_ADDRESS AS BUYER_EMAIL,
(select sum(nvl(line.quantity, 0) * nvl(line.unit_price, 0))
from fwk_tbx_po_lines line
where line.header_id = PurchaseOrderHeaderEO.HEADER_ID) AS ORDER_TOTAL,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'APPROVED', 'okind_status.gif',
'COMPLETE', 'completeind_status.gif',
'REJECTED', 'criticalind_status.gif', 'inprogressind_status.gif')
AS STATUS_IMAGE,
LookupCodeEO.MEANING AS STATUS_DISPLAY,
LookupCodeEO.ROW_ID,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'COMPLETE', 'DeleteDisabled',
'APPROVED', 'DeleteDisabled', 'DeleteEnabled') AS DELETE_IMAGE,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'COMPLETE', 'UpdateDisabled',
'APPROVED', 'UpdateDisabled', 'UpdateEnabled') AS UPDATE_IMAGE,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'COMPLETE', 'Y',
Copyright Oracle Corporation, 2002. All rights reserved.
(The texts in bold style indicate the modifications to the base View Object SQL.) Before you
move to the next step, test the query. In the Java section, uncheck View Object Class Generate Java File checkbox. But check View Row Class - Generate Java File and
Generate Accessors checkboxes. Go through the rest of the steps and click Finish at the
end. Just accept the defaults for the rest of the steps.
5. Save all your work.
6. Make sure the CustomPoSimpleSummaryVORowImpl extends
PoSimpleSummaryVORowImpl class.
7. In the CustomPoSimpleVORowImpl class, check if there are only three constants (protected
static final int) at the beginning as follows:
protected static final int MAXATTRCONST =
oracle.jbo.server.ViewDefImpl.getMaxAttrConst("oracle.apps.fnd.framework.toolbox.tu
torial.server.PoSimpleSummaryVO");;
protected static final int SUPPLIERSITEID = MAXATTRCONST;
protected static final int SITENAME = MAXATTRCONST + 1;
8. Substitute the new VO for the parent VO. We discuss the process for doing this in the section
titled, Substitute the extended BC4J object for the parent BC4J object to be used throughout
the application.
9. We have made the BC4J changes, now we need to connect this to its UI component.
10. Create a directory myprojects\oracle\apps\fnd\custom\framework\toolbox\tutorial\webui.
11. Copy PoSummaryL7PG.xml from myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui
into this directory and rename the file to CustomPoSummaryL7PG.xml.
12. Copy PoSummaryRN.xml from myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui
into this directory and rename the file to CustomPoSummaryRN.xml.
13. We need to modify both XML files because once we modify the shared region
(CustomPoSummaryRN), we need to have the page XML (CustomPoSummaryL7PG) use that
new shared region.
14. Add these two new XML files into the project, TutorialCustom.jpr.
15. Modify the CustomPoSummaryRN.xml. Add a new item with ID, SupplierSiteName. Set the
Attribute Set to
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxSupplierSites/SiteName. Set the View
Usage Name to PoSimpleSummaryVO as in the other table region items. Set the View
Attribute Name to SiteName.
We will extend lesson 7's Purchase Orders create page - step 2 to throw a validation error when the
Unit Price exceeds 10000. See the extended lesson 7's Purchase Orders create page - step 2 for
the expected outcome of this extension.
1. Analyze what to change:
o The XML file for the Purchase Orders create page - step 2 is
myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui\PoLinesPG.xml in the
Tutorial.jpr.
o The Page (PG) name and file.
o The Region (RN) name and file.
o The View Object (VO) name associated with the RN.
o The Application Module (AM) name associated to the VO.
o The Entity Object (EO) used by the VO.
2. Based on this analysis, we know that we need to extend the
oracle.apps.fnd.framework.toolbox.schema.server.PurchaseOrderLineEO to add the
validation logic for UnitPrice.
3. If you haven't done so already, create a new empty BC4J package as detailed in Step 3 in Add
additional attributes to the BC4J object that serves as the data source. If you did this already,
skip this step.
4. Create an extended BC4J Entity Object, CustomPurchaseOrderLineEO that extends
PurchaseOrderLineEO in TutorialCustom.jpr. This Entity Object will add the validation logic
for the UnitPrice attribute in the Java class. Set the Extends Entity field to
PurchaseOrderLineEO under oracle.apps.fnd.framework.toolbox.schema.server. For the
rest of the steps, accept all the defaults and proceed until you get to Generate Default View
Object step. In Generate Default View Object step, uncheck the Generate Default View Object
checkbox as we do not need any new View Object for our extension. Then click Finish.
5. Edit the CustomPurchaseOrderLineEOImpl Java class. First, make sure that it extends
PurchaseOrderLineEOImpl Java class. Add code to UnitPrice's setter method to throw a
validation error when it exceeds 10000.
6. Recompile your project.
7. Substitute the new EO for the parent EO. We discuss the process for doing this in the section
titled, Substitute the extended BC4J object for the parent BC4J object to be used throughout
the application.
8. Run the PG to test. Your results should look as follows:
3. Then press OK. This will add TutorialCustom.jpr under toolbox.jws. Select File | Save All to
frequently save your changes.
4. Once the TutorialCustom.jpr is created, right click on the jpr and select Project Settings.
Then make the following changes to the project settings.
o In Common | J2EE, set the J2EE Web Application Name to "bb" and J2EE Web
Context Root to "/". This will later allow you to run your JSP programs in the project.
o In Configurations | Development | Libraries, add "BC4J Tester" library from the
Available Libraries to the Selected Libraries. This step is necessary because
JDeveloper 9i requires that all the projects in the workspace contain the same libraries.
5. To create extended BC4J objects in the new project, the base BC4J objects must be available
in the new project as well.
Hence, we will add the BC4J objects in Tutorial.jpr to TutorialCustom.jpr.
Select File | Open from the JDeveloper menu and add the following files to TutorialCustom.jpr.
Copyright Oracle Corporation, 2002. All rights reserved.
Whenever you add a BC4J package by including the server.xml file, you will get the following
popup dialog message:
Press Yes to add the BC4J package. This will create a new jpx file called TutorialCustom.jpx.
This jpx file contains information on the BC4J packages in the project.
2. Adding additional attributes to the BC4J object that serves as the data source
We will extend lesson 7's Purchase Orders summary page to display the Supplier Site Name
information as well in the table display. See the extended lesson 7's Purchase Orders summary page
for the expected outcome of this extension.
BC4J Changes
1. Analyze what to change:
o The XML file for the Purchase Orders summary page is
myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui\PoSummaryL7PG.xml in
the Tutorial.jpr.
In Tutorial.jpr, click on PoSummaryL7PG.xml and examine its page structure and
properties in the Property Inspector.
o
Then in the next step, unclick all the checkboxes so that an empty package gets
created. Click Next and then Finish.
ii.
This step tells the BC4J framework to create a View Object named
CustomPoSimpleSummaryVO that extends PoSimpleSummaryVO. This feature is often
called "XML Extends" in BC4J. Filling out the Extends View Object field allows the
extended View Object to inherit the XML and the Java classes of the base View Object.
iii.
The next step specifies the Entity Objects that the View Object will include. We will add
SupplierSiteEO to this extended View Object to get the SiteName (supplier site name)
attribute. Select the SupplierSiteEO in
oracle.apps.fnd.framework.toolbox.schema.server package from the Available list and
then use the righ arrow button to add it to the Selected list. Leave the Read Only and
Reference checkboxes checked as we are going to use this Entity Object for read
purpose only.
iv.
Next, we need to add the SiteName attribute from the SupplierSiteEO to the View
Object. In this step, we are going to add the following two attributes from the
SupplierSiteEO to this extended View Object:
SupplierSiteId -- we need this attribute because BC4J framework performs operations
based on the primary key of the Entity Object.
SiteName
Hold down the control key in the keyboard and select both SupplierSiteId and SiteName
from the SupplierSiteEO in the Available list. Then use the right arrow button to add
these attributes to the Selected list.
v.
The next step shows you the default attribute settings. Just accept the defaults and
move to the next step. When you try to move out of the Attribute Settings either upon
View Object creation or edit time, you may get the following popup dialog message:
Just press Yes. You get this message because the View Object contains some transient
attributes like SelectFlag that are not based on database columns or calculated
attributes like OrderTotal that are derived from the View Object SQL in the base View
Object.
vi.
Now, you need to specify the View Object query. For this particular View Object that we
are creating, you will notice that the Query Statement field is initially left blank and the
Expert Mode checkbox is checked and disabled by default. The reason is that this new
View Object extends a View Object (PoSimpleSummaryVO) that was created in expert
mode. Checking the Expert Mode checkbox upon View Object creation allows you to
alter the query statement with more database columns in the SELECT clause and extra
WHERE clause. The extra database columns added in the SELECT clause become
what is called "Calculated" View Object attributes. The View Object attribute name is
derived from the database column alias.
If the original base View Object was created in non-Expert Mode (that is, with the Expert
Mode check box cleared), then the View Object wizard for the extended object will open
with Expert Mode disabled. In this case, the Query Statement area of the Query page
will display the default SQL query in a read-only list box.
If the original View Object was created in Expert Mode, then the Query page for the
extended object will open in Expert Mode. In this case, the Query Statement area of the
Query page will display an empty, editable list box. Again, the SQL query from the
original View Object is a reasonable starting point for your edits. You can copy the
query from the original View Object and paste it into the Query Statement area of the
extended View Object that you are creating.
You can examine the SQL of the base View Object, PoSimpleSummaryVO by selecting
and right clicking on the PoSimpleSummaryVO node in JDeveloper and choosing the
Edit PoSimpleSummaryVO option. Then in the wizard, you can go to the Query
section to get the SQL.
For CustomPoSimpleSummaryVO, we will use the following SQL. Copy this SQL and
paste it into the Query Statement list box:
SELECT PurchaseOrderHeaderEO.HEADER_ID,
PurchaseOrderHeaderEO.DESCRIPTION,
PurchaseOrderHeaderEO.STATUS_CODE,
PurchaseOrderHeaderEO.SUPPLIER_ID,
PurchaseOrderHeaderEO.CURRENCY_CODE,
PurchaseOrderHeaderEO.CREATION_DATE,
SupplierEO.NAME AS SUPPLIER_NAME,
SupplierEO.SUPPLIER_ID AS SUPPLIER_ID1,
EmployeeEO.FULL_NAME AS BUYER_NAME,
EmployeeEO.EMPLOYEE_ID,
PurchaseOrderHeaderEO.BUYER_ID,
EmployeeEO.EMAIL_ADDRESS AS BUYER_EMAIL,
(select sum(nvl(line.quantity, 0) * nvl(line.unit_price, 0))
from fwk_tbx_po_lines line
where line.header_id = PurchaseOrderHeaderEO.HEADER_ID) AS
ORDER_TOTAL,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'APPROVED', 'okind_status.gif',
Copyright Oracle Corporation, 2002. All rights reserved.
'COMPLETE', 'completeind_status.gif',
'REJECTED', 'criticalind_status.gif',
'inprogressind_status.gif') AS STATUS_IMAGE,
LookupCodeEO.MEANING AS STATUS_DISPLAY,
LookupCodeEO.ROW_ID,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'COMPLETE', 'DeleteDisabled',
'APPROVED', 'DeleteDisabled', 'DeleteEnabled') AS
DELETE_IMAGE,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'COMPLETE', 'UpdateDisabled',
'APPROVED', 'UpdateDisabled', 'UpdateEnabled') AS
UPDATE_IMAGE,
decode(PurchaseOrderHeaderEO.STATUS_CODE,
'COMPLETE', 'Y',
'APPROVED', 'Y', 'N') AS APPROVE_DISABLED,
SupplierSiteEO.SUPPLIER_SITE_ID,
SupplierSiteEO.SITE_NAME
FROM FWK_TBX_PO_HEADERS PurchaseOrderHeaderEO,
FWK_TBX_SUPPLIERS SupplierEO,
FWK_TBX_EMPLOYEES EmployeeEO,
FWK_TBX_LOOKUP_CODES_VL LookupCodeEO,
FWK_TBX_SUPPLIER_SITES SupplierSiteEO
WHERE PurchaseOrderHeaderEO.SUPPLIER_ID = SupplierEO.SUPPLIER_ID
AND PurchaseOrderHeaderEO.BUYER_ID = EmployeeEO.EMPLOYEE_ID
AND PurchaseOrderHeaderEO.STATUS_CODE = LookupCodeEO.LOOKUP_CODE
AND LookupCodeEO.LOOKUP_TYPE = 'FWK_TBX_ORDER_STATUS'
AND SupplierEO.SUPPLIER_ID = SupplierSiteEO.SUPPLIER_ID
(The texts in bold style indicate the modifications to the base View Object SQL.)
vii.
Before you move to the next step, test the query you entered by pressing the Test
button. If the query is valid, then click Next.
viii.
In the Java section, uncheck View Object Class - Generate Java File checkbox. But
check View Row Class - Generate Java File and Generate Accessors checkboxes.
The Extends button in the Java section allows you to specify the super classes
for the Java files. When you extend the XML of the base View Object, the
extended View Object Java classes would extend the Java classes of the base
View Object by default -- that is, CustomPoSimpleSummaryVOImpl would extend
PoSimpleSummaryVOImpl, and CustomPoSimpleSummaryVORowImpl would
extend PoSimpleSummaryVORowImpl. If you do not generate the Java files for
the extended View Object, the Java files of the base View Object
(PoSimpleSummaryVOImpl and PoSimpleSummaryVORowImpl) will be used.
However, if you press the Extends button upon View Object creation, the super
classes may not show the base View Object Java classes. But if you see the
auto-generated extended View Object Java classes after completing the View
Object creation wizard steps, you will notice that they correctly extend the base
View Object Java classes. If you then edit the View Object wizard for the
extended View Object that was created, the Java Extends button will show the
Copyright Oracle Corporation, 2002. All rights reserved.
correct super classes at that time. This is bug 2723937 (APPS: VO XML
EXTENDS - JAVA CLASS DOES NOT SHOW CORRECT PARENT).
ix.
Go through the rest of the steps and click Finish at the end. Just accept the defaults for
the rest of the steps.
x.
xi.
xii.
There should be MAXATTRCONST and the constants for the new View Object
attributes (SUPPLIERSITEID and SITENAME) that we added.
3.
UI Changes
Note: For this lesson, we create copies of the existing page XML files and modify the
copies. However, note that this mechanism does not work with upgrades. In other
words, if the original page XML files get upgraded, you will end up having to create
copies again and redo the modifications. In OA Framework 5.8 version, we plan to
introduce a substitution feature for the UI pages that is equivalent to the BC4J
substitution to support extensibility in UI.
1. Analyze what to change:
As we analyzed (above), we need to modify the shared region,
myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui\PoSummaryRN to include an
extra table region item for the supplier site name.
2. Create a directory myprojects\oracle\apps\fnd\custom\framework\toolbox\tutorial\webui.
Copy PoSummaryL7PG.xml from myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui
into this directory and rename the file to CustomPoSummaryL7PG.xml.
Copy PoSummaryRN.xml from myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui
Copyright Oracle Corporation, 2002. All rights reserved.
Note: If the Property Inspector complains about this attribute set not being found, then
just set the following property values instead:
Display Length: 20
Prompt: Site Name
o
o
o
Set the View Usage Name to PoSimpleSummaryVO as in the other table region
items.
Set the View Attribute Name to SiteName
Then drag the item above Currency and below Supplier.
Note: Note that we set the View Usage Name to PoSimpleSummaryVO and not
CustomPoSimpleSummaryVO. The BC4J substitution will take care of properly creating a
CustomPoSimpleSummaryVO instance at runtime in place of the PoSimpleSummaryVO.
5.
Note: We will skip the part of associating this new extended page with a menu funtion for this
lesson.
Run Page
1.
We are now almost ready to test our BC4J extensions. Before we run the page, we need to
configure the JRAD Framework Connections.
Select Tools | Preferences from the JDeveloper menu.
In the Preferences window, select JRAD | Framework Connections. Then set the following
properties:
User Name: fwktester
Password: fwkdev
Application: ICX
Responsibility Key: FWK_TBX_TUTORIAL
Copyright Oracle Corporation, 2002. All rights reserved.
PoDescPG contains a MainRN region under the PageLayoutRN region. Note that all
the items under this region have the View Usage Name property set to
PoDetailsFullVO. Also note that the Application Module Definition Name property is
set only at the top level (PageLayoutRN) to
oracle.apps.fnd.framework.toolbox.tutorial.server.Lesson7AM.
iii.
As in the Add additional attributes to the business object section, click on the
Browse button next to the Extends Entity text input field and select
PurchaseOrderHeaderEO under
oracle.apps.fnd.framework.toolbox.schema.server. This will auto-fill the
Extends Entity field and default the Entity Object Name to
PurchaseOrderHeaderEOEx. Change the default name to
CustomPurchaseOrderHeaderEO.
For the rest of the steps, accept all the defaults and proceed until you get to
Generate Default View Object step. In Generate Default View Object step,
uncheck the Generate Default View Object checkbox as we do not need any new
View Object for our extension. Then click Finish.
You would also need to include the following import statement to make this class
compile successfully:
import oracle.jbo.AttributeList;
Note: The create(AttributeList) method is invoked when the Entity Object is created. We
set the default values in this method.
3. Substitute CustomPurchaseOrderHeaderEO for PurchaseOrderHeaderEO:
Right click on the TutorialCustom.jpr and select Edit Business Components Project. Then
select Substitutions.
Select PurchaseOrderHeaderEO in the Available list, and select
CustomPurchaseOrderHeaderEO in the Substitute list.
Click Add. Then click OK to apply the changes and exit.
See Substitute the extended business object for the base object section for more information.
UI Changes
No page XML change is needed.
Run Page
1.
Run CustomPoSummaryL7PG. Once the page is rendered, press the "Create Purchase Order" button.
2.
The extended page should render with the Payment Terms field correctly defaulted to Net 60 as shown in
extended lesson 7's Purchase Orders create page - step 1.
We will extend lesson 7's Purchase Orders create page - step 2 to throw a validation error when the
Unit Price exceeds 10000. See the extended lesson 7's Purchase Orders create page - step 2 for
the expected outcome of this extension.
BC4J Changes
1. Analyze what to change:
o The XML file for the Purchase Orders create page - step 2 is
myprojects\oracle\apps\fnd\framework\toolbox\tutorial\webui\PoLinesPG.xml in the
Tutorial.jpr.
In Tutorial.jpr, click on PoLinesPG.xml and examine its page structure and properties
in the Property Inspector.
o
i.
ii.
As in the Add additional attributes to the business object section, click on the
Browse button next to the Extends Entity text input field and select
PurchaseOrderLineEO under
oracle.apps.fnd.framework.toolbox.schema.server. This will auto-fill the
Extends Entity field and default the Entity Object Name to
PurchaseOrderLineEOEx. Change the default name to
CustomPurchaseOrderLineEO.
For the rest of the steps, accept all the defaults and proceed until you get to
Generate Default View Object step. In Generate Default View Object step,
uncheck the Generate Default View Object checkbox as we do not need any new
View Object for our extension. Then click Finish.
You would also need to include the following import statements to make this class
compile successfully:
Copyright Oracle Corporation, 2002. All rights reserved.
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OAAttrValException;
import oracle.apps.fnd.framework.OAException;
Notes:
Entity Level Validation: For a single attribute validation, you can override the
attribute setter method as illustrated in this lesson. If you want to perform crossattribute validation, then you need to override the validateEntity() method. For
an example, see
oracle.apps.fnd.framework.toolbox.tutorial.server.PurchaseOrderHeaderEOImpl
validateEntity() method.
Attribute Level Exception vs. Entity Level Exception: For attribute level
exceptions, use OAAttrValException as illustrated in this lesson. For entity level
exceptions, use OARowValException. For an example of an
OARowValException, see
oracle.apps.fnd.framework.toolbox.tutorial.server.PurchaseOrderHeaderEOImpl
remove() method.
1.
Run CustomPoSummaryL7PG. Once the page is rendered, press the "Create Purchase Order" button. Fill out all
the required fields for the purchase order header. For the Supplier LOV, you may select "Hot Chip
Semiconnductors" from the LOV window. And then you can select "HQ" for the Site Name LOV. Then in the next
train step (purchase order lines page), press the "Add Another Item" button. Enter all the required fields and a unit
price that is larger than 10000. Then press the "Next" button.
2.
The extended page should throw a validation error when a unit price that is larger than 10000 was entered in
extended as shown lesson 7's Purchase Orders create page - step 2.
place of the base object (PoSimpleSummaryVO). You can also update and remove the
substitution rules with the Update and Remove buttons.
Click OK to apply the changes and exit.
3. Applying the substitutions at runtime:
After using the wizards to define the substitutions you want to make, the BC4J framework
enters this information in the project's .jpx file. The BC4J runtime does not typically read the
project's .jpx file. To make the runtime read the .jpx file, you must do the following:
i.
Make sure that the classpath contains the .jpx file.
ii.
Use the runtime system property -Djbo.project=Name where Name is the JPX file
name without the .jpx extension.
In JDeveloper, the classpath already contains the .jpx file when you compile the project.
Hence, you just need to specify the runtime system property.
For TutorialCustom.jpr, right click on the project and select Project Settings.
Then in Configurations | Development | Runner, add -Djbo.project=TutorialCustom to the
Java Options.
Give a space between the existing options like -mx256m and the new option, Djbo.project=TutorialCustom.
Note: JDeveloper 9i requires that all the projects in the workspace (.jws) to have the same output
directories. Hence, make the same changes for other projects in the workspace. For this lesson, we
need to make all the projects in toolbox.jws have the same output directories and then rebuild
Tutorial.jpr and TutorialCustom.jpr. When you try to change the paths, you may get the following
warnings.
Click OK.
Click Yes.
The messages used in this lesson can be uploaded to the message repository with
icxfwkmsg.lct and TutorialCustomMsg.ldt.
Download the lct and ldt files and run the following command to upload the messages.
FNDLOAD username/password@databaseSID 0 Y UPLOAD icxfwkmsg.lct
TutorialCustomMsg.ldt
Supply the proper database user name, password, and SID for this command.
All the lesson solutions are in TutorialCustom.zip. You can extract the files from this zip file into
your JDeveloper user home directory.