Professional Documents
Culture Documents
12 - OAF - Oracle Application Framework Training Manual Document
12 - OAF - Oracle Application Framework Training Manual Document
12 - OAF - Oracle Application Framework Training Manual Document
Table of Contents
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Model-layer BC4J Objects .......................................................................................................... ..................3-5
Encapsulation The "Reuse Onion". ............................................................................................................... 3-6
General Reuse Rules......................................................................................................................................3-7
Recommended Build Approach................................................................................................... ..................3-8
Business Component (BC4J) Packages ......................................................................................................... 3-9
BC4J Package Naming Standards ............................................................................................... ..................3-10
Application Modules .....................................................................................................................................3-11
Transaction Object.........................................................................................................................................3-14
Application Module Files .................................................................................................... ..........................3-15
Entity Objects ................................................................................................................................................3-16
Entity Object Creation Standards ..................................................................................................................3-18
Entity Object Automatic Features .................................................................................................................3-19
Entity Object Files .........................................................................................................................................3-20
View Objects ................................................................................................................................................. 3-21
View Object Creation Methods .....................................................................................................................3-24
ExpertMode View Objects ............................................................................................................................ 3-25
View Objects with Entity Objects ............................................................................................ .....................3-26
View Object Rows............................................................................................................. ............................3-27
Creating View Objects...................................................................................................................... .............3-28
View Object Java Files ..................................................................................................................................3-29
View Object Files ..........................................................................................................................................3-30
BC4J Database Interactions........................................................................................................................... 3-31
Non-BC4J Method....................................................................................................................... ..................3-32
Read-only Queries ......................................................................................................................................... 3-33
Step 1: Initial Query ......................................................................................................................................3-34
Step 2: Entity Object Population ................................................................................................................... 3-35
Step 3: Entity Object Reuse........................................................................................................................ ...3-36
Step 4: Entity-derived Attributes ...................................................................................................................3-37
Step 5: Entity Object Fault-in ........................................................................................................................ 3-38
Step 6: Entity Object References ...................................................................................................................3-39
EO/VO Merge ................................................................................................................. ..............................3-40
Step 1: EO/VO Merge Resolution .................................................................................................................3-41
Step 2: EO/VO Merge Resolution ................................................................................................................. 3-42
Other Model-layer Objects ............................................................................................................... .............3-43
Association Objects ............................................................................................................................. ..........3-44
Reference Association Objects ......................................................................................................................3-46
Composition Association Objects..................................................................................................................3-47
Composition Association Object Behavior.................................................................................................... 3-48
View Links .................................................................................................................. ..................................3-49
Entity Experts ..................................................................................................................... ...........................3-51
Validation AMs and Validation VOs............................................................................................................. 3-52
Summary...................................................................................................................... ..................................3-54
Basics of the View ............................................................................................................................. ...............4-1
R12 Building OA Framework Applications ..................................................................................................4-3
Lesson Objectives............................................................................................................ ..............................4-4
Recommended Build Approach................................................................................................... ..................4-5
View-layer Terminology ...............................................................................................................................4-6
Workspaces and Projects ................................................................................................... ............................4-8
Step 1: Create a Page ....................................................................................................... ..............................4-9
Step 2: Name Your New Page ....................................................................................................................... 4-10
Step 3: View Page's Initial Structure .............................................................................................................4-11
Step 4: Modify the Page's Structure...............................................................................................................4-12
Running the New Page .................................................................................................................................. 4-13
What Can You Add to the Page? ...................................................................................................................4-14
Region Styles................................................................................................................................................. 4-15
Sub-Region Styles ............................................................................................................... ..........................4-16
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Named Children vs. Indexed Children ..........................................................................................................4-17
Item Styles ................................................................................................................. ....................................4-19
Item Style Details .......................................................................................................... ................................4-20
Shared Regions...................................................................................................................... ........................4-23
Attribute Sets ................................................................................................................................................. 4-25
Creating Attribute Sets ..................................................................................................................................4-26
Table Column Template ................................................................................................................................ 4-27
Button Template ............................................................................................................................................4-28
Region Header Template ...................................................................................................... .........................4-29
CSS Styles .....................................................................................................................................................4-30
Common CSS Styles ..................................................................................................................................... 4-31
Extending Other Objects ..................................................................................................... ..........................4-33
Destinations and Links .................................................................................................................................. 4-34
Mailto Links ................................................................................................................ ..................................4-35
Lists of Values (LOVs)....................................................................................................... ...........................4-36
Defining an External LOV.......................................................................................................................... ...4-38
Reading Model Data......................................................................................................................................4-40
Writing Model Data........................................................................................................... ............................4-42
Binding Items to Data......................................................................................................................... ...........4-44
General Naming Rules........................................................................................................................ ...........4-45
Page and Object Naming Rules .....................................................................................................................4-48
Styles and Bean Names ....................................................................................................... ..........................4-49
Attribute Set Standards.................................................................................................................................. 4-50
Attribute Sets .............................................................................................................. ...................................4-53
Attribute Set Naming Conventions................................................................................................................4-54
More Attribute Set Standards ........................................................................................................................4-55
Summary...................................................................................................................... ..................................4-56
Basics of the Controller..................................................................................................... ..............................5-1
R12 Building OA Framework Applications ..................................................................................................5-3
Lesson Objectives............................................................................................................ ..............................5-4
Recommended Build Approach................................................................................................... ..................5-5
Do You Need a Controller? ........................................................................................................................... 5-6
Controller Basics ........................................................................................................... ................................5-7
Common Logic to Code ................................................................................................................................ 5-8
Typical Locations for Code ...........................................................................................................................5-9
Handling Queries............................................................................................................. ..............................5-10
View Object initQuery Code ......................................................................................................................... 5-11
Dynamic WHERE Clauses ....................................................................................................... .....................5-12
Using findByKey Instead of initQuery............................................................................................... ...........5-13
Processing a Button Press..............................................................................................................................5-14
Getting Parameters from Requests ................................................................................................................5-15
Example: Manually-built Search ................................................................................................................... 5-16
The Process.................................................................................................................. ..................................5-17
Example VOImpl Code ......................................................................................................... ........................5-18
Example AMImpl Code................................................................................................................................. 5-19
Example Controller Code ..............................................................................................................................5-20
Example Search: Controller........................................................................................................................... 5-21
Forwarding to Another Page.......................................................................................................................... 5-22
Setting Titles with Message Dictionary.........................................................................................................5-23
Event Flow Overview..................................................................................................................... ...............5-24
Initial Setup Flow .......................................................................................................................................... 5-25
Controller Event Flows in OA Framework....................................................................................................5-26
GET Event Flow – Overview ........................................................................................................................ 5-27
GET Event Flow (1-3)........................................................................................................................... ........5-28
GET Event Flow (4) Instantiate BC4J and UIX Classes .............................................................................5-30
Example Bean Hierarchy Structure ...............................................................................................................5-31
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
GET Event Flow (5) processRequest........................................................................................................... 5-32
GET Event Flow (6) Post-Processing..........................................................................................................5-33
GET Event Flow (7) UIX Renders the Page...................................................................................... ............5-34
POST Event Flow – Overview ......................................................................................................................5-35
POST Event Flow (1 - 3) Submit, Client-Side Validation............................................................................. 5-36
POST Event Flow (4 & 5) Validate User and Retrieve State ........................................................................5-37
POST Event Flow (6) Apply Form Data .......................................................................................................5-38
POST Event Flow (6) More of processFormData ................................................................................. ........5-39
POST Event Flow (7) processFormRequest.................................................................................................. 5-42
Summary...................................................................................................................... ..................................5-43
Setting Up Your Development Environment ..................................................................................... ...........6-1
R12 Building OA Framework Applications ..................................................................................................6-3
Lesson Objectives............................................................................................................ ..............................6-4
Installing and Setting Up JDeveloper ............................................................................................................6-5
Configure Your Environment Variables........................................................................................................ 6-7
Get the DBC File ...........................................................................................................................................6-9
Create a Shortcut ........................................................................................................... ................................6-10
Assign the E-Business Suite User.................................................................................................................. 6-11
Uncompress Tutorial.zip ..................................................................................................... ..........................6-12
Launch JDeveloper 10g ................................................................................................................... ..............6-13
Configure the Connections and Test.............................................................................................................. 6-14
Configure the Connection and User...............................................................................................................6-16
Summary...................................................................................................................... ..................................6-18
OA Framework State Management ...............................................................................................................7-1
R12 Building OA Framework Applications ...................................................................................... ............7-3
Lesson Objectives............................................................................................................ ..............................7-4
Architectural Overview – Session and Cookies............................................................................................. 7-5
Architectural Overview – JVM ..................................................................................................................... 7-6
State Caches in OA Framework ....................................................................................................................7-7
Root Application Modules............................................................................................................................. 7-8
Default Root Application Module Retention.................................................................................................7-10
Retaining the Root Application Module........................................................................................................ 7-11
Recommendation: Multipage Flow ...............................................................................................................7-13
Recommendation: Multipage Flow with Side Trip .......................................................................................7-14
Recommendation: Side Trip with Extended Page .........................................................................................7-15
Recommendation: Unrelated Pages Flow......................................................................................................7-16
Servlet Session............................................................................................................................................... 7-17
Applications User Session (ICX Session) .....................................................................................................7-18
Page Context...................................................................................................................... ............................7-19
Request and Page Boundaries........................................................................................................................ 7-20
Request ..........................................................................................................................................................7-23
Ways to Pass Parameters ............................................................................................................................... 7-24
URL Parameters: Tokens, Encryption, Encoding.......................................................................................... 7-26
Passivation.................................................................................................................. ...................................7-28
Application Module Pooling................................................................................................... .......................7-30
Application Module and Connection Pooling................................................................................................ 7-32
Application Module Pooling Process ............................................................................................................7-34
Monitoring the AM Pool ...............................................................................................................................7-38
JDBC Connection Pooling Process ...............................................................................................................7-39
Monitoring the JDBC Connection Pooling....................................................................................................7-44
Determining User Load ................................................................................................................................. 7-46
Back Button Usage Goals...................................................................................................... ........................7-47
Back Button Scenario #1 .............................................................................................................................. .7-48
Back Button Scenario #2 ............................................................................................................................. ..7-49
Back Button Scenario #3 .................................................................................................. .............................7-50
Addressing Consistent Behavior....................................................................................................................7-51
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Further Study of Back Button....................................................................................................................... .7-52
Summary.................................................................................................................... ....................................7-53
Introduction to JDeveloper 10g with OA Extension.....................................................................................8-1
R12 Building OA Framework Applications ..................................................................................................8-3
Lesson Objectives............................................................................................................ ..............................8-4
Oracle JDeveloper 10g with OA Extension...................................................................................... .............8-5
Oracle JDeveloper 10g Components .............................................................................................................8-7
Applications and Workspaces.................................................................................................. ......................8-9
Projects .................................................................................................................... ......................................8-11
Creating JDeveloper Items ............................................................................................................................ 8-13
Creating a Workspace......................................................................................................... ...........................8-14
Step 1: Creating a Project .................................................................................................. ............................8-15
Step 2: Creating a Project .............................................................................................................................. 8-16
Step 3: Creating a Project .................................................................................................. ............................8-17
Step 4: Creating a Project .............................................................................................................................. 8-18
Step 1: Establish a Database Connection.......................................................................................................8-19
Step 2: Establish a Database Connection.......................................................................................................8-20
Step 3: Establish a Database Connection....................................................................................................... 8-21
Step 4: Establish a Database Connection.......................................................................................................8-22
Step 5: Establish a Database Connection.......................................................................................................8-23
Step 6: Establish a Database Connection.......................................................................................................8-24
Step 7: Establish a Database Connection.......................................................................................................8-25
Project Properties........................................................................................................................................... 8-26
Project Properties – Oracle Applications....................................................................................................... 8-27
Directory Structure ........................................................................................................................................ 8-28
Exploring Java Files ........................................................................................................ ..............................8-29
Exploring Other Objects - Wizards ............................................................................................................... 8-30
Exploring Other Objects – UI Objects........................................................................................................... 8-31
Finding Methods and Fields .................................................................................................. ........................8-32
Supporting Code Development with Profiler and Code Coach .................................................................... 8-34
New Code Editor Features..................................................................................................... ........................8-36
Customizing JDeveloper 10g with OA Extension .........................................................................................8-38
Refactoring ....................................................................................................................................................8-40
JDeveloper Help System ............................................................................................................................... 8-43
Obtaining Help on a Topic ............................................................................................................................8-44
Oracle JDeveloper Debugger.......................................................................................................... ...............8-45
Breakpoints.................................................................................................................................................... 8-47
Breaking on Exceptions....................................................................................................... ..........................8-49
Debugger Windows ....................................................................................................................................... 8-50
Stepping Through a Program................................................................................................... ......................8-52
Watching Data and Variables ........................................................................................................................8-53
Debugging Declarative Applications............................................................................................................. 8-54
More Debugging Tips.......................................................................................................... ..........................8-55
Understand BC4J Interactions .......................................................................................................................8-56
Debugging Validation and Commits .............................................................................................................8-58
Summary...................................................................................................................... ..................................8-59
Implementing a Query and Drill-down ......................................................................................................... 9-1
R12 Building OA Framework Applications ...................................................................................... ............9-3
Lesson Objectives.............................................................................................................. ............................9-4
Course Methodology .....................................................................................................................................9-5
Finished Page Before Search ......................................................................................................................... 9-7
Finished Page After Search ...........................................................................................................................9-8
Finished List of Values Page .........................................................................................................................9-9
Finished Drilldown-to-Details Page .............................................................................................................. 9-10
Summary...................................................................................................................... ..................................9-11
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Implementing a Create.................................................................................................. ..................................10-1
R12 Building OA Framework Applications ...................................................................................... ............10-3
Lesson Objectives................................................................................................................... .......................10-4
Implementing a Poplist.................................................................................................................................. 10-5
Extending a Shared Region ................................................................................................... ........................10-6
Creating a New Row...................................................................................................................................... 10-7
Initializing a View Object..............................................................................................................................10-8
Creating and Initializing a VO Row ..............................................................................................................10-9
Getting the Data......................................................................................................................... ....................10-10
Saving a Row to the Database ....................................................................................................................... 10-11
Lab – After Create Basics.......................................................................................................... ....................10-12
Lab – After Validations ................................................................................................................................. 10-13
Lab – After Partial Page Rendering................................................................................................. ..............10-15
Summary...................................................................................................................... ..................................10-17
Implementing a Delete....................................................................................................................... ..............11-1
R12 Building OA Framework Applications ..................................................................................................11-3
Lesson Objectives............................................................................................................ ..............................11-4
Error Handling Overview ..............................................................................................................................11-5
Exception Types ........................................................................................................... .................................11-6
Exception Classes ........................................................................................................... ...............................11-8
Message Types .............................................................................................................................................. 11-9
Message Dictionary .......................................................................................................... .............................11-10
Implementing Message Dictionary................................................................................................................11-11
Instantiating Attribute-level Exceptions ........................................................................................................11-12
Instantiating Row-level Exceptions ............................................................................................................ ...11-13
Attribute Value - EO Example .................................................................................................................. ....11-14
Attribute Value - VO Example ...................................................................................................................... 11-15
Row Value - EO Example .................................................................................................................. ...........11-16
Row Value - VO Example...................................................................................................................... .......11-17
Messaging Flows ...........................................................................................................................................11-18
Inline Messages ............................................................................................................. ................................11-19
Dialog Pages.................................................................................................................................................. 11-20
Switchers ................................................................................................................... ....................................11-22
Table Content Switcher Abilities and Limits.................................................................................................11-23
Implementing Table Content Switchers ........................................................................................................11-24
Query Page with Non-Deleteable Employee ................................................................................................. 11-25
Query Page with Deleteable Employee .........................................................................................................11-26
Warning Dialog ............................................................................................................................................. 11-27
Confirmation Message......................................................................................................... ..........................11-28
Summary...................................................................................................................... ..................................11-29
Implementing an Update................................................................................................................................. 12-1
R12 Building OA Framework Applications ...................................................................................... ............12-3
Lesson Objectives.......................................................................................................................................... 12-4
Locator Elements............................................................................................................. ..............................12-5
Breadcrumbs.................................................................................................................. ................................12-6
Page Navigators............................................................................................................................................. 12-7
Record Navigators ........................................................................................................... ..............................12-8
Trains....................................................................................................................... ......................................12-9
Implementing Trains...................................................................................................................................... 12-10
Single-Page Update ................................................................................................................. ......................12-11
Update Confirmation ...................................................................................................................... ...............12-13
Multi-Page Update......................................................................................................................................... 12-14
Multi-Page Update Confirmation .................................................................................................... ..............12-17
Summary...................................................................................................................... ..................................12-18
OA Framework Development Concepts and Standards .............................................................................. 13-1
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
R12 Building OA Framework Applications ..................................................................................................13-3
Lesson Objectives............................................................................................................ ..............................13-4
General Coding Standards .................................................................................................... .........................13-5
Coding Terminology.................................................................................................................. ....................13-6
OA Framework Standard Considerations ......................................................................................................13-7
E-Business Suite Standard Considerations ....................................................................................................13-8
E-Business Suite Standard DB Objects ......................................................................................................... 13-11
Oracle BLAF Standards.................................................................................................................................13-13
E-Business Suite Java Standards ........................................................................................................ ...........13-14
OA Framework File Standards ......................................................................................................................13-15
Files in a Typical OA Framework Application..............................................................................................13-16
Standard File Suffix Abbreviations ............................................................................................................... 13-18
Package Names................................................................................................................ ..............................13-20
File Names........................................................................................................................ .............................13-23
Region and Item Names ................................................................................................................................ 13-24
OA Framework Model Standards................................................................................................. .................13-25
OA Framework View Standards.................................................................................................................... 13-26
OA Framework Controller Standards ........................................................................................... .................13-27
Summary...................................................................................................................... ..................................13-28
OA Framework and E-Business Suite Security ............................................................................................14-1
R12 Building OA Framework Applications ...................................................................................... ............14-3
Lesson Objectives......................................................................................................................... .................14-4
Key E-Business Suite Security Terms ...........................................................................................................14-5
Successive Layers of Access Control ............................................................................................................14-10
Increasing Flexibility and Scalability ............................................................................................................ 14-11
Function Security...........................................................................................................................................14-13
Data Security ............................................................................................................... ..................................14-14
Oracle User Management Layers of Access Control..................................................................................... 14-16
Role Based Access Control (RBAC) .............................................................................................................14-17
Delegated Administration........................................................................................................... ...................14-19
Registration Processes ...................................................................................................................................14-21
Self Service and Approvals ...........................................................................................................................14-23
Introduction to Function Security ..................................................................................................................14-24
Securing Functions ........................................................................................................................................14-25
Defining a Menu............................................................................................................................................ 14-26
Menu Guidelines ............................................................................................................. ..............................14-28
Creating a Menu ............................................................................................................................................ 14-29
Modifying an Existing Menu Definition ......................................................................................................14-30
Using Responsibilities ...................................................................................................... .............................14-31
Responsibility Components ........................................................................................................................... 14-33
Defining a New Responsibility......................................................................................................................14-34
Sample Menu.................................................................................................................................................14-35
Dissecting Security – Users ........................................................................................................................... 14-36
Dissecting Security – Responsibilities........................................................................................................... 14-37
Dissecting Security – Project Settings ...........................................................................................................14-38
Dissecting Security – Menus ................................................................................................................. ........14-39
Key E-Business Suite Menu Terms ................................................................................................... ............14-44
Dissecting Security – Standard Menus .......................................................................................................... 14-46
Menu: Global Menu............................................................................................................ ...........................14-47
Menu: Tabs......................................................................................................................... ...........................14-48
Menu: Subtabs ............................................................................................................................................... 14-49
Menu: Side Navigation........................................................................................................ ..........................14-50
Menu: Task/Property Menu...........................................................................................................................14-51
Menu Structures............................................................................................................................................. 14-52
Creating Menus .............................................................................................................................................14-53
Navigation and Security Separate..................................................................................................................14-54
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Introduction to Data Security..................................................................................................................... ....14-55
Data Security Components - Objects.............................................................................................................14-57
Grants ...................................................................................................................... ......................................14-58
Permissions and Permission Sets................................................................................................................... 14-59
Data Security Policies....................................................................................................... .............................14-60
Summary...................................................................................................................... ..................................14-61
Deploying OA Framework Applications .......................................................................................................15-1
R12 Building OA Framework Applications ...................................................................................... ............15-3
Objectives .................................................................................................................... ..................................15-4
Storing Personalizations ................................................................................................................................15-5
Directory Structure ..................................................................................................... ...................................15-6
Directory Structure - Layer Values................................................................................................................ 15-7
Toolset ........................................................................................................................................................... 15-8
Functional Administrator Personalization UI ...............................................................................................15-9
export.bat / import.bat- Syntax ...................................................................................................................... 15-10
export.bat/import.bat - Example .................................................................................................................... 15-11
Command Line – XMLExporter/XMLImporter............................................................................................ 15-12
export.bat vs. XMLExporter.......................................................................................................................... 15-13
Import Substitutions – JPXImport.bat ........................................................................................................... 15-14
JPXImport.bat - Syntax ...................................................................................................................... ...........15-15
Import Substitutions – JPXImporter .............................................................................................................. 15-16
Inspecting the MDS Repository.....................................................................................................................15-17
JDR_UTILS PL/SQL package APIs................................................................................................ ..............15-18
List the Personalizations Done on a Page..................................................................................................... 15-25
Inspect Personalizations .................................................................................................... ............................15-26
Deploying Personalizations ...........................................................................................................................15-28
Extract the Personalizations – Functional Administrator Page...................................................................... 15-29
Set Personalization Document Root Path ......................................................................................................15-30
Import/Export Personalizations ..................................................................................................................... 15-31
Extract the Personalizations – Select the Page ..............................................................................................15-32
Extract the Personalizations – Export to File System .................................................................................... 15-33
Upload Personalizations into Production Instance – Functional Administrator Page....................................15-34
Upload Personalizations into Production Instance – Exported Personalizations ........................................... 15-35
Upload Personalizations into Production Instance – Import from File System .............................................15-36
Extensions................................................................................................................... ...................................15-37
OA Page Extensions ...................................................................................................................................... 15-38
Deployment of Page Extensions.................................................................................................................... 15-39
1.Copy .java Classes......................................................................................................... .............................15-40
2. Import Substitutions ..................................................................................................................................15-41
3. Import OA Component Definitions ...........................................................................................................15-42
View The Deployed Extensions ................................................................................................ ....................15-43
BC4J Extensions............................................................................................................................................ 15-44
Deployment of Business Logic Extensions ...................................................................................................15-45
Summary....................................................................................................................................... .................15-46
..................................................................................................................................................... 16-1
R12 Building OA Framework Applications ...................................................................................... ............16-3
Lab 1......................................................................................................................................................... .....16-4
Lab - Learning More About the Page ........................................................................................................16-5
Task 1: Login to Your E-Business Suite Instance ..................................................................................... 16-6
Task 2: About This Page Link ...................................................................................................................16-9
Lab - Learning More About the Page ................................................................................................ ........16-15
Lab 2........................................................................................................................ ......................................16-26
Lab: JDeveloper and E-Business Suite Set-up........................................................................................... 16-27
Task 1: Modify the FWKTEST User.............................................................................................. ...........16-28
Task 2: Set-up the NX Client on Your Classroom PC............................................................................... 16-30
Task 3: Open the NX Client on Your Classroom PC ................................................................................16-33
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Task 4: Unzip Tutorial.zip.........................................................................................................................16-35
Task 5: Set Your JDeveloper Environment ...............................................................................................16-36
Task 6: Start JDeveloper............................................................................................................................16-37
Task 7: Get the DBC File .......................................................................................................................... 16-39
Task 8: Test Your JDeveloper Workspace and Project .............................................................................16-40
Task 9: Set-up Your Database Connection................................................................................................ 16-43
Task 10: Set Your Project Properties.........................................................................................................16-49
Task 11: Test Your JDeveloper Set-up...................................................................................................... 16-55
Task 12: Optional – Personal Set-up .........................................................................................................16-58
Lab 3........................................................................................................................ ......................................16-59
Overview ................................................................................................................................................... 16-60
Step 1. Setup your environment for OA Framework development............................................................ 16-61
Step 2. Create the Model-layer Components ............................................................................................. 16-63
Step 3. Create the View-layer Components............................................................................................... 16-69
Lab 4........................................................................................................................ ......................................16-76
Overview ................................................................................................................................................. ..16-77
Task 1: Create Your Model-layer Components .........................................................................................16-78
Task 2: Create Your View-layer Components........................................................................................... 16-83
Task 3: Configure Your Search .................................................................................................................16-85
Task 4: Add a List of Values (LOV) to Query ..........................................................................................16-91
Task 5: Create Your Model-layer Components ......................................................................................... 16-96
Task 6: Create Your View-layer Components........................................................................................... 16-100
Task 7: Write Your Model-layer Programmatic Elements ........................................................................ 16-103
Task 8: Modify Your Existing View-layer Components ........................................................................... 16-105
Task 9: Write Your Controller-layer Programmatic Elements .................................................................. 16-106
Lab 5....................................................................................................................... .......................................16-109
Part 1: Basic Create Overview...................................................................................................................16-110
Task 1: Build Your Model-layer Components........................................................................................... 16-111
Task 2: Build Your View-layer Components ............................................................................................ 16-112
Task 3: Implement the Poplist .................................................................................................... ...............16-118
Task 4: Write Your Model-layer Programmatic Elements ........................................................................16-121
Task 5: Write Your Controller-layer Programmatic Elements .................................................................. 16-123
Task 6: Revise Your QueryPG ..................................................................................................................16-128
(OPTIONAL) Part 2: Validation Overview....................................................................................... ........16-130
Task 1: Handle the Back Button ................................................................................................................16-131
Task 2: Implement Declarative Validations ..............................................................................................16-139
Task 3: Implement Programmatic Validations ..........................................................................................16-141
Task 4: Creating Entity-Layer Validation Objects .................................................................................... 16-154
(OPTIONAL) Part 3: Partial Page Rendering Overview........................................................................... 16-162
Task 1: Create Your Model-layer Components .........................................................................................16-163
Task 2: Configure Your View-layer Components ..................................................................................... 16-165
Task 3: Implement the Programmatic Elements ........................................................................................ 16-167
Lab 6........................................................................................................................ ......................................16-172
Overview .................................................................................................................... ...............................16-173
Task 1: Build Your Model-layer Components........................................................................................... 16-174
Task 2: Build Your View-layer Components ............................................................................................ 16-176
Task 3: Write Your Model-layer Programmatic Elements ........................................................................ 16-179
Task 4: Write Your Controller-layer Programmatic Elements .................................................................. 16-181
Lab 7........................................................................................................................ ......................................16-187
Overview ...................................................................................................................................................16-188
Task 1: Initial Set-up ................................................................................................................................. 16-189
Task 2: Modify the QueryPG View-layer Components............................................................................. 16-192
Task 3: Modify the Controller-layer Components..................................................................................... 16-193
Task 4: Create Your View-layer Components........................................................................................... 16-199
Task 5: Create Your Controller-layer Components ................................................................................... 16-205
Guided Demo 1................................................................................................................ ..............................16-212
Task 1: Allow Personalizations .................................................................................................................16-213
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Task 2: Personalize the Expenses Home Page........................................................................................... 16-214
Task 3: Create folders on the server .......................................................................................................... 16-217
Task 4: Set the Personalization Document Root Path Profile.................................................................... 16-219
Task 5: Export the Personalizations to File System................................................................................... 16-220
Task 6: Edit the Personalizations............................................................................................................... 16-223
Task 7: Change the Personalization Document Root Path Profile............................................................. 16-225
Task 8: Import the Personalizations into the MDS repository................................................................... 16-226
Guided Demo 2.............................................................................................................................................. 16-228
Pre-requisites: ............................................................................................................................................ 16-229
Task 1: Copy all .class files to $JAVA_TOP ........................................................................................... 16-231
Task 2: Import the Page and Region into the MDS ................................................................................... 16-232
Task 3: Register the Page within E-Business Suite ................................................................................... 16-233
Task 4: Bounce the E-Business Suite Instance .......................................................................................... 16-234
Task 5: Test Your New Page .................................................................................................. ................... 16-235
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
Lab 1
Note: Because of the Oracle University (OU) classroom set-up, you must use IE. IE
is not the only browser certified for use with an E-Business Suite instance. But, it is
the only browser properly configured on your PC (terminal).
2. Enter the URL for your E-Business Suite.
3. You will see the redirection screen which will look similar to the following:
RAJU CHINTHAPATLA
16-Page7
Oracle Application Framework Training Manual OAF
3. The detailed steps to answer this question are shown at the end of this lab. But,
with what you know about OA Framework, and a little exploration, you should
be able to answer these questions.
4. What is the full name of the page? (complete path)
__________________________________________________________________
__________________________________________________________________
6. What is the name of the pageLayout region (and therefore is the name of the
page)?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
YES / NO
__________________________________________________________________
In XML only / In Java only / In both XML and Java / In text / In PL-SQL
12. Beneath the Page Definition region is a link titled, Expand All. Click the Expand
All link.
13. List four (4) UI web beans used on the page?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
14. Is there more than one controller used on the page? (Circle one)
YES / NO
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
YES / NO
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
21. Question 16 asked what VO was being used. What is the complete path to
that VO?
__________________________________________________________________
22. What is the EO associated to the VO from Question 16/21? (list the full path)
__________________________________________________________________
YES / NO
__________________________________________________________________
25. Click the GrantsResultsVO link to drill-down to the details of this VO.
__________________________________________________________________
YES / NO
__________________________________________________________________
YES / NO
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
__________________________________________________________________
__________________________________________________________________
32. List four (4) attributes that are contained in the VO?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
__________________________________________________________________
__________________________________________________________________
44. Where does APPL_TOP point to on this server? (list the complete path)
__________________________________________________________________
__________________________________________________________________
NOTE: FND: Diagnostics is the profile option that controls whether or not you see
the About this Page link. It must be set in order for you to see the link.
48. Click the Patches tab.
49. Have patches been applied to this E-Business Suite instance? (Circle one)
YES / NO
50. If Yes, list the last patch number applied to this server?
__________________________________________________________________
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
/oracle/apps/fnd/security/grants/webui/GrantSummaryPG 5.
120.3
6. What is the name of the pageLayout region (and therefore is the name of the
page)?
Grants
GrantSummaryAM
GrantSummaryCO
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
NO – But, this is a trick question at this point. You have not expanded the items on
the page to see this. So, Bonus Points if you got this correct.
10. Where is the page stored?
In XML only
12. Beneath the Page Definition region is a link titled, Expand All. Click the Expand
All link.
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
YES – As mentioned earlier. It was a trick question. Now, as you scroll down through
the UI objects, you will see that a second controller is mentioned.
15. If Yes, what are the name(s) of the additional controllers?
GrantResultsCO
GrantResultsVO
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
oracle.apps.fnd.security.grants.server.GrantSummaryAM
NO
21. Question 16 asked what VO was being used. What is the complete path to
that VO?
oracle.apps.fnd.security.grants.server.GrantResultsVO
oracle.apps.fnd.schema.security.grants.server.GrantEO
NO
25. Click the GrantsResultsVO link to drill-down to the details of this VO.
RAJU CHINTHAPATLA
Oracle Application Framework Training Manual OAF
120.0
YES – But, it is a trick question. You already answered this. But, if you scroll
down on this page, you can see additional information on the EO.
28. If Yes, list the complete name of this EO?
YES
oracle.apps.fnd.schema.security.grants.server.GrantEntityExpert
120.1
32. List four (4) attributes that are contained in the VO?
SYSADMIN
RAJU CHINTHAPATLA
16-Page21
Oracle Application Framework Training Manual OAF
38. What Responsibility is this page using?
Functional Administrator
FND_FUNC_ADMIN
FND_GRANTS_SUMMARY
RAJU CHINTHAPATLA
16-Page22
Oracle Application Framework Training Manual OAF
44. Where does APPL_TOP point to on this server? (list the complete path)
/appltop/apps/apps_st/appl
RAJU CHINTHAPATLA
16-Page23
Oracle Application Framework Training Manual OAF
NOTE: FND: Diagnostics is the profile option that controls whether or not you see
the About this Page link. It must be set in order for you to see the link.
YES
50. If Yes, list the last patch number applied to this server?
5905539
RAJU CHINTHAPATLA
16-Page25
Oracle Application Framework Training Manual OAF
Lab 2
Throughout this course, you will be asked to designate your name, or some other
unique identifier. You can use your initials. You can use your classroom terminal
number. The only requirement is that it is unique to you. Once you have selected that
designation, use it consistently throughout the remainder of the course.
Important Information:
SYSADMIN/SYSADMIN
FWKTESTER/FWKDEV
nxuser1/oracle
oracle/oracle
applmgr/applmgr
RAJU CHINTHAPATLA
16-Page27
Oracle Application Framework Training Manual OAF
e. Press the Tab key, which will return to the Password field. Re-enter
ORACLE as the password.
f. In the Direct Responsibilities region, click any listed responsibility,
and then click the New button on the button bar as shown.
j. Click the Save icon on the button bar to commit your changes.
5. You are logging in to the FWKTESTER responsibility for the first time. E-Business
Suite will require you to change the password. Change the password to
FWKDEV.
6. You will go to the E-Business Suite home page, which should look similar to
the following:
2. If not already set-up, the NX Connection Wizard will open. Click the Next
button to continue with the NX Connection Wizard.
3. Set your Session to the same as your SID name. Set your Host as indicated by
your instructor. Set the Internet Connection Type slider to WAN. Click the Next
button.
4. Accept the defaults on the page. Click the Next button to continue.
5. Accept the defaults on the final page. Click the Finish button to continue.
(Note: You can ignore any screens that appear after you click the Finish
button. If necessary, click the OK buttons on any screens that might appear.)
3. The Login user default is nxuser1, and that is correct. The password is oracle.
Click the Login button to login to your server. When the NX Client finally logs in,
you will see a screen similar to the following:
2. A terminal window will open, and it will look similar to the following:
cd jdevhome
unzip /JDev/jdevbin/Tutorial.zip
RAJU CHINTHAPATLA
16-Page35
Oracle Application Framework Training Manual OAF
export JDEV_USER_HOME=/home/nxuser1/jdevhome/jdev
2. You can also set your E-Business Suite environment at this point. In the terminal
window, input the following command:
. /appltop/apps/apps_st/appl/VX0321_vx0321.env
Note: The example command shown assumes that the SID is VX0321, and the
Host is vx0321 (without the .us.oracle.com, in the complete path). Your SID and
Host names will change.
Note: While difficult to discern in print, there is a <space> in the command shown
between the . (period) and the /appltop directory path.
/JDev/jdevbin/jdev/bin/jdev&
Note: It is important to include the ampersand (&) at the end of the command to
allow your terminal window to continue to be used.
2. If the migration window appears, click the No button.
3. JDeveloper 10g with OA Extension will load, and it will appear similar to the
following:
6. Hover over the Start Page tab, and the (X) (Close) icon will appear. Click the
Close icon to close the Start Page.
RAJU CHINTHAPATLA
16-Page38
Oracle Application Framework Training Manual OAF
cd $JDEV_USER_HOME/dbc_files/secure
cp $INST_TOP/appl/fnd/12.0.0/secure/VX0321.dbc ./
Note: The cp (copy) command is an example. Your DBC file will be named based on
the SID for your instance.
3. When you open the workspace, you may encounter the Migration
Warning window. If you do, click the Yes button to continue.
4. If you encountered the Migration Warning, when the migration is complete you
will see the Migration Progress window. Click the OK button to continue.
7. JDeveloper will open the toolbox workspace. It will appear similar to the
following:
8. Expand the toolbox workspace. Click the [+] icon beside toolbox in the
Applications Navigator window.
RAJU CHINTHAPATLA
16-Page42
Oracle Application Framework Training Manual OAF
3. The Create Database Connection wizard will open. Click the Next button to
continue.
RAJU CHINTHAPATLA
16-Page44
Oracle Application Framework Training Manual OAF
RAJU CHINTHAPATLA
16-Page45
Oracle Application Framework Training Manual OAF
RAJU CHINTHAPATLA
16-Page46
Oracle Application Framework Training Manual OAF
Note: You should see a Success! message in the Status: window. If you do not see
the Success! message, click the Back button, resolve any errors in the settings,
and return to the test screen to click the Test Connection button. Do not click the
Finish button until you receive the Success! message.
13. If the test was a success, click the Finish button.
14. When you exit the Create Database Connection wizard, you will return to
the Connections panel. It will appear as follows:
Note: You have two connections. The connection you just created (VX0321, as an
example) and fwk12dev. Fwk12dev is a default connection provided in JDeveloper. It
will not work. You can delete this connection if you like. Otherwise, just ignore it.
2. Double-click the Tutorial project, or right-click the Tutorial project, and select
Project Properties. This will open the Project Properties window that appears
similar to the following:
Note: If a migration window appears, click the OK button. You can safely ignore any
warning messages.
3. Click the Business Components category. It will appear similar to the following:
RAJU CHINTHAPATLA
16-Page51
Oracle Application Framework Training Manual OAF
6. When the Edit Database Connection window opens, click the Test tab.
10. Expand the Oracle Applications category, within the Project Properties window,
by clicking the [+] icon.
11. When you expand this category for the first time, you may get the following Login
window. Accept the defaults, which are User Name is apps, and Password is
apps.
12. Click the OK button to continue.
13. Select the Runtime Connections subcategory. Your screen should look similar to
the following:
14. The DBC File Name is initially blank. You can either input the path directly, or
you can browse for the specific DBC file. At the end, the DBC File Name field
should contain:
/home/nxuser1/jdevhome/jdev/dbc_files/secure/VX0321.dbc
Note: A full discussion of E-Business Suite security is beyond the scope of this
course. You will learn more about E-Business Suite security later in the course.
At this point, it is enough to know two things. One, these values will work. Two,
the Application Short Name and Responsibility Key could be any value provided
that the User Name being referenced has those values in its definition.
19. Click the OK button.
20. Click the Save All icon, or using the menu choose (Menu) File > Save All, to save
your work.
2. Right-click the test_fwktutorial.jsp file, and choose Run from the context menu.
4. When you see a screen similar to the following, you know that you have correctly
installed JDeveloper 10g with OA Extension, and you have configured it to work
properly with your E-Business Suite instance.
2. You will be setting up your user account so that when a terminal window is opened
that the JDEV_USER_HOME environment variable is automatically set. It will also
automatically set the E-Business Suite environment. And, it will create an alias,
JDev, that will give you a shorthand means of invoking JDeveloper.
vi .bashrc
i (just press the i key, it will put vi into insert mode)
(Once in insert mode, add these lines)
export JDEV_USER_HOME=/home/nxuser1/jdevhome/jdev
. /appltop/apps/apps_st/appl/VX0321.env
alias JDev=’/JDev/jdevbin/jdev/bin/jdev&’
(press the Escape key)
(type :wq, and press the Enter key
(This will save your work, and exit vi)
4. Close the terminal window, and reopen a new terminal window. Your
environment will automatically be set, and you can type JDev to start-up
JDeveloper.
Lab 3
Overview
This lab leads you through using Oracle JDeveloper 10g with OA Extension to create
a very simple page This lab has minimal explanation and as few steps as possible. It
takes approximately 1 hour. After completing this lab, you should have learned how to:
Note: This is the default. So, you only need confirm that it is set as expected.
1. Click the Next button when the Oracle Applications Project Wizard –
Welcome page opens.
2. Set the Project Name to ClassProject.
3. Confirm that the Directory Name is set to your
JDEV_USER_HOME/myprojects.
Note: This is the default. So, you only need confirm that it is set as expected.
Note: You obtained and downloaded your DBC file in the set-up you
have already completed. Your DBC file should not be located in
JDEV_USER_HOME/dbc_files/secure.
10. Set the JDBC Port to the information provided by the Instructor or
contained in your DBC file. Generally, the port is 1521.
11. Set the SID to the information provided by the Instructor or contained in your
DBC file.
12. Click the Next button.
13. Select the Test Connection button.
14. Look for a status of Success!. If you receive a successful test connection,
Click the Next button. If not, check your connection information, and ask
your instructor for assistance.
15. Click the Finish button.
16. Select the Applications Navigator tab.
Note: You can also right-click the project, and select Project Properties from
the context window.
3. Expand the Oracle Applications category in the menu panel on the left.
4. Choose Oracle Applications > Run Options.
5. Shuttle OADiagnostics from Available Options to Selected Options using
the > button.
6. Click the OK button.
7. Save your process by selecting the Save All icon.
Every OA Framework page has to have a connection to the E-Business Suite database.
The BC4J component that holds the connection and transaction is called an Application
Module.
1. Right-click the ClassProject project, and choose New from the context menu.
2. Select Business Tier > ADF Business Components > Application Module.
3. Click the OK button to open the Create Application Module wizard.
4. Click the Next button at the Create Application Module – Welcome page.
5. Set the Package to oracle.apps.ak.<your name>.first.server.
Note: Make certain the package name is set properly. Carefully read
any defaults that may have been entered automatically.
17. Note that when you expand your oracle.apps.ak.<your name>.first.server, you
will see your newly created FirstAM.
18. Note that the AM created three (3) files noted in the Sources folder of the
Structure panel. Those files are
a. FirstAM.xml – the declarative (XML-based) components of the AM.
b. FirstAMImpl.java – the programmatic (Java-based) components of the
AM.
c. bc4j.xcfg – the XML configuration which lists all the BC4J
components in your project.
19. Save your work.
While you only need an Entity Object on an OA Framework page if that page is going
to do an Insert, Update, or Delete, you are going to create an EO for this page as a
building block to future work.
1. Right-click the ClassProject project, and choose New from the context menu.
2. Select Business Tier > ADF Business Components > Entity Object.
3. Click the OK button to open the Create Entity Object wizard.
4. Click the Next button at the Create Entity Object – Welcome page.
5. Set the Name to FwkTbxAddressesEO.
6. Set the Package to oracle.apps.ak.<your name>.schema.server.
Note: The default package name is not correct. You will have to enter this
package name manually.
a. Select the Cancel button to exit the Create Entity Object wizard.
b. Double-click the ClassProject project to open the Project
Properties windows.
c. Select the Business Components category.
d. In the Connection field, select the drop-down box, and select
your database connection from the list.
e. Select the Edit… button to open the Edit Database
Connection window.
f. Select the Test tab.
g. Select the Test Connection button.
h. Test the connect for a Success! status.
i. Click the OK button.
j. Click the OK button.
k. Repeat Steps 1-7. This time the Database Objects should not be
inactive (grayed out).
1. Right-click the ClassProject project, and choose New from the context menu.
2. Select Business Tier > ADF Business Components > View Object.
3. Click the OK button to open the Create View Object wizard.
4. Click the Next button at the Create View Object – Welcome page.
5. Set the Package to oracle.apps.ak.<your name>.first.server.
6. Set the Name to AddressesVO.
7. Select the Rows Populated by a SQL Query with: radio button.
8. Select the Updatable Access through Entity Objects radio button.
9. Click the Next button on Step 1 of 7.
10. Expand the oracle.apps.ak.<your name>.schema.server package.
11. Select the FwkTbxAddressesEO, and shuttle it to the Selected pane.
12. Click the Next button on Step 2 of 7.
13. Select the AddressId, AddressLine1, AddressName, and TownOrCity, and
shuttle them to the Selected pane. Note: It also creates a RowID in the
Selected pane. This is expected behavior. Use the Up and Down arrows in
the Selected pane to order them as AddressId, AddressName, AddressLine1,
TownOrCity, and RowID.
14. Click the Next button on Step 3 of 7.
15. Click the Next button on Step 4 of 7.
16. Click the Next button on Step 5 of 7.
17. Click the Next button on Step 6 of 7.
18. Deselect the AddressesVOImpl: Generate Java File checkbox.
19. Select the AddressesRowVOImpl: Generate Java File and its Accessors
checkboxes. Note: You select these as part of adhereing to Oracle
Applications Development standards that allow extensibility.
20. Click the Next button on Step 7 of 7.
21. Click the Finish button.
22. Save your work.
All VOs must be contained within an AM. In this exercise, your AM is FirstAM. You
need to add the EmployeesVO to your FirstAM.
1. Right-click your FirstAM, and choose Test from the context menu.
2. This opens the Oracle Business Component Browser. Select the
Connect button.
3. Double-click the AddressesVO1 in the BC4J browser.
4. This will query the database, and return the records associated with your
VO (which is just a SQL SELECT).
5. You can use the navigation keys in the BC4J browser to explore the records.
6. You can, but you shouldn’t, create new Employees. Why shouldn’t you?
Because your VO only contains four (4) fields. There is other data that is
required for this table. If you insert a record, you will corrupt the
FWK_TBX_ADDRESSES table.
7. Close the BC4J browser by selecting the [X] at the top of the window.
8. Save your work
To this point, you can only test your progress with the BC4J browser. You have yet
to create any View-layer (UI) components.
1. Right-click the ClassProject project, and choose New from the context menu.
2. Select Web Tier > OA Components > Page.
3. Set the Name to FirstPG.
4. Set the Package to oracle.apps.ak.<your name>.first.webui
5. Click the OK button.
6. FirstPG is created. It is selected in the Applications Navigator panel, and it is
shown in detail in the Structure panel. Additionally, the Property Inspector
opens.
7. In the Structure panel, select region1. Then, using the Property Inspector, set
the following properties for this region.
a. ID: PageLayoutRN
b. AM Definition: Use the (…) to browse for your FirstAM.
(oracle.apps.ak.<your name>.first.server.FirstAM
c. Window Title: First Page
d. Title: FWK_TBX_ADDRESSES Query
8. Save your work.
9. To test your work, right-click FirstPG.xml in the Applications Navigator or
Structure panel, and choose Run from the context menu. Your page should
appear as follows:
10. While this isn’t much, it is your first OA Framework page. Now, let’s make
it do something.
1. In the Structure panel, right-click on the PageLayoutRN, and choose New >
Region from the context menu.
2. In the Property Inspector, change the properties of region1 as follows:
a. ID: QueryRN
b. Region Style: query
c. Construction Mode: resultsBasedSearch
d. Include Simple Panel: true
e. Include Views Panel: true
f. Include Advanced Panel: true
3. Save your work.
4. Right-click the QueryRN in the Structure panel, choose New > Region
Using Wizard to open the Create Region wizard.
a. Click the Next button at the Welcome page.
b. Select your FirstAM from the drop-down list of Application Modules.
c. Select your AddressesVO1 in the Available View Usages.
d. Click the Next button.
e. Set the Region ID to ResultsRN.
f. Set the Region Style to table from the drop-down list.
g. Click the Next button.
h. Shuttle all the attributes from Available View Attributes to Selected
View Attributes using the >> button.
i. Click the Next button.
j. Select the Style field for AddressId, and choose messageStyledText
from the drop-down list.
k. In the Step 4 of 4: Region Items table, select the Attribute Set field
for the AddressName attribute. Click the search (flashlight) icon.
l. Select the Browse button for Attribute Set.
m. Select Entire MDS XML Path for the radio button.
n. Select the Browse button.
o. Using the Package Browser, expand down to oracle > apps > fnd >
framework > toolbox > attributesets, and then Click the OK button.
p. Select the Search button. It lists all the associated attribute sets. Note
that some of the attribute sets are named, FwkTbxEmployees, and have
been created specifically for the FwkTbxEmployees table. You will most
likely need to drag-expand the Fully Qualified Name column to see all the
names. Select the
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxAddresses/Ad
dressName attribute set.
q. Click the OK button to return.
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxAddresses/Ad
dressLine1
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxAddresses/To
wnOrCity
d. Note the Save Search button. This is on the page because we set the
User Personalization property on the ResultRN and its items to True.
e. For advanced challenge, create a User Personalization on your query
page.
This is a powerful technique. You can use this as a template to create a query page for
any table within an E-Business Suite instance, assuming that the E- Business Suite
user and password you are using for your project has the proper access.
Where’s the Controller? The Query Bean encapsulates the controller within the UI
component. There is no need to write an additional controller. This reinforces the notion
from the Basics of the Controller lesson. Only write a controller when you are required
to do so.
Overview
For this lab, you'll be implementing employee query and drill-down to employee details
pages. This is the foundation for future enhancements to the application as a whole.
Eventually, you’ll add the ability to create, update and delete employees.
In this task, you'll create the initial standards-compliant packages and objects that
make up the model-layer in your Employees application.
Note: This lab assumes you have completed the Lab: First OA Framework Page. It
builds on objects created during that lab. If you have not yet completed that lab, you
need to complete the steps outlined in that lab before attempting the steps in this lab.
Create a new Application Module (AM) to be used as the root UI application module for
your page.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > Application
Module from the New Gallery to open the Create Application Module wizard.
3. Set the Package to oracle.apps.ak.<your name>.employee.server.
4. Set the Name to QueryAM.
5. Click the Next button.
6. You can accept the remaining detaults. Click the Finish button.
7. Open the oracle.apps.ak.<your name>.employee.server package in
the Applications Navigator.
8. Double-click QueryAM to open the Application Module Editor.
9. Choose Custom Properties from the categories panel.
10. Set the Name to RETENTION_LEVEL.
11. Set the Value to MANAGE_STATE.
12. Click the Add button.
13. Click the OK button.
14. Save your work.
Tip: Most of the ADF Business Component wizards allow you to resize the wizard
window, even though there may not be visible resize controls. This is helpful for
viewing long values and SQL statements.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > Entity Object from
the New Gallery to open the Create Entity Object wizard.
3. Set the Name to FwkTbxEmployeesEO.
4. Set the Package to oracle.apps.ak.<your name>.schema.server.
5. Set the Schema Object to FWK_TBX_EMPLOYEES.
NOTE: You MUST remove the RowId column from the Selected columns.
If you do not, you will be unable to create your VO later in the lab.
In this picture, a manager can have any number of employees (indicated by the "crow's
foot" next to the Employees entity), and an employee can have at most one -- but
possibly no -- manager (indicated by the straight dotted line next to the Managers
entity). In object-oriented modeling terms, the "crow's foot" is analogous to the *
annotation, and the single dotted line is represented by the 0..1 annotation. In SQL
terms, this relationship is expressed as an outer join.
Create a summary-level view object including only those attributes that you need for the
Employees search results table. This view object is the main view object for your
Search page. It should leverage the FwkTbxEmployeesEO and EmpToMgrAO you just
created.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > View Object from the
New Gallery to open the View Object wizard. If the Welcome screen appears,
click the Next button.
3. Set the Package to oracle.apps.ak.<your name>.employee.server.
4. Set the Name to QueryVO.
5. Select the Updateable Access through Entity Objects radio button.
6. Click the Next button.
7. Open the oracle.apps.ak.<your name>.schema.server package in the Available
pane, and select the FwkTbxEmployeesEO. Use the > button to shuttle the EO
to the Selected pane.
8. Use the > button and shuttle a second copy of the EO to the Selected pane.
9. Verify that the Association field for the second copy is set to
EmpToMgrAO.ManagerIDFwkTbxEmployeesEO, and the Alias is set to
FwkTbxEmployeesEO1.
10. Select the Reference checkbox for the Association.
Note: The Reference checkbox indicates if you want the information from the
entity object to be treated as reference information in this view object, with
automatic lookup. Attribute values are dynamically fetched from the entity
cache when a controlling key attribute changes.
1. EmployeeId
2. FullName
3. EmailAddress
b. From FwkTbxEmployeesEO1:
1. EmployeeId (JDeveloper assigns this attribute the default name
of EmployeeId1)
2. FullName (JDeveloper assigns this attribute the default name
of FullName1)
3. EmailAddress (JDeveloper assigns this attribute the default name
of EmailAddress1)
SELECT FwkTbxEmployeesEO.EMPLOYEE_ID,
FwkTbxEmployeesEO.FULL_NAME AS EMPLOYEE_NAME,
FwkTbxEmployeesEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
FwkTbxEmployeesEO1.EMPLOYEE_ID AS MANAGER_ID,
FwkTbxEmployeesEO1.FULL_NAME AS MANAGER_NAME,
FwkTbxEmployeesEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
FwkLookupCode.MEANING AS POSITION_DISPLAY
FROM FWK_TBX_EMPLOYEES FwkTbxEmployeesEO,
NOTE: The differences between the generated query and this query are:
1. FWK_TBX_LOOKUP_CODES_VL FwkLookupCode was added to the FROM clause.
2. FwkTbxEmployeesEO.EMPLOYEE_ID = FwkTbxEmployeesEO1.MANAGER_ID
was removed from the WHERE clause.
3. FwkTbxEmployeesEO.MANAGER_ID = FwkTbxEmployeesEO1.EMPLOYEE_ID
(+) was added to the WHERE clause.
4. AND FwkTbxEmployeesEO.POSITION_CODE = FwkLookupCode.LOOKUP_CODE
was added to the WHERE clause.
5. AND FwkLookupCode.LOOKUP_TYPE = ‘FWK_TBX_POSITIONS’ was added to
the WHERE clause.
22. When you are finished with your editing, select the Test button to ensure your
syntax is correct.
23. Click the Next button.
24. Check the Attribute Mappings to ensure that all of the Query Columns match
up to the proper View Attributes. This is a critical check when you create a VO
in Expert Mode.
25. Click the Next button.
26. Click the Next button on Step 7 of 8.
Note: The Bind Variables page (Step 7) allows you to define named bind
variables. You will not need those for your VO.
27. Deselect the View Object Class: QueryVOImpl: Generate Java File checkbox.
28. Select the View Object Class: QueryVORowImpl: Generate Java File and
Accessors checkboxes.
29. Click the Finish button.
30. Save your work.
View objects can be used only within the context of a containing application module.
Before you can use the QueryVO in your page, you must add it to the Application
Module.
1. Open QueryAM in the Application Module Editor (i.e., double-click the object in
the Applications Navigator).
2. Choose Data Model from the categories pane.
3. Shuttle QueryVO from the Available View Objects to the Data Model pane. Note:
When you shuttle QueryVO to the Data Model, it is automatically assigned an
Instance Name of QueryVO1. This is expected and acceptable behavior.
4. Click the OK button.
5. Save your work.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Web Tier > OA Components > Page from the New Gallery.
3. Set the Name to QueryPG.
4. Set the Package to oracle.apps.ak.<your name>.employee.webui.
5. Click the OK button.
1. Select your PageLayoutRN in the Structure panel, right-click and select New >.
productBranding from the context menu.
2. JDeveloper creates a pageLayoutComponents folder containing a
productBranding image item (named item1). Select this item and set the
following properties:
a. ID = ProdBrand
b. Image URI = FNDTAPPBRAND.gif
c. Additional Text = Employee Query Page
1. Select the PageLayoutRN in the Structure panel, right-click select New >
pageStatus from the context menu (any instruction text or other content added
to the pageStatus will render in parallel with any page-level action or navigation
buttons that you add).
Tip: See the Search topic in Chapter 4 of the OA Framework Developer's Guide for
additional information about implementing searching in your pages. This is a broad
topic, and we're just scratching the surface of what you can do in this lab.
1. Select the PageLayoutRN in the Structure panel, right-click and select New >
Region from the context menu.
2. Select the new region (region1), and set its properties as follows:
a. ID = QueryRN
b. Region Style = query
c. Construction Mode = autoCustomizationCriteria
d. Include Simple Panel = true
e. Include Views Panel = true
1. Select the QueryRN in the Structure panel, right-click and select New > Region
Using Wizard from the context menu. If the Welcome page appears, select Next.
2. Set the Application Module to your oracle.apps.ak.<your
name>.employee.server.QueryAM.
3. Do not select the “Use this as Application Module Definition for the region”
checkbox.
4. Select the QueryVO1 from the Available View Usages.
5. Click the Next button.
6. Set the Region Id to ResultsRN.
7. Set the Region Style to table.
8. Click the Next button.
9. Move the following attributes from the Available View Attributes list to
the Selected View Attributes list in this order:
a. EmployeeId
b. EmployeeName
c. PositionDisplay
d. ManagerName
Note: If needed, use the Up and Down arrow buttons in the Selected
View Attributes pane to move the attributes into the correct order.
Note: While it is possible to use the lookups associated with the field to set
the Attribute Sets, JDeveloper uses a non-intuitive interface for doing this. It is
easier to simply type the value into the field.
a. EmployeeId =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId
b. EmployeeName =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/FullName
c. PositionDisplay =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/Position
Tip: You can use the Search capability to help find your attribute sets. Type
/oracle/apps/fnd/framework/toolbox/attributesets/ (or a shorter path such as
/oracle/apps/fnd/framework) into the Package field in the Search window,
select Search in: Entire MDS XML Path, then select the Search button (not
the Browse button).
12. Set all the the items in the Region Items table to Style = messageStyleText.
13. Click the Finish button.
14. Select the ResultsRN region in the structure panel, and set the
following properties:
a. Additional Text = Employees Table
b. Width = 100%
Note: It is critical that you include the % (percent) symbol. If you enter
100 without the % symbol, the table will only be 100 pixels wide. By using
100%, you are telling OA Framework to use all of the available width.
Tip: For more information on the Sort Allowed and Initial Sort
Sequence properties, refer to the Developer's Guide topic on Tables >
Sorting. For more information on the Search Allowed and Selective
Search Criteria properties, refer to the Developer's Guide topics on
Search > Declarative Implementation: Results Based Search and Search >
Declarative Implementation: Auto Customization Criteria.
1. Select the QueryRN in the Structure panel, right-click and choose New >
simpleSearchPanel from the context menu. A header region (region2) and a
messageComponentLayout region (region1) will be created automatically.
2. Select the header region (region2), set its ID to SimpleSearchRN.
3. Select the default messageComponentLayout region created under the
simpleSearchPanel folder (region1) and set its ID to CustomSimpleSearchRN.
Step 3.5 Create an Employee Name Search Item for Your Query.
Step 3.6 Create an Employee Number Search Item for Your Query
OA Framework uses the mappings that you define between your custom search items
and columns in the ResultsRN to automatically handle the query when the user
selects the Go button.
1. Select the query Components folder in the Structure panel, right-click and choose
New > simpleSearchMappings from the context menu.
2. Select the default mapping created under the simpleSearchMappings and set its
properties to the following:
a. ID = EmpNameMap
b. Search Item = SearchEmpName
c. Results Item = EmployeeName
3. Select the simpleSearchMappings folder in the Structure panel, right-click and
choose New > queryCriteriaMap from the context menu.
4. Select the default mapping created under the simpleSearchMappings and set its
properties to the following:
a. ID = EmpNumMap
b. Search Item = SearchEmpNum
c. Results Item = EmployeeId
Related LOV view objects should be grouped into a common application module. For
example, any LOV view objects that you create for the Employees application should
be included in one application module.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > Application
Module from the New Gallery to open the Create Application Module wizard.
3. Set the Package to oracle.apps.ak.<your name>.lov.server.
4. Set the Name to EmpNameLovAM.
5. Click the Next button.
6. Click the Next button on Step 2 of 4.
7. Click the Next button on Step 3 of 4.
8. Deselect the Generate Java Files(s) checkbox.
9. Click the Finish button.
10. Save your work.
View objects can be used only within the context of a containing application module.
Before you can use the EmpNameLovVO in your LOV, you must add it to the LOV
application module.
Since the EmpNameLOV can be used in many different pages, it must be created as a
shared, standalone region.
1. Select the EmployeesLovRN in the Structure panel, right-click and select New
> table Using Wizard from the context menu. If the Welcome page appears,
click the Next button.
2. Set the Application Module drop-down to your EmpNameLovAM.
3. Do not select the “Use this as Application Module Definition for the region”
checkbox.
4. Select EmpNameLovVO1 from the Available View Usages.
5. Click the Next button.
6. Set the Region ID to EmpNameResultsRN.
7. Set the Region Style to table.
8. Click the Next button.
9. Shuttle all of the Available View Attributes to Selected View Attributes using the
>> button.
10. Click the Next button.
11. In the Region Items table, set the Attribute Set column of the items as follows:
a. EmployeeName =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/FullName
b. EmployeeNumber =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId
c. EmailAddress =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmailAddress
When you first created the SearchEmpName item in your query, you set its style to
messageTextInput (a standard text entry field). Now, you need to configure it as an
LOV.
Create mappings between base page items and LOV items. The mappings identify
the data input/output relationships between base page items and LOV items.
1. Select the default LOV mapping, ID'ed as lovMap1, and set the
following properties:
Note: To find the lovMap1 item, expand the SearchEmpName item, and then
expand the lovMappings item under SearchEmpName. lovMap1 will be
found there.
Note: A Return Item is the attribute returned by the LOV. A Criteria Item is the
attribute passed to the LOV, and is the basis for the LOV’s query (select).
2. Right-click lovMappings, and select New > lovMap from the context menu.
3. Select the default LOV mapping, ID'ed as lovMap2, and set the
following properties:
a. LOV Region Item = EmployeeNumber
b. Return Item = SearchEmpNum
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > Application
Module from the New Gallery to open the Create Application Module wizard.
3. Set the Package to oracle.apps.ak.<your name>.employee.server.
4. Set the Name to DetailsAM.
5. Click the Next button.
6. You can accept the remaining detaults. Click the Finish button.
Note: One of the defaults for an AM is to generate the AMImpl.java class. You will
be adding code to this class at a later point in the lab.
Create a detail-level view object including all the attributes that you need for the
Employees detail.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > View Object from the
New Gallery to open the View Object wizard. If the Welcome screen appears,
click the Next button.
3. Set the Package to oracle.apps.ak.<your name>.employee.server.
4. Set the Name to DetailsVO.
5. Select the Updateable Access through Entity Objects radio button.
6. Click the Next button.
7. Open the oracle.apps.ak.<your name>.schema.server package in the Available
pane, and select the FwkTbxEmployeesEO. Use the > button to shuttle the EO
to the Selected pane.
8. Use the > button and shuttle a second copy of the EO to the Selected pane.
1. EmployeeId
2. FirstName
3. LastName
4. FullName
5. EmailAddress
6. ManagerId
7. PositionCode
8. Salary
9. StartDate
10. EndDate
b. From FwkTbxEmployeesEO1:
1. EmployeeId (JDeveloper assigns this attribute the default name
of EmployeeId1)
2. FullName (JDeveloper assigns this attribute the default name
of FullName1)
3. EmailAddress (JDeveloper assigns this attribute the default name
of EmailAddress1)
SELECT FwkTbxEmployeesEO.EMPLOYEE_ID,
FwkTbxEmployeesEO.FIRST_NAME,
FwkTbxEmployeesEO.LAST_NAME,
FwkTbxEmployeesEO.FULL_NAME AS EMPLOYEE_NAME,
FwkTbxEmployeesEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
FwkTbxEmployeesEO.MANAGER_ID,
FwkTbxEmployeesEO.POSITION_CODE,
FwkTbxEmployeesEO.SALARY,
FwkTbxEmployeesEO.START_DATE,
FwkTbxEmployeesEO.END_DATE,
FwkTbxEmployeesEO1.EMPLOYEE_ID AS EMPLOYEE_ID1,
FwkTbxEmployeesEO1.FULL_NAME AS MANAGER_NAME,
FwkTbxEmployeesEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
FwkLookupCode.MEANING AS POSITION_DISPLAY
FROM FWK_TBX_EMPLOYEES FwkTbxEmployeesEO,
FWK_TBX_EMPLOYEES FwkTbxEmployeesEO1,
FWK_TBX_LOOKUP_CODES_VL FwkLookupCode
WHERE FwkTbxEmployeesEO.MANAGER_ID = FwkTbxEmployeesEO1.EMPLOYEE_ID (+)
AND FwkTbxEmployeesEO.POSITION_CODE = FwkLookupCode.LOOKUP_CODE
AND FwkLookupCode.LOOKUP_TYPE = ‘FWK_TBX_POSITIONS’
NOTE: The differences between the generated query and this query are:
1. FWK_TBX_LOOKUP_CODES_VL FwkLookupCode was added to the FROM clause.
2. FwkTbxEmployeesEO.EMPLOYEE_ID = FwkTbxEmployeesEO1.MANAGER_ID
was removed from the WHERE clause.
3. FwkTbxEmployeesEO.MANAGER_ID = FwkTbxEmployeesEO1.EMPLOYEE_ID
(+) was added to the WHERE clause.
4. AND FwkTbxEmployeesEO.POSITION_CODE = FwkLookupCode.LOOKUP_CODE
was added to the WHERE clause.
5. AND FwkLookupCode.LOOKUP_TYPE = ‘FWK_TBX_POSITIONS’ was added to
the WHERE clause.
22. When you are finished with your editing, select the Test button to ensure your
syntax is correct.
23. Click the Next button.
24. Check the Attribute Mappings to ensure that all of the Query Columns match
up to the proper View Attributes. This is a critical check when you create a VO
in Expert Mode.
25. Click the Next button.
26. Click the Next button on Step 7 of 8.
27. Select the View Object Class: QueryVOImpl: Generate Java File checkbox.
28. Select the View Object Class: QueryVORowImpl: Generate Java File and
Accessors checkboxes.
29. Click the Finish button.
30. Save your work.
1. Open DetailsAM in the Application Module Editor (i.e., double-click the object in
the Applications Navigator).
2. Choose Data Model from the categories pane.
3. Shuttle DetailsVO from the Available View Objects to the Data Model pane.
4. Click the OK button.
5. Save your work.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Web Tier > OA Components > Page from the New Gallery.
3. Set the Name to DetailsPG.
4. Set the Package to oracle.apps.ak.<your name>.employee.webui.
5. Click the OK button.
1. Select your PageLayoutRN in the Structure panel, right-click and select New >.
productBranding from the context menu.
2. JDeveloper creates a pageLayoutComponents folder containing a
productBranding image item (named item1). Select this item and set the
following properties:
a. ID = ProdBrand
b. Image URI = FNDTAPPBRAND.gif
c. Additional Text = Employee Details Page
1. Select your PageLayoutRN, right-click, and select New > Region Using Wizard.
If the Welcome page appears, click the Next button.
2. Set the Application Module drop-down to your DetailsAM.
3. Do not select the “Use this as Application Module Definition for the region”
checkbox.
4. Select DetailsVO1 from the Available View Usages.
5. Click the Next button.
6. Set the Region ID to MainRN.
7. Set the Region Style to defaultSingleColumn.
8. Click the Next button.
9. Shuttle the following attributes in this order to the Selected View Attributes pane.
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OAException;
try {
empNum = new Number(employeeNumber);
} catch (Exception e) {
throw new OAException
("AK","FWK_TBX_INVALID_EMP_NUMBER");
}
setWhereClause("EMPLOYEE_ID = :1");
setWhereClauseParams(null); // Always
reset setWhereClauseParam(0, empNum);
executeQuery();
}
} // end initQuery()
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.common.MessageToken;
In addition to creating new View-layer components, which you did in Task 6, you also
need to modify the existing QueryPG to implement the drill-down.
OA.jsp?page=/oracle/apps/ak/<your
name>/employee/webui/DetailsPG
&employeeNumber={@EmployeeId}
&employeeName={@EmployeeName}
&retainAM=N&addBreadCrumb=Y
OA.jsp?page=/oracle/apps/ak/<your
name>/employee/webui/DetailsPG
&employeeNumber={@EmployeeId}
&employeeName={@EmployeeName}
&retainAM=N&addBreadCrumb=Y
import java.io.Serializable;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;
2. Per the BLAF UI Guidelines on Header Components, you need to display the
current selected employee name in the Details page title. To do this, add the
following code to your controller's processRequest() method. Note that this
assumes a message (FWK_TBX_T_EMP_HEADER_TEXT) has already been
created in the database with the following content: Employee: &EMP_NAME.
((OAPageLayoutBean)webBean).setTitle(pageHeaderText);
After completing this part of the lab, you should have learned how to:
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Business Tier > ADF Business Components > Application
Module from the New Gallery to open the Create Application Module wizard.
3. Set the Package to oracle.apps.ak.<your name>.employee.server.
4. Set the Name to CreateAM.
5. Click the Next button.
6. You can accept the remaining detaults. Click the Finish button.
7. Open the oracle.apps.ak.<your name>.employee.server package in
the Applications Navigator.
8. Double-click CreateAM to open the Application Module Editor.
9. Choose Custom Properties from the categories pane.
10. Set the Name to RETENTION_LEVEL.
11. Set the Value to MANAGE_STATE.
12. Click the Add button.
13. Choose Data Model from the categories pane.
14. Shuttle DetailsVO from the Available View Objects to the Data Model pane.
1. Right-click your ClassProject project, and select New from the context menu.
2. Choose the Web Tier > OA Components > Page from the New Gallery.
3. Set the Name to CreatePG.
4. Set the Package to oracle.apps.ak.<your name>.employee.webui.
5. Click the OK button.
Note that setting the Warn About Changes property to True ensures that
users are warned when they try to navigate from this data entry page
with pending changes (the page's Cancel button is an exception, as you'll
see later in this lab).
1. Select your PageLayoutRN in the Structure panel, right-click and select New >.
productBranding from the context menu.
2. JDeveloper creates a pageLayoutComponents folder containing a
productBranding image item (named item1). Select this item and set the
following properties:
a. ID = ProdBrand
b. Image URI = FNDTAPPBRAND.gif
c. Additional Text = Employee Query Page
Per the BLAF UI guidelines, all page-level buttons render twice on the page: below
the page title, and below the menu. However, you only need to add them once using a
special pageButtonBar region.
1. Select your PageLayoutRN in the Structure panel, right-click and select New
> Region from the context menu.
2. Set the following properties for this region:
a. ID = PageButtons
Note: eBusiness Suite provides attribute sets for common objects, like
Apply and Cancel buttons. You promote good programming practice,
standards compliance, and ease of translation, it is recommended that you
use this attribute sets.
Note: You set both of these properties to True to allow the user to leave
the page by selecting the button without encountering a validation error.
5. Right-click PageButtons in the Structure panel, and select New > Item from the
context menu.
6. Set the following properties for this item:
a. ID = Apply
b. Item Style = submitButton
c. Attribute Set = /oracle/apps/fnd/attributesets/Buttons/Apply
1. Select the PageLayoutRN in the Structure panel, right-click and select New >
Region Using Wizard from the context menu.
2. Set the Application Module drop-down to your CreateAM.
11. In the Region Items table, set the Attribute Set column of the items as follows:
d. EmployeeId =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId_Number
e. FirstName =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/FirstName
f. LastName =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/LastName
g. EmployeeEmail =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmailAddress
h. PositionCode =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/Position
i. ManagerName =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/FullName_Manager
j. Salary =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/Salary
k. StartDate =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/StartDate
l. EndDate =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EndDate
The "Indicates Required Field" region is used to provide a hint to the user that the fields
with the asterisk (*) are required fields. This region should render on the same line as
the page-level action/navigation buttons. To achieve this, always add page-level keys
like this to a pageStatus component.
RAJU CHINTHAPATLA
16-Page116
Oracle Application Framework Training Manual OAF
To learn more about poplists (and other standard basic components like text fields,
checkboxes, radio buttons, list boxes and so forth), see Chapter 4 in the OA Framework
Developer's Guide.
Note: This is the first real example of the modifications that will slowly happen over
the duration of the labs for this course. As the labs progress, simple processes,
with which you should be familiar, will be explained briefly. If you need detailed
explanations on the process, you will have to look at earlier labs and lab steps.
oracle.apps.ak.<your name>.poplist.server.PositionsVO
As you did in the Drilldown to Details exercise, change the MainRN Region Style to
messageComponentLayout:
Before you can fill out your CreatePG page for a new employee, you must create a
view object row. This view object row will receive page values once the user causes a
form submit (such as by selecting the Apply button), which brings the new employee
information to the middle tier.
1. Add the following code, including the import statements and the method code,
to your CreateAMImpl.java file.
import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
...
1. Add the following code, including the import statements and the method code,
to your CreateAMImpl.java file.
import oracle.jbo.Transaction;
...
For now you'll ignore the Cancel button. You'll add logic for that later.
1. Select the PageLayoutRN region in the CreatePG, right-click and select Set
New Controller ... from the context menu.
2. In the Package Name field enter oracle.apps.ak.<your name>.employee.webui.
(Note: remember that the default name puts webui in the name twice.)
3. In the Name field enter CreateCO.
4. Click the OK button.
1. Add the following code, including the import statements and the
processRequest() method code, to your CreateCO.java file.
import oracle.apps.fnd.framework.OAApplicationModule;
...
if (!pageContext.isFormSubmission()) {
am.invokeMethod("createEmployee", null);
}
} // end processRequest()
When the user presses the Apply button, you need to commit and navigate back to the
QueryPG page where you will display a confirmation message.
1. Add the following code, including the import statements and the
processFormRequest() method code, to your CreateCO.java file.
...
// Note that we have to get this value from the VO because the
// EO will assemble it during its validation cycle.
// For performance reasons, we should generally be calling
// getEmployeeName() on the DetailsVORowImpl object, but we
// don't want to do this on the client so we're illustrating
// the interface-appropriate call. If we implemented this code
// in the AM where it belongs, we would use the other
// approach.
String employeeName =
(String)vo.getCurrentRow().getAttribute("FirstName") + " "
+ (String)vo.getCurrentRow().getAttribute("LastName");
// We need to get a String so we can pass it to the
// MessageToken array below. Note that we are getting this
// value from the VO (we could also get it from the Bean as
// shown in the Drilldown to Details lab) because the item
// style is messageStyledText, so the value isn't put on the
// request like a messaqeTextInput value is.
Number employeeNumber =
(Number)vo.getCurrentRow().getAttribute("EmployeeId");
String employeeNum =
String.valueOf(employeeNumber.intValue());
MessageToken[] tokens =
am.invokeMethod("apply");
OADialogPage dialogPage =
new OADialogPage(OAException.CONFIRMATION,
confirmMessage, null,
"OA.jsp?page=/oracle/apps/ak/<your name>/employee/webui/QueryPG",
"OA.jsp?page=/oracle/apps/ak/<your
name> /employee/webui/CreatePG");
// We set this value so the code that handles this button
// press is descriptive.
dialogPage.setOkButtonItemName("CreateOKButton");
dialogPage.setOkButtonLabel("To Query Page");
dialogPage.setNoButtonLabel("Add Another
Employee"); dialogPage.setPostToCallingPage(true);
pageContext.redirectToDialogPage(dialogPage);
}
}
To access the CreatePG from the QueryPG, revise the QueryPG, to include a Create
Employee button above the results table. To do this, add a tableAction component to
the ResultsRN table that you created in the QueryPG.
1. Select the ResultsRN table region of the QueryPG in the Structure pane, right-
click and select New > tableActions from the context menu.
2. JDeveloper automatically creates a flowLayout region for you. Change this
region's ID to ButtonLayout.
3. Select the ButtonLayout region, right-click and select New > Item. Set this item's
properties as follows:
a. ID = Create
b. Item Style = submitButton
c. Attribute Set =
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/CreateEmployee
4. Save your work.
When the user presses the Create Employee submitButton, you need the
processFormRequest() method to determine that this button has been pressed
and navigate the user to the CreatePG.
1. Select the ResultsRN table region of the QueryPG, right-click and select Set New
Controller … from the context menu.
2. Set the Package Name to oracle.apps.ak.<your name>.employee.webui.
(Note: Beware the double webui package name.)
3. Set the Name to ResultsCO.
4. Click the OK button.
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
...
After completing this part of the lab, you should have learned how to:
Implement typical entity object and entity expert attribute and row-level business
logic (including throwing attribute and row-level validation exceptions).
Use validation view objects and validation application modules in your business
logic.
Ensure your transaction flow is browser Back button safe.
The Create Employee page requires logic to ensure that the user doesn't encounter
errors due to navigation using the browser Back button. For example, it's important to
ensure that there are no partially created FwkTbxEmployeesEO entity objects in the
middle-tier cache when the user tries to create a new employee. While the solution
prevents page access after "invalid" Back button navigation, the code below allows the
page to be properly rebuilt if the transaction is passivated.
Add the following code to the end of your CreateCO’s processRequest() method.
import oracle.apps.fnd.framework.webui.TransactionUnitHelper;
...
if (!pageContext.isBackNavigationFired(false)) {
// We indicate that we are starting the create transaction
// (this is used to ensure correct Back button behavior).
TransactionUnitHelper.startTransactionUnit(pageContext,
"empCreateTxn");
// This test ensures that we don't try to create a new
// employee if we had a JVM failover, or if a recyled
// application module is activated after passivation.
// If these things happen, BC4J will be able to find
// the row that you created so the user can resume
work. } else {
if
(!TransactionUnitHelper.isTransactionUnitInProgress(pageContext,
"empCreateTxn",
true)) {
// We got here through some use of the browser "Back"
// button, so we want to display a stale data error and
// disallow access to the page. If this were a real
// application, we would probably display a more
// context-specific message telling the user she can't
// use the browser "Back" button and the "Create" page.
// Instead, we wanted to illustrate how to display the
// Applications standard NAVIGATION ERROR message.
RAJU CHINTHAPATLA
16-Page131
Oracle Application Framework Training Manual OAF
}
Add the following method to your Create AMImpl class for rolling back the database
and the middle tier. This method will later be called by the ResultsCO and CreateCO
controllers.
/*
****************************************************************
*
* Executes a rollback including the database and the middle
tier.
****************************************************************
*
*/
To account for various Back button navigation patterns between the Create Employee
page and the Query page, add the following logic to the ResultsCO controller's
processRequest() method. This ensures that any unfinished employee objects are
cleared from the middle tier cache when the user navigates to the Query page using the
browser Back button and then tries to create a new employee.
Tip: make sure you are adding this logic to the correct controller: ResultsCO.
...
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,
"empCreateTxn", false))
{
am.invokeMethod("rollbackEmployee");
TransactionUnitHelper.endTransactionUnit(pageContext,
"empCreateTxn");
}
}
When the user presses the Cancel button on the CreatePG, you need to rollback
the transaction and navigate back to the QueryPG page (the rollback is required per
the Back button guidelines in this particular use case).
Add the following code to the end of the processFormRequest method in the
CreateCO controller to handle the Cancel button selection.
Tip: make sure you are adding this logic to the correct controller: CreateCO.
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null, null, false,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
}
Note: To add a breakpoint to the code, click the left column of the line of code in
the code editor window. When you click, a red dot (breakpoint) appears. It is a
toggle. So, if you click again, the breakpoint will be removed.
To reset the breakpoints, choose Delete All from the context menu. When you
do, only the default breakpoints will remain. Your breakpoints will look as
follows.
To remove a specific breakpoint, you can click on the specific breakpoint, and
press the delete key. Or, you can right-click the specific breakpoint, and
choose Disable from the context menu.
(Note: Some of these rules can be implemented declaratively in BC4J. When you have
a choice, between declarative and programmatic validation, it is preferred to choose
the declarative implementation.)
NOTE: This table is for information purposes The steps that follow this table
define the precise steps to implement the validations outlined in this table.
This declarative validation should not change the current behavior of your page, so you
do not need to test anything now.
Note: You are encouraged to cut-n-paste the validation logic introduced in the next
several tasks from the solution text provided or the online version of the Create lab. It is
quite time-consuming to type this in directly, the risk of mistakes is higher, and you
might not include the comments that will help explain what is happening as you debug
the code.
import oracle.apps.fnd.framework.OAAttrValException;
import oracle.apps.fnd.framework.OARowValException; import
oracle.apps.fnd.framework.server.OADBTransaction; import
oracle.apps.fnd.framework.OAException; import
oracle.jbo.server.EntityImpl;
Within the context of the entity object, note that you use an OADBTransaction (unlike
the superclass Transaction that we used in our application module) because the
OAEntityImpl superclass provides a convenience getOADBTransaction()
method for us to use in our FwkTbxEmployeesEOImpl subclass.
(FwkTbxEmployeesEOImpl)empDefinition.findByPrimaryKey(transaction,
new
Key(employeeKey));
if (employee != null) {
throw new
OAAttrValException(OAException.TYP_ENTITY_OBJECT,
getEntityDef().getFullName(),
getPrimaryKey(),
"EmployeeId",
value, "AK",
"FWK_TBX_T_EMP_ID_UNIQUE");
}
}
// Note that this is the point at which the value is actually
// set on the EO cache (during the scope
of setAttributeInternal
// processing). If you don't make this call after you perform
// your validation, your value will not be set correctly.
// Also, any declarative validation that you define for this
// attribute is executed within this method.
setAttributeInternal(EMPLOYEEID, value);
}
Note that you call the set<AttributeName>() methods and pass them the
values you want to set. This ensures that all attribute-level validation is performed.
OADBTransaction transaction =
getOADBTransaction(); Number employeeId =
transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
setEmployeeId(employeeId);
}
Normally, making programmatic validation changes would not imply any connection to
your UI element. However, the CreatePG has an EmployeeId item that has, until now,
been an messageTextInput style item. Now that the EmployeeId is being derived from a
sequence and an EO-based validation, you can and should change the item to be
display-only.
RAJU CHINTHAPATLA
16-Page143
Oracle Application Framework Training Manual OAF
Note: this code will not compile until you add the method in the next step.
Tip: Since the entity object classes can be large, it's helpful to colocate related
code. For example, you should add the following method immediately after the
setStartDate() method.
In this step, you set the default value for StartDate for your CreatePG page by adding to
your create() method in your FwkTbxEmployeesEOImpl class.
Note that you call the set<AttributeName>() methods and pass them the
values you want to set. This ensures that all attribute-level validation is performed.
Now, you're going to implement the business rules to handle changes to the
FirstName and LastName attributes. In each method, you check to see if the new
value differs from the old value, and if it does, you combine the new name values into
a FullName value in the form of LastName, FirstName, and then call the FullName
setter. Since you don't need any additional validation in the setFullName() method,
you don't need to add any logic to it.
RAJU CHINTHAPATLA
16-Page147
Oracle Application Framework Training Manual OAF
2. Rebuild ClassProject.
3. Run the QueryPG, and select the Create Employee button.
4. Create an employee, apply the creation, and return to the Query page. Query
your newly created employee. You should now see the Employee Name handled
correctly in the results table of your query page.
5. If you want to see how the new code interacts with your entire page, set
the following breakpoints on the first executable line of these methods:
a. create() method
b. setFirstName() method
c. setLastName() method
d. setStartDate() method
6. Debug the QueryPG, and select the Create Employee button. Enter values for
the fields, and select the apply button.
7. As the breakpoints are encountered, verify that all of the methods are behaving
as expected.
"EndDate",
value,
"AK",
"FWK_TBX_T_END_DATE_PAST");
}
}
}
This method simply verifies that the salary value is > 0. It demonstrates how to correctly
compare oracle.jbo.domain.Number values. Add the following logic to the
setSalary() method in your FwkTbxEmployeesEOImpl class.
Condition 2: The position is not President, If so, both the ManagerName and
the ManagerId must be set. And, the ManagerId must be a valid EmployeeId.
"FWK_TBX_T_EMP_MANAGER_REQUIRED");
}
}
}
RAJU CHINTHAPATLA
16-Page152
Oracle Application Framework Training Manual OAF
"AK",
"FWK_TBX_T_START_END_BAD");
}
}
Note: Why does the ManagerId error throw first, and not the Start/End Date? Since the
checks are both in the same method, once the exception for ManagerId is thrown, the
method ceases to execute. So, to test and see both exceptions, correct the ManagerId
exception by changing the position to President, and then clicking the Apply button
again.
You must associate the EmployeeVAM with FwkTbxEmployeesEO so you can use
certain convenience methods in the Entity Expert (you'll need this in a few steps).
Validation view objects encapsulate simple validation queries that you would
otherwise write directly in your entity object or expert. For example, the PositionVVO
simply checks to see if the given position exists in the database.
SELECT LOOKUP_CODE
FROM FWK_TBX_LOOKUP_CODES_B
WHERE LOOKUP_CODE = :1
AND LOOKUP_TYPE = 'FWK_TBX_POSITIONS'
3. On the Java page (Step 8 of 8), generate both the PositionVVOImpl and the
PositionVVORowImpl for this VVO.
This validation view object looks for active employees (for simplicity, this is defined as
any employee without an end date -- regardless of what the end date is).
SELECT EMPLOYEE_ID
FROM FWK_TBX_EMPLOYEES
WHERE EMPLOYEE_ID = :1
AND END_DATE IS NULL
3. On the Java page (Step 8 of 8), generate both the EmployeeVVOImpl and
the EmployeeVVORowImpl for this VVO.
1. The validation view object must be able to set a where clause and execute
its own query. Add the following simple initQuery() method to the
PositionVVOImpl class.
import oracle.jbo.domain.Number;
...
The entity expert class will handle validation of ManagerId and PositionCode. In
each of these cases, the expert class delegates to the validation view objects (VVOs) to
execute some SQL statements that implement the required business rules.
Entity experts are singletons (meaning there is one instance that is global to the JVM
and shared by all users) that are closely affiliated with entity objects. They can be
used to perform internal work on behalf of the entity object, and they can be used for
lightweight operations by other classes instead of requiring multiple entity object
instances.
1. Right-click ClassProject in the Navigator, and select New > General > Java Class
from the New Gallery.
2. Click the OK button.
3. In the Create Java Class dialog window, enter the following:
a. Name = FwkTbxEmployeesEntityExpert
b. Package = oracle.apps.ak.<your name>.schema.server
c. Extends = oracle.apps.fnd.framework.server.OAEntityExpert
d. Deselect the Generate Default Constructor checkbox.
e. Click the OK button.
Tip: If you fail to associate the VAM with the EO, the findValidationViewObject()
method below will return null, and you will see an error message like "Could not
resolve attribute set method..." when you try to save a new employee.
import oracle.jbo.domain.Number;
...
/*
****************************************************************
*
* Returns true if the given employee is currently active and
* false if not.
****************************************************************
*
*/
public boolean isEmployeeActive(Number employeeId)
{ boolean isActive = false;
EmployeeVVOImpl empVO =
(EmployeeVVOImpl)findValidationViewObject("EmployeeVVO1");
empVO.initQuery(employeeId);
/*
****************************************************************
*
* Returns true if the given position is valid.
****************************************************************
*
*/
public boolean isPositionValid(String position)
{ boolean isActive = false;
PositionVVOImpl positionVO =
(PositionVVOImpl)findValidationViewObject("PositionVVO1");
positionVO.initQuery(position);
Entity expert classes are officially registered with their owning entity object.
Since the Entity Expert is owned by your Entity Object (EO), you should create
a method in the EO to allow any associated Entity Expert to be returned. Add
the following static method to your FwkTbxEmployeesEOImpl class.
Note: This is a static method so it can be called without the client instantiating the
EOImpl class.
/*
* Convenience method returns the EmployeeEntityExpert.
*/
public static FwkTbxEmployeesEntityExpert
getFwkTbxEmployeesEntityExpert(OADBTransaction txn) {
return
(FwkTbxEmployeesEntityExpert)txn.getExpert(FwkTbxEmployeesEOImpl
.getDefinitionObject());
} // end getEmployeeEntityExpert()
Replace the generated setPositionCode() method code with the following logic in your
FwkTbxEmployeesEOImpl class. It calls the entity expert isPositionValid ()
method, and if this call returns false, it throws an attribute-level exception.
After completing this part of the lab, you should have learned how to:
To enable PPR in this page, you must create an OA Framework standard applications
properties view object (PVO) including a transient attribute for tracking the state of the
Rendered property for the Manager field. This view object will ultimately include a
single row which you will initialize and update as the user interacts with the page. You'll
see how the Manager field binds to this view object attribute to determine whether it
should be rendered or not, and you'll configure the Position poplist to fire a PPR event
when the value changes.
Note: See the Dynamic User Interface topic in the OA Framework Developer's Guide for
additional information about leveraging PPR in your application.
The PVO should be created in the same package as your page's AM. You should have
only one PVO per application module, but it can include multiple attributes used by
various pages that share the same root AM. This PVO should follow the naming
convention: <AssociatedApplicationModuleName>PVO. Since you will be associating
your application properties view object with your CreateAM, it should be named
CreatePVO.
RAJU CHINTHAPATLA
16-Page164
Oracle Application Framework Training Manual OAF
Task 2: Configure Your View-layer Components
Step 2.1 Change Your PositionCode Item
1. Set the following properties for the PositionCode item on your CreatePG page:
a. Action Type = firePartialAction
Note: There are three action types, none, firePartialAction, and fireAction.
None is the default. firePartialAction is used for PPR. Why? Because this
is being done somewhere on the form. You do not want the entire form to
submit. You don’t want to validate all the attributes. You simply want a
subset of actions to fire, namely the PPR-related actions. This is why for
PPR, you select firePartialAction as your Action Type value.
Do not perform any server-side validation when this item changes, and the
form is submitted. For example, ignore invalid field values. Why? The
VVOs and the EntityExpert are going to handle the validation.
Note: This follow properties only appears after you set the Action
Type property to firePartialAction.
Do not perform any client side Javascript validation when this item
changes, and the form is submitted. For example, ignore null required field
values.
d. Event = positionChange
Name of PPR event added to request when the item value changes.
1. Set the following properties for the ManagerName item on your CreatePG page:
Note: Simply type the value into the property, even though there is a
True/False drop-down value. Then, press the Enter key to get the value
to “stick” in the property. If you use the mouse to click directly out of the
property after typing the value, the property resets to True. This type of
expression is known as SPEL (simplest possible expression language),
and is the UI syntax that enables PPR.
You've created the PVO, configured the PositionCode item to fire a PPR event, and
configured the ManagerName item’s Rendered property to bind to the PVO's
ManagerRendered attribute. Now, you need to add code to handle the PPR change
events and initialize the PVO.
Your controller code will invoke the method whenever it's PPR event is fired.
Add the following code to your CreateAMImpl class. This checks the value of the item's
associated DetailsVO attribute. If the value is null or PRESIDENT, the ManagerName
field should not be rendered. In this case, the ManagerRendered property should be set
to Boolean.FALSE.
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OARow;
...
/*
*********************************************************************
* Handles changes of the position poplist to set the application
* properties VO value for PPR.
*********************************************************************
*/
public void handlePositionChangeEvent() {
// Get the special, single-row application properties and make
// the first (only) row current.
OAViewObject vo = (OAViewObject)findViewObject("CreatePVO1");
OARow row = (OARow)vo.first();
// Get the value of the view object attribute with the position
// code.
OAViewObject detailsVO = (OAViewObject)findViewObject("DetailsVO1");
OARow detailsRow = (OARow)detailsVO.getCurrentRow();
String position = (String)detailsRow.getAttribute("PositionCode");
if ((position == null) || ("PRESIDENT".equals(position))) {
row.setAttribute("ManagerRendered",
Boolean.FALSE); } else {
row.setAttribute("ManagerRendered", Boolean.TRUE);
}
} // end handlePositionChangeEvent()
The following code ensures that your CreatePVO includes a single row. It sets the
RowKey primary key value, and calls the handlePositionChangeEvent() method
to initialize the ManagerRendered property based on whatever the item’s default value
is.
/*
*********************************************************************
* Initializes the transient application properties VO.
*********************************************************************
*/
public void init() {
OAViewObject appPropsVO = (OAViewObject)findViewObject("CreatePVO1");
if (appPropsVO != null) {
// Do not reinitialize the VO unless needed. Note that
// this method call does not try to query the database for
// VOs with no SELECT statement and only transient
attributes. if (appPropsVO.getFetchedRowCount() == 0) {
// Setting the match fetch size to 0 for an in-memory VO
// prevents it from trying to query rows. Calling
// executeQuery() ensures that rows aren't lost after
// a commit in the transaction (BC4J known issue
// workaround).
appPropsVO.setMaxFetchSize(0);
appPropsVO.executeQuery();
// You must create and insert a row in the VO before you
// can start setting properties.
appPropsVO.insertRow(appPropsVO.createRow());
// Set the primary key value for this single-rwo
VO. OARow row = (OARow)appPropsVO.first();
row.setAttribute("RowKey", new Number(1));
}
}
// Initialize the application properties VO (and the UI) based
// on the default employee position value set on the underlying
// object.
handlePositionChangeEvent();
} // end init()
Step 3.3 Call Your AMImpl init( ) Method from Your Controller
Add the following code to your CreateCO’s processRequest() method after the
call to am.invokeMethod("createEmployee"). This ensures that your
application properties VO is properly initialized when the page renders.
You configured the PositionCode item to perform a form submit. Add the following code
to the end of your existing CreateCO’s processFormRequest() method to check to
see if the item's PPR event has been fired. It is was fired, invoke the
CreateAMImpl.handlePositionChangeEvent() method to handle the change.
Overview
For this lab, you'll be implementing the basic components of an Employee Delete page.
This lab assumes, and relies upon, you having completed Lab: First OA Framework
Page, Lab: Implementing a Query and Drill-down, and Lab: Implementing a Create. If
you have not yet finished those labs, please do so before continuing with this lab.
After completing this lab, you should have learned how to:
You are implementing the delete function by adding capabilities to the existing
QueryPG. To add the needed capability, you need to add two attributes to the
QueryVO, a delete switcher attribute and a employee status attribute.
Note: For simplicity, the business rules assume that the presence of a non-null
END_DATE implies that the employee is inactive, regardless of the END_DATE value.
SELECT FwkTbxEmployeesEO.EMPLOYEE_ID,
FwkTbxEmployeesEO.FULL_NAME AS EMPLOYEE_NAME,
FwkTbxEmployeesEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
FwkTbxEmployeesEO1.EMPLOYEE_ID AS MANAGER_ID,
FwkTbxEmployeesEO1.FULL_NAME AS MANAGER_NAME,
FwkTbxEmployeesEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
FwkLookupCode.MEANING AS POSITION_DISPLAY,
decode(nvl(to_char(FwkTbxEmployeesEO.END_DATE), 'N'),
'N', 'DeleteDisabled', 'DeleteEnabled') AS DELETE_SWITCHER,
decode(nvl(to_char(FwkTbxEmployeesEO.END_DATE), 'Y'),
'Y', 'okind_status.gif', 'criticalind_status.gif') AS
EMPLOYEE_STATUS
FROM FWK_TBX_EMPLOYEES FwkTbxEmployeesEO,
FWK_TBX_EMPLOYEES FwkTbxEmployeesEO1,
FWK_TBX_LOOKUP_CODES_VL FwkLookupCode
WHERE FwkTbxEmployeesEO.MANAGER_ID = FwkTbxEmployeesEO1.EMPLOYEE_ID (+)
AND FwkTbxEmployeesEO.POSITION_CODE = FwkLookupCode.LOOKUP_CODE
AND FwkLookupCode.LOOKUP_TYPE = 'FWK_TBX_POSITIONS'
4. Select the Attribute Mappings category, and confirm that all of the attributes are
mapped as expected.
Create the swticher bean that will bind to the DeleteSwitcher view attribute you just
created to determine which Delete icon to display.
1. Select the QueryPG in the Applications Navigator pane, and then select
the ResultsRN in the Structure pane.
2. Right-click ResultsRN and select New > switcher from the context menu. Set the
properties of region1 as follows:
a. ID = DeleteSwitcherRN
b. Attribute Set = /oracle/apps/fnd/attributesets/Buttons/Delete
c. View Instance = QueryVO1
d. View Attribute = DeleteSwitcher
Switchers mimic a programmatic switch: you create a separate "case" for each option
that might display. The switcher bean binds to the view object attribute that returns the
name of the case to render. Each case that you add must have an ID value that
matches one of your decode return value names.
Configure the first switcher case item to show the disabled Delete image.
1. Select the default <case> switcher case in the Structure pane, right-click and
select New > Item from the context menu. Set the item1 properties as follows:
a. ID = DeleteDisabled
b. Item Style = image
c. Image URI = deleteicon_disabled.gif
d. Additional Text = Delete employee action is disabled.
e. Height = 24
f. Width = 24
Note that you must specify the Height and Width properties for any images
that you add to a page, except for the branding image. To find the values to
enter, look for your image in either the Oracle Browser Look and Feel UI
Guideline Icon Repository or the Ancillary Graphic Repository. See the Adding
Images to Your Pages document for additional information about icon creation
and use procedures.
When the user selects the Delete icon, you want to submit the form (Post) so
you can handle the event in processFormRequest(). Normally, you’d simply set a
Destination URI property for an image. But, its selection results in an HTTP
GET and not a POST. You want to perform a POST. To do this, you explicitly
configuring the image to perform a form submit when selected.
A switcher is one approach for conditionally displaying alternatives. You can achieve
the same thing using a bound value (specifically, you'll use
oracle.apps.fnd.framework.webui.OADataBoundValueViewObject
that references an employee status attribute in your QueryVO view object).
In simple terms, a bound value lets you configure a data source for a component
property (you've already configured bound values implicitly when you specified the
View Object Instance and View Object Attribute property values for
items in other labs). This task shows how to explicitly configure bound values for
selected component properties.
1. Select the ResultsRN in the Structure pane, right-click and select New > Item
from the context menu. Set item1 properties as follows:
a. ID = EmpStatus
b. Item Style = image
c. View Instance = QueryVO1
d. View Attribute = EmployeeStatus
e. Prompt = Status
f. Additional Text = Current employment status
g. Height = 16
h. Width = 16
Verify the that you have the following remove() method in your
FwkTbxEmployeesEOImpl class. If not, add it and then compile and save your change.
This method actually implements the deletion.
****************************************************************
* Add entity delete logic here.
****************************************************************
*/
public void remove() {
super.remove();
} // end remove()
Add a method to the QueryAMImpl class that takes an employeeNumber parameter and
looks for a matching row in QueryyVO view object. Note that calling the remove()
method on your QueryyVORowImpl class delegates to the remove() method in your
FwkTbxEmployeesEOImpl class.
Tip: This code illustrates how to iterate through the result set manually so you can see
how this works, however, as of release 11.5.10 there are new convenience methods in
the oracle.apps.fnd.framework.server.OAViewObjectImpl class that let you quickly find
one or more matching rows for given values. See the Javadoc for additional information.
import oracle.jbo.domain.Number;
import oracle.jbo.RowSetIterator;
import oracle.apps.fnd.framework.OAViewObject;
...
/*
*******************************************************************
* Deletes an employee.
*******************************************************************
*/
public void deleteEmployee(String employeeNumber) {
// First, find the selected employee in your VO.
// When you find it, call remove( ) on the row which in turn
OAViewObject vo = (OAViewObject)getQueryVO1();
QueryVORowImpl row = null;
// This tells the number of rows that have been fetched in the
// row set, and will not pull additional rows in like some of the
// other "get count" methods.
int fetchedRowCount = vo.getFetchedRowCount();
// Use a separate iterator, even though you could step through the
// rows without it, because you don't want to affect row currency.
RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
if (fetchedRowCount > 0) {
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++) {
row = (QueryVORowImpl)deleteIter.getRowAtRangeIndex(i);
// For performance reasons, generate ViewRowImpls for all
// VOs. When you need to obtain an attribute value,
// use the named accessors instead of a generic String
// lookup.
All image columns should be centered. Image columns are automatically centered, but
switcher columns (even when displaying images) are not. Additionally, you need to
bind the image name returned in the EmployeeStatus attribute with the OA Framework
image directory. To handle both of these conditions, add this logic to the end of the
processRequest() method in the ResultsCO after the code you've previously added.
import oracle.cabo.ui.data.DictionaryData;
import oracle.cabo.ui.data.DataObjectList;
import oracle.apps.fnd.framework.webui.beans.table.OATableBean;
import oracle.cabo.ui.data.BoundValue;
import oracle.cabo.ui.data.bind.ConcatBoundValue;
import oracle.cabo.ui.data.bind.FixedBoundValue;
import oracle.apps.fnd.common.MessageToken; import
oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OADataBoundValueViewObject;
import oracle.apps.fnd.framework.webui.beans.OAImageBean;
...
RAJU CHINTHAPATLA
16-Page181
Oracle Application Framework Training Manual OAF
// Define the OA Framework image directory
FixedBoundValue imageDirectory =
new FixedBoundValue(APPS_MEDIA_DIRECTORY);
Event 1: The delete icon has been selected, and a Warning dialog needs to
be displayed.
Event 2: The Warning dialog’s OK button has been selected, and the delete can
be executed.
See the Dialog Pages topic in the OA Framework Developer's Guide for
additional information about this component.
import oracle.apps.fnd.framework.webui.OADialogPage;
import java.io.Serializable;
...
else if ("delete".equals(pageContext.getParameter(EVENT_PARAM))) {
// The user has clicked a delete icon so display a Warning
// dialog asking to confirm deleting the employee. Note you
// configure the dialog so the "Yes" button submits to
// this page so you handle the action in processFormRequest()
MessageToken[] tokens =
{ new MessageToken("EMP_NAME", employeeName) };
OAException mainMessage =
new OAException("AK", "FWK_TBX_T_EMP_DELETE_WARN", tokens);
// Set this value so the code that handles this button press
// is descriptive.
dialogPage.setOkButtonItemName("DeleteYesButton");
pageContext.redirectToDialogPage(dialogPage);
} else if (pageContext.getParameter("DeleteYesButton") != null) {
MessageToken[] tokens =
{ new MessageToken("EMP_NAME", employeeName) };
OAException message =
new OAException("AK", "FWK_TBX_T_EMP_DELETE_CONFIRM", tokens,
OAException.CONFIRMATION, null);
pageContext.putDialogMessage(message);
}
Overview
For this lab, you'll be implementing the basic components of an Employee Update page.
This lab assumes, and relies upon, you having completed Lab: First OA Framework
Page, Lab: Implementing a Query and Drill-down, and Lab: Implementing a Create. If
you have not yet finished those labs, please do so before continuing with this lab.
After completing this lab, you should have learned how to:
Note: You are using the page copy technique shown here to avoid having you recreate
a page that is virtually identical to one that you've already created. You could also
implement pages that are this similar as a single page with a dynamic user interface.
The PPR tasks of the Lab: Implementing a Create introduced you to this technology.
Read the Dynamic User Interface topic in the Developer's Guide for additional
information about how to leverage this in your development.
JDeveloper does not provide the ability to "save as" or copy/paste a page
document, you need to use the file system for the following task.
cp $JDEV_USER_HOME/ myprojects/oracle/apps/ak/<your
name>/employee/webui/CreatePG.xml $JDEV_USER_HOME/
myprojects/oracle/apps/ak/<your name>/employee/webui/UpdatePG.xml
3. Start JDeveloper
4. Select the oracle.apps.ak.<your name>.employee.webui package in
the Applications Navigator.
5. You should now see UpdatePG listed in your Applications Navigator pane.
We need to change the controller associated with your new update page.
Tip: If you forgot to change the class name to match the file name and
you recompile, you'll get a warning like this.
1. Select the UpdatePG page's PageLayoutRN region in the Structure pane to open
the property inspector.
2. Change the PageLayoutRN properties as follows:
a. Controller Class = oracle.apps.ak.<your
name>.employee.webui.UpdateCO
b. Window Title = <Your Name> Update
c. Title = Update Employee: <Your Name>
In this task, you'll add an update image column to your ResultsRN table.
1. Select the ResultsRN table of your QueryPG in the Structure pane, right-click
and select New > Item from the context menu.
2. Set item1’s properties as follows:
a. ID = UpdateImage
b. Item Style = image
c. Attribute Set = /oracle/apps/fnd/attributesets/Buttons/Update
d. Image URI = updateicon_enabled.gif
e. Additional Text = Select to update employee.
f. Height = 24
g. Width = 24
h. Action Type = fireAction
i. Event = update
j. Select the (…) button in the Parameter property, and do the following:
Click the Add Parameters button.
Name = empNum
Value = ${oa.QueryVO1.EmployeeId}
Click the Add Parameters button.
Name = empName
Value = ${oa.QueryVO1.EmployeeName}
Click the OK button
You will use these parameters later to ensure that you update
only the employee that is selected for update. At runtime, the OA
Framework automatically creates and populates formParameter
(hidden) items for the empName and empNum parameters you
configure. These formParameter values are then added to the
request.
You must include the initiDetails() method from the DetailsAMImpl, into the AM for your
UpdatePG. Since the UpdatePG uses the CreateAM, and therefore the CreateAMImpl,
you must copy initDetails() into CreateAMImpl.
Add processRequest() logic to handle Back button navigation. Add the else if logic
shown in bold to the if statement that you already added in the Create lab.
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,
"empCreateTxn",
false)) {
am.invokeMethod("rollbackEmployee");
TransactionUnitHelper.endTransactionUnit(pageContext,
"empCreateTxn");
} else if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,
"empUpdateTxn",
false)) {
am.invokeMethod("rollbackEmployee");
TransactionUnitHelper.endTransactionUnit(pageContext,
"empUpdateTxn");
}
Add processFormRequest() logic to determine if the update icon was selected. Add this
code to the end of the existing processFormRequest() method.
} else if ("update".equals(pageContext.getParameter(EVENT_PARAM))) {
// The user has clicked an update icon so you want to navigate
// to the Update page. Later, you will change the single-page
// update to a multi-page flow.
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/ak/<your
name>/employee/webui/UpdatePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null, null, false,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
OAWebBeanConstants.IGNORE_MESSAGES);
}
RAJU CHINTHAPATLA
16-Page193
Oracle Application Framework Training Manual OAF
You need to change the logic in the UpdateCO controller to properly support the
update action and page flow. Replace the existing processRequest() method (which is
configured for Create) with this processRequest() method code (which is configured for
Update).
import java.io.Serializable;
...
You need to change the logic in the UpdateCO controller to properly support the
update action and page flow. Replace the existing processFormRequest() method
(which is configured for Create) with this processFormRequest() method code (which is
configured for Update).
Now that you have a single page update, you'll convert this to a multi-page update flow
including shared regions for the train locator bean and the navigation buttons.
For the purposes of implementing Back button logic, this exercise assumes that, after
committing, it is not appropriate to return to any of the pages in the Update transaction
using the browser Back button. Assume, for example, that all employee updates trigger
a Workflow approval, so you cannot make changes after you commit.
3. Start JDeveloper
4. You should now see all three (3) pages, UpdateDetailsPG, UpdateAssignPG,
and UpdateReviewPG, listed in your Applications Navigator pane.
We need to create three (3) controllers that will be associated with your three (3) new
pages.
1. Right-click the UpdateTrainRN in the Structure pane, and select New > link
from the context menu.
2. Set item1’s properties as follows:
a. ID = TrainStep1
b. Destination URI =
OA.jsp?page=/oracle/apps/ak/<your name>/employee/webui/UpdateDetailsPG
c. Text = Step 1
3. Right-click the UpdateTrainRN in the Structure pane, and select New > link
from the context menu.
4. Set item1’s properties as follows:
a. ID = TrainStep2
b. Destination URI =
OA.jsp?page=/oracle/apps/ak/<your name>/employee/webui/UpdateAssignPG
c. Text = Step 2
5. Right-click the UpdateTrainRN in the Structure pane, and select New > link
from the context menu.
6. Set item1’s properties as follows:
a. ID = TrainStep3
b. Destination URI =
c. Text = Step 3
If the user selects the Submit button, you'll display a Confirmation page dialog. If the
user selects the Back button you'll return to the last step in the flow, and if the user
selects the Cancel button you'll return to the Search and Results page where you
started.
Note that you don't have to implement any navigation logic yourself; the OA
Framework handles this for you using the links that you configure below.
In this step, you will add a Cancel button, an OANavigationBarBean (to render the
Next/Back buttons and the "Step X of Y" poplist) and a Submit button. You'll add code
a bit later to conditionally display and handle the Submit button.
1. Right-click the UpdateTrainFooterRN in the Structure pane, and select New >
Item from the context menu.
2. Set the item's properties as follows:
a. ID = Cancel
b. Item Style = submitButton
c. Attribute Set = /oracle/apps/fnd/attributesets/Buttons/Cancel
d. Disable Server-Side Validation = True
e. Disable Client-Side Validation = True
3. Right-click the UpdateTrainFooterRN in the Structure pane, and select New >
Region from the context menu.
4. Set the region's properties as follows:
a. ID = NavBar
b. Region Style = navigationBar
c. First Step = 1
d. Last Step = 3
Since you are coupling your navigation bar with an interaction train, it should be
interactive as well (meaning that a poplist displays after the first step that lets the user
navigate directly to a step as they would by selecting a train node). To do this, you add
a link for each page in the flow. Note that these links must have the same
Destination URI as the corresponding train step nodes, and the Warn About
Changes property is set to False since users should be able to navigate back and
forth within the flow without being warned about a loss of data.
1. Right-click the NavBar in the Structure pane, and select New > link from
the context menu.
2. Set the item's properties as follows:
a. ID = Step1Link
b. Destination URI =
OA.jsp?page=/oracle/apps/ak/<your name>/employee/webui/UpdateDetailsPG
OA.jsp?page=/oracle/apps/ak/<your name>/employee/webui/UpdateAssignPG
OA.jsp?page=/oracle/apps/ak/<your name>/employee/webui/UpdateReviewPG
Remove all the code from the existing processFormRequest() method until
your processFormRequest() method looks as follows:
Remove all the code from the existing processFormRequest() method until
your processFormRequest() method looks as follows:
Remove all the code from the existing processFormRequest() method until
your processFormRequest() method looks as follows:
RAJU CHINTHAPATLA
16-Page206
Oracle Application Framework Training Manual OAF
Step 5.4 Create Your Footer Region’s Controller
Now add code to control whether the submit button is displayed (based on the
current page), and indicate to the OANavigationBarBean what step to render.
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
import oracle.apps.fnd.framework.webui.beans.nav.OATrainBean; import
oracle.apps.fnd.framework.OAApplicationModule; import
oracle.apps.fnd.framework.webui.OAWebBeanConstants;
...
Note that the OA Framework handles the OANavigationBarBean navigation (it can do
this when it is interactive since it has the links), so you don't need to worry about
explicitly navigating from one page to the next.
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OADialogPage;
...
String employeeName =
(String)pageContext.getTransactionValue("empName");
MessageToken[] tokens =
{ new MessageToken("EMP_NAME", employeeName) };
OAException confirmMessage =
new OAException("AK", "FWK_TBX_T_EMP_UPDATE_CONFIRM", tokens);
OADialogPage dialogPage =
new OADialogPage(OAException.CONFIRMATION, confirmMessage,
null,
"OA.jsp?page=/oracle/apps/ak/<your
name>/employee/webui/QueryPG",
null);
pageContext.releaseRootApplicationModule();
pageContext.redirectToDialogPage(dialogPage);
// retain AM
pageContext.forwardImmediately("OA.jsp?page=/oracle/apps/ak/<your
name>/employee/webui/QueryPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null, null, true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
}
} // end processFormRequest()
Currently, your QueryPG’s ResultCO forwards to the UpdatePG when the update icon
is selected. You need to change this to forward to the UpdateDetailsPG instead.
Change the processFormRequest() method code to read as follows: (Note: You only
need to change one (1) line (snippet) of code, and it at the end of the
processFormRequest() method in the section where you test for update.)
...
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/ak/<your
name>/employee/webui/UpdateDetailsPG",
...
6. When the profile option, Personalize Self-Service Defn, is returned, click the
Update Value icon for that profile option.
7. Erase the value in the Site Value field.
10. Click the Quick Select icon in Yes row of the table.
Note: If you don’t see this Personalize Page link on the header bar, you have not
done Task 1 correctly.
4. Select the Personalize icon on the Page Layout: Expenses Home item in the
Personalization Structure.
5. Change the Title at the Site level from Inherit to Expenses Home (Personalized).
5. Password: applmgr
6. Enter pwd to verify the current directory. The current directory would be
/home/applmgr.
10. Give full permission to the folder by entering chmod 777 instructor1.
6. Update the profile and set the value to the instructor1 folder that you have
created on the server vx0321.us.oracle.com - /home/applmgr/instructor1.
RAJU CHINTHAPATLA
16-Page220
Oracle Application Framework Training Manual OAF
4. Drill-down to the page that is being used for this demo. Choose
/oracle/apps/ap/oie/webui/customizations/site/0/HomePG.
6. Click Export to File System button to export the personalization document to the
file system. As the Personalization Document Root Path is set to
/home/nxuser1/instructor1 folder, the personalization document will be exported
to this folder.
RAJU CHINTHAPATLA
16-Page222
Oracle Application Framework Training Manual OAF
cp –r instructor1/* instructor.
cd /home/user1/instructor/oracle/apps/ap/oie/webui/customizations/site/0
more HomePG.xml
RAJU CHINTHAPATLA
16-Page224
Oracle Application Framework Training Manual OAF
4. Update the profile and set the value to the instructor1 folder that you have
created on the server vx0321.us.oracle.com - /home/applmgr/instructor.
8. Login as OPERATIONS/WELCOME.
10. Confirm that the newly imported personalization is in place. Note: In order to
see the newly imported personalization, you may to clear the Global Cache
which you do from the Functional Administrator > Core Services > Caching
Framework > Global Configuration page.
Guided Demo 2
Pre-requisites:
1. Delete any files in the Instructor’s JDEV_USER_HOME. Start from an empty
state.
2. Unzip the Tutorial.zip into the Instructor’s JDEV_USER_HOME.
3. Download the DBC file for the course server into the Instructor’s
JDEV_USER_HOME/dbc_files/secure.
4. Login to the course server as SYSADMIN/SYSADMIN, use the System
Administrator responsibility, and add two responsibilities to the
FWKTESTER user.
12. Run the QueryPG to confirm your project is in place, and that it operates
properly.
3. ClassProject.jpx – The BC4J Substitution file. This file is only needed when you
have extended BC4J objects in your code.
4. The QueryPG.xml and EmployeesLovRN.xml files for the UI elements.
Password: applmgr
. /appltop/apps/apps_st/appl/VX0321_vx0321.env
cd $JAVA_TOP
. ./adstrtal.sh apps/apps
located. cd $JDEV_USER_HOME/myprojects
java oracle.jrad.tools.xml.importer.XMLImporter
./oracle/apps/ak/instructor/employee/webui/QueryPG.xml
–rootdir $JDEV_USER_HOME/myprojects
–dbconnection vx0321.us.oracle.com:1521:VX0321
java oracle.jrad.tools.xml.importer.XMLImporter
./oracle/apps/ak/instructor/lov/webui/EmpNameLovRN.xml
–rootdir $JDEV_USER_HOME/myprojects
–dbconnection vx0321.us.oracle.com:1521:VX0321
RAJU CHINTHAPATLA
16-Page232
Oracle Application Framework Training Manual OAF
. /appltop/apps/apps_st/appl/VX0321_vx0321.env
. ./adstrtal.sh apps/apps
RAJU CHINTHAPATLA
16-Page234
Oracle Application Framework Training Manual OAF
4. It should load/run the newly deployed page. Test to see that all is functional.
For example, put 1 in the Employee Number and then Go. Or put B% in the
Employee Name and then Go.
RAJU CHINTHAPATLA