100% found this document useful (1 vote)
174 views

Oracle ADF Training Hands-On Lab Practices - Student

Oracle ADF training Hands-On Lab Practices - Student

Uploaded by

Deepak Bhagat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
174 views

Oracle ADF Training Hands-On Lab Practices - Student

Oracle ADF training Hands-On Lab Practices - Student

Uploaded by

Deepak Bhagat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 465

Develop Rich Web Applications

with ADF 12c Essentials


Hands-on Lab Practices

Author: Deepak Bhagat


Fusion Functional Consultant,
Solution Architect & ADF Corporate Trainer

Free Downloadable Course material: GDrive Link


Deepak Bhagat’s Oracle ADF Blogs
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

Table of Contents
1 Overview of Fusion Middleware and ADF ..............................................................1
1.1 System Requirements for ADF Training -* ......................................................2
1.2 Oracle Technology Resource Account Login -* ................................................3
1.3 Downloading and Installing Oracle XE Database -* .........................................4
1.4 Downloading and Installing JDeveloper -* ......................................................5
1.5 Unlocking HR Schema -* ...............................................................................9
1.6 Entity Relation Diagram of HR System -*...................................................... 11
1.7 Working with JDev IDE Configuration Files -o ............................................... 13
1.8 Java for Beginners -o .................................................................................. 14
1.9 References -o ............................................................................................. 15
1.10 Grouping of Hands-on Lab Practices -* ........................................................ 16
1.11 Important Abbreviation and Information -* .................................................. 17
1.12 Downloading Training Materials -* ............................................................... 18
1.13 Important to go through after the training -o ............................................... 19
2 Understanding Development Tool: JDeveloper .................................................... 20
2.1 Creating a New Fusion Application and Project -* ......................................... 21
2.2 Creating a New Database Connection and Initialize the Project -* .................. 25
2.3 Adding ADF Business Components and ADF Faces -* .................................... 27
2.4 Exploring JDeveloper and New Application -* ............................................... 33
2.5 Exploring Windows of JDeveloper -* ............................................................ 34
2.6 Working with Windows -*............................................................................ 35
2.7 Taking Help using F1 key -* ........................................................................ 36
2.8 Refactoring JDeveloper Artifacts -* .............................................................. 37
2.9 Setting IDE Preferences -* .......................................................................... 39
2.10 Setting Package Levels -* ............................................................................ 41
2.11 Lab Solution ............................................................................................... 42
3 Modeling Database Schema ............................................................................... 43
3.1 Copying Application -o ................................................................................ 44
i
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

3.2 Exploring HR System ER Diagram -* ............................................................ 45


3.3 Examining Training Lab Application – Lab Solution 22 -* ............................... 46
3.4 Creating an Offline Database Diagram with Existing Schema Objects-o .......... 47
3.5 Adding New Offline Database Schema Objects -o ......................................... 49
3.6 Generating the SQL Scripts -o...................................................................... 51
3.7 Running the SQL Scripts on Database -o ...................................................... 55
3.8 Invoking PLSQL -x ...................................................................................... 56
4 Building Business Services with Default Business Components ............................. 57
4.1 Creating another New Application and Projects -* ......................................... 58
4.2 Creating Default ADF Business Components -* ............................................. 59
4.3 Examining Generated ADF Business Components Artifacts -*......................... 62
4.4 Testing the Business Service (using Oracle ADF Model Tester) -* .................. 63
4.5 Lab Solution ............................................................................................... 64
5 Persisting Data Using Entity Objects ................................................................... 65
5.1 Copying Application -o ................................................................................ 66
5.2 Creating Multiple Entity Objects at Once -*................................................... 67
5.3 Creating an Association -* ........................................................................... 68
5.4 Examining Attribute Settings -* ................................................................... 69
5.5 Creating Entity Object based on Database View -o ........................................ 71
5.6 Synchronizing an Entity Object with Table Structure Changes -o .................... 74
5.7 Lab Solution ............................................................................................... 75
5.8 Applying Property Set -d ............................................................................. 76
6 Querying Data Using View Objects ..................................................................... 77
6.1 Copying Application -o ................................................................................ 78
6.2 Creating Read-Only View Object based on SQL Query -* ............................... 79
6.3 Creating Updatable Join View Object -*........................................................ 82
6.4 Adding View Object to Existing Application Module -* ................................... 85
6.5 Testing View Objects -* .............................................................................. 86
6.6 Internationalizing through Resource Bundle -o.............................................. 89

ii
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

6.7 Creating Read-Only View Object based on Static List -o ................................ 90


6.8 Creating Multiple Read-Only View Objects at Once -o.................................... 92
6.9 Creating View Link -o .................................................................................. 94
6.10 Adding Child VO to Master VO Through Link in Existing AM -o ....................... 95
6.11 Testing View Objects and Link -o ................................................................. 96
6.12 Lab Solution ............................................................................................... 97
7 Exposing Business Service through Application Module ........................................ 98
7.1 Copying Application -o ................................................................................ 99
7.2 Creating New Nested Application Module -o................................................ 100
7.3 Lab Solution ............................................................................................. 102
8 Declaratively Customizing Business Services ..................................................... 103
8.1 Copying Application -o .............................................................................. 104
8.2 Customizing Entity Objects by Defining Control Hints -* .............................. 105
8.3 Customizing View Object by Adding Transient Attribute -*........................... 107
8.4 Defining List of Values and Accessors -*..................................................... 109
8.5 Creating View Object with Parameterized Where Clause -* .......................... 113
8.6 Creating and Using Parameterized View Criteria -o ...................................... 115
8.7 Creating Alternate Key Entity Constraints -o ............................................... 119
8.8 Declaratively Populating Primary Key with a Database Sequence -o ............. 120
8.9 Lab Solution ............................................................................................. 121
8.10 References for Groovy -o .......................................................................... 122
8.11 Defining Dependent List of Values (LOV) -x ................................................ 123
8.12 View Criteria using Custom Operator -d...................................................... 124
9 Validating in Business Services......................................................................... 125
9.1 Copying Application -o .............................................................................. 126
9.2 Adding Declarative Validation: Range Validator -* ....................................... 127
9.3 Generating Java Files for Entity Objects -* ................................................. 129
9.4 Adding Method Validator -* ....................................................................... 131
9.5 Adding Declarative Validation: Unique Key Validator -o ............................... 134

iii
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

9.6 Lab Solution ............................................................................................. 137


9.7 Adding Domain Validator -x ....................................................................... 138
9.8 Demonstrate Various Types of Validations -d .............................................. 139
10 Introducing User Interface Technologies ....................................................... 140
10.1 Running, Exploring and Familiarizing Lab 20 Application -* .......................... 141
11 Getting Started with User Interface and UI Components ................................ 149
11.1 Creating New Application with only ViewController Project -* ...................... 150
11.2 Setting Up the UI Project for Internationalization -* .................................... 152
11.3 Setting Up the Skin Preference -* .............................................................. 153
11.4 Lab Solution ............................................................................................. 154
11.5 ADF Faces Rich Client Components -d ........................................................ 155
12 Planning Pages using Layout Components ..................................................... 156
12.1 Copying Application -o .............................................................................. 157
12.2 Creating New JSF Page -* ......................................................................... 158
12.3 Adding Default Layout Components -* ....................................................... 159
12.4 Customizing Layout Components -* ........................................................... 163
12.5 Lab Solution ............................................................................................. 165
13 Designing User Interfaces and Page Flows .................................................... 166
13.1 Copying Application -o .............................................................................. 167
13.2 Creating Bounded Task Flows and Add View Activities -* ............................ 168
13.3 Creating New Page Fragments -* ............................................................... 169
13.4 Adding Task Flow Call Activities -* ............................................................. 171
13.5 Adding Return Activities -* ........................................................................ 172
13.6 Using Bounded Task Flows as a Region on a page -* .................................. 173
13.7 Creating Bounded Task Flow without Fragments -o..................................... 175
13.8 Converting Bounded Task Flows to Use Page Fragments -o ......................... 176
13.9 Using Unbounded Task Flow with View and Control Flow Activities -o .......... 177
13.10 Extracting Part of Task Flow -o .................................................................. 179
13.11 Lab Solution ............................................................................................. 181

iv
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

13.12 Using URL View Activity -d ........................................................................ 182


14 Interactively Controlling with Navigation Components .................................... 183
14.1 Copying Application -o .............................................................................. 184
14.2 Adding Links and Buttons for Navigation -* ................................................ 185
14.3 Using Menu and Menu Items -* ................................................................. 191
14.4 Assigning Internationalization and Accessibility -o ....................................... 193
14.5 Using BreadCrumbs -o .............................................................................. 195
14.6 Using Popup Dialog -o ............................................................................... 197
14.7 Defining Sequence of Steps (Train) and Use Wild Card Activity -o ................ 199
14.8 Lab Solution ............................................................................................. 204
15 Ensuring Reusability in Web Applications ....................................................... 205
15.1 Copying Application -o .............................................................................. 206
15.2 Creating and Using Reusable Component -* ............................................... 207
15.3 Creating Page Templates -o ...................................................................... 212
15.4 Applying Template to Existing Page Fragments -o ....................................... 216
15.5 Creating a New Header Template -o .......................................................... 218
15.6 Applying Template to Existing Page -o ....................................................... 221
15.7 Creating a New Page with Template -o ...................................................... 222
15.8 Adding Panel Springboard Component -o ................................................... 224
15.9 Converting JSPX to Facelets -o .................................................................. 226
15.10 Refactoring Page and Page Definition File -o .............................................. 229
15.11 Lab Solution ............................................................................................. 231
15.12 Bind Custom Declarative Components to ADF -d ......................................... 232
16 Working with Parameters, Scopes and Partial Page Refresh (PSP) ................... 233
16.1 Copying BATLab_16-PSP from Solution -o .................................................. 234
16.2 Implementing Set Action Listener, Scopes and Partial Page Refresh -o ......... 235
16.3 Setting Conditional Display -o .................................................................... 236
16.4 Defining Task Flow Parameters -o .............................................................. 238
16.5 Defining Regions Parameters -o ................................................................. 239

v
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

16.6 Using Refresh Property in PageDef -o ........................................................ 240


16.7 Lab Solution ............................................................................................. 241
17 Responding to Managed Beans, Events and Listeners..................................... 242
17.1 Creating new Application BATLab_17 with ViewController Project -* ............ 243
17.2 Creating Managed Bean -* ........................................................................ 245
17.3 Creating Action Listener and Adding Method Binding -*............................... 251
17.4 Creating Value Change Listener -* ............................................................. 252
17.5 Adding Phase Listener -o ........................................................................... 253
17.6 Adding Validator -o ................................................................................... 255
17.7 Adding Converter -o .................................................................................. 256
17.8 Lab Solution ............................................................................................. 257
18 Binding Model Layer with Business Services and Databound View ................... 258
18.1 Copying Application -o .............................................................................. 259
18.2 Creating a Read Only ADF Tables with Row Selection -* ............................. 260
18.3 Customizing Data and UI Components -o ................................................... 264
18.4 Creating a Detail Forms -o ......................................................................... 270
18.5 Making a Table Non-Selectable -o .............................................................. 272
18.6 Using setCurrentRowWithKey -o ................................................................ 274
18.7 Using setCurrentRowWithKeyValue -o ........................................................ 277
18.8 Creating a Graph Component -o ................................................................ 280
18.9 Creating a Read Only Tree -o .................................................................... 283
18.10 Lab Solution ............................................................................................. 287
18.11 More ADF Data-bound Components -d ....................................................... 288
19 Querying Data with Search Components ....................................................... 289
19.1 Copying Application -o .............................................................................. 290
19.2 Adding Query Search and Result -* ............................................................ 291
19.3 Customizing Query Search and Result -o .................................................... 295
19.4 Adding Quick Search -o ............................................................................. 296
19.5 Lab Solution ............................................................................................. 299

vi
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

20 Implementing Transactions .......................................................................... 300


20.1 Copying Application -o .............................................................................. 301
20.2 Implementing Create Operation -* ............................................................. 302
20.3 Implementing Delete Operation and Creating Helper Method -* .................. 310
20.4 Implementing Update Operation -o ............................................................ 313
20.5 Lab Solution ............................................................................................. 316
20.6 More ADF Transaction Management -d ....................................................... 317
21 Understanding Data Controls and Bindings .................................................... 318
21.1 Examining the Page’s Data Bindings -*....................................................... 319
22 Programmatically Customizing Business Services ........................................... 321
22.1 Copying Application -* .............................................................................. 322
22.2 Migrating Project to Another Application -* ................................................. 323
22.3 Prog Custz EO: Including Override Method -* ............................................. 325
22.4 Prog Custz EO: Overriding Method -* ......................................................... 327
22.5 Programmatically Assigning a Database Sequence -* .................................. 329
22.6 Prog Custz AM: Adding and Exposing Service Methods -* ............................ 330
22.7 Prog Custz VO: Default Parameterized Where Clause -* .............................. 334
22.8 Prog Custz VO: Default Parameterized View Criteria -o ................................ 335
22.9 Prog Custz VO: Dynamic Parameterized Where Clause -o ............................ 336
22.10 Prog Custz VO: Dynamic Parameterized View Criteria -o .............................. 337
22.11 Prog Custz VO: Resetting -o ...................................................................... 338
22.12 Prog Custz VO: CRUD Operation: Creating -o ............................................. 339
22.13 Prog Custz VO: CRUD Operation: Reading and findByPrimaryKey -o............. 340
22.14 Prog Custz VO: CRUD Operation: Deleting and findByKey -o........................ 341
22.15 Testing Exposed Service Methods using ADF Model Tester -o ...................... 342
22.16 Creating and Running Test Clients -o ......................................................... 343
22.17 Calling Service Method from MVC Layer -o ................................................. 345
22.18 Lab Solution ............................................................................................. 348
23 Deploying ADF Applications .......................................................................... 349

vii
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

23.1 Copying Application -o .............................................................................. 350


23.2 Creating a Business Service Deployment Profile -* ...................................... 351
23.3 Creating a Web Module Deployment Profile -* ............................................ 353
23.4 Creating an Application Deployment Profile -* ............................................ 355
23.5 Starting Integrated Weblogic Server -* ...................................................... 358
23.6 Deploying the Application from JDeveloper -* ............................................. 359
23.7 Running the Application -* ........................................................................ 360
23.8 Undeploying the Application -* .................................................................. 361
23.9 Lab Solution ............................................................................................. 364
24 Securing ADF Applications ............................................................................ 365
24.1 Copying Application -o .............................................................................. 366
24.2 Configuring the Application to use ADF Security -o...................................... 367
24.3 Defining Users in the Identity Store -o ....................................................... 369
24.4 Defining Application Roles -o ..................................................................... 370
24.5 Implementing Security on Task Flows and Pages -o .................................... 372
24.6 Testing Application Authentication and Authorization -o .............................. 374
24.7 Lab Solution ............................................................................................. 375
24.8 ADF Basic Authentication -d ...................................................................... 376
25 Debugging and Troubleshooting ADF Applications .......................................... 377
25.1 Copying Solution -*................................................................................... 378
25.2 Discovering Application Problems -* ........................................................... 379
25.3 Setting Breakpoints in the Debugger -* ...................................................... 380
25.4 Running Application Module in Debug Mode -* ........................................... 383
26 Best Practices .............................................................................................. 390
27 Miscellaneous Topics .................................................................................... 391
27.1 Real-time End-to-end ADF Application -d .................................................... 392
28 Advance Topics............................................................................................ 393
28.1 UI and Page Flow Design .......................................................................... 394
28.2 List of Existing Features ............................................................................ 395

viii
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

28.3 Adding Custom View Criteria ..................................................................... 396


28.4 Traversing, Creating and Deleting Master-Detail ......................................... 397
28.5 Creating an Application Module Base Class ................................................. 398
28.6 Programmatically Calling EL, Scopes and Conditional Display ....................... 399
28.7 Adding Router Activity ............................................................................... 400
28.8 Programmatically Handling Confirm Dialog ................................................. 401
28.9 Programmatically Invoking Popup .............................................................. 402
28.10 Programmatically Closing Popup ................................................................ 403
28.11 Rendering Dynamic Region........................................................................ 404
28.12 Adding Context Menu ................................................................................ 405
28.13 Creating Data Control Method from Backing Bean ....................................... 406
28.14 Contextual Events ..................................................................................... 407
28.15 Publishing Contextual Event ...................................................................... 408
28.16 Subscribing and Handling Contextual Event to Region ................................. 409
28.17 Subscribing and Handling Contextual Event to Page .................................... 410
28.18 Programmatically Adding Partial Page Refresh ............................................ 411
28.19 Programmatically Handling UI Create Transaction ....................................... 412
28.20 Programmatically Handling UI Delete Transaction ....................................... 413
28.21 Lab Solution ............................................................................................. 414
28.22 Advance ADF Extended Examples -x .......................................................... 415
28.23 Entity-Level Triggers -d ............................................................................. 416
29 Integrating ADF with Web Service ............................................................... 417
29.1 Creating REST Web Service with ADF Business Service ............................... 418
29.2 Creating SOAP Web Service with ADF Business Service ............................... 422
29.3 Consuming REST Web Service (ADF) ......................................................... 425
29.4 Consuming REST Web Service (Generic) .................................................... 427
29.5 Consuming SOAP Web Service ................................................................... 429
29.6 Advance ADF Extended Examples -x .......................................................... 431
29.7 More Examples on ADF Integration with Web Services -d ............................ 432

ix
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

30 Integrating ADF with Enterprise Java Bean (EJB) ......................................... 433


30.1 Consuming EJB Data Control ..................................................................... 434
30.2 Advance ADF Extended Example -x ............................................................ 435
30.3 More Examples on Consuming EJB Data Control -d ..................................... 436
31 Integrating ADF with Service Orientated Architecture (SOA) ......................... 437
31.1 Integrating SOA ........................................................................................ 438
31.2 Advance ADF Extended Example -x ............................................................ 440
31.3 More Examples on Integrating Oracle SOA with ADF -d ............................... 441
32 Integrating ADF with Mobile Application Framework (MAF) ........................... 442
32.1 Mobile Application Framework (MAF) ......................................................... 443
32.2 Advance ADF Extended Example -x ............................................................ 453
32.3 More Examples on Integrating Oracle MAF with ADF -d ............................... 454

Free Downloadable Course material: GDrive Link


Deepak Bhagat’s Oracle ADF Blogs: www.cloudadfdeepakb.blogspot.com

x
ADF Essentials Training by Deepak Bhagat
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices

1
Overview of Fusion Middleware
and ADF
For detail information refer handout “…\BATHandouts\BATDocs-
PreTrainingMaterial\BAT ADF Hands-on Lab Setup Guide.pdf”.

Download all Oracle ADF training documents and lab solutions, from shared folders on Google
GDrive shared by the trainer. Unzip all lab solutions. These training materials consist of study
guides, hands-on lab practices, reference guides, bookmarks, downloaded materials, extended
samples, demos, books, tutorials, etc.

This Hands-on Lab Practices is a beta version.

1/465
ADF Essentials Training by Deepak Bhagat
1.1 System Requirements for ADF Training -*

1) Personal laptop with admin access (Logged in user must be an Admin)


2) Software versions and requirements on your personal laptop, for ADF Training:
Requirements Recommended Minimum Value
RAM 4 GB of RAM (Preferably 8 GB). (I use 16 GB).
1024 X 768 resolution or more. Prefer extra extended
Display large monitor, to attend lecture and lab simultaneously.
Hard Drive Space 10+ GB
OS MS Windows 8+, Linux
Java JDK 1.7 Update 15+
Oracle XE Database 11.2.0.2.0
ADF, JDeveloper and 12.2.1.0.0 (not latest)
Fusion Middleware (12c) (Do NOT use 12.2.1.1.0 or later)
Oracle Technology https://www.oracle.com/technical-resources ->
Resource Account View Accounts -> Oracle Account -> Sign-In

2/454
ADF Essentials Training by Deepak Bhagat
1.2 Oracle Technology Resource Account Login -*

Login to your Oracle Resource account. Create one if necessary. The URL is
https://www.oracle.com/technical-resources -> View Accounts -> Oracle Account -> Sign-In.

3/454
ADF Essentials Training by Deepak Bhagat
1.3 Downloading and Installing Oracle XE Database -*

1) Link to download latest Oracle XE 11gR2 database:


a) https://download.oracle.com/otn/nt/oracle11g/xe/OracleXE112_Win64.zip or
b) https://www.oracle.com/database/technologies/xe-prior-releases.html or
c) copy an executable file from someone who has already downloaded.
2) Links for installing Oracle XE Database:
http://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#XEINW123
While Installing Oracle DB it will ask for system (SYS or SYSTEM) password. So, enter a
password and save it for later use. Example sysadmin (used for this lab).

3) Links for starting Oracle XE Database:


http://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#XEINW133

4/454
ADF Essentials Training by Deepak Bhagat
1.4 Downloading and Installing JDeveloper -*

1) Link to download JDeveloper 12.2.1.0.0:


https://www.oracle.com/tools/downloads/jdev-v12210-downloads.html.
2) Links for installing JDeveloper:
https://docs.oracle.com/middleware/1221/jdev/install/GUID-311BD061-083E-403A-8FE7-
4D78EEAFCB45.htm#OJDIG114
3) Unzip jdev_suite_122100_win64-2.zip.
4) Right-click on jdev_suite_122100_win64.exe file and select Run as Administrator.
Click Yes.
Oracle JDeveloper Studio Installation wizard appears.
5) On the Welcome page of the wizard, click Next.
6) On the Auto Updates page of the wizard, ensure Skip Auto Updates is selected and
click Next.
7) On the Installation Location page of the wizard, in the Oracle Home field, change the
path to C:\Oracle\Middleware122100.

8) Click Next. Click Next.


9) On the Installation Summary page of the wizard, click Install.
10) On the Installation Progress page of the wizard, after installation is completed, click
Next.
11) On the Installation Complete page of the wizard,
a) select Customize Settings and Then Start JDeveloper.
b) Click Finish.
Note: Do NOT miss this Important Step. See image below.

5/454
ADF Essentials Training by Deepak Bhagat
12) Oracle JDeveloper Studio Settings wizard appears.
a) In the Default User Directory field, enter D:\<<User>>\.jdeveloper.
b) In the JDeveloper Work Directory field, enter D:\<<User>>\BATJDev122100.
Click OK.

D:\Deepak-PC\.jdeveloper

D:\Deepak-PC\BATJDev122100

13) Links for starting JDeveloper:


https://docs.oracle.com/middleware/1221/jdev/install/GUID-533986A2-EF19-44B3-
B2BA-7090DB6F8891.htm#OJDIG129
14) After installing the JDeveloper run the Weblogic Server by clicking Run > Start Server
Instance (as shown in below image) and giving the password as weblogic1 (as shown in
below image) and test whether it is running successful or not.

6/454
ADF Essentials Training by Deepak Bhagat
15) To start JDeveloper, click on the Start menu > Oracle > Oracle JDeveloper Studio,
or double-click on the desktop shortcut .

7/454
ADF Essentials Training by Deepak Bhagat
8/454
ADF Essentials Training by Deepak Bhagat
1.5 Unlocking HR Schema -*

1) After Installing Oracle XE, you can access ‘system’ schema but not ‘hr’ schema. ‘hr’ schema
comes along with Oracle XE database, but locked. To unlock ‘hr’ schema from database to
grant permission to the users to utilize this schema, follow below steps.
a) Click Start > expand Oracle Database 11g Express Edition > select Run SQL
Command Line.

Run SQL Command Line editor opens.


b) In the editor, enter connect; command
c) Enter the user name and password for the ‘system’
Enter user-name: system (case insensitive)
Enter password: sysadmin (case sensitive)
d) Enter the following command to unlock the ‘hr’ Schema
SQL> ALTER USER HR IDENTIFIED by hr ACCOUNT UNLOCK;
e) Exit from the editor by giving command “exit” or by closing directly.
f) Now login with ‘hr’ user and password
User Name: hr (case insensitive)
Password: hr (case sensitive)
g) Now you can use all tables specified in tutorial.
h) Unlocking the HR Schema
OR
2) Alternatively, you can also unlock ‘hr’ Schema from JDeveloper as follows
a) Once you are connected as system, expand the tree in the connection panel
as Connections->SYSTEM->Other Users
b) Right-click on HR to access the Edit User dialog.

9/454
ADF Essentials Training by Deepak Bhagat
c) Within the dialog, simply uncheck the box entitled Account is Locked and
click Apply.

d) After completing this process, you should now have a fully functional Oracle XE
database with the example HR schema unlocked.

10/454
ADF Essentials Training by Deepak Bhagat
1.6 Entity Relation Diagram of HR System -*

11/454
ADF Essentials Training by Deepak Bhagat
12/454
ADF Essentials Training by Deepak Bhagat
1.7 Working with JDev IDE Configuration Files -o

1) The locations from where you can start JDeveloper apart from the shortcuts are:
a) MW_HOME\jdeveloper\jdeveloper.exe
b) MW_HOME\jdeveloper\jdev\bin\jdevw.exe
c) MW_HOME\jdeveloper\jdev\bin\jdev.exe
The first two options have the same purpose. The last option will open along with a console
for diagnostic purposes. Example of MW_HOME is C:\Oracle\Middleware122100.
2) An alternate way for this is to set the JDEV_USER_DIR environment variable that points
to the user's current working directory.
JDEV_USER_HOME and JDEV_USER_DIR are the variables that are listed in the
MW_HOME\jdeveloper\jdev\bin\jdev.boot file. JDeveloper will look up these variables on
startup to set the user's directory. For example:
set JDEV_USER_HOME=C:\Users\<<User>>\AppData\Roaming\JDeveloper
set JDEV_USER_DIR=D:\<<User>>\BATJDev122100\mywork
3) Location of IDE configuration files:
a) MW_HOME\jdeveloper\ide\bin\ide.conf
b) MW_HOME\jdeveloper\jdev\bin\jdev.conf
4) Location of IDE boot files:
a) MW_HOME\jdeveloper\ide\bin\ide.boot
b) MW_HOME\jdeveloper\jdev\bin\jdev.boot

13/454
ADF Essentials Training by Deepak Bhagat
1.8 Java for Beginners -o

Following links are limited Java necessary for ADF. Those moving to ADF from non-Java
background may find these sufficient to learn Java.

1) http://www.javatpoint.com/simple-program-of-java
2) http://www.javatpoint.com/variable-datatype
3) http://www.javatpoint.com/operators-in-java
4) http://www.javatpoint.com/object-and-class-in-java
5) http://www.javatpoint.com/constructor
6) http://www.javatpoint.com/static-keyword-in-java
7) http://www.javatpoint.com/this-keyword
8) http://www.javatpoint.com/interface-in-java
9) http://www.javatpoint.com/access-modifiers
10) http://www.javatpoint.com/package

14/454
ADF Essentials Training by Deepak Bhagat
1.9 References -o

1) JDeveloper and ADF Release 12.2.1.0.0:


https://www.oracle.com/tools/downloads/jdev-v12210-downloads.html
2) JDeveloper and ADF Latest Release, Technical Resources & Learn more:
https://www.oracle.com/application-development/technologies/jdeveloper.html
3) ADF Homepage:
https://www.oracle.com/database/technologies/developer-tools/adf/
4) Step by Step Building Simple Demo Application with ADF:
a) http://docs.oracle.com/cd/E53569_01/tutorials/tut_rich_app/tut_rich_app.html
b) http://docs.oracle.com/cd/E53569_01/tutorials/tut_rich_app_alta/tut_rich_app_alta_
1.html
5) ADF Faces Rich Component Demos:
https://docs.oracle.com/middleware/1221/adf/develop-faces/GUID-EE22FD96-2723-4F07-
95A9-04931E42C365.htm
6) ADF Code Corner:
https://www.oracle.com/application-development/technologies/adf/codecorner.html
7) ADF Forums:
https://community.oracle.com/community/java/java_development_tools/application_devel
opment_in_java/jdeveloper_and_adf

15/454
ADF Essentials Training by Deepak Bhagat
1.10 Grouping of Hands-on Lab Practices -*

1) There is no Lab 01, Lab 10 and Lab 21.


2) Lab 02, Lab 16, Lab 17 and Lab 25 are independent Lab practices and are not dependent
on any other Lab.
3) Lab 02, Lab 04, Lab 11, Lab 16, Lab 17, Lab 25 are new starter Labs.
4) Lab 04 continues to Lab 09 and has practices on ADF BC. Later Lab 09 merges with Lab 22
into one Application.
5) Lab 11 continues to Lab 24 (excluding Lab 16, Lab 17). Later Lab 15 adds Lab 09 as ADF
Model Library.
6) Lab 20, Lab 24 and Lab 28 are full applications like real-time project.
7) To get a feel of lab objectives and practices, run Lab 20 or Lab 22.

16/454
ADF Essentials Training by Deepak Bhagat
1.11 Important Abbreviation and Information -*

Some of the abbreviations used in this documents are:


1) BAT stands for Bhagat’s (or Bright Wave’s) ADF Training.
2) Lxx where xx is a numeric value. L stands for Lab or Lesson. L04 means Lab04 or Lesson04.
3) -* are Hands-on Labs you must practice.
4) -o are optional example(s), as Advance ADF topics for self-paced Hands-on practice.
5) -x are extended example(s), as Advance ADF topics for self-paced Hands-on practice,
provided separately under folder …\BATHandouts\BATXtEg-Proprietary\. These
examples may also be found in my blog at https://cloudadfdeepakb.blogspot.com.
6) -d is downloaded examples from web, as Advance ADF topics for self-paced hands-on
practice, provided separately under folder …\BATHandouts\OADFXtEg-Downloaded\.

Important Information:
1) The labs marked with –o, -x and –d are extended example(s), as Advance ADF topics for
optional self-paced Hands-on practice.
2) Some images may have the word AAT instead of BAT and aat instead of bat. Please
read/replace them as BAT and bat respectively.
3) Steps provided for Hands-on Labs are beta version and not fully verified yet. All errors and
omissions are regretted.
4) Kindly contribute with corrections to the Hands-on Lab Practices, to help the ADF
community, as all Oracle ADF documents written by us, are free with no copyright. To
participate send an email to [email protected].
5) Do share freely with larger ADF communities.

17/454
ADF Essentials Training by Deepak Bhagat
1.12 Downloading Training Materials -*

Download all Oracle ADF training documents and lab solutions (prepared by Deepak Bhagat),
from shared folders on Google GDrive. Unzip all lab solutions. These training materials consist of
study guides, hands-on lab practices, reference guides, bookmarks, downloaded materials,
extended samples, demos, etc. Hands-on Lab Practices is a beta version.
You may also find some Advance ADF topic examples in Deepak Bhagat’s blog at
https://cloudadfdeepakb.blogspot.com.

18/454
ADF Essentials Training by Deepak Bhagat
1.13 Important to go through after the training -o

Codes, Scripts and Configurations:


1) ...\BATHandouts\BATLabs-SrcCodes\scr\jdev.conf
2) ...\BATHandouts\BATLabs-SrcCodes\L28-SrcCodes-AdvanceADF\vc-util\BATADFUtil.java
3) ...\BATHandouts\BATLabs-SrcCodes\L17-SrcCodes-Bean_Event_Listener\
4) ...\BATHandouts\BATLabs-SrcCodes\L21-SrcCodes-Binding\*.java
5) ...\BATHandouts\BATXtEg-Proprietary\L28-BATXtEg-AdvanceADF\BATVCContextualEventEg
6) ...\BATHandouts\BATXtEg-Proprietary\L28-BATXtEg-AdvanceADF\BATVCDynamicRegionEg
7) ...\BATHandouts\BATXtEg-Proprietary\L28-BATXtEg-AdvanceADF\BATVCProgHandleSimplePopupEg
8) ...\BATHandouts\BATXtEg-Proprietary\L28-BATXtEg-AdvanceADF\BATVCProgHandlePopupWithRegionEg
9) ...\BATHandouts\BATXtEg-Proprietary\L29-BATXtEg-Integrating-WebService\1Create_REST-WebService-withADFBS

Documents:
10) ...\BATHandouts\BATDocs-PreTrainingMaterial\Print- BAT ADF Handy Reference.pdf
11) ...\BATHandouts\BATDocs-TrainingMaterial\BAT ADF Study Guide - student.pdf
12) ...\BATHandouts\BATDocs-TrainingReference\BAT ADF Assorted Notes.pdf
13) ...\BATHandouts\BATDocs-TrainingReference\L08-BAT Introduction to Groovy.pdf
14) ...\BATHandouts\BATDocs-TrainingReference\Oracle ADF Bookmarks 2016.html
15) ...\BATHandouts\BATDocs-TrainingReference\Oracle ADF Feeds Firefox 2015.opml
16) ...\BATHandouts\OADFDocs-Downloaded\L26-ADFDocs-BestPractices\
17) ...\BATHandouts\OADFDocs-Downloaded\L27-ADFDocs-Miscellaneous\ADF Programmer Cheat Sheet.pdf
18) ...\BATHandouts\OADFDocs-Downloaded\L35-ADFDocs-Books\
19) ...\BATHandouts\OADFDocs-Downloaded\L35-ADFDocs-Tutorials\

Concepts:
20) Geometry Management
21) Scopes
22) Lifecycle and validation
23) Contextual event
24) Create or Expose as REST Web Service or as REST API

19/454
ADF Essentials Training by Deepak Bhagat
2
Understanding Development
Tool: JDeveloper
In this lab for this lesson, start JDeveloper, set preferences for the IDE, and create a JDeveloper
application, project and database connection.

20/454
ADF Essentials Training by Deepak Bhagat
2.1 Creating a New Fusion Application and Project -*

Start JDeveloper, create a new ADF Fusion Web Application named BATLab_02 with custom
settings and database connection. Also explore data control, overview page and generated files.

1) Start JDeveloper using the default role.


a) Double-click the desktop shortcut to start JDeveloper.
b) In the Select Role dialog box, select the Role as Studio Developer (All
Features). Click OK.
c) Optionally, if system prompts the Confirm Import Preferences dialog box, click
No.
d) JDeveloper starts by displaying the Tip of the Day. Optionally, if you want, deselect
the Show tips at startup check box. Click Close.
e) Explore and then optionally close the Start page by clicking the X at the right of its
tab. (The X is not visible until you position the cursor over the tab.)
2) Create a new ADF Fusion Web Application named BATLab_02 in the bat.lab.hrsystem
package. Do not use an application template. Create the initial projects named HRService
in the bat.lab.hrsystem.service package and HRViewController in the
bat.lab.hrsystem.ui package.
a) Click the File menu > New > select Application.
Or
In the Applications window, click the New Application link.

New Gallery wizard appears.

21/454
ADF Essentials Training by Deepak Bhagat
b) Expand the General (in the Categories list) > Applications > select ADF Fusion
Web Application (in the Items list). Click OK.
Create ADF Fusion Web Application wizard appears.

BAT

Page

c) On the Application Name page of the wizard,


i) In the Application Name field, enter BATLab_02.
ii) In the Application Package Prefix field, enter bat.lab.hrsystem.
iii) Click Next.

BAT

BAT BAT

bat

d) On the Project 1 Name page of the wizard,

22/454
ADF Essentials Training by Deepak Bhagat
i) In the Project Name field, enter HRService.
ii) Click Next.

BAT BAT

e) On the Project 1 Java Settings page of the wizard,


i) In the Default Package field, enter bat.lab.hrsystem.service.
ii) Click Next.

bat.

BAT BAT

BAT BAT

f) On the Project 2 Name page of the wizard,


i) In the Project Name field, enter HRViewController.
ii) Click Next.

BAT

g) On the Project 2 Java Settings page of the wizard,


i) In the Default Package field, enter bat.lab.hrsystem.ui.
ii) Click Next.

bat

BAT BAT

BAT BAT

h) Click Finish.
3) Notice that the Applications window displays your application and projects.

23/454
ADF Essentials Training by Deepak Bhagat
BAT
BAT

4) Explore all the default generated files.


5) Explore the empty Data Controls window (within Applications window).
6) Explore the BATLab_02 Overview. (Notice that the BATLab_02 Overview page is open
in the editor. This page enables you to see all the aspects of your application at a glance,
to obtain related help and to create new objects. You can spend some time exploring this
overview objects if you want to, but it is not used in this lab.)

24/454
ADF Essentials Training by Deepak Bhagat
2.2 Creating a New Database Connection and Initialize the Project -*

Create a new database connection and initialize the project.

1) Create a new database connection.


a) Expand the Application Resources window. Right-click the Connections > New
Connection > select Database.
Create Database Connection wizard appears.

BAT

b) Supply the following information.


Connection Name Hrconn
Connection Type Oracle (JDBC)
Username hr (or if you are using a shared database, follow
instructions given by your instructor.)
Password hr (case sensitive)
Save Password Select the check box (if not checked/selected)

25/454
ADF Essentials Training by Deepak Bhagat
c) In Oracle (JDBC) Settings section, leave the Driver field as thin, Host Name field
as localhost, JDBC Port field as 1521, SID field as XE respectively.
d) Click Test Connection.
The status box should display the word Success!.
e) Click OK. Click Save All .

26/454
ADF Essentials Training by Deepak Bhagat
2.3 Adding ADF Business Components and ADF Faces -*

Create new default business components such as entity objects, view objects and application
module. Also create a JSF page.

1) Create new default business components.


a) Right-click the HRService > New > select Business Components from Tables.
Initialize Business Components Project wizard appears.

b) Ensure the Connection is hrconn (if the database connection is already created or
else click icon and follow the 2.2 above to create a new database connection). Click
OK.
Create Business Components from Tables wizard appears.

bat

Page
c) On the Entity Objects page of the wizard,
27/454
ADF Essentials Training by Deepak Bhagat
i) In the Package field, enter bat.lab.hrsystem.service.eo (note eo).
ii) Click the Query button to see the available tables.
iii) From the Available pane, select DEPARTMENTS and EMPLOYEES, click to
shuttle to the Selected pane.

bat

Page
iv) In the Selected pane, select the DEPARTMENTS, in the Entity Name field,
change to DepartmentEO (remove s).

Pane Pane

v) Similarly, select the EMPLOYEES, in the Entity Name field, change to


EmployeeEO (remove s).
vi) Click Next.
d) On the Entity-based View Objects page of the wizard,
i) In the Package field, enter bat.lab.hrsystem.service.vo (note vo).
ii) From the Available pane, select DepartmentEO and EmployeeEO, click to
shuttle to Selected pane.
iii) In the Selected pane, select the DepartmentEOView, in the Object Name
field, change to DepartmentVO (remove View and replace E to V).
iv) Similarly, select the EmployeeEOView, in the Object Name field, change to
EmployeeVO (remove View and replace E to V).
v) Click Next.

28/454
ADF Essentials Training by Deepak Bhagat
bat

Page

e) On the Query-based View Objects page of the wizard,


i) In the Package field, enter bat.lab.hrsystem.service.vvo (note vvo
replacing vo).
ii) Click the Query button.
iii) From the Available pane, select the JOBS, click to shuttle to the Selected
pane.
iv) In the Selected pane, select the JOBS, in the View Name field, change to
JobsVVO (note sVVO).
v) Click Next.

bat

Page

f) On the Application Module page of the wizard,


i) Ensure that the Add to Application Module check box is checked.
ii) In the Package field, enter bat.lab.hrsystem.service.am (note am).
iii) In the Name field, change to HRSystemAM.
iv) Click Next.

29/454
ADF Essentials Training by Deepak Bhagat
bat

g) On the Diagram page of the wizard,


i) Check the Add to Business Components Diagram check box to create
business components diagram. (Leave Package as it is. We will refactor later).
ii) Click Next.
iii) Click Finish. Click Save All .

bat

Page

2) Explore the files generated and diagrams. Ensure following details:


Type of Object Package Objects Based on
DEPARTMENTS,
DepartmentEO,
Entity Object bat.lab.hrsystem.service.eo EMPLOYEES
EmployeeEO
tables
DepartmentVO, DepartmentEO,
Updatable VO bat.lab.hrsystem.service.vo
EmployeeVO EmployeeEO
Query-based VO bat.lab.hrsystem.service.vvo JobsVVO JOBS table
Application bat.lab.hrsystem.service.am HRSystemAM
Module

30/454
ADF Essentials Training by Deepak Bhagat
BAT

bat

bat

bat

bat

bat

bat

3) Test the default business components by running the application module.


a) Right-click the (application module) HRSystemAM (in the bat.lab.hrsystem.service.am
package) > select Run.
Oracle ADF Model Tester wizard appears.

b) Explore the view object instances in it.


2) Create a new JSF page named HRSystemIndex and run the page.

31/454
ADF Essentials Training by Deepak Bhagat
a) Right-click the HRViewController > New > select Page.

bat
bat
bat
bat
bat
bat

Create JSF Page wizard appears.

BAT BAT

b) In the File Name field, enter HRSystemIndex. Keep remaining as defaults.


c) Click OK.
d) Explore the newly created page HRSystemIndex.jsf.
e) Right-click the HRSystemIndex.jsf > select Run.
System opens the HRSystemIndex page in web browser. Explore the URL and title.

32/454
ADF Essentials Training by Deepak Bhagat
2.4 Exploring JDeveloper and New Application -*

Examine, explore, understand and familiarize with all generated artifacts.

1) Expand the HRService > Application Sources > bat.lab.hrsystem.


2) Double-click the HRService.jpx file (database connectivity) and explore it. Observe
Connection details.
3) Expand the Data Controls window and explore newly displayed artifacts i.e.,
HRSystemAMDataControl and components under it.

4) Expand the bat.lab.hrsystem.service.am and double-click the Business


Components Diagram.adfbc_diagram.

bat

5) Explore all generated artifacts.


6) Expand the Application Resources window > Connections, explore HR System schema,
tables, sequence, properties, etc.

33/454
ADF Essentials Training by Deepak Bhagat
2.5 Exploring Windows of JDeveloper -*

Examine, explore, understand and familiarize with various windows of the JDeveloper.

1) Explore various windows of JDeveloper such as Applications, Data Controls, Databases,


Structure, Editors (code and visual), Log and Debugger, Components, Resources (IDE and
Application), Properties, etc. and other Windows.

BATLab_02

34/454
ADF Essentials Training by Deepak Bhagat
2.6 Working with Windows -*

Play around with windows and familiarize.

1) Right-click the window title, to work with following window options:


Close / Open Maximize / Restore Float / Dock Split / Unsplit Resize Reposition

2) All JDev Menus and menu items like File, Edit, View, Application, Refactor, Search, etc.

BAT

35/454
ADF Essentials Training by Deepak Bhagat
2.7 Taking Help using F1 key -*

Familiarize with JDeveloper Help.

1) Select or place the cursor on the object or context of which you need help.
2) Press F1 key for help.
Help window appears, which contains the detailed information regarding the selected object
or context.

36/454
ADF Essentials Training by Deepak Bhagat
2.8 Refactoring JDeveloper Artifacts -*

Refactor artifacts by renaming view object and moving diagram to appropriate package.

1) Rename (JobsVVO to JobVVO) and move diagram (from


bat.lab.hrsystem.service.am to bat.lab.hrsystem.service.diagram).
a) Right-click the JobsVVO > Refactor > select Rename.

bat

Rename wizard appears.

b) In the Rename To field, change to JobVVO (remove s). Click OK.


Notice the name JobsVVO changed to JobVVO.
c) Expand the bat.lab.hrsystem.service.am, select Business Components
Diagram.adfbc_diagram.
d) Click the Refactor menu > select Move.

37/454
ADF Essentials Training by Deepak Bhagat
Move Files window appears.

BAT BAT
BAT

bat

BAT

e) Select the service folder, create a new folder diagram by clicking icon and
select it.
f) Click the Select button.
Diagram moves from package bat.lab.hrsystem.service.am to
bat.lab.hrsystem.service.diagram
2) Save All.

38/454
ADF Essentials Training by Deepak Bhagat
2.9 Setting IDE Preferences -*

Configure JDeveloper preferences for Object Naming and Packages.

1) Set global naming preferences and packaging preferences for following ADF BC objects:
entity object, domain, association, view object, view link and application module.
a) Click the Tools menu > select Preferences.
Preferences wizard appears.

b) Expand the ADF Business Components > select Object Naming.


c) In the Suffix column, enter values as follows:

d) At the left pane, select Packages and enter Packages values as follows
39/454
ADF Essentials Training by Deepak Bhagat
e) Click OK. Save All.
2) Click the Tools menu > select Switch Roles, to switch default role to start JDeveloper, if
needed.

40/454
ADF Essentials Training by Deepak Bhagat
2.10 Setting Package Levels -*

Set the project package and web content levels to reduce number of levels.

1) Click the Applications Window Options as shown below.

BAT

bat
bat

bat
bat
bat
bat

2) Change the both Package Level and Web Content Level to 5.


3) Save All.

41/454
ADF Essentials Training by Deepak Bhagat
2.11 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_02.

42/454
ADF Essentials Training by Deepak Bhagat
3
Modeling Database Schema
In this lab, you use the diagram modeler/editor to create a visual representation of the database
schema. You also create a new database component (a table) and create the DDL (Data Definition
Language) scripts to add the table to the schema.

43/454
ADF Essentials Training by Deepak Bhagat
3.1 Copying Application -o

Make a copy of application BATLab_02 and rename it to BATLab_03.

1) In the File Explorer, open location …\mywork.


2) Copy and paste the application BATLab_02 in the same location.
3) Rename the newly copied application from BATLab_02-Copy to BATLab_03.
4) Switch to JDeveloper.
5) Click the File menu > select Open.
6) Select the …mywork\BATLab_03\BATLab_02.jws from your local system. Click Open.
7) Click the Application menu > select Rename.
Rename wizard appears.

BAT BAT

BAT

BAT

8) In the File Name field, change to BATLab_03.jws. Click Save.


9) Click the Build menu > select Clean All and Refresh Application. Click Yes.

44/454
ADF Essentials Training by Deepak Bhagat
3.2 Exploring HR System ER Diagram -*

Examine, explore, understand and familiarize with HR System ER diagram.

45/454
ADF Essentials Training by Deepak Bhagat
3.3 Examining Training Lab Application – Lab Solution 22 -*

Open …\BATHandouts\BATLabs-Solutions\BATLab_22 lab solution. Run and explore the


application.
<<to be done together at end>>

46/454
ADF Essentials Training by Deepak Bhagat
3.4 Creating an Offline Database Diagram with Existing Schema Objects-o

Create a new offline database diagram (BAT_DB) with existing schema objects.

1) Expand the Application Resources window > Connections > Database > hrconn and
explore.
2) Right-click the HRService > New > select From Gallery.
New Gallery wizard appears.

3) Expand the General > Diagrams > select Database Diagram at right-side. Click OK.
Create Database Diagram wizard appears.

BAT

bat

4) In the Name field, enter BATSchema


5) In the Package field, enter bat.lab.hrsystem.service.db (note db).
6) Click OK.
7) BATSchema.db_diagram opens in the editor. Save All.
47/454
ADF Essentials Training by Deepak Bhagat
8) Expand the Application Resources window > Connections > Database > hrconn >
Tables.
9) Drag the DEPARTMENTS and EMPLOYEES tables to the diagram modeler/editor.
BAT

BAT

Specify Location dialog box appears.

BAT

10) Select the Offline Database, in Offline Database field enter BAT_DB.
11) Click OK. Save All.

48/454
ADF Essentials Training by Deepak Bhagat
3.5 Adding New Offline Database Schema Objects -o

Add new database schema object (GENDERS) to the newly created offline database (BAT_DB).

1) From the Components window (ensure Database page is selected), drag Table
component to the BATSchema.db_diagram editor.
BAT

BAT

Specify Location wizard appears.


2) In the Offline Database list, select BAT_DB (If it is already not selected). Click OK.
3) In the diagram editor, change table name from TABLE1 to GENDERS.
4) Resize the table.
5) Double-click the GENDERS table diagram to invoke Edit Table page.
BAT

Page
a) Click the Columns page (left side).
49/454
ADF Essentials Training by Deepak Bhagat
b) Clickthe icon (right end) to add a new column GENDER_ID.
i) In the Name column, enter GENDER_ID,
ii) In the Data Type column, change to Number,
iii) In the Size column, enter 4,
iv) In the Not NULL column, check the check box, to make it mandatory,
v) In the PK column, click inside column, to make it a primary key,
vi) Save All.
OR
vii) Click the Constraints page. Click icon and select New Primary Key
Constraint. From Available Columns, select GENDER_ID and shuttle it to
Selected Columns.
c) Similarly add another column GENDER_NAME with default values.
i) In the Name column, enter GENDER_NAME.

6) Save All.

50/454
ADF Essentials Training by Deepak Bhagat
3.6 Generating the SQL Scripts -o

Create and run scripts to create GENDER table in the Database and to insert data in it.

1) To generate DDL script,


a) In the Projects window, expand Offline Database Sources > BAT_DB > HR.
b) Right-click the GENDERS table > Generate To > select SQL Script.

BAT

Generate SQL from Database Objects wizard appears.

BAT BAT

BAT

51/454
ADF Essentials Training by Deepak Bhagat
c) On the SQL Script page of the wizard, in the File Name field change to
…\database\BAT_DB\createTableGender.sql. Click Next. Click Next. Click
Next. Click Next. Click Finish.
It creates createTableGender.sql file and opens in the editor

BAT

BAT

2) Double-click the Employees table.


a) Click the Columns page.
b) Select the last column (i.e. DEPARTMENT_ID), click icon to add a new column.
It inserts new column.
c) In the Name column, change from COLUMN1 to GENDER_ID,
d) In the Data Type column, change to Number,
e) In the Size column, change to 4. Save All.

3) Go back to BATSchema.db_digram (if it is closed, expand the Recent Files window and
double-click the diagram).
4) In the Components window, drag Foreign Key from GENDER_ID of GENDERS table to
GENDER_ID of EMPLOYEES table. Click OK. Save All.

52/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

BAT

5) To generate DDL script,


a) Expand the Offline Database Sources > BAT_DB > HR.
b) Right-click the EMPLOYEES table > Generate To > select SQL Script.
Generate SQL from Database Objects wizard appears.
c) In the File Name field, change to …\database\BAT_DB\alterTableEmp.sql.
Click Next. Click Next. Click Next.
d) On the Specify Operation page of the wizard,
i) In the Operation option, select Alter radio button.
ii) Check the With replace if necessary checkbox.
iii) In the Target option, select Database Connection.
iv) Ensure the Connection is hrconn (BATLab_03).
v) Click Next. Click Finish.

53/454
ADF Essentials Training by Deepak Bhagat
BAT

6) Expand the Offline Database Sources.


7) Right-click the BAT_DB > New > select From Gallery.
New Gallery wizard, appears.
a) Expand the Database Tier > select Database Files > SQL File. Click OK.
Create SQL File wizard appears.

BAT BAT BAT

b) In the File Name field, enter populateTableGender.sql.


c) In the Directory field, change path to …\HRService\database\BAT_DB.
d) Click OK.
populateTableGender.sql opens in the editor.
8) Insert following content in populateTableGender.sql editor.
INSERT INTO GENDERS (gender_id, gender_name) VALUES (1, 'MALE');
INSERT INTO GENDERS (gender_id, gender_name) VALUES (2,
'FEMALE');
9) Save All.

54/454
ADF Essentials Training by Deepak Bhagat
3.7 Running the SQL Scripts on Database -o

Run the all three scripts to create GENDER table and to insert data in the table.

1) Run the scripts in following order: createTableGender.sql, alterTableEmp.sql


and populateTableGender.sql.
a) Expand the Offline Database Sources > BAT_DB > HR.
b) Double-click the createTableGender.sql to open it in the editor.
c) Right-click in the editor, select Run Script.

It creates new table GENDERS in database.


2) Similarly, Run Script on alterTableEmp.sql and populateTableGender.sql.
3) To verify, check the database that the GENDERS table is created and it has data.

55/454
ADF Essentials Training by Deepak Bhagat
3.8 Invoking PLSQL -x

This is part of advance ADF topic and a copy of this extended example (named
BATPLSQLIntgEg) may be found under …\BATHandouts\BATXtEg-Proprietary\L03-
BATXtEg-Database\. For hands-on practice, please refer to Deepak Bhagat’s Blog at
https://cloudadfdeepakb.blogspot.com or download from above location. It’s a lab sample on
invoking PLSQL.

56/454
ADF Essentials Training by Deepak Bhagat
4
Building Business Services with
Default Business Components
In this lab, you create a business model by using the wizards that are built into JDeveloper. You
see how to build a default model without any coding. In subsequent lessons and practices, you
learn to build and customize components to meet your specific application requirements.

57/454
ADF Essentials Training by Deepak Bhagat
4.1 Creating another New Application and Projects -*

Create an application BATLab_04 with default projects, with default packages and settings.

1) Create an application named BATLab_04 with package bat (as explained in Lab 2.1) and
with default projects, packages and settings.
a) Click the File menu > New > select Application.
New Gallery wizard appears.
b) Expand the General > Applications > select ADF Fusion Web Application.
c) Click OK.
Create ADF Fusion Web Application wizard appears.

BAT

BAT BAT

bat

d) On the Application Name page of the wizard,


i) In the Application Name field, enter BATLab_04.
ii) In the Application Package Prefix field, enter bat.
iii) Click Finish. (or Click Next > Next > Next > Next > Next > Finish).
2) The application gets created with default projects Model and ViewController and with
default packages bat.model and bat.view respectively.

BAT

3) Optionally one may delete ViewController project.

58/454
ADF Essentials Training by Deepak Bhagat
4.2 Creating Default ADF Business Components -*

Create default business components; Entity Objects, View Objects and Application Module.

1) Create Business Components by using Create Business Components from Tables with
following details
Type of Object Package Objects Based on
bat.model.eo DepartmentsEO, DEPARTMENTS,
Entity Object
EmployeesEO EMPLOYEES tables
bat.model.vo
DepartmentsVO, DepartmentsEO,
Updatable VO
EmployeesVO EmployeesEO
Query-based VO bat.model.vo JobsVO JOBS tables
Application bat.model.am AppModuleAM
Module
a) Right-click the Model project > New > select Create Business Components from
Tables.
Initialize Business Components Project wizard appears.

b) Click the icon, next to the Connection.


Create Database Connection wizard appears.

59/454
ADF Essentials Training by Deepak Bhagat
BAT

c) Supply the following information:


Connection Name Hrconn
Connection Type Oracle (JDBC)
hr (or if you are using a shared database, follow the
Username
instructions given by your instructor.)
Password hr (case sensitive)

Save Password Select check box


d) Click the Test Connection. The status box displays the word Success! Click OK.
e) Click OK.
Create Business Components from Tables wizard appears.
f) To create default business components, follow below steps, as explained in step 2.1.9.

60/454
ADF Essentials Training by Deepak Bhagat
bat

Page

i) Click the Query button. From Available pane, select DEPARTMENTS and
EMPLOYEES and shuttle them to Selected pane. Click Next.
ii) On the Entity-based View Objects page of the wizard. From Available pane,
shuttle DepartmentsEO and EmployeesEO to Selected pane. Click Next.
iii) On the Query-based View Objects page of the wizard. Click Query button.
From Available pane, select JOBS and shuttle them to Selected pane. Click
Next.
iv) Ensure the Add to Application Module checkbox is checked.
v) Click Next.
vi) Click Finish.
g) Save All.

61/454
ADF Essentials Training by Deepak Bhagat
4.3 Examining Generated ADF Business Components Artifacts -*

Examine, explore, understand and familiarize with all generated artifacts.

BAT

bat

bat

bat

bat

bat

bat

62/454
ADF Essentials Training by Deepak Bhagat
4.4 Testing the Business Service (using Oracle ADF Model Tester) -*

Test the business services which are created in earlier sections by using Oracle ADF Model Tester.

1) Run and test application module (AppModuleAM), using Oracle ADF Model Tester.
a) Right-click the (application module) AppModuleAM, select Run.
Oracle ADF Model Tester wizard appears.

2) Double-click the various object instances on the left side panel and test.
a) For example, double-click the EmpDeptFkVL1 and Jobs and observe the details on
right side panel.
b) Navigate through records by clicking right-arrow and left arrow .

63/454
ADF Essentials Training by Deepak Bhagat
4.5 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_04

64/454
ADF Essentials Training by Deepak Bhagat
5
Persisting Data Using Entity
Objects
In this lab, you create entity objects for tables that the application will update and also create
associations.

65/454
ADF Essentials Training by Deepak Bhagat
5.1 Copying Application -o

Make a copy of application BATLab_04 and rename it to BATLab_05. Follow the steps, as
explained in Lab 3.1.

1) In the File Explorer, open location …\mywork.


2) Copy and paste the application BATLab_04 in the same location.
3) Rename the newly copied application from BATLab_04-Copy to BATLab_05.
4) Switch to JDeveloper.
5) Click the File menu > select Open.
6) Select …mywork\BATLab_05\BATLab_04.jws from your local system. Click Open.
7) Click the Application menu > select Rename.
Rename wizard appears.
8) In the File Name field, change to BATLab_05.jws. Click Save.
9) Click the Build menu > select Clean All and Refresh Application. Click Yes.
10) Open the Model.jpx file in the editor.
11) If the Connection is selected None, then select Online Database.

66/454
ADF Essentials Training by Deepak Bhagat
5.2 Creating Multiple Entity Objects at Once -*

Create following multiple entity objects at once by using Create Business Components from
Tables.

DB Tables Entity Objects (EO)


COUNTRIES CountriesEO
REGIONS RegionsEO
JOB_HISTORY JobHistoryEO
1) Right-click the bat.model.eo package > New > select Business Components from
Tables.
Create Business Components from Tables wizard appears.
2) Click the Query button.
3) From the Available (left) pane, select COUNTRIES, REGIONS and JOB_HISTORY and shuttle
them to Selected (right) pane.

bat

4) Click Finish.

67/454
ADF Essentials Training by Deepak Bhagat
5.3 Creating an Association -*
(dependent on 5.3)

Manually create an association JobHistDeptAS between two entity objects DepartmentsEO


and JobHistoryEO.

1) Right-click the bat.model.as > New > select Association.


Create Association wizard appears.

bat

2) On the Name page of the wizard, in the Name field enter JobHistDeptAS. Click Next.
3) On the Entity Objects page of the wizard,
a) From the Select Source Attribute pane, expand DepartmentsEO > select
DepartmentId and from Select Destination Attribute pane, expand
JobHistoryEO > select DepartmentId.
b) Click the Add button.

bat
bat

4) Click Next. Click Next. Click Next. Click Finish. Save All.

68/454
ADF Essentials Training by Deepak Bhagat
5.4 Examining Attribute Settings -*

Examine, explore, understand and familiarize with all settings of an Attribute.

1) Property Set: Select a named property set to apply to this attribute. A property set is a
version of an existing domain that is XML-only (no Java) and does not enforce a data type.
2) Effective Date: Specify effective date properties for the attribute. These options are
available only if the attribute type is Date.
3) Start Date: Select to indicate that this attribute is the start attribute of an effective dated
entity object.
4) End Date: Select to indicate that this attribute is the end attribute of an effective dated
entity object.
5) Sequence Flag: Select to indicate that this attribute stores a flag indicating the most recent
change in the sequence for an effective dated entity object.
6) Sequence: Select to indicate that this attribute stores a sequence of changes for an
effective dated entity object.
7) Updatable: You can enable the attribute to Always or Never be updatable or enable it to
be updated only before the entity is first posted (While New).

69/454
ADF Essentials Training by Deepak Bhagat
8) Queryable: Specify that this attribute can occur in the WHERE clause of a view object
(selected by default except for LOBs).
9) Precision Rule: Specifies that a validator is applied by the framework at runtime to enforce
the maximum precision and scale of the data type. If selected, the validation is performed
by the entity. If not selected, the validation is not performed by the entity and may result
in invalid precision/scale errors from the database when the transaction is committed.
10) Refresh on Insert/ Update: Specify whether to retrieve the value from the database
after an insert or update.
11) Change Indicator: Select this option if the column is a change indicator, such as a
timestamp, to be used to indicate that a row has been changed by another transaction. (If
no columns are specified as change indicators, ADF BC does a column-by-column
comparison.)
12) Effective Date: The attribute is either the start or end date of a date range for which the
entity row is effective (used for a point of time snapshot to answer such questions as what
an employee’s salary was on January 30, 2004.)
13) History Column: Select to use this column to log changes to the database. You can log
changes only if you have implemented Java Authentication and Authorization Service (JAAS)
authentication, the selected attribute is persistent, you have not selected Primary Key,
Mandatory, or Discriminator, and the attribute is Char, Character, String, Date, Timestamp,
or Number. After you have selected History Column, you can select the history column type
(created on or modified on for a Date or Timestamp attribute, created by or modified by for
a Char, Character, or Stringattribute, or version number for a Number attribute).
14) Generate Unique Constraint: Select to generate a UNIQUE constraint for this attribute.
It is often useful to define an attribute so that its values must be unique. For example, you
might want to enforce that every customer has a unique email address.
15) Sequence Name: Enter the name of the database sequence. The sequence name shown
on the Sequence tab is applicable only at design time when you use the Create Database
Tables feature. The sequence indicated here will be created along with the table on which
the entity object is based. This field is not available for all attribute types.
16) Start At: Enter an integer value you want the sequence to start at, the default value is 1.
This field is not available for all attribute types.

70/454
ADF Essentials Training by Deepak Bhagat
5.5 Creating Entity Object based on Database View -o

Create Entity Object EmpDetailsViewEO in bat.model.eo package, based on Database View


(EMP_DETAILS_VIEW).

1) In the Applications window, right-click the Model project (or bat.model.eo package)
> New > select Entity Object.
Create Entity Object wizard appears.

bat

2) On the Name page of the wizard, in the Name field, enter EmpDetailsViewEO and click
Browse (next to the Schema Object).
Select Schema Object wizard appears.

a) Check the Object Type as Views and uncheck Tables.


b) Click the Query button.
c) From the Available Objects select EMP_DETAILS_VIEW. Click OK.

71/454
ADF Essentials Training by Deepak Bhagat
bat

3) Click Next.
4) On the Attributes page of the wizard, select last two columns (CounrtyName and
RegionName). Click Remove. Click Next. (Removing is important for lab 5.4).

5) On the Attribute Settings page of the wizard, select EmployeeId and check Primay Key
check box to make it as Primary Key. Click Next. Click Next. Click Next. Click Finish. (See
lab 5.6 for details on each properties of the Attribute).

72/454
ADF Essentials Training by Deepak Bhagat
73/454
ADF Essentials Training by Deepak Bhagat
5.6 Synchronizing an Entity Object with Table Structure Changes -o
(dependent on 5.5)

Synchronize EmpDetailsViewEO entity object’s missing columns with database or structure


changes in table.

1) Double-click the EmpDetailsViewEO to open in the editor.


2) Click the Attributes page. Verify that CounrtyName and RegionName attributes are
missing.
3) Right-click the EmpDetailsViewEO > select Synchronize with Database.
Synchronize with Database wizard appears.

4) Select statements with COUNTRY_NAME and REGION_NAME. Click Synchronize button.


Click OK. Click OK. Save All.
5) Verify the CounrtyName and RegionName attributes are now present in the
EmpDetailsViewEO.

74/454
ADF Essentials Training by Deepak Bhagat
5.7 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_05

75/454
ADF Essentials Training by Deepak Bhagat
5.8 Applying Property Set -d

This Property Set topic is part of the Advance ADF extended example, taken from the web. For
optional self-paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L05-ADFXtEg-EntityObject.

76/454
ADF Essentials Training by Deepak Bhagat
6
Querying Data Using View
Objects
In this lab, you create view objects that are more customized for your application. You can also
create LOV, read-only view objects to support those LOVs and updatable view objects based on
entity objects and also create links between view objects. You can test these objects or instances
by using tester.

77/454
ADF Essentials Training by Deepak Bhagat
6.1 Copying Application -o

Make a copy of application BATLab_05 and rename it to BATLab_06. Follow the steps, as
explained in Lab 5.1.

1) In the File Explorer, open location …\mywork.


2) Copy and paste the application BATLab_05 in the same location.
3) Rename the newly copied application from BATLab_05-Copy to BATLab_06.
4) Switch to JDeveloper.
5) Click the File menu > select Open.
6) Select …mywork\BATLab_06\BATLab_05.jws from your local system. Click Open.
7) Click the Application menu > select Rename.
Rename wizard appears.
8) In the File Name field, change to BATLab_06.jws. Click Save.
9) Click the Build menu > select Clean All and Refresh Application. Click Yes.
10) Open the Model.jpx file in the editor.
11) If the Connection is selected None, then select Online Database.

78/454
ADF Essentials Training by Deepak Bhagat
6.2 Creating Read-Only View Object based on SQL Query -*

Create a read-only view object EmpSqlQueryVO based on SQL Query.

1) Right-click the bat.model.vo > New > select View Object.


Create View Object wizard appears.
2) On the Name page of the wizard,
a) In the Name field, enter EmpSqlQueryVO.
b) Select the Custom SQL query radio button (under Data Source). Click Next.

bat

3) On the Query page of the wizard,


a) Click the Query Builder button to build a Query.
SQL Statement wizard appears.
b) Click the Query button.
c) Expand the EMPLOYEES and select attributes EMPLOYEE_ID, FIRST_NAME,
LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY,
COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID from Available pane (left) and
shuttle them to Selected pane (right). Click OK.

79/454
ADF Essentials Training by Deepak Bhagat
4) Verify the Query: SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT,
MANAGER_ID, DEPARTMENT_ID FROM EMPLOYEES.

5) Click Next till Step 8 (i.e. Application Module page).


6) Check the Add to Application Module.
7) Click Finish. Save All.
8) Right-click the AppModuleAM > select Run.
80/454
ADF Essentials Training by Deepak Bhagat
Oracle ADF Model Tester wizard appears.
9) Double-click the EmpSqlQuery1 and observe the result with read-only values.

81/454
ADF Essentials Training by Deepak Bhagat
6.3 Creating Updatable Join View Object -*
(Dependent on 4.2)

Create updatable join view object EmpSummaryVO in the bat.model.vo package, based on two
entity objects EmployeesEO and DepartmentsEO.

1) Right-click the bat.model.vo > New > select View Object.


Create View Object wizard appears.
2) On the Name page of the wizard,
a) In the Name field, enter EmpSummaryVO and select Entity radio button (under Data
Source).
b) Click Next.

bat

3) On the Entity Objects page of the wizard,


a) From the Available pane, expand bat.model.eo > select first EmployeesEO and
then DepartmentsEO and shuttle them to Selected pane. (Note Order of selection
is important).

bat

82/454
ADF Essentials Training by Deepak Bhagat
b) In the Selected pane, select DepartmentsEO. Ensure that Association is set to
EmpDeptFkAS.Departments1.
c) Notice that default Join Type is inner join.
d) Change the Join Type to left outer join.
e) Ensure that Updatable check box is NOT checked, and that Reference check box is
checked.

bat
bat

f) Select the EmployeesEO and ensure Updatable checkbox is checked. Click Next.

bat
bat

4) On the Attributes page of the wizard,


a) From Available pane, expand EmployeesEO > select attributes EmployeeId,
FirstName, LastName, Email, PhoneNumber, HireDate, JobId,
83/454
ADF Essentials Training by Deepak Bhagat
CommissionPct, Salary and shuttle them to Selected pane. (Note order of
selection is very important).
b) From Available pane, expand DepartmentsEO > select attributes DepartmentId,
DepartmentName, ManagerId and shuttle them to Selected pane. Click Next till
Application Module page.

5) Do NOT check Add to Application Module checkbox. Click Finish.


6) Save All your work and Make.

84/454
ADF Essentials Training by Deepak Bhagat
6.4 Adding View Object to Existing Application Module -*
(Dependent on 6.6)

Add a view object (EmpSummaryVO) to existing application module (AppModule).

1) Add a view object EmpSummaryVO to AppModuleAM


a) Double-click the AppModuleAM (under bat.model.am) to open in the editor.
b) Click the Data Model page.
c) From Available View Objects pane, select EmpSummaryVO and shuttle it to Data
Model pane (Observer it creates an instance EmpSummary1).

bat
bat
bat

d) Save All.

85/454
ADF Essentials Training by Deepak Bhagat
6.5 Testing View Objects -*

Test view objects and view links by using Oracle ADF Model Tester. <<more elaborate steps req>

1) Right-click the AppModuleAM > select Run.


Oracle ADF Model Tester wizard appears.
2) Test the view link DeptLocVL1 and master detail Locations1-Departments3.

3) Test the updatable view object EmpSummary1.


4) Double-click the EmpSummary1 and traverse through details by clicking icon.

86/454
ADF Essentials Training by Deepak Bhagat
5) Create a new employee and commit.
6) Find/Search this particular employee record.
7) Update this record and commit.
8) Now remove filter/search and get all records.
9) Again, find record and edit details of an employee.
10) Delete record and rollback.
11) Delete record and commit.
12) Now find that record. Verify that it shows empty non- editable fields, as record does not
exist anymore.
13) For EmployeeId 100, change Salary to 240000 and tab out. Observe that there is no
error thrown. Change Salary to 2400000 and observe that error is thrown because
Salary range cannot be more than 6 digits.
14) Observe the format of HireDate is YYYY-MM-DD. Change HireDate to 2023-06-17 and
tab out. Observe that there is no error thrown even though HireDate is greater than
current date.
15) Observe that JobId is not an LOV and displays only the Job Id, not Job Title.
16) Observe that there is no field as Annual Salary.

87/454
ADF Essentials Training by Deepak Bhagat
88/454
ADF Essentials Training by Deepak Bhagat
6.6 Internationalizing through Resource Bundle -o

Internationalize ADF Business Service through resource bundle.

1) Click the Application menu > select Project Properties.


Project Properties wizard appears.
BAT BAT

bat

2) Select the Resource Bundle (at left side pane).


3) In the Default Project Bundle Name field, enter bat.model.rb.ModelBundle.
4) Click OK. Click Yes. Save All.

89/454
ADF Essentials Training by Deepak Bhagat
6.7 Creating Read-Only View Object based on Static List -o

Create a read-only view object CurrencyStaticVO based on Static List.

1) Right-click the bat.model.vo > New > select View Object.


Create View Object wizard appears.

bat

2) On the Name page of the wizard,


a) In the Name field, enter CurrencyStaticVO.
b) Select the Static list radio button (under Data Source).
c) Click Next.
3) On the Attributes page of the wizard,
a) Click the New button.
New View Object Attribute dialog box appears.

b) In the Name field, enter Symbol. Click OK.


4) Follow the same steps, to add new attributes Country and Currency.
90/454
ADF Essentials Training by Deepak Bhagat
5) Click Next. Click Next. (if it prompts dialog box, click No).
6) On the Static List page of the wizard,
a) Click the icon to add values for the Attributes, as shown in below table.

b) Click on empty text boxes and provide values for the Attributes as shown in above
table. Click Next.
7) On the Application Module page of the wizard, check Add to Application Module.
Click Finish. Save All.
8) Right-click the AppModuleAM > select Run.
Oracle ADF Model Tester, wizard appears.
9) Double-click the CurrencyStatic1 and observe the result with static values.

91/454
ADF Essentials Training by Deepak Bhagat
6.8 Creating Multiple Read-Only View Objects at Once -o

Create following multiple read-only view objects at once by using Create Business Components
from Tables.
Tables Read Only View Objects
COUNTRIES CountriesVO
LOCATIONS LocationsVO
REGIONS RegionsVO

1) Right-click the bat.model.vo > New > select Business Components from Tables.
Create Business Components from Tables wizard appears.
2) Click Next till Query-based View Objects page.
3) On the Query-based View Objects page of the wizard,
a) Click the Query button.
b) Select COUNTRIES, LOCATIONS and REGIONS from Available pane and shuttle them
to Selected pane.
c) Click Next till Application Module page.

bat

4) On the Application Module page of the wizard, check Add to Application Module.
Click Finish.
5) Examine the newly generated links CountrRegFkVL and LocCIdFkVL that it is not based
on association unlike others.
6) Right-click the AppModuleAM > select Run.
Oracle ADF Model Tester wizard appears.
7) Double-click the LocCIdFkVL1 and CountrRegFkVL1 and observe the result with read-
only values.

92/454
ADF Essentials Training by Deepak Bhagat
93/454
ADF Essentials Training by Deepak Bhagat
6.9 Creating View Link -o

Manually create a Master-Detail relationship between two view objects (LocationsVO and
DepartmentsVO) using view link (DeptLocVL).

1) Right-click the bat.model.vl > New > select View Link.


Create View Link wizard appears.

bat

2) On the Name page of the wizard, in the Name field enter DeptLocVL. Click Next.
3) On the View Objects page of the wizard,
a) From Select Source Attribute pane, expand bat.model.vo > LocationsVO >
select LocationId and from Select Destination Attribute pane expand
DepartmentsVO > select LocationId.
b) Click the Add button.

bat

c) Click Next. Click Finish. (Note Do NOT check Add to Application Module).

94/454
ADF Essentials Training by Deepak Bhagat
6.10 Adding Child VO to Master VO Through Link in Existing AM -o
(Dependent on 6.9)

Add master view object (LocationsVO) and child view object (DepartmentsVO) via view link
(DeptLocVL) to application module (AppModuleAM). <<Make all other objectives clear>>

1) Open the AppModuleAM in the editor.


2) Click the Data Model page.
3) In the Data Model pane, select Locations1.
4) From Available View Objects pane, expand bat.model.vo > LocationsVO > select
DepartmentsVO via DeptLocVL and shuttle it to Data Model pane.
5) Ensure that child instance Departments3 is created under Location1 in Data Model
pane. Save All.

bat

95/454
ADF Essentials Training by Deepak Bhagat
6.11 Testing View Objects and Link -o

Test view objects and view links by using Oracle ADF Model Tester.

1) Right-click the AppModuleAM > select Run.


Oracle ADF Model Tester wizard appears.
2) Test the view link DeptLocVL1 and master detail Locations1-Departments3.

96/454
ADF Essentials Training by Deepak Bhagat
6.12 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_06

97/454
ADF Essentials Training by Deepak Bhagat
7
Exposing Business Service
through Application Module
In this lab, you create nested application module and add view objects to that application module
which are no longer required.

98/454
ADF Essentials Training by Deepak Bhagat
7.1 Copying Application -o

Make a copy of application BATLab_06 and rename it to BATLab_07. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

99/454
ADF Essentials Training by Deepak Bhagat
7.2 Creating New Nested Application Module -o

Create new nested application module NestedAM in bat.model.am package.

1) Right-click the bat.model.am > New > select Application Module.


Create Application Module wizard appears.

bat

2) On the Name page of the wizard,


a) In the Name field, enter NestedAM.
b) Click Next.
3) On the Data Model page of the wizard,
a) From the Available View Objects pane (under bat.model.vo), select
CurrencyStaticVO, CountrRegFkVL and LocCIdFkVL and shuttle them to Data
Model pane, under NestedAM.
b) Click Next.

bat
bat
bat

4) On the Application Modules page of the wizard,


a) From the Available pane, select AppModuleAM and shuttle it to Selected pane.
b) Click Next. Click Finish.

100/454
ADF Essentials Training by Deepak Bhagat
bat
bat

5) Open the AppModuleAM in the editor.


6) Click the Data Model page.
a) From the Data Model pane, select and remove Countries1, CurrencyStatic1
and Regions1 object instances by shuttling them back (use back arrow) to
Available View Objects pane.
b) Save All.
7) Run the NestedAM and test.

101/454
ADF Essentials Training by Deepak Bhagat
7.3 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_07

102/454
ADF Essentials Training by Deepak Bhagat
8
Declaratively Customizing
Business Services
In this lab, you make declarative modifications to your business components such as defining
control hints, creating alternate key, populating primary key, adding transient attribute, creating
list of values, creating view criteria and using groovy.

103/454
ADF Essentials Training by Deepak Bhagat
8.1 Copying Application -o

Make a copy of application BATLab_07 and rename it to BATLab_08. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

104/454
ADF Essentials Training by Deepak Bhagat
8.2 Customizing Entity Objects by Defining Control Hints -*
(Dependent on 4.3)

Customize entity objects (EmployeesEO) by defining control hints.

1) Open the EmployeesEO in the editor.


2) Click the Attributes page.
3) Select the HireDate attribute.
4) Click the UI Hints tab (after the attributes).
a) In the Tooltip field, enter Hire Date,
b) In the Format Type field, select Simple Date,
c) In the Format field, select dd-MMM-yyyy. If it prompts Warning message, click Yes.
d) Save All.

5) Click the Details tab.


a) Select the Expression radio button under Default Value section.
b) Click the Edit expression icon.
Edit Expression Editor wizard appears.

c) In the Expression textbox, enter adf.currentDate.

105/454
ADF Essentials Training by Deepak Bhagat
d) Click OK. Save All.

106/454
ADF Essentials Training by Deepak Bhagat
8.3 Customizing View Object by Adding Transient Attribute -*
(Dependent on 6.6)

Customize view object by adding a new transient attribute.

1) Open the EmpSummaryVO in the editor.


2) Click the Attributes page.
3) Click the icon (to add new attribute) > select New Attribute.

New View Object Attribute dialog box appears.

4) In the Name field enter AnnualSalary, in the Type field select BigDecimal, Click OK.
5) Select the AnualSalary attribute, click UI Hints tab, in the Width field enter 10.

107/454
ADF Essentials Training by Deepak Bhagat
6) Click the Details tab, select Expression radio button under Default Value section, click
Edit expression icon.
Edit Expression Editor wizard appears.
7) In the Expression textbox, enter Salary!=null?Salary*12:null. Click OK. Save All.

108/454
ADF Essentials Training by Deepak Bhagat
8.4 Defining List of Values and Accessors -*
(Dependent on 6.6)

Define list of values and accessors.

1) Open the EmpSummaryVO in the editor.


2) Click the Attributes page.
3) Select the JobId attribute.
4) Click the List of Values tab. Click icon.

Create List of Values wizard appears.

a) In the List Data Source field, select JobsVO1 by clicking icon and selecting
JobsVO from View Accessors dialog box.
b) In the List Attribute field, select JobId from the drop-down.
c) Click the UI Hints tab,
109/454
ADF Essentials Training by Deepak Bhagat
i) In the Default List Type field, select Combo Box with List of Values from
the drop-down
ii) From the Available pane, select JobTitle and shuttle it to Selected pane.
iii) Click OK. Save All.

OR
5) Alternatively, Click the Accessors page and click icon.
View Accessors wizard appears.

bat
bat

a) Add the JobsVO. Click OK. Save All.


6) Go back to Attributes page. Select JobId attribute.
7) Click the List of Values tab and click icon.
Create List of Values wizard appears.
a) In the List Data Source field, select JobsVO1.
110/454
ADF Essentials Training by Deepak Bhagat
b) In the List Attribute field, select JobId.
c) Click the UI Hints tab.
i) In the Default List Type field, select Combo Box with List of Values.
ii) From the Available pane select JobTitle and shuttle it to Selected pane.
d) Click OK.

8) Save All.
9) Click the Accessors page, observe the View Accessors.

bat
bat

10) Run the AppModuleAM and test.


a) Double-click the AppModuleAM > select Run.
Oracle ADF Model Tester wizard appears.
b) Double-click the EmpSummary1.
c) Observe the JobId field shows the list of values with Job Title.

111/454
ADF Essentials Training by Deepak Bhagat
112/454
ADF Essentials Training by Deepak Bhagat
8.5 Creating View Object with Parameterized Where Clause -*

Create view object with Parameterized Where Clause.

1) Right-click the bat.model.vo > New > select View Object.


Create View Object wizard appears.
2) On the Name page of the wizard,
a) Select the Custom SQL query,
b) In the Name field, enter EmpByEmailVO,
c) Click Next.

bat

3) On the Query page of the wizard,


a) Write the query select FIRST_NAME, LAST_NAME, EMAIL from EMPLOYEES where
EMAIL=:p_email.
b) Click Next.
4) On the Bind Variables page of the wizard,
a) Click the New button to add bind variable.
b) In the Name field, enter p_email.
c) Click Next till Attribute Settings page.
5) On the Attribute Settings page of the wizard,
a) Click Next. (If it prompts dialog box click No).
6) On the Application Module page of the wizard,
a) Check the Add to Application Module checkbox.
b) In the Name field, change to AppModuleAM.
7) Click Finish. Save All.
8) Run the AppModuleAM and test.
a) Double-click the AppModuleAM > select Run.

113/454
ADF Essentials Training by Deepak Bhagat
Oracle ADF Model Tester wizard appears.
b) Double-click the EmpByEmail1.
Bind Variables dialog box appears.
c) In the Value field, enter AKHOO. Click OK.
d) It shows FirstName, LastName and Email values in read-only mode.

114/454
ADF Essentials Training by Deepak Bhagat
8.6 Creating and Using Parameterized View Criteria -o
(Dependent on 6.4)

Create two parameterized view criteria’s in EmpSqlQueryVO.

1) Open the EmpSqlQueryVO in the editor.


2) Click the View Criteria page. Click icon under View Criteria section.
Create View Criteria wizard appears.

3) In the Criteria Name field, enter EmpByDeptVC. Click Add Item.


4) In the Definition section,
a) In the Attribute field, select DepartmentId,
b) In the Operator field, select Equals,
c) In the Operand field, select Bind Variable.
d) In the Parameter field, click icon to enter bind variable.
New Variable dialog box appears.
e) In the Name field enter p_deptId, in the Type field select Integer, click OK.
5) Click OK. Saver All.

115/454
ADF Essentials Training by Deepak Bhagat
6) Similarly, create another view criteria named EmpByEmailVC. In the Attribute field select
Email, in the Operator field select Equals, in the Operand field select Bind Variable
and add Parameter as p_email. Click OK. Save All.

7) Run the AppModuleAM and test.


a) Double-click the AppModuleAM > select Run.
Oracle ADF Model Tester wizard appears.
b) Double-click the EmpSqlQuery1.
c) Click the Search icon.
View Criteria wizard appears.
i) From the Available pane select EmpByDeptVC and shuttle it to Selected pane.
ii) Click Find.
iii) Bind Variables dialog box appears.
iv) In the Value field, enter 80. Click OK.

116/454
ADF Essentials Training by Deepak Bhagat
d) It shows the employee details with Department Id 80.

117/454
ADF Essentials Training by Deepak Bhagat
e) Similarly, double-click the EmpSqlQuery1, click the Search icon. Shuttle
EmpByEmailVC. (Move back EmpByDeptVC). Click Find. In the Value field enter
AKHOO. Click OK.
f) It shows the employee details with Email AKHOO.

118/454
ADF Essentials Training by Deepak Bhagat
8.7 Creating Alternate Key Entity Constraints -o
(Dependent on 6.6)

Explore how to create alternate key constraint.

1) Right-click the EmployeesEO > select New Entity Constraint (from context menu).
Create Entity Constraint wizard appears.

2) On the Name page of the wizard, keep default values. Click Next.
3) On the Attributes page of the wizard, from the Available pane, select PhoneNumber and
shuttle it to Selected pane. Click Next.

4) On the Properties page of the wizard, select Alternate radio button (under Key Type
section). Click Cancel (Do NOT Save).

119/454
ADF Essentials Training by Deepak Bhagat
8.8 Declaratively Populating Primary Key with a Database Sequence -o
(Dependent on 6.6)

Declaratively populate primary key with Database sequence.

1) Open the EmployeesEO in the editor.


2) Click the Attributes page.
3) Select the EmployeeId attribute.
4) In the Details tab, in the Type field select DBSequence, in the Sequence Name field
enter EMPLOYEES_SEQ.
5) Do NOT Save. (revert back)

6) Additional advance extended example BATDBSequenceEg may be found under


...\BATXtEg-Proprietary\L08-BATXtEg-DeclCustomization.

120/454
ADF Essentials Training by Deepak Bhagat
8.9 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_08.

121/454
ADF Essentials Training by Deepak Bhagat
8.10 References for Groovy -o

1) Groovy Language, guides, examples: http://groovy.codehaus.org


2) …\BATDocs-TrainingReference\L08-BAT Introduction to Groovy.pdf
3) http://www.oracle.com/technetwork/developer-tools/jdev/introduction-to-groovy-128837.pdf

122/454
ADF Essentials Training by Deepak Bhagat
8.11 Defining Dependent List of Values (LOV) -x

Create a new application, displaying Locations containing Country LOV and State Province LOV,
where State Province LOV is dependent on Country LOV. This would demonstrate that State
Province LOV is dependent on Country LOV and hence called Dependent LOV.

This topic is part of advance ADF extended example (BATDependentLOV-Eg) may be found
under …\BATHandouts\BATXtEg-Proprietary\L08-BATXtEg-DeclCustomization.
For hands-on practice, please refer to Deepak Bhagat’s Blog at
https://cloudadfdeepakb.blogspot.com or download from the above location. It's a lab sample on
creating dependent or cascading List of Values (LOV).

123/454
ADF Essentials Training by Deepak Bhagat
8.12 View Criteria using Custom Operator -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L08-ADFXtEg-DeclCustomization.

124/454
ADF Essentials Training by Deepak Bhagat
9
Validating in Business Services
In this lab, you add several types of declarative validation to entity objects and view objects.

125/454
ADF Essentials Training by Deepak Bhagat
9.1 Copying Application -o

Make a copy of application BATLab_08 and rename it to BATLab_09. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

126/454
ADF Essentials Training by Deepak Bhagat
9.2 Adding Declarative Validation: Range Validator -*

Add Range Validator on Salary attribute.

1) Open the EmployeesEO in the editor.


2) Click the Attributes page.
3) Select the Salary attribute.
4) Click the Validation Rules tab, click icon.
Add Validation Rule wizard appears.

a) In the Type field, select Range,


b) In the Minimum Value field, enter 0,
c) In the Maximum Value field, 99999.
d) Click the Failure Handling tab.
i) In the Message Text textbox, enter BAT_ERROR: Salary Range should be
between 0 to 99999.
ii) Click OK.
5) Save All.
6) Run the AppModuleAM and test Salary validation.
a) Run the AppModuleAM.
b) Double-click the Employees1.
c) In the Salary field, change value to 12345 and tab out. No Error.
d) Change the value to 123456 and tab out.
e) System prompts an error message by saying BAT_ERROR: Salary Range should
be between 0 to 99999.

127/454
ADF Essentials Training by Deepak Bhagat
BAT

128/454
ADF Essentials Training by Deepak Bhagat
9.3 Generating Java Files for Entity Objects -*

Generate Java Class for EmployeesEO.

1) Open the EmployeesEO in the editor.


2) Click the Java page.
3) In the Java Classes section, click Pencil icon.

bat

Select Java Options wizard appears.

4) Check the Generate Entity Object Class, check the methods Accessors, Create
Method, Data Manipulation Methods and Remove Method options if needed.
5) Click OK. Save All.
6) In the Java Classes section, observe the newly created java class
bat.model.eo.EmployeesEOImpl. (as shown in step-3 diagram)
7) And also expand the EmployeesEO, double-click the EmployeeEOImpl.java to open it
in the editor.
129/454
ADF Essentials Training by Deepak Bhagat
8) Explore the entity object java class.
BAT

bat

bat
bat

bat
bat
bat

bat
bat
bat

130/454
ADF Essentials Training by Deepak Bhagat
9.4 Adding Method Validator -*

Add a method validator to validate Hire Date such that it must be on or before current date.

1) Open the EmployeesEO in the editor.


2) Click the Attributes page.
3) Select the HireDate attribute.
4) Click the Validation Rules tab, click icon.
Add Validation Rule wizard appears.

5) In the Type field, enter Method.


6) Ensure that Create and Select Method check box is checked and Method Name is
validateHireDate.
7) Click the Failure Handling tab.
8) In the Message Text textbox, click Magnifier icon.
Select Text Resource wizard appears.

131/454
ADF Essentials Training by Deepak Bhagat
a) In the Display Value textbox, enter BAT_ERROR: Hire Date must be on or
before {p_cd}.
b) In the Key textbox, enter BAT_ERROR_HIRE_DATE.
c) Click Save and Select.
9) In the Token Message Expressions section, enter Expression value of p_cd as
adf.currentDate.
10) Click OK. Save All.
11) Open the EmployeesEOImpl.java in the editor.
12) Add the following code inside validateHireDate() method. (Copy code from file
…\BATHandouts\BATLabs-SrcCodes\L09-Codes-
Validation\EmployeesEOImpl.java.).
System.out.println(" In EmployeesEOImpl.validateHireDate() ");
if(hiredate != null && hiredate.before(new java.util.Date()))
return true;
else
return false;
13) Save All and Make (right-click in the editor, select Make from context menu).

14) Run the AppModuleAM.


a) Double-click the Employees1.
b) Create a new Employee by clicking icon.
c) Change the HireDate to be greater than current date. Tab out. Verify error message.

132/454
ADF Essentials Training by Deepak Bhagat
BAT

d) Correct HireDate to be less than or equal to current date. Populate all mandatory
fields. Tab out.

133/454
ADF Essentials Training by Deepak Bhagat
9.5 Adding Declarative Validation: Unique Key Validator -o

Add Unique Key Validator on EmployeeId.

1) Open the EmployeesEO in the editor.


2) Click the Business Rules page.

3) Select the Entity Validators, click icon to create new validator.


Add Validation Rule wizard appears.

a) In the Name field, enter EmpUniqueKeyRule,


b) In the Type field, select UniqueKey,
c) In the Keys textbox, select EmpEmpIdPk(EMPLOYEE_ID).
d) Click the Failure Handling tab.
e) Ensure the Failure Severity is Error.
f) In the Message Text textbox, click Magnifier icon.
134/454
ADF Essentials Training by Deepak Bhagat
Select Text Resource wizard appears.

BAT

BAT

i) In the Display Value textbox, enter BAT_ERROR: You Have Entered


duplicate ID {p_id}.
ii) In the Key textbox, enter BAT_ERROR_DUPLICATE_ID.
iii) Click Save and Select.
g) In the Token Message Expressions section, enter Expression value of p_id as
EmployeeId. Click OK.

BAT

BAT

4) Save All.
5) Run the AppModuleAM and test validation by creating new Employee.

135/454
ADF Essentials Training by Deepak Bhagat
a) Run the AppModuleAM.
b) Double-click the Employees1.
c) Click icon.
d) In the EmployeeId field, enter existing value 100 and tab out.
e) System prompts an error message by saying BAT_HR_ERROR: You have entered
duplicate ID 100.

BAT

136/454
ADF Essentials Training by Deepak Bhagat
9.6 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_09.

137/454
ADF Essentials Training by Deepak Bhagat
9.7 Adding Domain Validator -x

Create a domain for a Phone Number data type. You then apply that domain
BATPhoneNumberDO as the data type for an Employee PhoneNumber attribute.

This topic is part of advance ADF extended example (BATDependentLOV-Eg) may be found
under …\BATHandouts\BATXtEg-Proprietary\L09-BATXtEg-Validation. For hands-
on practice, please refer to Deepak Bhagat’s Blog at https://cloudadfdeepakb.blogspot.com or
download from the above location. It's a lab sample on creating and using a domain instead of
data type.

138/454
ADF Essentials Training by Deepak Bhagat
9.8 Demonstrate Various Types of Validations -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L09-ADFXtEg-Validation\.
These examples demonstrate all types of validations in ADF BC.

139/454
ADF Essentials Training by Deepak Bhagat
10
Introducing User Interface
Technologies
In this lab, you navigate through the application and you check all the functionalities such as
page flows, navigations, searches, transactions, CRUD operations, etc.

140/454
ADF Essentials Training by Deepak Bhagat
10.1 Running, Exploring and Familiarizing Lab 20 Application -*

Run the lab application BATLab_20, explore and familiarize User Interface (UI) flows and the
functionalities such as page flows, navigations, searches, transactions, CRUD operations, etc.

1) Run the BATIndex page.


Application opens in the web browser.
BAT

BAT BAT

BAT

2) Explore Location-Departments (master-details) functionality, implemented through ADF


Tree.
a) In the Loc-Depts section, expand a location with department, observe that it displays
the departments associated with it.
b) For example, expand 1400 Southlake and it displays the associated department 60
IT.
c) Note that some locations may not have departments.

141/454
ADF Essentials Training by Deepak Bhagat
3) Check the Quick Search functionality.
a) In the Quick Search section,
i) In the Email field, enter AKHOO,
ii) Click Search button.
iii) It displays the First Name, Last Name and Email values as Alexander, Khoo
and AKHOO associated with the entered email.

4) Check the Master-Detail (child) functionality.


a) In the Employee List section, observe Departments table as Master and Employees
table as Detail.
b) Select a row in the Departments table and observe that Employees table displays
the child/detail records accordingly.
c) For example, select a row with DepartmentId 20 and observe that Employees table
displays the child/detail records i.e. EmployeeId’s 201 and 202.

BAT

5) Check the Pop-up and Graph functionality.


a) Select a DepartmentName and observe that displays Pop-up with Salary graph in
it.
b) For example, select Shipping and observe that displays Pop-up with Department
Salary details in Graph mode.

142/454
ADF Essentials Training by Deepak Bhagat
BAT

6) Check the Printable Page, Export to Excel functionalities and different menus available in
the table.
a) Test the Printable Page functionality.
i) Click the BATMenu and select Printable Page from the submenu.

BAT

ii) It displays the Departments-Employees details in new tab which is available for
printing.
b) Test the Export to Excel functionality.
i) Click the BATMenu and select Export to Excel from the submenu.

143/454
ADF Essentials Training by Deepak Bhagat
BAT

ii) It displays a window which allows you to open or download the Employees record
in excel format.
c) Test the View menu.
i) Click the View menu and select required submenu and test.

BAT

ii) The submenu comprises following functionalities.


iii) Columns: Allows to select the columns which should display in the table.
iv) Detach: Allows to detach the Employees table.
v) Reorder Columns: Allows to re-order the columns.
7) Check the Employee-Detail, Link, Button and Breadcrumbs functionalities.
a) In the Employees table, click any one of EmployeeId or LastName link, then it
navigates to Employee Detail page.
b) For example, click EmployeeId 200 or LastName Whalen, it navigates to Employee
Detail page and displays the details according to the selected Employee Id.

BAT

c) Now, click Done button to navigate back to Employee List page.

144/454
ADF Essentials Training by Deepak Bhagat
d) Or you can use breadcrumbs to navigate back. Click the Employee List link on top,
then it navigates back to Employee List page.
8) Check the Search functionality.
a) Click Employee Search tab, it navigates to Employee Search page and displays
search fields.

b) You can search the records by providing any value in the search fields. The result will
be shown in below table accordingly.
c) For example, in the LastName field enter A% and click Search button or press Enter.
d) It displays the Employee records in the below table whose LastName starts with A.

145/454
ADF Essentials Training by Deepak Bhagat
e) Click Reset button to clear or reset fields.
f) Click Advanced button to search the records by using advanced options.

9) Check the Create functionality.


a) Click the Create button.
b) In the Employee Create page, create a new record.

146/454
ADF Essentials Training by Deepak Bhagat
10) Check the Update and Train sequence functionalities.
a) Click Update button.
b) Modify the employee details and click Save button.

147/454
ADF Essentials Training by Deepak Bhagat
11) Check the Delete functionality.
a) Select one particular record and click Delete button.
b) It displays a Popup with Yes and No buttons.
c) Click Yes to delete the record.
d) Now check that particular record. It won’t display as it is deleted.

148/454
ADF Essentials Training by Deepak Bhagat
11
Getting Started with User
Interface and UI Components
In this lab, you create a new application. You then set-up project for internationalization and skin
preference.

149/454
ADF Essentials Training by Deepak Bhagat
11.1 Creating New Application with only ViewController Project -*

Create a new application BATLab_11 with default projects, with default packages and settings.

1) Create an application named BATLab_11 with package bat and with default projects,
packages and settings.
a) Click the File menu > New > select Application.
New Gallery wizard appears.
b) Expand the General > Applications > select ADF Fusion Web Application.
c) Click OK.
Create ADF Fusion Web Application wizard appears.

BAT

BAT BAT

bat

d) On the Application Name page of the wizard,


i) In the Application Name field, enter BATLab_11.
ii) In the Application Package Prefix field, enter bat.
iii) Click Finish. (or Click Next > Next > Next > Next > Next > Finish).
2) The application gets created with default projects Model and ViewController, and with
default packages bat.model and bat.view respectively.
3) Delete the Model project as we don’t need in this lab.
a) Right-click the Model project > select Delete Project.
BAT

Confirm Delete Project wizard appears.


150/454
ADF Essentials Training by Deepak Bhagat
BAT

b) Choose the relevant option and click Yes button. Click Yes again. Save All.
4) Close the JDeveloper.
5) Under the …\BATLab_11\ folder, delete Model folder.
BAT BAT

BAT

6) Re-start the JDeveloper.


7) Click the Build menu > select Clean All and Refresh Application. Click Yes.

151/454
ADF Essentials Training by Deepak Bhagat
11.2 Setting Up the UI Project for Internationalization -*

Setup the UI Project (ViewController) for Internationalization.

1) Right-click the ViewController project > select Project Properties


Project Properties wizard appears.
2) Select the Resource Bundle.
3) Ensure the One Bundle Per Project is selected.
4) In the Default Project Bundle Name field, ensure bat.view.ViewControllerBundle.
BAT BAT

bat

5) Click OK. Save All.

152/454
ADF Essentials Training by Deepak Bhagat
11.3 Setting Up the Skin Preference -*

Change the Skin preference from alto to skyros.

1) Expand the ViewController > Web Content > WEB-INF.


2) Double-click the trinidad-config.xml to open in the editor.
3) Change the <skin-family> to skyros.

4) Save All your work.


5) Run the BATLab_16 and BATLab_20 with two different skins and demonstrate look and
feel on two browser windows.

BAT

153/454
ADF Essentials Training by Deepak Bhagat
11.4 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_11.

154/454
ADF Essentials Training by Deepak Bhagat
11.5 ADF Faces Rich Client Components -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L11-ADFXtEg-RichUIComp\.
These examples demonstrate ADF Faces Rich Client Components.

155/454
ADF Essentials Training by Deepak Bhagat
12
Planning Pages using Layout
Components
You could continue developing pages, but it is usually helpful to plan out the application before
creating all the pages. In this lab, you create a new JSF page, add default layouts to the page
like Panel Splitter, Panel Accordion, Panel Tabbed to enhance the appearance of the application
and customize the layouts. This enables you to visualize the flow of the application.

156/454
ADF Essentials Training by Deepak Bhagat
12.1 Copying Application -o

Make a copy of application BATLab_11 and rename it to BATLab_12. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

157/454
ADF Essentials Training by Deepak Bhagat
12.2 Creating New JSF Page -*

Create a new JSF Page.

1) Right-click the ViewController > New > select Page.


Create JSF Page wizard appears.

BAT

BAT BAT

2) In the File Name field, enter BATIndex.


3) In the Document Type field, ensure Facelets is selected.
4) Ensure the Create Blank Page is selected. Click OK.

158/454
ADF Essentials Training by Deepak Bhagat
12.3 Adding Default Layout Components -*

Add default layouts to the page such as Panel Splitter, Panel Accordion and Panel Tabbed layouts
as follows.
BAT

1) Open the BATIndex page in the editor.


2) Add the Panel Splitter layout to the page.
a) In the Components window, select Panel Splitter (in Layout category) and drag it
to the page.

b) In the Structure window, select af:panelSplitter, in the Properties window,


in the Orientation property, change to vertical.

159/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

3) Add another Panel Splitter to 2nd facet of 1st Panel Splitter with defaults.
a) In the Structure window, expand af:panelSplitter-vertical > Panel
Splitter facets > select f:facet-second.
b) Drag the Panel Splitter to f:facet-second in the Structure window or in the
editor (or you can select facet and just click on Panel Splitter it will be added
automatically).
BAT

BAT

160/454
ADF Essentials Training by Deepak Bhagat
4) Add the Panel Accordion layout to the page.
a) Add the Panel Accordion to 1st facet of the 2nd Panel Splitter.
Create Panel Accordion window appears.

b) Click the icon, to add one more pane.


c) In the 1st pane’s Text field, enter Loc-Depts.
d) In the 2nd pane’s Text field, enter Quick Search.
Or click the icon next to the pane, in Select Text Resource wizard, in Display
Value field, enter Loc-Depts and click Save and Select. Do the same process to
the next pane and in the Display Value field, enter Quick Search.
e) Click OK.
5) Add the Panel Tabbed layout to the page.
a) Add the Panel Tabbed to 2nd facet of the 2nd Panel Splitter.
Create Panel Tabbed wizard appears.

b) Click the icon, to add one more tab.


c) In the 1st tab’s Text field, enter Employee List.
d) In the 2nd tab’s Text field, enter Employee Search.
e) Click OK and Save All.
6) The structure should be as shown in below figure.

161/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

7) Run the BATIndex page and explore.


BAT

BAT BAT

162/454
ADF Essentials Training by Deepak Bhagat
12.4 Customizing Layout Components -*

Customize the layouts which have been added in previous lab.

1) Customize the layouts of BATIndex page with following properties:


SN Component Id Property Value Note
1st / outer Panel
1 panelSplitter ps1 SplitterPosition 142
Splitter
2nd / inner Panel
2 panelSplitter ps2 SplitterPosition 220
Splitter
3 panelAccordion pa1 DiscloseMany true
1st pane of panel
4 showDetailItem pane InflexibleHeight 297
accordion
1st pane of panel
5 showDetailItem tab1 Disclosed true
accordion
2nd pane of panel
6 showDetailItem tab2 Disclosed true
accordion
BAT

BAT

2) Run the BATIndex page and observe the changes.

163/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT BAT

164/454
ADF Essentials Training by Deepak Bhagat
12.5 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_12.

165/454
ADF Essentials Training by Deepak Bhagat
13
Designing User Interfaces and
Page Flows
In this lab, you create both unbounded and bounded task flows, along with various types of
activities and control flows for each. You also extract part of an unbounded task flow into its own
flow and convert an unbounded task flow to a bounded one.

Following list of Task Flows will be created, along with corresponding Page Fragments. Each
page fragment (.jsf or .jsff) will contain a Panel Group Layout. Further Additional
Components will be added inside Panel Group Layout as shown in table below.
Additional Additional
Task Flow Page Fragment
Component Component Text
EmpListTF EmpListPF Panel Box Departments
Panel Box Employees
Panel Collection
EmpDetailTF EmpDetailPF Panel Header Employee Detail
LocDeptsTF LocDeptsPF Output Text Loc-Depts
EmpQuickSearchTF EmpQuickSearchPF Output Text Quick Search
EmpSearchTF EmpSearchPF Panel Header Employee Search
Panel Collection
EmpCreateTF EmpCreatePF Panel Box Employee Create

At the end of this hands-on lab practices, the structure of newly created task flows and fragments
should appear as shown in the below diagram.
BAT

166/454
ADF Essentials Training by Deepak Bhagat
13.1 Copying Application -o

Make a copy of application BATLab_12 and rename it to BATLab_13. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

167/454
ADF Essentials Training by Deepak Bhagat
13.2 Creating Bounded Task Flows and Add View Activities -*

Create bounded task flows with page fragments and add view activities, as shown below.
Task Flow View Activity Name
EmpListTF EmpListPF
EmpDetailTF EmpDetailPF
EmpQuickSearchTF EmpQuickSearchPF
EmpSearchTF EmpSearchPF
EmpCreateTF EmpCreatePF

1) Right-click the ViewController project > New > select ADF Task Flow.
Create Task Flow wizard appears.
2) In the File Name field, enter EmpQuickSearchTF, ensure Create as Bounded Task
Flow and Create with Page Fragments are selected. Remaining boxes should be
unchecked.

BAT BAT

3) Click OK.
4) It creates EmpQuickSearchTF.xml task flow and opens in the editor.
5) In the Components window, select View activity, drag it to the
EmpQuickSearchTF.xml, change its name to EmpQuickSearchPF.
6) Save All.
7) Similarly, create four more task flows EmpListTF, EmpDetailTF, EmpSearchTF and
EmpCreateTF and add View activities EmpListPF, EmpDetailPF, EmpSearchPF and
EmpCreatePF, as mentioned above.

168/454
ADF Essentials Training by Deepak Bhagat
13.3 Creating New Page Fragments -*

Create page fragments EmpListPF, EmpDetailPF, EmpQuickSearchPF, EmpCreatePF


& EmpSearchPF.

1) Open the EmpListTF in the editor.


a) Double-click the EmpListPF.
Create ADF Page Fragment wizard appears.
b) Leave all fields default and click OK.
c) Drag the Panel Group Layout (as outmost layer).
d) Drag the Panel Box layout (inside Panel Group Layout), change its text to Employees
List.
e) Drag the Panel Collections (inside Panel Group Layout).
f) Save All.
2) Open the EmpDetailTF in the editor.
a) Double-click the EmpDetailPF.
Create ADF Page Fragment wizard appears.
b) Leave all fields default and click OK.
c) Drag the Panel Group Layout (as outmost layer).
d) Drag the Panel Header layout (inside Panel Group Layout), change its text to
Employees Details.
e) Save All.
3) Open the EmpQuickSearchTF in the editor.
a) Double-click the EmpQuickSearchPF.
Create ADF Page Fragment wizard appears.

BAT BAT

b) Ensure all default settings that options Facelets and Create Blank Page are
selected.
c) Leave all fields default and click OK. Save All.
d) It creates EmpQuickSearchPF.jsff page and opens in the editor.
e) Drag the Panel Group Layout (as outmost layer).
f) Drag the Output Text (inside Panel Group Layout), change its text to Quick Search.
g) Save All.

169/454
ADF Essentials Training by Deepak Bhagat
4) Open the EmpSearchTF in the editor.
a) Double-click the EmpSearchPF.
Create ADF Page Fragment wizard appears.
b) Leave all fields default and click OK.
c) Drag the Panel Group Layout (as outmost layer).
d) Drag the Panel Header layout (inside Panel Group Layout), change its text to
Employees Search.
e) Drag the Panel Collections (inside Panel Group Layout).
f) Save All.
5) Open the EmpCreateTF in the editor.
a) Double-click the EmpCreatePF.
Create ADF Page Fragment wizard appears.
b) Leave all fields default and click OK.
c) Drag the Panel Group Layout (as outmost layer).
d) Drag the Panel Box layout (inside Panel Group Layout), change its text to Employee
Create.
6) Ensure following details are incorporated (where PG stands for Panel Group Layout):
Task Flow Page Fragment Additional Additional
Component Component Text
EmpListTF EmpListPF PG +Panel Box Departments
+Panel Box Employees
++Panel Collection
EmpDetailTF EmpDetailPF PG +Panel Header Employee Detail
EmpQuickSearchTF EmpQuickSearchPF PG +Output Text Quick Search
EmpSearchTF EmpSearchPF PG +Panel Header Employee Search
+Panel Collection
EmpCreateTF EmpCreatePF PG +Panel Box Employee Create
7) The generated artifacts should appear as following.

BAT

170/454
ADF Essentials Training by Deepak Bhagat
13.4 Adding Task Flow Call Activities -*

Add task flow call activities and control flow cases.

1) Open the EmpListTF.xml in the editor.


2) Drag the EmpDetailTF to the EmpListTF.xml as task flow call activity.
3) In the Components window, select Control Flow Case, drag it from EmpListPF to
EmpDetailTF, change its name to create.
4) Save All.
5) Similarly, Open the EmpSearchTF.xml in the editor.
6) Drag the EmpCreateTF to the EmpSearchTF.xml as task flow call activity.
7) In the Components window, select Control Flow Case, drag it from EmpSearchPF to
EmpCreateTF, change its name to create.
8) Save All.

BAT

171/454
ADF Essentials Training by Deepak Bhagat
13.5 Adding Return Activities -*

Add return activities and control flow cases. (Dependent on 13.3, 13.7)

1) Open the EmpDetailTF in the editor.


2) In the Components window, select Task Flow Return activity, drag it to the
EmpDetailTF, change its name to Done.
3) In the Components window, select Control Flow Case, drag it from EmpDetailPF to
Task Flow Return (Done) activity, change its name to done.

4) Open the EmpCreateTF in the editor.


5) Drag the 2 Task Flow Return activities and change name to Save and Cancel.
6) Select the Control Flow Case, drag it from EmpCreatePF to Task Flow Return (Save)
activity, change name to save.
7) Select another Control Flow Case, drag it from EmpCreatePF to Task Flow Return
(Cancel) activity, change name to cancel.
8) Save All.

172/454
ADF Essentials Training by Deepak Bhagat
13.6 Using Bounded Task Flows as a Region on a page -*

Drop the task flows as regions.


Task Flow Section
EmpListTF Employee List
EmpQuickSearchTF Quick Search
EmpSearchTF Employee Search

1) Open the BATIndex page in the editor.


2) In the Applications window, select EmpListTF > drag it to Employee List section >
select Region from the context menu.
BAT

BAT

BAT

3) In the Applications window, select EmpQuickSearchTF > drag it to Quick Search


section > select Region from the context menu.
4) In the Applications window, select EmpSearchTF > drag it to Employee Search section
> select Region from the context menu.
5) Save All.
6) Run the BATIndex page.

173/454
ADF Essentials Training by Deepak Bhagat
7) If the EmpListPF is not rendered properly, open EmpListTF.xml in the editor. Select
EmpListPF > right-click > Mark Activity > select Default Activity (from context-menu).
OR
Select EmpListPF > Click on Default Activity icon.

174/454
ADF Essentials Training by Deepak Bhagat
13.7 Creating Bounded Task Flow without Fragments -o

Create a bounded task flow without fragments.

1) Right-click ViewController project > New > select ADF Task Flow.
Create Task Flow wizard appears.

BAT BAT

2) In the File Name field, enter LocDeptsTF.


3) Uncheck the Create with Page Fragments. Click OK.
4) It creates LocDeptsTF.xml task flow and opens in the editor.
5) In the Components window, select View activity, drag it to the LocDeptsTF.xml page,
change its name to LocDeptsPF.
6) Double-click the LocDeptsPF to create page fragment.
Create JSF Page wizard appears.
7) Leave all defaults. Click OK.
8) It creates the LocDepts.jsf page fragment and opens in the editor. Save All.
9) Add the Panel Group Layout (as outmost layer) to the page.
10) Add the Output Text to the page (inside Panel Group Layout). In the Properties window,
in the Value property, change to Loc-Depts. Save All.
Task Flow Page Fragment Additional Component Additional Component Text
LocDeptsTF LocDeptsPF PG +Output Text Loc-Depts
11) Try to drag the task flow as a region to the page.
a) Open the BATIndex page in the editor.
b) In the Applications window, select LocDeptsTF and try to drag it to BATIndex
page as Region. It does not create region.

175/454
ADF Essentials Training by Deepak Bhagat
13.8 Converting Bounded Task Flows to Use Page Fragments -o
Convert bounded task flows to use page fragments.

1) Open the LocDeptsTF.xml in the editor.


2) Right-click in the editor and select Convert To Task Flow With Page Fragments (from
context-menu).

3) Convert To Task Flow With Page Fragments dialog box appears, click OK. Click Yes.
4) Observe the LocDeptPF.jsf have been converted to LocDeptPF.jsff.

Before convert: After convert:


5) Open the BATIndex page in the editor.
6) In the Applications window, select LocDeptsTF and drag it to BATIndex page as
Region.
7) Run the BATIndex page.

176/454
ADF Essentials Training by Deepak Bhagat
13.9 Using Unbounded Task Flow with View and Control Flow Activities -o

Use unbounded task flow adfc-config.xml to design page flows.

1) Expand the ViewController project > Web Content > WEB-INF.


2) Double-click the adfc-config.xml to open it in the editor.
3) Add the View activities to the task flow.
a) In the Components window, select View activity, drag it to the editor.
b) In the Properties window, in the Activity ID property, enter DeptListPF.
OR
You can directly change the text/name in the editor itself.
c) Select another View activity, drag it to the editor, change its name to DeptDetailPF.
d) Save All.
4) Add the Control Flow Case between View activities.
a) In the Components window, select Control Flow Case, drag it from DeptListPF
to DeptDetailPF, change its name to detail. Save All.
5) Create facelets from view activities as DeptListPF and DeptDetailPF and add additional
components as explained in lab 13.2.
a) In the adfc-config.xml page, double-click the DeptListPF.
Create JSF page wizard appears.
b) Leave everything default and click OK.

BAT BAT

c) It creates the DeptListPF.jsf page and opens in the editor.


d) Add the layouts to the page.
i) Drag the Panel Group Layout (as outmost layer) to the page.
ii) Drag the Panel Box layout (inside Panel Group Layout), in the Properties
window, in the Text property, change to Departments.
iii) Drag the Panel Box layout (inside Panel Group Layout), in the Properties
window, in the Text property, change to Employees.
iv) Drag the Panel Collections layout (inside Panel Box - Employees).
e) Double-click the DeptDetailPF.jsf.
Create JSF Page wizard appears.
f) Leave everything default and click OK.
177/454
ADF Essentials Training by Deepak Bhagat
g) Add the layouts to the page.
i) Drag the Panel Group Layout (as outmost layer) to the page.
ii) Drag the Panel Header (inside Panel Group Layout), in the Properties
window, in the Text property, change to Employee Detail.
h) Save All.
6) Run the adfc-config.

178/454
ADF Essentials Training by Deepak Bhagat
13.10 Extracting Part of Task Flow -o

Extract part of task flow.

1) Open the adfc-config.xml in the editor.


2) Right-click on the DeptDetailPF > select Extract Task Flow. if dialog box appears, click
Yes.

Extract Bounded Task Flow wizard appears.

BAT BAT

3) In the File Name field, enter DeptDetailTF. Click OK.


179/454
ADF Essentials Training by Deepak Bhagat
4) It creates the DeptDetailTF task flow and opens in the editor.
5) In the adfc-config.xml. Drag a rectangle to encompass DeptListPF and
DeptDetailTF. Right-click > select Extract Task Flow, click Yes.
Extract Bounded Task Flow wizard appears.
6) In the File Name field, enter DeptListTF. Click OK.
7) It creates the DeptListTF task flow and opens in the editor.
8) In the adfc-config.xml. Delete DeptListTF. Save All.

180/454
ADF Essentials Training by Deepak Bhagat
13.11 Lab Solution

Lab solutions can be found under …\BATHandouts1\BATLabs-Solutions\BATLab_13

181/454
ADF Essentials Training by Deepak Bhagat
13.12 Using URL View Activity -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L13-ADFXtEg-TaskFlow\.
This example demonstrates URL View Activity in ADF Task Flow.

182/454
ADF Essentials Training by Deepak Bhagat
14
Interactively Controlling with
Navigation Components
In this lab, you implement navigation on pages by creating buttons, links, breadcrumbs, and a
train.
So far you have created several pages that are part of task flows, and you have created control
flows between them with outcomes that can be used for navigation. However, you have not
implemented navigation on the pages, so there is no mechanism for moving from one activity to
the next within task flows.

183/454
ADF Essentials Training by Deepak Bhagat
14.1 Copying Application -o

Make a copy of application BATLab_13 and rename it to BATLab_14. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

184/454
ADF Essentials Training by Deepak Bhagat
14.2 Adding Links and Buttons for Navigation -*

Add link and button components for navigation.

1) Add link component in the EmpListPF page.


a) Open the EmpListPF.jsff page in the editor.
b) In the Components window, select Link, drag it to the panelBox-Employees (in
the Structure window).

c) In the Structure window, select af:link-link1.


d) In the Properties window,
i) In the Text property, enter Detail,
ii) In the Action property, select detail.

e) Save All.
2) Add the button component in the EmpDetailPF page.
185/454
ADF Essentials Training by Deepak Bhagat
a) Open the EmpDetailPF.jsff page in the editor.
b) In the Components window, select Button, drag it to the toolbar of
panelHeader-Employee Detail (in Structure window).
c) In the Structure window, select af:button-button1.
d) In the Properties window,
i) In the Text property, enter Done,
ii) In the Action property, select done.
e) Save All.

3) Add the toolbar and button in EmpSearchPF page.


a) Open the EmpSearchPF.jsff page in the editor.
b) In the Components window, select Toolbar, drag it to the panelGroupLayout.
OR
In the Structure window, right-click the af:panelGroupLayout > Insert Inside
Panel Group Layout > select ADF Faces. Insert ADF Faces Item window
appears. Select Toolbar and click OK.

186/454
ADF Essentials Training by Deepak Bhagat
BAT

c) In the Structure window, select af:toolbar, in the Components window, click


the Button component,
d) In the Properties window,
i) In the Text property, enter Create,

187/454
ADF Essentials Training by Deepak Bhagat
ii) In the Action property, select create.
e) Save All.

4) Add the toolbar and buttons in EmpCreatePF page.


a) Open the EmpCreatePF.jsff in the editor.
b) In the Structure window, expand af:panelBox-Employee Create, right-click the
f:facet-toolbar > Insert Inside f:facet - toolbar > select ADF Faces.
Insert ADF Faces Item wizard appears.
c) Select the Toolbar and click OK.
d) Select the af:toolbar, add Button from the Components window.
e) In the Properties window,
i) In the Text property, enter Cancel,
ii) In the Action property, select cancel.
f) Add the Button to the af:toolbar,
g) In the Properties window,
i) In the Text property, enter Save (no action).
h) Add another Button to the af:toolbar,
i) In the Properties window,
i) In the Text property, enter Save and Close,
ii) In the Action property, select save.
5) Save All.

188/454
ADF Essentials Training by Deepak Bhagat
6) Run the BATIndex page and test.

link

189/454
ADF Essentials Training by Deepak Bhagat
190/454
ADF Essentials Training by Deepak Bhagat
14.3 Using Menu and Menu Items -*

Add Menu and Menu Items into it.


1) Open the EmpListPF in the editor.
2) Under Emp > Panel Header.
3) Add Menu component.
a) In the Components window, select and drag Menu Bar to the panelBox-
Employees.
b) In the Structure window, right-click af:menuBar > Insert Inside Menu Bar >
select Menu. Select af:menu-menu1 (if already not selected).
c) In the Properties window, in the Text property, enter BATMenu.
BAT

BAT

d) In the Structure window, right-click af:menu-BATMenu > Insert Inside Menu >
select Menu Item.
e) In the Properties window, in the Text property, enter Printable Page.
f) Add another Menu Item and change its Text to Export to Excel.
g) In the Structure window, select af:commandMenuItem-Printable Page. In the
Components window, drag and drop Show Printable Page Behavior (or just click
on it to add).
h) Save All.

191/454
ADF Essentials Training by Deepak Bhagat
BAT

4) Run the BATIndex and test the menu items.

BAT

192/454
ADF Essentials Training by Deepak Bhagat
14.4 Assigning Internationalization and Accessibility -o

Internationalization and Accessibility: Using Resource Bundle, Access Key and Defining Tool Tips.

1) Store value of Text in Resource Bundle.


2) Open the EmpListPF.jsff page in the editor.
a) In the Structure window, select af:link-Detail link.
b) In the Properties window,
i) Click the (gear) icon next to the Text property and select Select Text
Resource from the context menu.
Select Text Resource window appears.
c) In the Display Value text box, enter (override) Detail and click Save and Select.
d) Save All.

3) Add the Access Key and Tooltip properties to the button.


4) Open the EmpDetailPF.jsf page in the editor.
a) In the Structure window, select af:button-Done.
b) In the Properties window,
i) In the AcessKey property (in Appearance section), enter D,
ii) In the ShortDesc property, enter You can go back to List from here to
add tooltip.
5) Save All.

193/454
ADF Essentials Training by Deepak Bhagat
Note that accessKey is triggered by browser-specific and platform-specific modifier keys.
For e.g., IE will set focus when you press Alt+<accessKey>. FF & Chrome sets focus on
some operating systems when you press Alt+Shift+<accessKey>. FF & Chrome on
other operating systems sets focus when you press Control+<accessKey>. Refer to your
browser's documentation for how it treats access keys.
6) Run the BATIndex page and test.

194/454
ADF Essentials Training by Deepak Bhagat
14.5 Using BreadCrumbs -o

Add BreadCrumbs and Navigation Items.

1) Open the EmpListPF page in the editor.


2) Add the Output Text component to the af:panelGroupLayout (move it above the
af:panelBox-Departments) and change its Value to BreadCrumbs (in the Properties
window).
3) Add the BreadCrumbs component to the page.
a) In the Components window, select BreadCrumbs and add it to the
af:panelGroupLayout (move it above the af:panelBox-Departments).
b) In the Structure window, right-click af:breadCrumbs > Insert Inside
BreadCrumbs > select Navigation Item.
c) In the Properties window, in the Text property, enter Employee List.
BAT

BAT

4) Open the EmpDetailPF page in the editor.


5) Add the BreadCrumbs component to the page
a) In the Components window, select BreadCrumbs and add it to the
af:panelGroupLayout (move it above af:panelHeader-Employee Detail).
b) Add the Navigation Item and change its Text to Employee List.
c) Add another Navigation Item and change its Text to Employee Details.
d) In the Structure window, select af:commandNavigationItem-Employee List,
in the Properties window, in the Action property, select done.
195/454
ADF Essentials Training by Deepak Bhagat
e) Save All.
6) Run the BATIndex page and test breadcrumbs.

196/454
ADF Essentials Training by Deepak Bhagat
14.6 Using Popup Dialog -o

Add Popup and Dialog components.

1) Open the EmpListPF page in the editor.


2) Add the Popup and Dialog component into it.
a) In the Components window, select and drag Popup to the
af:panelGroupLayout.
b) In the Structure window, right-click af:popup > Insert Inside Popup > select
Dialog.
BAT

c) In the Structure window, select af:dialog, in the Properties window, in the Type
property select ok and in the Title property enter Department Salary.
d) In the Structure window, click icon to go back.
3) Add Link component and add Show Popup Behavior to it.
a) Add the Link component to af:panelBox-Department and change its Text to
Department Name.
b) In the Structure window, right-click af:link-Department Name > Insert
Inside Link > ADF Faces.
Insert ADF Faces Item wizard appears.
c) Select the Show Popup Behavior. Click OK.
Insert Show Popup Behavior dialog box appears.
d) In the PopupId field, enter p1, Click OK.
e) You can select PopupId value by clicking icon > Edit > selecting popup-p1 >
clicking OK.
f) Save All.
4) Run the BATIndex page and test the Popup.
197/454
ADF Essentials Training by Deepak Bhagat
BAT

198/454
ADF Essentials Training by Deepak Bhagat
14.7 Defining Sequence of Steps (Train) and Use Wild Card Activity -o

Define Sequence of Steps by using Train component.

1) Create a task flow named EmpUpdateTF with Train option.


a) Right-click the ViewController > New > select ADF Task Flow.
Create Task Flow wizard appears.

BAT BAT

b) In the File Name field, enter EmpUpdateTF,


c) Check the Create Train check box.
d) Click OK.
e) Add the 3 View activities to the task flow named EmpUpdatePersonPF,
EmpUpdateJobPF and EmpUpdateConfirmPF. (observe the link between view
activities)
f) Add the 2 Task Flow Return activities named Save and Cancel.
g) Add one Wild Card Control Flow Rule, keep name as it is, such as (*).
h) Add the 2 Control Flow Cases:
i) One from the EmpUpdateConfirmPF to Save return activity named save.
ii) Another flow from the Wild Card to Cancel return activity named cancel.

199/454
ADF Essentials Training by Deepak Bhagat
2) Create the page fragments from the view activities.
a) Double-click the EmpUpdatePersonPF.
Create ADF Page Fragment wizard appears.
b) Leave everything default and click OK.
c) It creates EmpUpdatePersonPF.jsff page and opens in the editor.
d) Double-click the EmpUpdateJobPF.
Create ADF Page Fragment wizard appears.
e) Leave everything default and click OK.
f) It creates EmpUpdateJobPF.jsff page and opens in the editor.
g) Double-click the EmpUpdateConfirmPF.
Create ADF Page Fragment wizard appears.
h) Leave everything default and click OK.
i) It creates EmpUpdateConfirmPF.jsff page and opens in the editor.
3) Add the Panel Group Layout, Train component, Panel Header, TrainButtonBar and Buttons
in all the three pages (i.e. EmpUpdatePersonPF, EmpUpdateJobPF and
EmpUpdateConfirmPF).
4) Open the EmpUpdatePersonPF page in the editor.
a) Add the Panel Group Layout to the page.
b) Add the Train component to af:panelGroupLayout .
Bind train dialog box appears.
c) Ensure the Value is
#{controllerContext.currentViewPort.taskFlowContext.trainModel}.
d) Click OK.
e) Add the Panel Header to af:panelGroupLayout and change its Text to
Employee Update Person.
f) Add the Train Button Bar to Panel Header’s f:facet-toolbar.
Bind trainButtonBar dialog box appears.
g) Ensure the Value is
#{controllerContext.currentViewPort.taskFlowContext.trainModel}.
h) Click OK.
i) Add the Button to Panel Header’s f:facet-toolbar.
j) In the Properties window, in Text property, enter Cancel and in Action property,
select cancel.

200/454
ADF Essentials Training by Deepak Bhagat
5) Similarly, do the same process for EmpUpdateJobPF and EmpUpdateConfirmPF
respectively.
6) In the EmpUpdateConfirmPF page. Add additional Button, change its Text to Submit
and Action to save.
7) Add the task flow call activity.
a) Open the EmpSearchTF page in the editor.
b) Drag the EmpUpdateTF to the editor as task flow call activity.
c) Add the Control Flow Case from EmpSearchPF to EmpUpdateTF and change its
name to update.

8) Open the EmpSearchPF page in the editor.


a) Add the Button to af:toolbar, change its Text to Update and Action to update.
b) Move the af:toolbar to Panel Header’s f:facet-toolbar.

201/454
ADF Essentials Training by Deepak Bhagat
9) Ensure that all buttons and trainButtonBar are inside Panel Header’s toolbar.
10) Save All.
11) Run the BATIndex.jsf page and test the train sequence.

202/454
ADF Essentials Training by Deepak Bhagat
203/454
ADF Essentials Training by Deepak Bhagat
14.8 Lab Solution

Lab solutions can be found under …\BATHandouts1\BATLabs-Solutions\BATLab_14

204/454
ADF Essentials Training by Deepak Bhagat
15
Ensuring Reusability in Web
Applications
In this lab, you begin to implement reusability in the application.

When several pages are used in succession, it is a good practice to make sure that the layout of
each page is exactly the same. For example, you want navigation buttons to appear in exactly
the same location on pages that are used in series, such as train sequence. To make the layout
cleaner and reusable, you create and apply a template to the pages.

205/454
ADF Essentials Training by Deepak Bhagat
15.1 Copying Application -o

Make a copy of application BATLab_14 and rename it to BATLab_15. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

206/454
ADF Essentials Training by Deepak Bhagat
15.2 Creating and Using Reusable Component -*
(Dependent on 8)

Create and Use Reusable Component.

1) Explore the Libraries and Classpath in Project Properties


a) Open the Project Properties window.
Project Properties window appears.
b) Select the Libraries and Classpath (at left side).
No library with name ADF Library or model.jar should be found.
2) Explore the Data Control and show no data model is exposed.
3) Reopen the lab BATLab_09.
4) Right-click the Model > Deploy > select New Deployment Profile.

BAT

BAT
BAT

Create Deployment Profile wizard appears.

207/454
ADF Essentials Training by Deepak Bhagat
5) Ensure the Profile Type is ADF Library Jar File and in Deployment Profile Name
field, enter Model. Click OK.
Edit ADF Library JAR Deployment Profile Properties window appears.
6) Click the Jar Options page.
a) In the JAR File field, enter …\BATJDev122100\mywork\deploy\Model.jar.
b) Click OK. Save All.
7) In case the Jar Option in previous step is not selected,
a) Select the Model > Project Properties > Deployment > Model (ADF Library
JAR File).
b) Click .
c) Click the Jar Options page.
d) In the JAR File field, enter …\BATJDev122100\mywork\deploy\Model.jar.
e) Click OK. Click OK. Save All.
BAT BAT

BAT

BAT

BAT

BAT

8) Right-click the Model > Deploy > select Model.


Deploy Model window appears.
9) Select the Deploy to ADF Library JAR file. Click Finish.

10) Switch back to BATLab_15.


11) Verify the empty Data Control.
12) In the Resources window (at right-side of the JDev), click icon > IDE Connections
> select File System.

208/454
ADF Essentials Training by Deepak Bhagat
If there is no Resources window at right-side. Click Window menu > select Resources to
open the window.

Create File System Connection window appears.

BAT

BAT

13) In the Connection Name field, enter modelLib and in the Directory Path field, enter
…\BATJDev122100\mywork\deploy. (or select appropriate path by clicking Browse)
14) Click the Test Connection in window. Click OK. Save All.

209/454
ADF Essentials Training by Deepak Bhagat
15) In the Resources window, expand File System > modelLib > right-click Model.jar >
select Add to Project. Click Add Library in the dialog box.

BAT

16) Save All.


17) Open the Project Properties wizard. Select Libraries and Classpath and explore ADF
Library having model.jar is found.
BAT BAT

BAT

18) Explore the Data the Control window and show no data model is exposed.
210/454
ADF Essentials Training by Deepak Bhagat
BAT

211/454
ADF Essentials Training by Deepak Bhagat
15.3 Creating Page Templates -o

Create Page Templates for train sequence and header.

1) Create a new page template named EmpUpdateTemplate.


a) Right-click the VeiwController > New > select ADF Page Template.
Create a Page Template wizard appears.
b) In the File Name field, enter EmpUpdateTemplate.jsf.
c) Click Next.

BAT BAT

d) In the Template Content page of the wizard, ensure Blank Template is selected.
e) Click Next.

f) In the Facets and Attributes page of the wizard,


i) In the Facet Definitions section, click icon, in the Name field enter
content.
ii) In the Attributes section, click icon, in the Name field enter title, check
Required check box.
iii) Click Next. Click Finish.

212/454
ADF Essentials Training by Deepak Bhagat
EmpUpdateTemplage.jsf template opens in the editor.
2) In the page template, add Panel Group Layout. In the Properties window, in the Layout
field, select Scroll.
3) Add the Train component to af:panelGroupLayout, in the Properties window, in
Value field, enter
#{controllerContext.currentViewPort.taskFlowContext.trainModel}.
(You can use Expression Builder. Click icon next to Value > select Expression Builder
>In Expression Builder wizard, expand ADF Controller Objects > controllerContext
> currentViewPort > taskFlowContext > trainModel to insert into expression.).
4) Add the Panel Header layout to af:panelGroupLayout, change its Text to
#{attrs.title}.
5) Add the Facet Definition to af:panelHeader. (You can search in Components window
as Facet Definition.)
Insert Facet Definition dialog box appears.
6) In the Facet Name field, select content from drop-down list. Click OK.
7) Add the Toolbar to Panel Header’s f:facet-toolbar.
8) Add the Train Button Bar to af:toolbar and in the Properties window, in the Value
field, enter #{controllerContext.currentViewPort.taskFlowContext.trainModel}.
9) Add the Button to af:toolbar and change its Text to Save and Close, change Action
to save.
10) In the Structure window, select button-Save and Close, in the Properties window,
in the Disabled property field, enter
#{controllerContext.currentViewPort.taskFlowContext.trainModel.next!=null} (by
using Expression Builder).

213/454
ADF Essentials Training by Deepak Bhagat
11) Add the Button before trainButtonBar and change its Text to Cancel, Action to
cancel, select Immediate property to true. (Note: if you use Expression Builder, it
displays the code as an error. It has context for trainModel, but does not understand
‘.next’ in expression. You can ignore the error.).
12) Save All.
BAT

bat
bat

BAT

214/454
ADF Essentials Training by Deepak Bhagat
215/454
ADF Essentials Training by Deepak Bhagat
15.4 Applying Template to Existing Page Fragments -o
(Dependent on 14.7)

Apply Template to Existing Pages.

1) Open the EmpUpdatePersonPF page in the editor.


2) Click the Source tab at bottom of the editor, comment out panelGroupLayout
(everything inside ui:composition). Save All.

3) Insert the EmpUpdateTemplate inside composition.


a) In the Structure window, select right-click ui:composition > Insert Inside
Composition > select ADF Faces.
Insert ADF Faces Item wizard appears.
b) Select the Template and click OK.
Insert Template wizard appears.
c) Select the EmpUpdateTemplate (at left side) and click OK.

216/454
ADF Essentials Training by Deepak Bhagat
4) In the Structure window, select af:pageTemplate.
5) In the Properties window, in the title field, enter Emp Update Person. Save All.

6) Similarly, open EmpUpdateJobPF and EmpUpdateConfirmPF. Add templates. Change


title properties to Emp Update Job and Emp Update Confirm respectively.
7) Save All.
8) Run the BATIndex page and test the templates.

217/454
ADF Essentials Training by Deepak Bhagat
15.5 Creating a New Header Template -o

Create a new template with logo and header.

1) Right-click the VeiwController > New > select ADF Page Template.
Create a Page Template wizard appears.

BAT

BAT BAT

BAT

2) In the File Name field, enter BATHeaderTemplate.


3) Ensure the Facelets is selected. Click Next.
4) In the Template Content page of the wizard, select Copy Quick Start Layout radio
button.
5) Select the One Column layout (in Categories section at left side), select One Column header
(Stretched) (2nd one in Types section), select One Column header (Stretched with
Splitter) (2nd one in Layouts section).
6) Click Next. Click Next. Click Finish.

218/454
ADF Essentials Training by Deepak Bhagat
7) BATHeaderTemplate.jsf template opens in the editor. Ensure Panel Splitter’s
Orientation property is vertical.
8) Add the Panel Group Layout to 1st facet of panelSplitter and in Properties window,
in Layout field, select Horizontal.
9) Add images to the header.
a) Copy the image folder into
mywork\BATLab_15\ViewController\public_html folder.
b) In the JDeveloper Refresh project.
c) Expand the ViewController > Web Content > image folder,
i) Select and drag the bat-logo.png to the page (to Panel Group Layout), select
ADF Faces Image (from context menu),
BAT

BAT

bat
bat
bat
bat

ii) Similarly, drag the bat-header.png to Panel Group Layout,


iii) In the Structure window, select af:image-image/batlogo.png, in the
Properties window, in Source field, select bat-logo.png (image without
path),
iv) Similarly, in the Structure window, select af:image-image/batlogo.png,
in the Properties window, in Source field, select bat-header.png.
10) Save All.

219/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

bat
bat

220/454
ADF Essentials Training by Deepak Bhagat
15.6 Applying Template to Existing Page -o
(Dependent on 15.4)

Apply Header template to existing page BATIndex.

1) Open the BATIndex.jsf page in the editor.


2) In the Structure window, expand panelSplitter > right-click f:facet-first >
Insert Inside f:facet-first > select ADF Faces.
Insert ADF Faces Item wizard appears.
3) Select the Template and click OK.
Insert Template wizard appears.

4) Select the BATHeaderTemplate. Click OK.


5) Save All.
BAT

BAT
BAT

BAT
BAT

BAT

221/454
ADF Essentials Training by Deepak Bhagat
15.7 Creating a New Page with Template -o
(Dependent on 14.4)

Create New Page with Template.

1) Create a new page named BATSpringboard with template BATHeaderTemplate .


a) Right-click the VeiwController > New > select Page.
Create JSF Page wizard appears.
b) In the File Name field, enter BATSpringboard.
c) Ensure the Document Type is selected as Facelets.
d) In the Page Layout tab, select Reference ADF Page Template radio button.
e) Select the BATHeaderTemplate. Click OK.

BAT

BAT BAT

BATSpringboard.jsf page opens in the editor.


2) Open the adfc-config.xml task flow in the editor, select and drag
BATSpringboard.jsf page to the task flow.
3) Save All.
4) Run the adfc-config.xml and test the BATSpringboard page with template.

222/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

BAT

BAT

BAT

bat BAT

BAT

223/454
ADF Essentials Training by Deepak Bhagat
15.8 Adding Panel Springboard Component -o
(Valid only on ADF/JDeveloper 12c)

Add Panel Springboard Component.

1) Open the BATSpringboard.jsf page in the editor.


2) Add the Panel Splitter layout to af:document-BATSpringboard.jsf (in Structure
window).
3) In the Properties window,
a) In the Orientation property, select vertical.
b) In the SplitterPosition property, enter 135.
4) Move the af:pageTemplate to 1st facet of Panel Splitter.
5) Add the Panel Springboard component to 2nd facet of Panel Splitter.
a) In the Properties window, in Display Mode property, select grid.
b) In the Structure window, right-click af:panelSpringboard > Insert Into Panel
Springboard > select Show Detail Item.
c) In the Structure window, select showDetailItem, in the Properties window, in
the Text field, enter Loc-Depts and in Icon field, select bat-loc-dept.png.
d) Add one more Show Detail Item and in the Properties window, in the Text field,
enter Quick Search and in Icon field, select bat-employee.png.
e) Save All.
6) Drag the LocDeptsTF and EmpQuickSearchTF task flows as Region to BATSpringboard page.
a) Drag the LocDeptsTF to af:showDetailItem-Loc-Depts, select Region (from
context menu).
b) Drag the EmpQuickSearchTF to af:showDetailItem-EmpQuickSearch, select
Region (from context menu).
BAT
BAT

BAT
BAT
BAT

BAT

7) Save All.
8) Run the BATSpringboard.jsf page and test the Panel Spring Board layout.
224/454
ADF Essentials Training by Deepak Bhagat
9) Click on Loc-Depts and Quick Search and test.
BAT

BAT BAT

225/454
ADF Essentials Training by Deepak Bhagat
15.9 Converting JSPX to Facelets -o

Convert JSPX page to Facelets.


1) Create a new page named BAT_JSPX_Page.
a) Right-click ViewController > New > select Page.
Create JSF Page wizard appears.

BAT

BAT BAT

b) In the File Name field, enter BAT_JSPX_Page.


c) In the Document Type field, select JSP XML.
d) Ensure the Create Blank Page is selected.
e) Click OK.
f) Save All.
2) BAT_JSPX_Page.jspx page opens in the editor.
3) Try to drag EmpQuickSearchTF as Region to BAT_JSPX_Page.jspx page Fails.

4) Convert the .jspx page to .jsf page.


a) In the Applications window, right-click BAT_JSPX_Page.jspx > select Convert
to Facelets (from context menu).

226/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT
BAT
BAT
BAT

BAT

BAT

Convert Project to Facelets window appears.

b) Ensure the Change Page Extensions to is selected as .jsf, click Preview in Log.
c) In the Log window, click Convert (Observe .jspx changes to .jsf.).

227/454
ADF Essentials Training by Deepak Bhagat
BAT

5) Now try to drag EmpQuickSearchTF as Region to the BAT_JSPX_Page.jspx.


6) Save All.
7) Run the BAT_JSPX_Page.jspx page.

228/454
ADF Essentials Training by Deepak Bhagat
15.10 Refactoring Page and Page Definition File -o

Refactoring Page and Page Definition File.

1) Show all references in page, page definition and data binding files.
2) Right-click the BAT_JSPX_Page > Refactor > select Rename.
BAT

BAT

BAT
BAT
BAT
BAT

BAT

BAT

Rename File wizard appears.

BAT

BAT

3) In the Rename To field, change to BAT_JSF_Page.jsf Click OK.


4) Refactor the BAT_JSPX_PagePageDef to BAT_JSF_PagePageDef.
5) Open the pageDef and DataBindings and rename wherever required.

229/454
ADF Essentials Training by Deepak Bhagat
6) To open pageDef file, right-click in the editor and select Go to Page Definition from
context menu.
BAT

bat
bat
BAT
BAT
BAT

BAT

BAT

BAT_JSF_PagePageDef.xml file opens in the editor.


7) Click the Source tab and check the name.

230/454
ADF Essentials Training by Deepak Bhagat
15.11 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_15

231/454
ADF Essentials Training by Deepak Bhagat
15.12 Bind Custom Declarative Components to ADF -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L15-ADFXtEg-Reusability\.
This example demonstrates binding of custom declarative components to ADF.

232/454
ADF Essentials Training by Deepak Bhagat
16
Working with Parameters,
Scopes and Partial Page Refresh
(PSP)
In this lab, you open the already existed application and explore set action listeners, scopes and
parameters. You also explore different types of parameters and partial page refresh.

233/454
ADF Essentials Training by Deepak Bhagat
16.1 Copying BATLab_16-PSP from Solution -o

1) Copy the …\BATHandouts\BATLabs-Solutions\BATLab_16-PSP to …\mywork\ and


open …\mywork\BATLab_16-PSP\BATLab_16-PSP.jws in JDeveloper.
2) Explore the solutions.

Lab Agenda:
BAT

234/454
ADF Essentials Training by Deepak Bhagat
16.2 Implementing Set Action Listener, Scopes and Partial Page Refresh -o

Using Set Action Listener, Scopes and Partial Page Refresh (Explore Solution) -o

1) Run the BAT_PSP_Index.jsf.


2) Play around with all buttons and links and observe various behavior and values.
3) Explore all page fragments (*.jsff files) under bat\lab\hrsystem\ui\page.
BAT

BAT

BAT

235/454
ADF Essentials Training by Deepak Bhagat
16.3 Setting Conditional Display -o

1) Run the BAT_PSP_Index.jsf page.


2) In the Employee List tab, observe values, click Change Scope Values button & observe
values.
3) Observe that Output Text ‘Conditionally Hide 3’ is displayed conditionally.
4) Open the EmployeeListPF.jsff and explore outputText with id ot333 and its
rendered property.

236/454
ADF Essentials Training by Deepak Bhagat
237/454
ADF Essentials Training by Deepak Bhagat
16.4 Defining Task Flow Parameters -o

1) Run the BAT_PSP_Index.jsf page.


2) Click the Employee Search tab & observe values > click Change Scope Values button
& observe values > click Create link & observe values > click Back button & observe
values. Also click Update link and compare observed values and Back and again compare
observed values.
3) Explore the parameter passing in EmployeeSearchTF and EmployeeCreateTF. Compare
with EmployeeUpdateTF.

238/454
ADF Essentials Training by Deepak Bhagat
16.5 Defining Regions Parameters -o

1) Run the BAT_PSP_Index.jsf. Observe parameter passing from parent jsf page to its two
regions ‘Location Department Page’ and ‘Employee List’.
2) Explore the parameter passing to regions in BAT_PSP_IndexPageDef.xml.
BAT

bat

bat

bat

239/454
ADF Essentials Training by Deepak Bhagat
16.6 Using Refresh Property in PageDef -o

1) Run the BAT_PSP_Index.jsf. Whenever Change Scope Values button is clicked in


header section, observe that changes take place only in ‘Location Department Page’
section and not in ‘Employee List’ tab.
2) Explore the BAT_PSP_IndexPageDef.xml. Look for Refresh="ifNeeded".
3) Compare all task flows flow in this page.

240/454
ADF Essentials Training by Deepak Bhagat
16.7 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_16

bat

bat

BAT

241/454
ADF Essentials Training by Deepak Bhagat
17
Responding to Managed Beans,
Events and Listeners
In this lab, you create managed beans, events and listeners.

242/454
ADF Essentials Training by Deepak Bhagat
17.1 Creating new Application BATLab_17 with ViewController Project -*

Create a new application BATLab_17 with default projects, with default packages and settings.

1) Create an application named BATLab_17 with package bat and with default projects,
packages and settings.
a) Click the File menu > New > select Application.
New Gallery wizard appears.
b) Expand the General > Applications > select ADF Fusion Web Application.
c) Click OK.
Create ADF Fusion Web Application wizard appears.

BAT

BAT BAT

bat

d) On the Application Name page of the wizard,


i) In the Application Name field, enter BATLab_17.
ii) In the Application Package Prefix field, enter bat.
iii) Click Finish. (or Click Next > Next > Next > Next > Next > Finish).
2) The application gets created with default projects Model and ViewController, and with
default packages bat.model and bat.view respectively.
3) Delete the Model project as we don’t need in this lab.
a) Right-click the Model project > select Delete Project.

Confirm Delete Project wizard appears.

243/454
ADF Essentials Training by Deepak Bhagat
BAT

b) Choose the relevant option and click Yes button. Click Yes again. Save All.
4) Close the JDeveloper.
5) Under the …\BATLab_17\ folder, delete Model folder.

BAT

6) Re-start the JDeveloper.


7) Click the Build menu > select Clean All and Refresh Application. Click Yes.

244/454
ADF Essentials Training by Deepak Bhagat
17.2 Creating Managed Bean -*

Create Managed Beans and holding values in it.

1) Create the new JSF page named BATIndex.jsf. (Refer 12.2 lab, to create a JSF page.)
2) Add the Panel Group Layout to the page.
a) In the Structure window, select af:panelGroupLayout,
b) In the Properties window, in Layout property, select scroll.
3) Add the Input Text to the Panel Group Layout.
a) In the Structure window, select af:inputText,
b) In the Properties window, in Label property, enter Input.
4) Add the Button to the Panel Group Layout.
a) In the Structure window, select af:button,
b) In the Properties window, in Text property, enter Submit.
5) Add the Output Text to the Panel Group Layout.
a) In the Structure window, select af:outputText,
b) In the Properties window, in Text property, enter Output.
6) Save All.
BAT

BAT

7) Bind the inputText and outputText components and their values to a new backing bean.
a) In the Structure window, select af:inputText-Input,
b) In the Property window, in Value property click icon, select Expression Builder
(from the context menu).

Expression Builder window opens.

245/454
ADF Essentials Training by Deepak Bhagat
c) Select the ADF Managed Beans, click Create Managed Bean.
Create Managed Bean window appears.

bat

BAT

bat

i) In the Bean Name field, enter batBackingBean,


ii) In the Class Name field, enter BATBackingBean,
iii) Click OK.
d) In the same window (Expression Builder), select batBackingBean (if already not
selected).

246/454
ADF Essentials Training by Deepak Bhagat
bat

bat

e) Click Create Property.


Create Property dialog box appears.
bat

bat

i) In the Name field, enter ipComp. Click OK.


f) Click OK.
g) named batBackingBean. Select batBackingBean, click Create Property named ipComp.
8) Same process with output text.

247/454
ADF Essentials Training by Deepak Bhagat
bat

BAT BAT

BAT

bat

bat

248/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

BAT

BAT

BAT

BAT

BAT

BAT

a) Select thr af:inputText-Input in Structure window. In Properties window,


click gear icon next to Binding property.
b) In the Edit Property: Binding dialog box, click New next to the Managed Bean.
c) In the Create Managed Bean wizard, in Bean Name field, enter
inputComponent, in the Class Name field, enter InputComponent, ensure
Package is bat.view, Extends as java.lang.Object, Scope as request. Click
OK.

249/454
ADF Essentials Training by Deepak Bhagat
d) Click New next to the Property, in Create Property dialog box, in the Property
Name field, enter lifecycleBean. Click OK. Click OK. Save All.
9) Verify newly created Managed Bean BATBackingBean.java.
10) Verify registration of backing bean in adfc-config.xml.
11) Select the outputText and assign PartialTriggers property against button-b1 and
inputText-t1.
12) Select the inputText and in the AutoSubmit property, select true.
13) Run the BATIndex.

bat BAT

250/454
ADF Essentials Training by Deepak Bhagat
17.3 Creating Action Listener and Adding Method Binding -*
(Dependent on 16.1)
Create Action Listener.

1) Select the button. In the actionListener property, enter


"#{batBackingBean.myActnListener}"
2) Assign input component value to output component value
public void myActnListener(ActionEvent actionEvent) {
System.out.println(" BATBackingBean.myActnListener():");
System.out.println(" inputValue= " + inputValue);
if (inputValue != null)
outputValue = inputValue;
System.out.println(" outputValue= " + outputValue);
}
3) Run the BATIndex.

BAT
BAT

251/454
ADF Essentials Training by Deepak Bhagat
17.4 Creating Value Change Listener -*
(Dependent on 16.1)

Add Value Change Listener.

1) Select the inputText. Enter


valueChangeListener="#{batBackingBean.myValChangeListener}"&
autoSubmit="true"
2) Display old and new values.
public void myValChangeListener(ValueChangeEvent
valueChangeEvent) {
System.out.println("
BATBackingBean.myValChangeListener():");
System.out.println(" valueChangeEvent.getOldValue()= "
+ valueChangeEvent.getOldValue());
System.out.println(" valueChangeEvent.getNewValue()= "
+ valueChangeEvent.getNewValue());
if (valueChangeEvent.getNewValue() != null)
outputValue = valueChangeEvent.getNewValue().toString();
System.out.println(" outputValue= " + outputValue);
}
3) Run the BATIndex

BAT
BAT

252/454
ADF Essentials Training by Deepak Bhagat
17.5 Adding Phase Listener -o

Add Phase Listener.

1) Create the new Java class BATLCPhaseListener.java


2) Implement the PhaseListener and display various phases.
public void beforePhase(PhaseEvent phaseEvent) {
System.out.println(" BATLifecyclePhaseListener.beforePhase(): "
+ phaseEvent.getPhaseId());
}
public void afterPhase(PhaseEvent phaseEvent) {
System.out.println(" BATLifecyclePhaseListener.afterPhase(): "
+ phaseEvent.getPhaseId());
}
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
3) Register the bat.view.BATLCPhaseListener in faces-config.xml .
4) Run the BATIndex.
BAT
BAT

BAT

BAT

253/454
ADF Essentials Training by Deepak Bhagat
BAT BAT

bat BAT

254/454
ADF Essentials Training by Deepak Bhagat
17.6 Adding Validator -o

Add Validator.

1) Create the java class named BATValidator.java.


2) Implement the Validator.
3) Override the validate() method.
4) Validate the length and display.
public void validate(FacesContext context, UIComponent component,
Object object) throws ValidatorException {
System.out.println(" BATUIValidator.validate():");
System.out.println(" object = " + object.toString());
System.out.println(" validated length= "
+ object.toString().length());

}
5) Register the bat.view.BATValidator in faces-config.xml.
6) Assign the batValidator to inputText in BATIndex.jsf.
7) Run the BATIndex.
BAT
BAT

BAT

255/454
ADF Essentials Training by Deepak Bhagat
17.7 Adding Converter -o

Add Converter.

1) Create the java class named BATConverter.java.


2) Implement the Converter.
3) Override the getAsObject() and getAsString() methods.
4) Convert the input to upper case.
public Object getAsObject(FacesContext context, UIComponent
component,
String value) {
System.out.println(" BATUIConverter.getAsObject():");
System.out.println(" value= " + value.toString());
System.out.println(" converted to upper case= "
+ value.toString().toUpperCase());
return value.toString().toUpperCase();
}
5) Register the bat.view.BATConverter in faces-config.xml.
6) Assign the batConverter to inputText in BATIndex.jsf.
7) Run the BATIndex.
BAT
BAT

BAT

256/454
ADF Essentials Training by Deepak Bhagat
17.8 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_17.

257/454
ADF Essentials Training by Deepak Bhagat
18
Binding Model Layer with
Business Services and
Databound View
In this lab, you bind the model layer with business services by using table, form and tree
components. You also use graph component and setCurrentRowWithKey,
setCurrentRowWithKeyValue properties.

258/454
ADF Essentials Training by Deepak Bhagat
18.1 Copying Application -o

Make a copy of application BATLab_15 and rename it to BATLab_18. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

259/454
ADF Essentials Training by Deepak Bhagat
18.2 Creating a Read Only ADF Tables with Row Selection -*
(Dependent on 14)

Add read-only ADF Tables to the page with row selection.

1) Open the EmpListPF in the editor.


2) In the Data Controls window, expand AppModuleAMDataControl > drag the
Departments1 to the panelBox-Departments > Table/List View > select ADF Table
(from context menu).

BAT

BAT
BAT
BAT
BAT

Create Table window appears.

260/454
ADF Essentials Training by Deepak Bhagat
a) Select Single Row,
b) Check all check boxes,
c) Click OK.
3) Expand the Departments1, drag Employees3 to the panelCollection > select ADF
Table (from context menu).

BAT

BAT
BAT
BAT

BAT

261/454
ADF Essentials Training by Deepak Bhagat
Create Table window appears.

a) Select Single Row,


b) Check Read-Only Table,
c) Click OK.
4) Save All.
5) Explore the EmpListPFPageDef.
a) To open page definition file, right-click in the editor and select Go to Page
Definition from context menu.
b) Or in the Projects window, expand Application Sources > bat.view.pageDefs
> double-click EmpListPFPageDef.xml.
c) It opens EmpListPFPageDef.xml file in the editor.

262/454
ADF Essentials Training by Deepak Bhagat
6) Run the BATIndex.jsf page and test the tables.
BAT

BAT BAT

263/454
ADF Essentials Training by Deepak Bhagat
18.3 Customizing Data and UI Components -o
(Dependent on 14.4, 18.2)

Customize the data and UI components such as table properties and convert columns to links etc.

1) Open the EmpListPF page in the editor.


2) In the Structure window, select Department’s af:table-t1, in the Properties window,
a) In the ColumnStretching field, select last,
b) In the StyleClass field, enter AFStretchWidth,
c) In the AutoHeightRows field, enter 5.
3) Convert the DepartmentName column to link.
a) In the Structure window, expand table-t1, > af:column-
#{…DepartmentName.label}.
b) Right-click the af:outputText-#{…DepartmenName} > select Convert To.
BAT

Convert Output Text window appears.

264/454
ADF Essentials Training by Deepak Bhagat
c) Select the Link and click OK. Click OK.
d) Select the af:link, in the Properties window, in the Text field enter
#{row.DepartmentName}.
4) Add the showPopupBehavior property to link.
a) Right-click the af:link-#{…DepartmenName} > Insert Inside Link > select ADF
Faces.
Insert ADF Faces Item window appears.
b) Select the Show Popup Behavior, click OK.
Insert Show Popup Behavior dialog box appears.

c) In the PopupId field, enter ::p1, click OK.


5) In the Structure window, select panelCollection, in the Properties window, in the
StyleClass field, enter AFStretchWidth.
6) In the Structure window, select Employees af:table-t2, in the Properties window, in
the ColumnStretching select blank and in the AutoHeightRows field enter 5.
7) Surround the EmloyeeId column with link.
a) In the Structure window, expand table-t2 > af:column-
#{…EmployeeId.label} > right-click af:outputText-#{… EmployeeId} >
select Surround With.

265/454
ADF Essentials Training by Deepak Bhagat
BAT

Surround With window appears.

b) Select the Link and click OK.


c) Select the af:outputText-#{…EmployeeId} (expand af:link). In the
Properties window, empty the Value field.
d) Select the af:link. In the Properties window, in the Text field enter
#{row.EmployeeId} and in the Action field select detail.
8) Convert the LastName (outputText) to link.
a) Right-click the af:outputText-#{…LastName} > select Convert To.
266/454
ADF Essentials Training by Deepak Bhagat
Convert Output Text window appears.
b) Select the Link, click OK. Click OK.
c) Select the af:link-link1, in the Properties window, in the Text field enter
#{row.LastName} and in the Action field, select detail.
9) Edit the Employee table by removing some columns.
a) In the Structure window, select Employees table-t2 (in Panel Collection).
In Properties window, click icon.

Edit Table window appears.

b) Select some columns, click to remove, click OK.


10) Move af:menu-BATMenu to Panel Collections f:facet-menus and add Export Collection
Action Listener.
267/454
ADF Essentials Training by Deepak Bhagat
a) In the Structure window, drag af:menu-BATMenu (from af:menuBar) to
f:facet-menus in panelCollection.
b) Delete the af:menuBar.
c) In the Structure window, expand the af:menu-BATMenu, select
af:commandMenuItem-Export to Excel. In the Components window,
click/drag Export Collection Action Listener.
Insert Export Collection Action Listener dialog box appears.

d) In the ExportedId field, enter t2 (id of Employees’ table) and in the Type field,
ensure excelHTML. Click OK.

BAT

11) Comment out two existing links in department and employee boxes (i.e. Department Name
& Detail).
12) Save All.
13) Run the BATIndex.jsf page and test the links and other changes.

268/454
ADF Essentials Training by Deepak Bhagat
BAT

269/454
ADF Essentials Training by Deepak Bhagat
18.4 Creating a Detail Forms -o

Add employee detail forms.

1) Open the EmpDetailPF in the editor.


2) In the Data Controls window, expand Departments1, drag Employees3 to
panelHeader-Employee Detail and select ADF Form (from context menu).

BAT

BAT
BAT
BAT
BAT

Create Form window appears.

3) Check Read-Only Form check box. Leave other check boxes as it is. Click OK.
270/454
ADF Essentials Training by Deepak Bhagat
4) Select the af:panelFormLayout, in the Properties window, in Rows field enter 6.
5) Save All.
6) Run the page and test the detail form.
a) Run the BATIndex page.
b) Click the EmployeeId (e.g. 200). It shows Employee Detail form.
c) Click the Done button to navigate back.

271/454
ADF Essentials Training by Deepak Bhagat
18.5 Making a Table Non-Selectable -o

Make Employee table non-selectable.

1) Edit the Employee table, make Row Selection as None.


a) Open the EmpListPF page in the editor.
b) In the Structure window, select Employees table-t2.
c) In Properties window, click icon.
Edit Table wizard appears.

d) Select None radio button. Click OK.


2) Save All.
3) Run the page and demonstrate the issue on Employee Detail page.
a) Click on any EmployeeId in from any row, it navigates to Employee Detail page but
shows only the first record of an employee.

272/454
ADF Essentials Training by Deepak Bhagat
BAT

273/454
ADF Essentials Training by Deepak Bhagat
18.6 Using setCurrentRowWithKey -o
(Dependent on 18.7)

Use the setCurrentRowWithKey operation to show particular employee record.

1) In the Data Controls window, expand Departments1 > Employees3 > Operations >
drag setCurrentRowWithKey to af:link-#{…EmployeeId} (in Structure window).

BAT

Edit Action Binding wizard appears.


2) Click OK.
Confirm Component Rebinding dialog box appears.

3) Check text and action check boxes to retain their values. Click OK.
4) Open the EmpListPFPageDef in the editor.

274/454
ADF Essentials Training by Deepak Bhagat
5) Click the Source tab (at the bottom), select setCurrentRowWithKey (i.e. <NamedData
NDName=”rowKey”..), in the Properties window, in NDValue property, enter
#{row.rowKeyStr}
6) Save All.

bat

7) Run the page and explore Employees table.


a) Run the BATIndex page
b) Now select EmployeeId from any row then it shows that particular Employee Detail
record only. Not the first record.

275/454
ADF Essentials Training by Deepak Bhagat
BAT

276/454
ADF Essentials Training by Deepak Bhagat
18.7 Using setCurrentRowWithKeyValue -o
(Dependent on 18.7)

Use the setCurrentRowWithKeyValue operation.

1) Open the EmpListPf page in the editor.


2) In the Data Controls window, expand Departments1 > Employees3 > Operations >
drag setCurrentRowWithKeyValue to af:link-#{…LastName} (in Structure
window).
BAT

Edit Action Binding wizard appears.


3) Click OK.
Confirm Component Rebinding dialog box appears.

277/454
ADF Essentials Training by Deepak Bhagat
4) Check text and action check boxes to retain their values. Click OK.
5) Open the EmpListPFPageDef in the editor.
6) Click the Source tab (at the bottom), select setCurrentRowWithKeyValue (i.e.
<NamedData NDName=”rowKey”..), in the Properties window, in NDValue property,
enter #{row.EmployeeId}.

7) Save All.
8) Run the page and explore Employees table.
a) Run the BATIndex page
b) Now select LastName from any row then it shows that particular Employee Detail
record only. Not the first record.

278/454
ADF Essentials Training by Deepak Bhagat
BAT

279/454
ADF Essentials Training by Deepak Bhagat
18.8 Creating a Graph Component -o
(Dependent on 14.5)

Add a graph component to the page i.e. Pie Chart for Salary.

1) Open the EmpListPF in the editor.


2) In the Data Controls window, expand Departments1 > drag Employees3 to
af:dialog-Department Salary > select Chart (from context menu).
Component Gallery window appears.

3) Select the Pie option (from Categories at left). Click OK.


4) Create Pie Chart window appears.
5) In the Pie field, select Salary from drop-down and drag LastName from Available list (at
left side pane) into Slices field. Click OK.

280/454
ADF Essentials Training by Deepak Bhagat
6) Add the PartialTrigger to point to DepartmentName column link i.e. ::t1::ot2.
a) Select the af:link-#{…DepartmentName}, in the Properties window,
i) In the PartialTriggers field, click icon next to it and select Edit from the drop-
down.

Edit Property wizard appears.

281/454
ADF Essentials Training by Deepak Bhagat
ii) Select the link-ot3 from Available pane and shuttle it to Selected pane. Click
OK.
7) In the Structure window. Select the af:popup, in the Properties window, in the
ConentDelivery property, select lazyUncached.
8) Save All.
9) Run the page and test the graph component.
a) Run the BATIndex page.
b) Click the DepartmentName link.
c) It shows Popup with Salary Graph.

282/454
ADF Essentials Training by Deepak Bhagat
18.9 Creating a Read Only Tree -o

Add read-only tree to the page.

1) Open the LocDeptsPF in the editor.


2) In the Data Controls window, drag Locations1 to panelGroupLayout > Tree >
select ADF Tree (from context menu).

BAT

BAT

Edit Tree Binding window appears.

283/454
ADF Essentials Training by Deepak Bhagat
3) In the Root Data Source field, ensure AppModuleAMDataControl.Locations1 is
selected.
4) In the Tree Level Rules section, click icon and select Departments.
5) Select the 1st level in tree i.e. bat.model.vo.LocationsVO(<Departments>).
6) Select the City from Available Attributes and shuttle it to Display Attributes (in the
bottom of the wizard).

bat
bat

7) Select the 2nd level tree i.e. bat.model.vo.DepartmentsVO.


8) Select the DepartmentName from Available Attributes and shuttle it to Display
Attributes. Click OK.

284/454
ADF Essentials Training by Deepak Bhagat
bat
bat

9) Select the tree-t1, in the Properties window,


a) In the InitiallyExpanded field, select true,
b) In the AutoHeightRows field, enter 16,
c) In the InlineStyle field, enter width:20em;.
10) Comment out the Output Text i.e. af:outputText-Loc-Depts. Save All.
11) Run the BATIndex page and explore Loc-Depts section.

285/454
ADF Essentials Training by Deepak Bhagat
BAT

286/454
ADF Essentials Training by Deepak Bhagat
18.10 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_18

287/454
ADF Essentials Training by Deepak Bhagat
18.11 More ADF Data-bound Components -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L18-ADFXtEg-DataboundComp\.
These examples demonstrate Thematic map, Master-Details more details and various features on
Tree component.

288/454
ADF Essentials Training by Deepak Bhagat
19
Querying Data with Search
Components
In this lab, you add quick search component to search employee results.

289/454
ADF Essentials Training by Deepak Bhagat
19.1 Copying Application -o

Make a copy of application BATLab_18 and rename it to BATLab_19. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

290/454
ADF Essentials Training by Deepak Bhagat
19.2 Adding Query Search and Result -*
(Dependent on 6.6)

Add Query Search and Result components to search the employee results by providing any
attribute value.

1) Open the EmpSearchPF in the editor.


2) In the Data Controls window, expand EmpSumamry1 > Named Criteria > drag All
Queriable Attributes to af:panelHeader-Employee Search > Query > select
ADF Query Panel from context-menu.

BAT

3) Drag the EmpSummary1 to panelCollection and select ADF Table from context menu.

291/454
ADF Essentials Training by Deepak Bhagat
BAT

Create Table window appears.

4) Select Single Row and check Sorting and Read-Only Table check boxes.
5) Reorder the columns by using arrows like: EmployeeId, FirstName, LastName,
Email, Salary, AnnualSalary, HireDate, JobId, ManagerId, DepartmentId and
remove CommissionPct. Click OK.

292/454
ADF Essentials Training by Deepak Bhagat
6) In the Structure window, move the toolbar (with Create and Update buttons) from
panelHeader to toolbar of panelCollection.

293/454
ADF Essentials Training by Deepak Bhagat
7) Select the af:query under panelHeader-EmployeesEO.
8) In the Properties window, in ResultComponentId field, enter ::pc1:t2 (table-t2 value
in Panel Collection).
9) Save All.
10) Run the BATIndex page and test query search functionality.
a) Click the Employee Search tab.
b) In the EmployeeId field, enter 100.
c) Click Search button or Enter key.
d) Observe the result in below table.

294/454
ADF Essentials Training by Deepak Bhagat
19.3 Customizing Query Search and Result -o
(Dependent on 18.3)

Customize Query Search and Result.

1) Select the af:query and in the Properties window, in Rows property enter 6 and in
MaxColumns property enter 3.
2) Select the af:panelCollection and in the Properties window, in the StyleClass
property enter AFStretchWidth.
3) Select the af:table-t2 and in the Properties window, in ColumnStrectching property
select blank and in AutoHeightRows property enter 5.
4) Save All.
5) Run the BATIndex page and test the customized changes.

295/454
ADF Essentials Training by Deepak Bhagat
19.4 Adding Quick Search -o
(Dependent on 7.5)

Add the Quick Search component to search to employee details by providing email in search box.

1) Open the EmpQuickSearchPF page in the editor.


2) In the Data Controls window, expand EmpByEmail1 > Operations > drag
ExecuteWithParams to panelGroupLayout > select ADF Parameter Form from
context menu.

BAT

Create Form dialog box appears.

3) Do nothing just review contents. Click OK.


4) Comment out the existing code line outputText-Quick Search.
5) In the Structure window, expand af:panelFormLayout > select inputText.

296/454
ADF Essentials Training by Deepak Bhagat
6) In the Properties window, in Label field change to Email.
7) Select the af:button-ExecuteWithParams, in the Properties window, in Text field
change to Search.
8) In the Data Controls window, drag EmpByEmail1 to af:panelGroupLayout and select
ADF Form from context menu.

Create Form wizard appears.

9) Check Read-Only Form and click OK.


10) Save All.
11) Run the BATIndex page and test Quick Search functionality.
a) In the Quick Search panel, in the Email field, enter AKHOO.
b) Click Search button and observe the output.

297/454
ADF Essentials Training by Deepak Bhagat
298/454
ADF Essentials Training by Deepak Bhagat
19.5 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_19

299/454
ADF Essentials Training by Deepak Bhagat
20
Implementing Transactions
In this lab, you complete the application by adding transaction management. So far, the
application navigates to all the pages and displays data, but the commit functions are missing.

300/454
ADF Essentials Training by Deepak Bhagat
20.1 Copying Application -o

Make a copy of application BATLab_18 and rename it to BATLab_19. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

301/454
ADF Essentials Training by Deepak Bhagat
20.2 Implementing Create Operation -*
(Dependent on 5.6 and 12)

Implement the create functionality.

1) Open the EmpCreatePF in the editor.


2) In the Data Controls window, drag EmpSummary1 to panelBox – Employee Create,
select ADF Form (from context menu)

BAT

BAT
BAT

Create Form window appears.

302/454
ADF Essentials Training by Deepak Bhagat
3) Do not check any check box, remove columns DepartmentId, DepartmentName,
ManagerId. Click OK.
4) Select the panelFormLayout. In the Properties window, in Rows property, enter 5.
5) In the Data Controls window, expand EmpSummary1 > Operations > drag
CreateInsert to af:toolbar > select ADF Button (from context menu).

303/454
ADF Essentials Training by Deepak Bhagat
BAT

6) Expand the Operations (under Locations1), drag Rollback to af:toolbar, select ADF
Button (from context menu).

304/454
ADF Essentials Training by Deepak Bhagat
BAT

7) Drag the Commit onto Save button. Check text to retain. Click OK. Save All.

305/454
ADF Essentials Training by Deepak Bhagat
BAT

8) Run the BATIndex page and test the buttons.


a) Click the Save and Close button, it does not save, nor Cancel rollbacks.
b) Compare in DB. Check JobId suggestion.
9) Explore the EmpCreatePFPageDef.
a) Go the Source tab.
b) Remove the CreateInsert & Rollback buttons and ensure (code lines) removed
from pageDef.
c) Retain the Commit in pageDef.

306/454
ADF Essentials Training by Deepak Bhagat
10) Navigate back to EmpCreatePF page.
a) In the Components window, drag Auto Suggest Behavior to JobId attribute.
b) In the Structure window, select af:autoSuggestBehavior under JobId, in the
Properties window, in SuggestedItems property enter
#{bindings.JobId.suggestedItems}.

c) Select the Salary, in Properties window, in Id property enter sal and in


AutoSubmit field select true.
d) Select the AnnualSalary, in Properties window, in PartialTriggers property select
sal by using Edit option.

307/454
ADF Essentials Training by Deepak Bhagat
11) Drag the CreateInsert as Method Activity to EmpCreateTF task flow and mark it as Default
Activity.
a) Open the EmpCreateTF.xml in the editor.
b) In the Data Controls window, expand EmpSummary1 > Operations > drag
CreateInsert to editor.
c) Select the CreateInsert activity and mark it to Default Activity (click on top of
the editor).
d) Add the Control Flow Case component from CreateInsert to EmpCreatePF, leave
name default.
e) Save All.

12) Run the page and see the importance of Immediate property and Commit required.
Compare data in DB.
13) Add the immediate property to Create button.
308/454
ADF Essentials Training by Deepak Bhagat
a) Open the EmpCreatePF page in the editor.
b) Select the Cancel button, in the Properties window, in Immediate property, select
true.
14) Add the commit and rollback properties to Save and Cancel return activities in task flow to
enhance transaction property.
a) Open the EmpCreateTF in the editor, click somewhere in the editor.
b) In the Properties window, in Transaction property, select Use Existing
Transaction if Possible.

c) Select the Save return activity, in Properties window, in End Transaction property
select commit.
d) Select the Cancel return activity, in Properties window, in End Transaction
property select rollback.
15) Run the BATIndex page and test Create operation.
a) Click the Create button.
b) In the Employee Create page, create a new record.

309/454
ADF Essentials Training by Deepak Bhagat
20.3 Implementing Delete Operation and Creating Helper Method -*

Implement the delete functionality.

1) Open the EmpSearchPF page in the editor.


2) In the Data Controls window, expand EmpSummary1 > Operations > drag Delete
operation to Panel Collections af:toolbar > select ADF Button from context menu.

BAT

3) Save All.
4) Run the BATIndex page and test.
5) Select the af:button-Delete, in the Properties window, in Disabled property select
false, in PartialTrigger property enter/add (b3) (itself).
6) Save All. Rebuild jsff page and refresh browser url.

310/454
ADF Essentials Training by Deepak Bhagat
7) Compare the data with DB.
8) In the Data Controls window, expand Operations > drag Commit operation to Panel
Collections af:toolbar > select ADF Button from context menu.

9) Run the page and test buttons.


10) Add ActionListener to the delete button.
a) Select the Delete button (in Structure window).
b) In Properties window, in ActionListener property, click gear icon > Edit.
Edit Property: Action Listener dialog box appears.
c) In the Managed Bean field, click New.
Create Managed Bean window appears.
i) In the Bean Name field, enter empSearchBean,
ii) In the Class Name field, enter EmpSearchBean,
iii) Click OK.
d) In the Method field, click New.
Create Method dialog box appears.
i) In the Method Name field, enter deleteAndCommit,
ii) Click OK.
e) It creates EmpSearchBean.java file and opens in the editor.
11) Remove the Commit button, from source (code) without removing bindings in pageDef.
311/454
ADF Essentials Training by Deepak Bhagat
12) Create or copy BATADFUtil.java.
13) Copy following code/ method in EmpSearchBean.java.
public void deleteAndCommit(ActionEvent actionEvent) {
BATADFUtil.executeOperationBinding("Delete");
BATADFUtil.executeOperationBinding("Commit");
}

312/454
ADF Essentials Training by Deepak Bhagat
20.4 Implementing Update Operation -o
(Dependent on 5.6 and 14.7)

Implement the update functionality.

1) Open the EmpUpdatePersonPF in the editor.


a) Drag the EmpSummarry1 to Content of pageTemplate (in Structure window),
select ADF Form from context menu.

Create Form window appears.

b) Keep the EmployeeId, FirstName, LastName, Email and PhoneNumber and


remove remaining fields. Click OK.

313/454
ADF Essentials Training by Deepak Bhagat
2) Open the EmpUpdateJobPF in the editor.
a) Drag the EmpSummarry1 to Content of pageTemplate (in Structure window),
select ADF Form from context menu.
Create Form window appears.

b) Keep the Salary, HireDate, JobId, AnnualSalary (RO), ManagerId,


DepartmentId and DepartmentName and remove remaining fields. Click OK.
c) Select the af:panelFormLayout, in the Properties window, in Rows property
enter 4.
d) Select the Salary attribute, in the Properties window, in Id property enter/select
sal.
e) In the AutoSubmit property, select true.
f) Select the AnnualSalary attribute, in the Properties window, in PartialTriggers
property enter/seelct sal.
3) Open the EmpUpdateConfirmPF in the editor.
a) Drag the EmpSummarry1 to Content of pageTemplate (in Structure window),
select ADF Form from context menu.
Create Form window appears.
b) Check the Read-Only Form checkbox.
c) Remove the LocationId, DepartmentId1 and ManagerId1 fields (if found).
d) Click OK.
e) Select the JobId attribute (in Structure window), in the Properties window, in
ReadOnly property, select True.
f) Select the af:panelFormLayout, in Properties window, in Rows field enter 5.
g) Save All.
4) Open the EmpUpdateTF in the editor.
a) In the Properties window, in Transaction property, select Use Existing
Transaction if Possible.

314/454
ADF Essentials Training by Deepak Bhagat
b) Select the Save return activity, in the Properties window, in End Transaction
property, select commit.
c) Select the Cancel return activity, in the Properties window, in End Transaction
property, select rollback.
d) Save All.
5) Run the BATIndex page and test the transaction functionality.

315/454
ADF Essentials Training by Deepak Bhagat
20.5 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_20

316/454
ADF Essentials Training by Deepak Bhagat
20.6 More ADF Transaction Management -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L20-ADFXtEg-TrxnMgmnt\.
These examples demonstrate various other transaction management.

317/454
ADF Essentials Training by Deepak Bhagat
21
Understanding Data Controls
and Bindings
No Lab.

318/454
ADF Essentials Training by Deepak Bhagat
21.1 Examining the Page’s Data Bindings -*
(Dependent on 14)

Examine the data bindings that JDeveloper automatically created on the page when you dragged
a data control to the page.

1) Open the EmpListPF in the editor.


2) Note the difference in the way the table columns appear in the JDeveloper editor and the
way they appear at run time.

BAT

BAT

3) For example, select the first column in the upper table in the JDeveloper editor, and then
look at the Property Inspector. What is the Header Text property set to?
Answer: #{bindings.Departments1.hints.DepartmentId.tooltip}.
4) Select the DepartmentName output text under the column header. What is its value?
Answer: #{row.DepartmentName}.
5) The reference to row is to a variable that is defined on the table.
6) Select the table in the Structure window, and then click the Source tab in the editor. How
is the row variable defined?
Answer: var="row"
value="#{bindings.Departments1.collectionModel}".
7) At run time, what appears in the browser for the first column’s heading?
Answer: The column heading is DepartmentId.
8) In JDeveloper, in the Model project of lab 9, open the DepartmentsEO entity object and
edit the DepartmentName attribute. Where does the Last Name label in the UI come from?
Answer: Last Name comes from the entity object attribute’s control hints for Label.
9) At run time, what appears in the browser for the first column’s values? Where do these
values come from?
Answer: 10, 20 and 30 are the department Id in the rowset; they are the input values
for the department Id in the rows.

319/454
ADF Essentials Training by Deepak Bhagat
10) In the Application Navigator, right-click the page and select Go to Page Definition. What
is the name of the page definition file? (You can also view data bindings by clicking the
Bindings tab of the page itself.)
Answer: EmplListPFPageDef.xml.
11) In the Model section of the page definition file, trace the source of the Departments1
binding. Where does the data come from?
12) Answer: The data comes from the Departments1 view object instance in the
AppModuleAMDataControl. The data is held in the entity object on which the
DepartmentsEO view object is based, and the values ultimately come from the database.
13) At the top of the page, click the link to the Data Binding Registry. What is the name of this
file?
Answer: DataBindings.cpx.
14) When does this data binding registry file get created? Hint: The answer is right at the top
of the Overview page for the data binding registry file.
Answer: The file is created the first time that you bind a UI component to data in the
application.
15) What does the Page Mappings section of this file show?
Answer: It shows the mapping of pages to the IDs of their associated page definition files.
16) What does the Page Definition Usages of this file show?
Answer: It shows the mapping of page definition file IDs to paths of their page definition
files.
17) What does the Data Control Usages section of this file show?
Answer: It shows the data controls that are used in the application.
18) Close the browser and the files that you have open in the JDeveloper editor. As you add
pages to the application, you can re-examine the data-binding registry to see how page
mappings, page definition usages, and data control usages are shown for the additional
pages.

320/454
ADF Essentials Training by Deepak Bhagat
22
Programmatically Customizing
Business Services
In this lab, you add programmatic functionality to your business components.

321/454
ADF Essentials Training by Deepak Bhagat
22.1 Copying Application -*

Make a copy of application BATLab_20 and rename it to BATLab_22. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

322/454
ADF Essentials Training by Deepak Bhagat
22.2 Migrating Project to Another Application -*

Remove existing Model.jar and migrate Model project from BATLab_09 to BATLab_22.

1) Remove the Model.jar and ADF Library (added in BATLab_15).


a) Click the Project Properties.
Project Properties wizard appears.
BAT BAT

b) Select the Libraries and Classpath > ADF Library and click Edit.
Edit Library Definition window appears.

323/454
ADF Essentials Training by Deepak Bhagat
BAT

c) Select the path ..\Model.jar and click Remove > Yes > OK.
d) In the Project Properties wizard, select ADF Library and click Remove. Click OK.
2) Copy the Model folder from BATLab_09 and paste it to BATLab_22.
3) In the JDeveloper, click Open folder and select …\BATLab_22\Model\Model.jpr.
4) Click the Build menu > Clean All and Refresh Application > Yes.
5) Click the Save All.

324/454
ADF Essentials Training by Deepak Bhagat
22.3 Prog Custz EO: Including Override Method -*

Programmatically customize EO such as include Override method in EmployeesEOImpl.java class.

1) Open the EmployeesEO.xml in the editor.


2) Click the Java page, click Edit .
Select Java Options window appears.

3) Ensure the following options are checked: Accessors, Data Manipulation Methods,
Create Method and Remove Method.
4) Open the EmployeesEOImpl.java.
5) Observe all accessors and three overridden methods generated.
6) Add the sop (i.e. System.out.println) and copy three overridden methods from the
solution.
protected void create(AttributeList attributeList) {
System.out.println(" In EmployeesEOImpl.create().");
super.create(attributeList);
}
public void remove() {
System.out.println(" In EmployeesEOImpl.remove().");
super.remove();
}
protected void doDML(int operation, TransactionEvent e) {
System.out.println(" BEGIN: EmployeesEOImpl.doDML().");
if (operation == DML_INSERT) {
System.out.println(" DML_INSERT operation
executed.");
}
if (operation == DML_UPDATE) {
System.out.println(" DML_UPDATE operation
executed.");

325/454
ADF Essentials Training by Deepak Bhagat
}
if (operation == DML_DELETE) {
System.out.println(" DML_DELETE operation
executed.");
}
System.out.println(" END: EmployeesEOImpl.doDML().");
super.doDML(operation, e);
}
7) Right-click in the editor and click Make.
8) Save All.

326/454
ADF Essentials Training by Deepak Bhagat
22.4 Prog Custz EO: Overriding Method -*

Programmatically customize EO such as Override method in EmployeesEOImpl.java class.

1) Open the EmployeesEOImpl.java in the editor.


2) Click the Source menu > Override Methods.

Override Methods window appears.

327/454
ADF Essentials Training by Deepak Bhagat
bat

3) In the Search box, enter init.. and check initDefaults():void. Click OK.
4) Save and Make.

328/454
ADF Essentials Training by Deepak Bhagat
22.5 Programmatically Assigning a Database Sequence -*

Programmatically customize EO such as assign programmatically a Database Sequence in


Overriding Method.

1) Add following code in new overridden method i.e. initDefaults():


// generate new employee sequence and assign to employeeId.
SequenceImpl seq = new SequenceImpl("EMPLOYEES_SEQ",
getDBTransaction());
populateAttributeAsChanged(EMPLOYEEID, new
Integer(seq.getSequenceNumber().toString()));

2) Press [ALT + Enter] to import relevant packages.


3) Save and Make.

329/454
ADF Essentials Training by Deepak Bhagat
22.6 Prog Custz AM: Adding and Exposing Service Methods -*

Programmatically create service methods and expose them as client interface.

1) Before adding and exposing service methods, expand the AppModuleAMDataControl.


Observe that data models and client interface methods are exposed.

2) Generate AppModuleAMImpl.java class.


a) Open the AppModuleAM.xml in the editor.
b) Click the Java page and click Edit .
Select Java Options window appears.

c) Check the Generate Application Module Class: AppModuleAMImpl. Click OK.


d) Save All.
3) Open the AppModuleAMImpl.java file in the editor.
4) Add the following empty methods with sop as per solution BATLab_22.
public void executeWC_EmpByEmail(String email){}
public void applyVC_EmpByDeptId(Integer departmentId){}
public void defineDynamicWC_EmpBySalary(Integer salary){}
public void defineDynamicVC_EmpBySalary(Integer salary){}
public void resetEmpSqlQueryVCs(){}
public void createEmployee(){}
public void displayEmpDetail_findByPrimaryKey(Integer
employeeId){}
public void deleteEmployee_findByKey(Integer employeeId){}
5) Expose these service methods as Client Interface:
330/454
ADF Essentials Training by Deepak Bhagat
a) Open the AppModuleAM.xml in the editor.
b) Click the Java page.
c) In the Client Interface section, click Edit .

bat

Edit Client Interface window appears.

d) Select these methods from Available pane and shuttle them to Selected pane, click
OK.
e) Observe the Client Interface section with added service methods.

331/454
ADF Essentials Training by Deepak Bhagat
6) Again, expand the AppModuleAMDataControl. Observe that data models and client
interface methods are exposed.

7) Run the ADF Model Tester and test service methods.


a) Run the AppModuleAM.
Oracle ADF Model Tester wizard appears.
b) Double-click the AppModuleAM on left pane.
c) In the right-pane, select relevant Method from the drop-down (e.g.
createEmployee).
d) Click the Execute button.
e) Then observe the values Result as Success, Return value as NULL.

332/454
ADF Essentials Training by Deepak Bhagat
8) Double-click the DeptLocVL1 and navigate through rows by clicking Next & Previous
icons. Now verify that only those Locations with Departments are displayed. Locations with
no Department are NOT displayed.

333/454
ADF Essentials Training by Deepak Bhagat
22.7 Prog Custz VO: Default Parameterized Where Clause -*

Programmatically customize view object such as Sorting and Selection: Default Parameterized
Where Clause

1) Open the AppModuleAMImpl.java.


2) Add the following code to executeWC_EmpByEmail(String email) method.
ViewObject employeeVO = getEmpByEmail1(); // Get Handle of ViewObject
employeeVO.setNamedWhereClauseParam("p_email", email);
employeeVO.executeQuery(); //Execute Query
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

334/454
ADF Essentials Training by Deepak Bhagat
22.8 Prog Custz VO: Default Parameterized View Criteria -o

Programmatically customize view object such as Sorting and Selection: Default Parameterized
View Criteria.

1) Open the AppModuleAMImpl.java in the editor.


2) Add the following code to applyVC_EmpByDeptId(Integer departmentId) method.
ViewObject employeeVO = getEmpSqlQuery1(); //Get Handle of
ViewObject
ViewCriteriaManager vcmanager =
employeeVO.getViewCriteriaManager();
ViewCriteria vc = vcmanager.getViewCriteria("EmpByDeptVC");
employeeVO.applyViewCriteria(vc);
employeeVO.setNamedWhereClauseParam("p_deptId", departmentId);
employeeVO.executeQuery(); //Execute Query
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

335/454
ADF Essentials Training by Deepak Bhagat
22.9 Prog Custz VO: Dynamic Parameterized Where Clause -o

Programmatically customize view object such as Sorting and Selection: Dynamic Parameterized
Where Clause.

1) Open the AppModleAMImpl.java in the editor.


2) Add the following code to defineDynamicWC_EmpBySalary(Integer salary)
method.
ViewObject employeeVO = getEmpSqlQuery1(); //Get Handle of
ViewObject
employeeVO.setWhereClause("SALARY > :p_salary");
employeeVO.setOrderByClause("SALARY");
employeeVO.defineNamedWhereClauseParam("p_salary", null, null);
employeeVO.setNamedWhereClauseParam("p_salary", salary);
employeeVO.executeQuery(); //Execute Query
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

336/454
ADF Essentials Training by Deepak Bhagat
22.10 Prog Custz VO: Dynamic Parameterized View Criteria -o

Programmatically customize view object such as Sorting and Selection: Dynamic Parameterized
View Criteria.

1) Open the AppModleAMImpl.javain the editor.


2) Add the following code to defineDynamicVC__EmpBySalary(Integer salary)
method.
ViewObject employeeVO = getEmpSqlQuery1(); //Get Handle of
ViewObject
ViewCriteria vc = employeeVO.createViewCriteria();
ViewCriteriaRow salaryRow = vc.createViewCriteriaRow();
salaryRow.setAttribute("Salary", "> :p_salary");
vc.addElement(salaryRow); // Add VC Row to view criteria
employeeVO.applyViewCriteria(vc); // add view criteria to view
object
employeeVO.defineNamedWhereClauseParam("p_salary", null, null);
employeeVO.setNamedWhereClauseParam("p_salary", salary);
employeeVO.executeQuery(); //Execute Query
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

337/454
ADF Essentials Training by Deepak Bhagat
22.11 Prog Custz VO: Resetting -o

Programmatically customize view object such as Sorting and Selection: Resetting.

1) Open the AppModuleAMImpl.java in the editor.


2) Add the following code to resetEmpSqlQueryVCs() method and explain.
ViewObject employeeVO = getEmpSqlQuery1(); // Get Handle of
ViewObject
employeeVO.applyViewCriteria(null);
employeeVO.setWhereClause(null);
employeeVO.setWhereClauseParams(null);
employeeVO.setOrderByClause(null);
if (salaryFlag == true) {
employeeVO.removeNamedWhereClauseParam("p_salary");
salaryFlag = false;
}
employeeVO.reset();
employeeVO.executeQuery();
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

338/454
ADF Essentials Training by Deepak Bhagat
22.12 Prog Custz VO: CRUD Operation: Creating -o

Programmatically customize view object such as CRUD Operation: Creation.

1) Open the AppModuleAMImpl.java in the editor.


2) Add the following code to createEmployee() method and explain.
ViewObject employeeVO = getEmployees1(); // 1. Get Handle of View
Object
employeeVO.executeQuery(); // 2. Execute Query
employeeVO.last();
Row employeeRow = employeeVO.createRow(); // 3. Create a Row in View Object
employeeRow.setAttribute("FirstName", "Deepak"); // 4. assign
desired values
employeeRow.setAttribute("LastName", "Bhagat");
employeeRow.setAttribute("Email", "[email protected]");
employeeRow.setAttribute("HireDate", ((DBTransactionImpl)
getDBTransaction()).getCurrentDbTime());
employeeRow.setAttribute("JobId", "IT_PROG");
employeeVO.insertRow(employeeRow); // 5. Insert newly created Row
into VO
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

339/454
ADF Essentials Training by Deepak Bhagat
22.13 Prog Custz VO: CRUD Operation: Reading and findByPrimaryKey -o

Programmatically customize view object such as CRUD Operation: Reading and findByPrimaryKey.

1) Open the AppModuleAMImpl.java in the editor.


2) Add the following code to displayEmpDetail_findByPrimaryKey(Integer
employeeId) method and explain.
EntityDefImpl employeeDef =
EntityDefImpl.findDefObject("bat.model.eo.EmployeesEO");
Key employeeIdKey = new Key(new Object[] { employeeId });
EmployeesEOImpl employeeRow = (EmployeesEOImpl)
employeeDef.findByPrimaryKey(getDBTransaction(), employeeIdKey);
3) Press [Alt+Enter] key to import required packages.

bat

4) Save and Make.

340/454
ADF Essentials Training by Deepak Bhagat
22.14 Prog Custz VO: CRUD Operation: Deleting and findByKey -o

Programmatic customization view object such as CRUD Operation: Deleting and findByKey.

1) Open the AppModuleAMImpl.java in the editor.


2) Add the following code to deleteEmployee_findByKey(Integer employeeId)
method and explain.
Key employeeIdKey = new Key(new Object[] { employeeId });
Row[] employeeVORowsFound = employeeVO.findByKey(employeeIdKey,
1);
if (employeeVORowsFound != null && employeeVORowsFound.length > 0)
{
Row employeeRow = employeeVORowsFound[0];
employeeRow.remove(); // 4. Delete row from VO
}
3) Press [Alt+Enter] key to import required packages.

4) Save and Make.

341/454
ADF Essentials Training by Deepak Bhagat
22.15 Testing Exposed Service Methods using ADF Model Tester -o

Test all the above service methods using ADF Model Tester.

1) Run the ADF Model Tester and test service methods.


a) Run the AppModuleAM.
Oracle ADF Model Tester wizard appears.

b) Double-click the AppModuleAM.


c) Check the service methods and check the result in Log window.
i) Select Method from the drop-down (e.g.: applyVC_EmpByDeptId).
ii) Click the Execute button.
iii) Observe the Result should be success.
iv) Check the result in Log window.

342/454
ADF Essentials Training by Deepak Bhagat
22.16 Creating and Running Test Clients -o

Create and run test clients.

1) Create the test client class BATBusinessServiceCallTC to call business service client
interface.
a) Right-click the bat.model > New > From Gallery.
New Gallery wizard appears.

b) Select the General at left-side pane (if already not selected).


c) Select the Java Class and click OK.
Create Java Class window appears.

343/454
ADF Essentials Training by Deepak Bhagat
BAT

bat

d) Fill the details to create a Java class.


i) In the Name field, enter BATBusinessServiceCallTC.
ii) Ensure the Package is bat.model.
iii) Check the Main Method and uncheck remaining check boxes.
iv) Click OK.
e) It creates the BATBusinessServiceCallTC Java class and opens in the editor.
2) Replace the only line of code in main() method, enter bc4jclient and press [Ctrl +
Enter] to instantiate a BC4J application module .
3) Copy the code from …\BATHandouts\BATLabs-SrcCodes\L22-Codes-
ProgCustomization\BATBusinessServiceCallTC.java.
4) After copying code press [Alt + Enter] to import packages.
5) Similarly create following 4 more test clients to demonstrate CRUD Operations.
6) Copy the solutions from …\BATHandouts\BATLabs-SrcCodes\L22-Codes-
ProgCustomization.
BATCreateEmployeeHiredTodayTC
BATDisplayEmployeesHiredTodayTC
BATModifyEmployeesHiredTodayTC
BATRemoveEmployeesHiredTodayTC

344/454
ADF Essentials Training by Deepak Bhagat
22.17 Calling Service Method from MVC Layer -o

Implementing service method call functionality.

1) Create the new task flow named EmpFilterTF and a new view activity named
EmpFilterPF.
2) Drag and drop following service methods from Data Control with ND Value, as shown below.
Client Interface ND Value
applyVC_EmpByDeptId(Integer); #{pageFlowScope.deptId}
defineDynamicWC_EmpBySalary(Integer); #{pageFlowScope.salary}
defineDynamicVC_EmpBySalary(Integer); #{pageFlowScope.salary}
3) Also add the Router name salFilterRouter to task flow EmpFilterTF.
4) Add the following control flows from page to router and methods.

5) Select the Router, add Expression and Outcome values, as following


#{pageFlowScope.salFilterType=='UseWC'} Outcome: salUingWC
#{pageFlowScope.salFilterType=='UseVC'} Outcome: salUingVC
6) Create the page EmpFilterPF by double-clicking on it. Add Panel Group Layout and Panel
Header layouts.
7) In the EmpFilterPF page, create an Employee table (using EmpSqlQuery1) and 4
buttons on page. Name buttons as follows.
SetActionListener
Text Action
From To
#{'UseWC'} #{pageFlowScope.salFilterType}
Filter By Sal > 20000 Using WC salFilterType
#{'20000'} #{pageFlowScope.salary}
#{'UseVC'} #{pageFlowScope.salFilterType}
Filter By Sal > 15000 Using VC salFilterType
#{'15000'} #{pageFlowScope.salary}
Filter By DeptId 40 filterByDeptId #{'40'} #{pageFlowScope.deptId}
Reset
8) Add the method binding resetEmpSqlQueryVCs() and associate it with Reset button.
9) Select the table, set PartialTriggers to 4 buttons.
10) In the BATIndex.jsf, add a new tab and drop EmployeeFilterTF as a region.
11) Save All.
12) Run and test all service methods.

345/454
ADF Essentials Training by Deepak Bhagat
BAT

346/454
ADF Essentials Training by Deepak Bhagat
347/454
ADF Essentials Training by Deepak Bhagat
22.18 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_22

348/454
ADF Essentials Training by Deepak Bhagat
23
Deploying ADF Applications
In this lab, you create a deployment profile and configure deployment options for the application
that you have developed. You then configure a data source in the stand-alone Oracle WebLogic
Server, and you configure the application to use a data source. Finally, you deploy the application
to the stand-alone Oracle WebLogic Server, and you test the deployment.

349/454
ADF Essentials Training by Deepak Bhagat
23.1 Copying Application -o

Make a copy of application BATLab_22 and rename it to BATLab_23. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

350/454
ADF Essentials Training by Deepak Bhagat
23.2 Creating a Business Service Deployment Profile -*

Create a business service deployment profile.

1) Create business service deployment profile.


a) Right-click the Model > Deploy > select New Deployment Profile.
Create Deployment Profile window appears.

BAT

b) In the Profile Type field, select Business Components Archive.


c) In the Deployment Profile Name field, enter BATModel.
d) Click OK. Save All.
e) Right-click the Model > select Project Properties.
Project Properties wizard appears.
BAT BAT

BAT
BAT
BAT
BAT
BAT

f) Select the Deployment (at left-side pane) > expand BATModel (Business
Components Archive) (at right-side pane).
g) Select the BATModel_Common (JAR Module) and click Edit.

351/454
ADF Essentials Training by Deepak Bhagat
Edit JAR Deployment Profile Properties wizard appears.

BAT BAT

h) Modify the JAR File field to …\mywork\deploy\...jar. Click OK.


i) Now select the BATModel_MiddleTier (ADF Library JAR File), click Edit and
modify JAR File field to…\mywork\deploy\...jar.
j) Click OK. Save All.
k) Right-click the Model > Deploy > select BATModel.
Deploy BATModel window appears.

l) Ensure the Deploy to File is selected. Click Next. Click Finish.


2) Save All.

352/454
ADF Essentials Training by Deepak Bhagat
23.3 Creating a Web Module Deployment Profile -*

Create a web module deployment profile.

1) Create web module deployment profile.


a) Right-click the ViewController > Deploy > select New Deployment Profile.
Create Deployment Profile window appears.

BAT

b) In the Profile Type field, select WAR File.


c) In the Deployment Profile Name field, enter BATWeb. Click OK.
Edit WAR Deployment Profile Properties wizard appears.

BAT BAT

BAT

BAT

d) Modify the WAR File field to …\mywork\deploy\BATWeb.war.

353/454
ADF Essentials Training by Deepak Bhagat
e) Select the Specify Java EE Web Context Root radio-button and enter BATLab in
the text box. Click OK.
f) Save All.
g) To edit the Deployment Profile, right-click the ViewController > select Project
Properties.
Project Properties wizard appears.
BAT BAT

BAT
BAT

h) Select the Deployment (at left-side pane) > BATWeb (Web Module) (at right-side
pane) and click Edit.
i) Enter Specify Java EE Web Context Root as BATLab. Modify WAR File as
…\mywork\deploy\BATWeb.war
j) Right-click the ViewController > Deploy > select BATWeb.
Deploy BATWeb wizard appears.
BAT

k) Select the Deploy to WAR, click Next and click Finish.


l) Save All.

354/454
ADF Essentials Training by Deepak Bhagat
23.4 Creating an Application Deployment Profile -*

Create an application deployment profile.

1) Create application deployment profile.


a) Click the Application menu > Deploy > select New Deployment Profile.

BAT

BAT BAT

Create Deployment Profile window appears.

BAT

b) In the Profile Type field, select EAR File.


c) In the Deployment Profile Name field, enter BATLab. Click OK.
Edit EAR Deployment Profile Properties wizard appears.

355/454
ADF Essentials Training by Deepak Bhagat
BAT BAT

BAT

d) Modify the EAR file field to …\mywork\deploy\BATLab.ear.


e) Click the Application Assembly page at right-side pane

BAT
BAT
BAT

BAT
BAT

f) Expand the Model.jpr, check BATModel and expand ViewController.jpr, check BATWeb.
Click OK.
g) Save All.
h) Select Application > Project Properties > Deployment > BATLab (Application
Module), click Edit.
i) Enter EAR file as …\mywork\deploy\BATLab.ear. In Application Assembly. Check
BATModel & BATWeb.
j) Click the Application menu > Deploy > select BATLab.
Deploy BATLab wizard appears.

k) Select the Deploy to EAR, click Next and Finish.

356/454
ADF Essentials Training by Deepak Bhagat
l) Save All.

357/454
ADF Essentials Training by Deepak Bhagat
23.5 Starting Integrated Weblogic Server -*

Start Integrated Weblogic server in JDeveloper.

1) Click the Run menu > select Start Server Instance (IntegratedWebLogicServer).

2) It runs the server and status can be shown in Log window

358/454
ADF Essentials Training by Deepak Bhagat
23.6 Deploying the Application from JDeveloper -*

Deploy the application from JDeveloper.

1) Click the Application menu > Deploy > select BATLab.

BAT

BAT BAT
BAT

Deploy BATLab wizard appears.


BAT

2) Select the Deploy to Application Server. Click Next.


3) On the Select Server page of the wizard, ensure IntegratedWebLogicServer is selected.
Click Finish.
4) It deploys BATLab to IntegratedWebLogicServer.
5) Save All.

359/454
ADF Essentials Training by Deepak Bhagat
23.7 Running the Application -*

Run the application.

1) Open the Browser and type URL: http://127.0.0.1:7101/BATLab/faces/BATIndex.jsf


2) It displays the BATIndex page.

360/454
ADF Essentials Training by Deepak Bhagat
23.8 Undeploying the Application -*

Undeploy the application from integrated web logic server.

1) Login to the server.


a) Open the URL: http://localhost:7101/console
b) It opens the “WebLogic Server” page.

c) In the Username field, enter weblogic,


d) In the Password field, enter weblogic1,
e) Click Login.
2) It opens the Server-Home page.

361/454
ADF Essentials Training by Deepak Bhagat
3) Click the Deployments (at left-side panel).
4) It displays all deployed files in the server.

BAT

BAT

5) Check the BATLab checkbox and click Delete to undeploy.


OR
6) In the JDeveloper,
a) Click the Windows menu > select Application Servers.

362/454
ADF Essentials Training by Deepak Bhagat
Application Servers window opens at left-side.

BAT
BAT

b) Expand the Application Servers > IntegratedWebLogicServer >


Deployments.
c) Right-click the BATLab > select Undeploy. Click Yes.
d) It undeploys the application from the server.
7) Click Stop button to stop IntegratedWebLogicServer Instance.

363/454
ADF Essentials Training by Deepak Bhagat
23.9 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_23

364/454
ADF Essentials Training by Deepak Bhagat
24
Securing ADF Applications
In this lab, you set up the application to use security. You create users and you assign permissions
to roles. You also create login. You then use ADF security to manage access to pages, task flows,
and entity objects.

365/454
ADF Essentials Training by Deepak Bhagat
24.1 Copying Application -o

Make a copy of application BATLab_23 and rename it to BATLab_24. Follow the steps, as
explained in Lab 5.1 or Lab 6.1.

366/454
ADF Essentials Training by Deepak Bhagat
24.2 Configuring the Application to use ADF Security -o

Configure the application to use ADF Security.

1) Expand the Application Resources window > Descriptors node and examine existing
files.

2) Select the ViewController project. Click the Application menu > Secure > select
Configure ADF Security.

BAT

bat
bat
bat
bat
bat
bat
bat

Configure ADF Security wizard appears.

367/454
ADF Essentials Training by Deepak Bhagat
BAT

3) Click Next. Click Next. Click Next.


4) On the Authenticated Welcome page of the wizard,
a) Check the Redirect Upon Successful Authentication checkbox,
b) In the Welcome Page field, select /faces/BATIndex.jsf by clicking icon.
5) Click Next. Click Finish. Click OK if any message appears.
6) Save All.
7) Observe the jazn-data.xml and changes in descriptor files.

368/454
ADF Essentials Training by Deepak Bhagat
24.3 Defining Users in the Identity Store -o

Define users in the identity store (jazn-data.xml).

1) In the Application Resources window, double-click the jazn-data.xml to open it in


the editor.
2) In the jazn-data.xml, click Test Users & Roles page.
3) Create 2 users named Admin and Deepak for application.
a) In the Users section, click icon.
i) In the Name field, enter Admin,
ii) In the Password field, enter 123456789,
iii) Enter the same in Confirm Password.
iv) Save All.
4) Similarly, create another User named Deepak with Password 12345678. Save All.

369/454
ADF Essentials Training by Deepak Bhagat
24.4 Defining Application Roles -o

Define roles for the application.

1) Click the Application Roles page.


2) Add 2 roles named Admin-Role and Emp-Role for the application.
a) Click the icon in Roles section and select Add New Role from the context-menu.

i) Ensure the NewApllicationRoles is selected, in the Name field, enter Admin-Role,


ii) In the Display Name field, enter Administrator.
iii) Select the Administrator (Admin-Role), click icon > Add New Role > select
Add to Admin-Role.

iv) In the Name field, enter Emp-Role,


v) In the Display Name field, enter Employee.
vi) Save All.
3) Add roles for the users.
a) Select the Administrator (Admin-Role), in Mappings section, click icon, select Add
User from the context-menu.

Select Users window appears.

370/454
ADF Essentials Training by Deepak Bhagat
b) Check the Admin checkbox and click OK.
c) Select the Employee (Emp-Role), click icon, select Add User.
d) In the Select User window, check Deepak checkbox. Click OK. Save All.

371/454
ADF Essentials Training by Deepak Bhagat
24.5 Implementing Security on Task Flows and Pages -o

Implement security on task flows and pages.

1) To Create and Update web pages and task flows, grant only Admin-Role. To all web pages
and task flows, grant both Admin-Role and Employee-Role.
a) Click the Resource Grants page,
i) In the Resource Type field, select Task Flow from the drop-down,
ii) Ensure the Source Project field is selected ViewController by clicking
magnifier icon.
iii) Select any task flow in Resources section. In Granted To section, click icon >
select Add Application Role.

Select Application Roles window appears.

iv) Check the Admin-Role checkbox and click OK.


v) In the Actions section, select relevant checkboxes (e.g. grant).

372/454
ADF Essentials Training by Deepak Bhagat
b) Now in the Resource Type field, select Web Page and assign required permissions.
2) Do the same process for User role. Save All.

BAT bat
BAT
BAT bat
BAT bat
bat

bat
bat
bat
bat
bat
bat
bat

bat

373/454
ADF Essentials Training by Deepak Bhagat
24.6 Testing Application Authentication and Authorization -o

Run the application and test the ADF Security functionality.

1) Run the BATIndex.jsf page.


2) It opens in the browser and displays Authentication Required dialog box.
BAT

BAT BAT

3) Enter User Name and Password of Admin or User. Click OK.


4) It displays the BATIndex home page.

374/454
ADF Essentials Training by Deepak Bhagat
24.7 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_24

375/454
ADF Essentials Training by Deepak Bhagat
24.8 ADF Basic Authentication -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L24-ADFXtEg-Security\.
This example demonstrates basic ADF Security.

376/454
ADF Essentials Training by Deepak Bhagat
25
Debugging and Troubleshooting
ADF Applications
Most of the techniques for troubleshooting are used mainly for debugging a user interface.
However, you can run the JDeveloper Debugger with the Business Components Browser, which
enables you to troubleshoot problems with your ADF BC model apart from running a Fusion Web
application. In the practices for this lesson, you debug a client method in an application module,
and you explore the features of the JDeveloper Debugger.

377/454
ADF Essentials Training by Deepak Bhagat
25.1 Copying Solution -*

Copy the solution from …\BATHandouts\BATLabs-Solutions\BATLab_25-DT

378/454
ADF Essentials Training by Deepak Bhagat
25.2 Discovering Application Problems -*

Discover the application problems.

1) Run the application module HRSystemAM.


Oracle ADF Model Tester wizard appears.

2) Double-click the HRSystemAM.


3) In the Method field (at right-side), ensure executeWhereClause_EmpByEmail is selected.
4) In the Value field, enter AKHOO for the Property (email[java.lang.String]).
5) Click Execute.
6) Observe the Return value displays No employee found with email= akhoo, in spite
we have an employee with valid AKHOO email. Problem is that email AKHOO is case sensitive
and it is getting converted to lower case akhoo, before getting passed as parameter, to
query data from database.
7) Expected Return value should be Alexander Khoo.
8) Double-click the EmployeeByEmail1.
Bind Variables dialog-box appears.
9) Click Cancel button, so that the value set by executeWhereClause_EmpByEmail
method is used.
10) The record appears blank.

379/454
ADF Essentials Training by Deepak Bhagat
25.3 Setting Breakpoints in the Debugger -*

Set breakpoints in the debugger.

1) Open the HRSystemAMImpl.java in the editor.


2) Set the Breakpoint.
a) Go to method executeWhereClause_EmpByEmail(), right-click in the left margin
of the first line (i.e. System.out.println()), and select Toggle Breakpoint from
the context-menu.
b) Or just click on the line.

3) Set the Watchpoint on dEmail.


a) In the Structure window, click Show Fields.

380/454
ADF Essentials Training by Deepak Bhagat
bat

b) Right-click the dEmail and select Create Watchpoint.

bat

c) Alternatively, in the HRSystemAMImpl.java, right-click on dEmail and select


Toggle Watchpoint.

4) View all the breakpoints.


a) Select the Window menu > select Breakpoints.

Breakpoints window appears at the bottom (under the Log window).

381/454
ADF Essentials Training by Deepak Bhagat
bat
bat

b) Right-click the Breakpoints window to see options that are available in context menu.

382/454
ADF Essentials Training by Deepak Bhagat
25.4 Running Application Module in Debug Mode -*

Run the application module in debug mode.

1) Run the HRSystemAM in debug mode.


a) Right-click the HRSystemAM and select Debug from context menu.
BAT

bat
bat

bat

b) Observe that cursor stops at String dEmail=null.

c) Observe the Stack window, HRSystemAMImpl is initialized.

383/454
ADF Essentials Training by Deepak Bhagat
d) Observe the Data tab, expand +this, dEmail is null.
e) Observe the Smart Data tab, dEmail appears on its own.

f) Right-click the dEmail and select Watch.

g) Click Resume on the top menu.


Oracle ADF Model Tester wizard appears.
h) Double-click the HRSystemAM, in the Method field ensure
executeWhereClause_EmpByEmail is selected and in the Value field enter AKHOO
for the Property (email[java.lang.String]). Click Execute.
i) Cursor stops at first breakpoint (i.e. System.out.println()).

j) Click Step-Over (2 times) on top menu, till the line emailToLowerCase()


method is encountered .
i) Observe the Smart Data tab.
ii) Right-click the debugEmail and select Watch.
k) Click Step Into to step into emailToLowerCase() method.
384/454
ADF Essentials Training by Deepak Bhagat
i) Observe the Watches tab.
ii) Method debugEmail have question mark, as it is out of scope.

l) Click Step Over till the line dEmail = lowerCaseEmail is encountered.


i) Observe the Smart Data tab.
ii) Method lowerCaseEmail is “akhoo” instead of AKHOO.

iii) Right-click the lowerCaseEmail, select Modify Value.

Modify Value dialog box appears.

iv) In the New Value field, enter AKHOO, click OK.

385/454
ADF Essentials Training by Deepak Bhagat
m) Click Step Out and then Step Over.
i) Observe the Watches tab.
ii) Method debugEmail is AKHOO.

n) Click Step Over till the line setNamedWhereClauseparam() is encountered.

i) Observe the Smart Data tab.


ii) Expand the employeeVO > mViewRowSet and observe value under
mWhereParams.

386/454
ADF Essentials Training by Deepak Bhagat
o) Click Step Over (2 times) till we cross or step over line executeQuery().

i) Again, in Smart Data tab, expand and observe the value under employeeVO >
mViewRowSet > mWhereParams > [0]. It is AKHOO.

ii) Click Resume.


2) Now observe the result in Oracle ADF Model Tester wizard.

387/454
ADF Essentials Training by Deepak Bhagat
a) Return value displays Alexander Khoo.
3) Double-click the EmployeeByEmail1.
Bind Variable dialog box appears.
4) Click Cancel button, so that value set by executeWhereClause_EmpByEmail()
method is used. Correct record appears with values.

388/454
ADF Essentials Training by Deepak Bhagat
389/454
ADF Essentials Training by Deepak Bhagat
26
Best Practices

390/454
ADF Essentials Training by Deepak Bhagat
27
Miscellaneous Topics

391/454
ADF Essentials Training by Deepak Bhagat
27.1 Real-time End-to-end ADF Application -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L27-ADFXtEg-Miscellaneous\.
These examples demonstrate real-time independent end-to-end ADF Application.

392/454
ADF Essentials Training by Deepak Bhagat
28
Advance Topics

393/454
ADF Essentials Training by Deepak Bhagat
28.1 UI and Page Flow Design

394/454
ADF Essentials Training by Deepak Bhagat
28.2 List of Existing Features

This real-time application consists of every ADF functionality implemented from Lab 3 to Lab 19
and some of Lab 21. So existing functionality can be explored in similar way as Lab 3 to Lab 21.
Implementation of few minor functionalities from Lab 3 to Lab 21 may be missing in this advance
ADF. There is implementation of additional advance functionalities as listed below. Explore,
understand and practice advance functionalities.

Observe that this lab solution has difference in file and package naming standard.

395/454
ADF Essentials Training by Deepak Bhagat
28.3 Adding Custom View Criteria

Add custom View Criteria - HRService (Extension to Lab 22).

1) To verify Location-Departments records with and without View Criteria,


a) Expand the path bat.lab.hrsystem.service.testclient.
b) Run the Java test clients BATTraverseLocDeptTC.java and
BATTraverseLocDeptWithVCTC.java.
c) Run the HRSystemIndex.jsf.
d) Verify Location-Department tree and compare it with previous lab solutions.
e) Observe that Locations without Departments are no more displayed in UI.
2) Open the LocationsVO in the editor and explore View Criteria.

3) Open the HRSystemAMImpl.java in the editor and explore


applyLocationVOCriteria() service method.
4) Open the HRLocationDepartmentsTF in the editor and explore
applyLocationVOCriteria() service method call.

396/454
ADF Essentials Training by Deepak Bhagat
28.4 Traversing, Creating and Deleting Master-Detail

Traverse, create and delete Master-Detail - HRService (Extension to Lab 22).

1) To verify master-detail methods,


a) Expand the path bat.lab.hrsystem.service.testclient.
b) Run the Java test clients BATAddEmpToDeptTC.java,
BATTraverseDeptEmpDetailsTC.java & BATRemoveEmpFromDeptTC.java.
2) Open the DepartmentsEOImpl.java in the editor.
a) Explore the addEmployee(), traverseEmployees() and removeEmployee()
methods.

397/454
ADF Essentials Training by Deepak Bhagat
28.5 Creating an Application Module Base Class

Create an application module base class - HRService (Extension to Lab 22).

1) Run the testUserPrincipalName() method using ADF Model Tester.


a) Run the HRSystemAM.
b) Double-click the HRSystemAM.
c) In the Method field, select testUserPrincipalName() and click Execute.
2) Open the BATBaseApplicationModuleImpl.java in the editor and explore
getUserPrincipalName() method.
3) Open the HRSystemAMImpl.java in the editor, explore extends and
testUserPrincipalName() method.

398/454
ADF Essentials Training by Deepak Bhagat
28.6 Programmatically Calling EL, Scopes and Conditional Display

Call EL, scopes and conditional display programmatically - PGViewController (Extn to Lab 16).

1) Run the PlaygroundIndex.jsf and play around with all buttons and links and observe
various behavior.
2) Open the PGEmpListPF.jsff and PGEmpListBean.java pages in the editor.
3) Explore the changeScopeValues() method.

399/454
ADF Essentials Training by Deepak Bhagat
28.7 Adding Router Activity

Add router activity – HRViewController.

1) Run the HRSystemIndex.jsf.


2) Click Employee Search tab > Search for a record (for update) > Select a record (for
update) > click Update (for update) or Create button.
3) Open the HREmpSearchTF.xml in the editor and explore Router activity.
4) Open the HREmpSearchPF.jsff in the editor and explore Create and Update buttons.

400/454
ADF Essentials Training by Deepak Bhagat
28.8 Programmatically Handling Confirm Dialog

Handle dialog box (with Yes or No) programmatically - HRViewController (Extn to Lab 14.5).

1) Run the HRSystemIndex.jsf.


2) Click Employee Search tab > Search > select a record > click Delete button.
3) Open the HREmpSearchPF.jsff in the editor and explore Delete button.
4) Open the HREmpSearchBean.java in the editor and explore
deleteConfirmDialogHandler() and deleteConfirmPopupCancelHandler()
methods.

401/454
ADF Essentials Training by Deepak Bhagat
28.9 Programmatically Invoking Popup

Invoke Popup programmatically - HRViewController (Extension to Lab 14.5).

1) Run the HRSystemIndex.jsf.


2) Click the Department Id and Manager Id. Explore two task flows
HRDepartmentDetailTF and HRDeptManagarDetailTF in pop-up.
3) Open the HREmpListBean.java in the editor.
4) Explore the invokeDepartmentDetailPopup() and
invokeDeptManagerDetailPopup() methods.
5) Explore the table t1 in HREmpListPF.jsff.
6) Alternatively, one can use BATADFUtil.invokePopup().

402/454
ADF Essentials Training by Deepak Bhagat
28.10 Programmatically Closing Popup

Close Popup programmatically - HRViewController: (Extension to Lab 14.5).

1) After running above lab, click cross (X) in pop-up to close pop-up.
2) Observe the message HREmpListBean.departmentPopupCancelHandler() in Log
window.
3) Open the HREmpListBean.java and explore departmentPopupCancelHandler()
method.
4) Open the pop-up again and click Done Outside Region button and observe message in
Log window.
5) Open the HREmpListBean.java and explore popupOutsideDoneButtonHandler()
method.
6) Open the pop-up again and click Done Inside Region button and observe message in Log
window.
7) Open the HRDepartmentDetailBean.java & HRDeptManagarDetailBean.java to
explore doneHandler() method.
8) Also explore BATADFUtil.closePopup() method under the package
bat.lab.hrsystem.ui.utils.

403/454
ADF Essentials Training by Deepak Bhagat
28.11 Rendering Dynamic Region

Close Popup programmatically - HRViewController (Extension to Lab 14.5).

1) Run the HRSystemIndex.jsf.


2) Click the Department Id and Manager Id. Observe the two task flows
HRDepartmentDetailTF and HRDeptManagarDetailTF displays on same region
dynamically.
3) Open the HREmpListPF.jsff and explore table t1, popup p1 and region r5 inside
popup p1.
4) Explore the HREmpListPFPageDef.xml and HREmpListBean.java.
5) Open the HRSystemAMImpl.java and explore applyManagerVOCriteria() method.
6) Open the EmployeeVO and explore ManagerVOCriteria view criteria.

404/454
ADF Essentials Training by Deepak Bhagat
28.12 Adding Context Menu

Add context menu – HRViewController.

1) Run the HRSystemIndex.jsf.


2) Right-click the Location Departments Page output text and observe context menu.
3) Explore the popup p1 and showPoputBehavior in HRLocDeptPF.jsff.

405/454
ADF Essentials Training by Deepak Bhagat
28.13 Creating Data Control Method from Backing Bean

Create data control method from backing bean – HRViewController.

1) Explore the HRProducerEventDC.java, HRContainerEventDC.java and


HRConsumerEventDC.java under package bat.lab.hrsystem.ui.datacontrols.
Also explore DataControls.dcx.
2) Right click the beans and notice Create Data Control.

3) Expand the Data Controls and notice beans and methods.

406/454
ADF Essentials Training by Deepak Bhagat
28.14 Contextual Events

Contextual Events – HRViewController.

1) Run the HRSystemIndex.jsf.


2) Observe the Employee List tab and make a note of output text Employee List Page.
3) Under the Location-Departments section, right-click the output text Location
Department Page > click My ContextMenuItem 1.
4) Observe the output text Employee List Page is replaced by Contextual Event from
Loc-Dept My ContextMenuItem 1. This communication (parameter passing) from region
to region is achieved by implementing sections 26.12, 26.13, 26.15, 26.16 and 26.18.
5) Observe log output message as In HRContainerEventDC.handleContainerEvent()..
containerParam=My ContextMenuItem 1. This communication (parameter passing) from
region to page is achieved by implementing sections 26.12, 26.13, 26.15, 26.17 and 26.18.
6) Contextual event requires publish, subscribe and handle event. This is demonstrated in next
4 sections.

407/454
ADF Essentials Training by Deepak Bhagat
28.15 Publishing Contextual Event

Publish Contextual Event - HRViewController.

1) Open the bean HRProducerEventDC.java and explore the raiseProducerEvent().


2) Explore the data control in DataControls.dcx and Data Controls.
3) Open the HRLocDeptPFPageDef.xml in the editor.
4) Explore the method binding raiseProducerEvent(), event HR_LAB_EVENT and payload
#{pageFlowScope.myContextMenuItem}.
5) Open the HRLocDeptPF.jsff in the editor.
6) Explore the actionListener= “#{bindings.raiseProducerEvent.execute}”.

408/454
ADF Essentials Training by Deepak Bhagat
28.16 Subscribing and Handling Contextual Event to Region

Subscribe and Handle Contextual Event for region to region - HRViewController.

1) Open the HRConsumerEventDC.java bean and explore handleConsumerEvent().


2) Explore data control in DataControls.dcx and Data Controls.
3) Open the HREmpListPFPageDef.xml, explore method binding
handleConsumerEvent(), event HR_LAB_EVENT and payload consumerParam.
4) Open the HREmloyeeListPF.jsff in the editor, explore output text ot1 binding
#{backingBeanScope.EmpListBean.mvRichOutputText}.
5) Open the HREmpListBean.java, explore property mvRichOutputText.
6) Open the HREmloyeeListTF.xml, explore registration of managed bean
HREmpListBean in task flow.
7) At runtime observe that output text Employee List Page is replaced by Contextual
Event from Loc-Dept My ContextMenuItem 1 and parameter passing from region to
region is achieved.

409/454
ADF Essentials Training by Deepak Bhagat
28.17 Subscribing and Handling Contextual Event to Page

Subscribe and Handle Contextual Event for Region to Page - HRViewController.

1) Open the HRContainerEventDC.java bean and explore handleContainerEvent().


2) Explore data control in DataControls.dcx and Data Controls.
3) Open the HRSystemIndexPageDef.xml. Explore method binding
handleContainerEvent(), event HR_LAB_EVENT and payload containerParam.
4) At runtime observe log output message as In
HRContainerEventDC.handleContainerEvent().. containerParam= My
ContextMenuItem 1 and parameter passing from region to page is achieved.

410/454
ADF Essentials Training by Deepak Bhagat
28.18 Programmatically Adding Partial Page Refresh

Add Partial Page Refresh programmatically - HRViewController.

1) Open the HREmloyeeListPF.jsff. Explore output text ot1 binding


#{backingBeanScope.EmpListBean.mvRichOutputText} .
2) Open the HREmpListBean.java and explore property mvRichOutputText.
3) Open the HRConsumerEventDC.java and explore handleConsumerEvent().
4) Look for statement addPartialTarget() in event handler handleConsumerEvent().

411/454
ADF Essentials Training by Deepak Bhagat
28.19 Programmatically Handling UI Create Transaction

Programmatically Handling UI Create Transaction - HRViewController.

1) Run the HRSystemIndex.jsf.


2) Click the Employee Search tab > Create button.
3) On Create page, fill mandatory fields and click Save button. Observe messages in Log
window and look for it in files listed.
4) Open the HREmloyeeCreateTF.xml and explore the registration of managed bean
HREmpCreateBean.
5) Explore the actionListener="#{backingBeanScope.EmpCreateBean.saveHandler}"
of Save button in HREmloyeeCreatePF.jsff.
6) Open the HREmpCreateBean.java and explore the saveHandler(). This implements
create operation programmatically, using data control frame.
7) Explore the BATADFUtil.saveAndContinue().

412/454
ADF Essentials Training by Deepak Bhagat
28.20 Programmatically Handling UI Delete Transaction

Programmatically Handling UI Delete Transaction - HRViewController.

1) Run the HRSystemIndex.jsf.


2) Click the Employee Search tab > search for a record > select a particular record > click
Delete button.
3) Open the HREmloyeeSearchTF.xml and explore registration of managed bean
HREmpSearchBean.
4) Explore
dialogListener="#{backingBeanScope.EmpSearchBean.deleteConfirmDialogHand
ler}" of Dialog d1 in HREmloyeeSearchPF.jsff.
5) Open the HREmloyeeSearchPFPageDef.xml and explore Delete and Commit bindings
in. This is done by dragging Delete (EmployeeSummary1) and Commit
(HRSystemAMDataControl) operations from Data Controls.
6) Open the HREmpSearchBean.java and explore deleteConfirmDialogHandler().
This executes delete and commit operation bindings programmatically in pagedef, in one
click.
7) Also explore executeOperationBinding() in BATADFUtil.java.

413/454
ADF Essentials Training by Deepak Bhagat
28.21 Lab Solution

Lab solutions can be found under …\BATHandouts\BATLabs-Solutions\BATLab_28

414/454
ADF Essentials Training by Deepak Bhagat
28.22 Advance ADF Extended Examples -x

Some of these advance ADF topics may be found as independent extended examples under
…\BATHandouts\BATXtEg-Proprietary\L28-BATXtEg-AdvanceADF. For hands-on
practice, please refer to Deepak Bhagat’s Blog at https://cloudadfdeepakb.blogspot.com or
download from the above location.

415/454
ADF Essentials Training by Deepak Bhagat
28.23 Entity-Level Triggers -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L28-ADFXtEg-AdvanceADF\.
This example demonstrates ADF BC 12c New Feature - Entity-Level Triggers.

416/454
ADF Essentials Training by Deepak Bhagat
29
Integrating ADF with
Web Service

417/454
ADF Essentials Training by Deepak Bhagat
29.1 Creating REST Web Service with ADF Business Service

Create REST web service with ADF business service.

1) Create the ADF Fusion Web Application named x with DepartmentsEO, DepartmentsVO
and AppModuleAM in the package bat.
2) Open the AppModuleAM.
a) Click the Web Service page.

b) Click the REST tab.


c) Click icon.
d) It shows an error dialog box that asks to define a version. Click OK.
3) Define release version and name in adf-config.xml to create REST Web Service.
a) Open the adf-config.xml (under Application Resources window).

b) Click the Release Versions page.


c) Click icon.
418/454
ADF Essentials Training by Deepak Bhagat
New Release Version dialog box appears.
d) In the Release Name field, enter adf12.2.1.
e) Click OK. Save All.
4) Go back to AppModuleAM.
a) Click the Web Service page.
b) Click the REST tab.
c) Click icon.
d) Confirm creation of REST Web Service Project dialog box appears. Click Yes.
Create REST Resource window appears.

e) In the Resource Name field, enter Department and select Release Version
adf12.2.1. (if it already not selected)
f) Click OK. Save All.
5) IDE generates a separate project RESTWebService for REST Web Service and a REST
Resource file under AppModuleAM to configure custom methods, view objects and
attributes etc.

BAT

bat
bat

bat
bat

Also REST Resource file AppModuleAM_DepartmentsVOResources.xml file opens in


the editor.
419/454
ADF Essentials Training by Deepak Bhagat
6) Ensure that REST Resource file has Create, Delete and Update options checked.
7) Right-click the RESTWebService project and select Run.
8) While running observe URL in log window, click the URL.

BAT
BAT

BAT

BAT

HTTP Analyzer tool opens in the editor.

420/454
ADF Essentials Training by Deepak Bhagat
BAT

BAT

a) In the URL field, enter http://127.0.0.1:7101/BATCreateRESTWS_Eg-


RESTWebService-context-root/rest/adf12.2.1/Department.
b) In the Method field, select GET from the drop-down.
c) Optionally, add department id (for example: 10) in the textbox to filter records.
d) Change content type to application/vnd.oracle.adf.resourceitem+json.
e) Click Send Request.
f) It displays the Departments records under given id (10).
9) Similarly, verify remaining methods such as POST, PUT, PATCH, DELETE.

421/454
ADF Essentials Training by Deepak Bhagat
29.2 Creating SOAP Web Service with ADF Business Service

Create SOAP web service with ADF business service.

1) Create the ADF Fusion Web Application named BATCreateSOAPWS_Eg with


DepartmentsEO, DepartmentsVO and AppModuleAM in the package bat.
2) Create the AppModuleAMImpl.java and add getDeptName() method.
public String getDeptName(Integer deptId) {
String deptName = "Department not found";
ViewObject deptVo = getDepartment1();
Row[] filteredRows = deptVo.getFilteredRows("DepartmentId",
deptId);
if (filteredRows.length > 0) {
deptName =
filteredRows[0].getAttribute("DepartmentName").toString();
}
return deptName;
}
3) Open the AppModuleAM.
a) Click the Web Service page.
b) Ensure the SOAP tab is selected.
c) Click icon.
Create Service Interface wizard appears.

bat

a) In the Web Service field, enter SOAPWebService and Target Namespace.


b) Click Next. Skip Service Built-in Methods. Click Next.
c) On the Service Custom Methods page of the wizard, expose custom method
getDeptName(). Click Next.

422/454
ADF Essentials Training by Deepak Bhagat
d) On the Service View Instances page of the wizard, expose view object
Departments1 and enable operations on Department view object (such as Create,
Update, Delete….). Click Finish. Save All.

4) Run the …\serviceinterface\SOAPWebServiceImpl.java (not


AppModuleAMImpl.java).

423/454
ADF Essentials Training by Deepak Bhagat
bat

bat

bat

bat

5) Observe the URL in message log window, click the URL.


HTTP Analyzer tool opens in the editor.
6) Select various operation and custom methods and verify the results.

424/454
ADF Essentials Training by Deepak Bhagat
29.3 Consuming REST Web Service (ADF)

Consume REST Web Service.

1) Create the ADF Fusion Web Application named BATConsumeRESTWSADF_Eg in the package
bat.
2) Right-click the Model project > New > select From Gallery.
New Gallery wizard appears.

3) Expand the Business Tier > select Data Controls (in Categories section at left-side) >
Web Service Data Control (SOAP/REST) (in Items section at right-side). Click OK.
Create Web Service Data Control wizard appears.

a) In the Name field, enter HRSystemRESTWSADF.


b) Select the REST radio button.
c) Ensure the Describe-Based ADF Data Control is selected.
i) In the ADF REST Connection field, click next to the drop-down.
Create REST Connection window appears.
425/454
ADF Essentials Training by Deepak Bhagat
ii) Ensure the Create Connections In is selected as Application Resources.
iii) In the Name field, enter ADF-REST-WS-Conn and in URL Endpoint field,
enter http://127.0.0.1:7101/BATCreateRESTWSExample-RESTWebService-
context-root/rest/adf12.2.1/describe. Click OK.
d) Click Next. Click Next.
e) On the Select Resources page of the wizard, add Department Resource. Click
Finish.
f) DataControl will be created.
4) Create a JSF page named Index.jsf.
5) Drag and drop Department to the page, select ADF Table.
Create Table window appears.
6) Select the single Row, check Enable Sorting and Enable Filtering check boxes.
7) Drag and drop Commit operation > select Button, change its Text to Save Changes.
8) Save All.
9) Run the application BATCreateRESTWS_Eg.
10) Run the page Index.jsf in this application and verify.

426/454
ADF Essentials Training by Deepak Bhagat
29.4 Consuming REST Web Service (Generic)

Consume REST Web Service.

1) Execute a GET request on browser:


2) http://maps.googleapis.com/maps/api/geocode/json?address=”10 Downing Street".
3) Create the ADF Fusion Web Application named BATConsumeRESTWSGeneric_Eg, with
Model and ViewController projects in bat package.
4) Select ViewController project. Open New Gallery > Web Service Data Control (SOAP/REST).
5) Enter Name as HRSystemRESTWSGeneric. Select REST > Generic Data Control with
manually described resources option.
6) Generic REST Connection. Select Create Connections in Application Resources, give
name REST-WS-Generic-Conn and URI Endpoint as
http://maps.googleapis.com/maps/api/geocode.
7) Skip OWSM Policies tab. On resources tab, choose Data Format as JSON, click green plus
to add Resource Path.
8) Rename Resource Path /path0 to /json and select GET method and give it a name: get.
Click Next.
9) In Method Details, select get and choose Parse from Example Code.
10) Paste response from step 1 into Response Example box. To URL Parameters add
address.
11) Test REST Connection (Ignore Error). Click Finish. Data Controls is created.
12) Create JSF page Index.jsf.
13) Drag and drop get method from data controls onto page. Choose ADF Parameter Form.
Give input field label Address.
14) Drag and drop address_components from data controls onto page. Choose ADF Table
(read-only).
15) Set PartialTriggers property on table to Button.
16) Run page. This may not work.
17) Reading data from response programmatically: .
18) Drag and drop Input Text component onto page. For value property, invoke Expression
Builder, and create a managed bean. Call this bean geocodeBean and give it view scope.
19) Create property for postal code and set this property on value of our input field. add Button
to PartialTriggers property.
20) Change get button’s action listener property to new managed bean’s findPostalCode()
method.
21) Add code to findPostalCode() method.
public void findPostalCode(ActionEvent actionEvent) {
BindingContext bindingContext = BindingContext.getCurrent();
BindingContainer bindings =
bindingContext.getCurrentBindingsEntry();
OperationBinding operationBinding =
bindings.getOperationBinding("get");
operationBinding.execute();

427/454
ADF Essentials Training by Deepak Bhagat
DCIteratorBinding addressComponentsIterator =
((DCBindingContainer)
bindings).findIteratorBinding("address_componentsIterator");
addressComponentsIterator.setRangeSize(-1);
Row[] rows = addressComponentsIterator.getAllRowsInRange();
if (rows != null) {
Optional<String> postalCode = Arrays.stream(rows)
.map(e -> (DCDataRow) e)
.map(e -> (Map) e.getDataProvider())
.filter(map -> ((List)
map.get("types")).contains("postal_code"))
.map(e -> (String) e.get("long_name"))
.map(e -> {return (e == null ? "Nothing found" :
e);}) .findFirst()
;
postalCode.ifPresent(this::setPostalCode);
}
}
22) Comment out table with address components.
23) Run page.

428/454
ADF Essentials Training by Deepak Bhagat
29.5 Consuming SOAP Web Service

Consume SOAP Web Service.

1) Create the ADF Fusion Web Application named BATConsumeSOAPWS_Eg in the package bat.
2) Right-click the Model project > New > select From Gallery.
New Gallery wizard appears.

3) Expand the Business Tier > select Data Controls (in Categories section at left-side) >
Web Service Data Control (SOAP/REST) (in Items section at right-side). Click OK.
Create Web Service Data Control wizard appears.

4) In the Name field, enter CountryWS.


5) Ensure the SOAP radio button is selected.

429/454
ADF Essentials Training by Deepak Bhagat
6) In the URL field, enter http://www.webservicex.net/country.asmx?WSDL.
7) Very Important: uncheck the Copy WSDL Locally. Click Next.
8) Shuttle the GetCountries, GetCurrencyByCountry from CountrySoap to Selected pane.
Click Finish.
9) Create the page named Index.jsf.
10) Drag and drop GetCountries to the page > select Button.
11) Drag the String > select Output Text Formatted and assign Partial Trigger to button
b1.
12) Optionally, color the output text, wrap in Panel Form and add a Separator.
13) Drag and drop GetCurrencyByCountry to the page > select ADF Parameter Form.
14) Drop the String > select Output Text Formatted and assign Partial Trigger to button
b2.
15) Run the Index.jsf.
16) Click the GetCountries button. Enter a country name example Japan and click
GetCurrencyByCountry button.

430/454
ADF Essentials Training by Deepak Bhagat
29.6 Advance ADF Extended Examples -x

These advance ADF topics may be found as independent extended examples under
…\BATHandouts\BATXtEg-Proprietary\L29-BATXtEg-Integrating-WebService.
For hands-on practice, please refer to Deepak Bhagat’s Blog at
https://cloudadfdeepakb.blogspot.com or download from the above location.

431/454
ADF Essentials Training by Deepak Bhagat
29.7 More Examples on ADF Integration with Web Services -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L29-ADFXtEg-Integrating-WebService\.
These examples demonstrate ADF Integration with Web Services.

432/454
ADF Essentials Training by Deepak Bhagat
30
Integrating ADF with
Enterprise Java Bean
(EJB)

433/454
ADF Essentials Training by Deepak Bhagat
30.1 Consuming EJB Data Control

Consume EJB Data Control.

1) Create Custom Application named BATConsumeEJBDC_Eg in bat with project EJBService


in bat.ejbservice. Click Finish.
2) Right-click the EJBService project > New > select Create Entity Objects from Tables.
Create Entity Objects from Tables wizard appears.
3) Click the Query and select Departments, Employees tables in
bat.ejbservice.entities package.
4) Right-click the EJBService project > New > select Session Bean.
5) Create the SessionEJB session EJB. Ensure that all methods of Departments and
Employees are exposed.
6) Expand the Data Controls and observe that there are none.
7) Open the Employees.java and add following Named Queries.
@NamedQueries({
@NamedQuery(name = "Employees.findAll", query = "select o from
Employees o"),
@NamedQuery(name = "Employees.findByEmail", query = "select o from
Employees o where o.email like :p_email")
})
8) Right-click the SessionEJBBean.java, select Edit Session Façade. Check
getEmployeesFindByEmail(). Click OK.
9) Right-click the SessionEJBBean.java, select Create Data Control.
10) Click Next. Click Finish.
11) Verify the Data Control, SessionEJBBean is created.
12) Click the New menu > Project > ADF ViewController Project.
13) Create new ViewController project in bat.ui.
14) Create the page named Index.jsf.
15) Add the Panel Stretch Layout and Panel Group Layout layouts to the page.
16) Expand the Data Controls > EmployeeFindByEmail > Operations.
17) Drag the ExecuteWithParams to the page and select ADF Parameter Form from the
context menu.
18) Select the Output Text, in the Properties window, in Label property, enter Email:. Select
Button, in Text property, enter Search.
19) Drag the employeesFindByEmail to the page (under Panel Group Layout), select ADF
Form from the context menu.
20) Run the Index.jsf and test EJB data control.

434/454
ADF Essentials Training by Deepak Bhagat
30.2 Advance ADF Extended Example -x

This advance ADF topics may be found as independent extended example under
…\BATHandouts\BATXtEg-Proprietary\L30-BATXtEg-Integrating-EJB. For hands-
on practice, please refer to Deepak Bhagat’s Blog at https://cloudadfdeepakb.blogspot.com or
download from the above location.

435/454
ADF Essentials Training by Deepak Bhagat
30.3 More Examples on Consuming EJB Data Control -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L30-ADFXtEg-Integrating-EJB\.
These examples demonstrate Consuming EJB Data Control.

436/454
ADF Essentials Training by Deepak Bhagat
31
Integrating ADF with
Service Orientated Architecture
(SOA)

437/454
ADF Essentials Training by Deepak Bhagat
31.1 Integrating SOA

Integrate with SOA.

1) Create the ADF Fusion Web Application named BATSOAIntg_Eg with DepartmentsEO,
DepartmentsVO & AppModuleAM in package bat.
2) In the AppModuleAMImpl.java, add getDeptName() method .
public String getDeptName(Integer deptId) {
String deptName = "Department not found";
ViewObject deptVo = getDepartments1();
Row[] filteredRows = deptVo.getFilteredRows("DepartmentId",
deptId);
if (filteredRows.length > 0) {
deptName =
filteredRows[0].getAttribute("DepartmentName").toString();
}
return deptName;
}
3) Open the AppModuleAM in the editor.
4) Click the Web Service page.
5) Ensure SOAP tab is selected. Click icon.
a) In the Name field, enter SOAModuleService.
b) Skip built in methods and expose custom method getDeptName(). Expose view
object Department and enable operations on Department view object.
6) Right-click the Model project > select Project Properties.
a) In the Project Properties window, select Deployment from list. Click the New
Profile icon.
b) In the Create Deployment Profile wizard, in Profile Type field select Business
Components Service Interface and in Deployment Profile Name enter
BATSOABusinessService.
c) Click OK and again click OK.
7) Run the server.
a) Click the Run menu > select Start Server Instance
(IntegratedWebLogicServer).
8) Click the Application menu > Deploy > select Model_BATSOABusinessSevice.
9) Select Deploy to Application Server, click Next and click Finish.
10) Observe in Deployment-Log window, statement “Deployment finished”. Alternatively,
deployment can be done from WLS console.
11) Open the WebLogic Sever Administration Console (http://127.0.0.1:7101/console), login
with Username: weblogic and Password: weblogic1.
12) Go to Deployments, select Model_BATSOABusinessSevice > Testing tab.
13) Expand the BATSOAIntg_Eg-Model-context-root and copy URL and paste it in a new
browser and append service name SOAModuleService, press Enter. Web Service Test
Client page opens.

438/454
ADF Essentials Training by Deepak Bhagat
14) Perform tests on methods and operations getDeptName, create, update, delete,
find.

439/454
ADF Essentials Training by Deepak Bhagat
31.2 Advance ADF Extended Example -x

This advance ADF topics may be found as independent extended example under
…\BATHandouts\BATXtEg-Proprietary\L31-BATXtEg-Integrating-SOA. For hands-
on practice, please refer to Deepak Bhagat’s Blog at https://cloudadfdeepakb.blogspot.com or
download from the above location.

440/454
ADF Essentials Training by Deepak Bhagat
31.3 More Examples on Integrating Oracle SOA with ADF -d

This topic is part of the Advance ADF extended example, taken from the web. For optional self-
paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L31-ADFXtEg-Integrating-SOA\.
These examples demonstrate ADF integration with Service Oriented Architecture (SOA).

441/454
ADF Essentials Training by Deepak Bhagat
32
Integrating ADF with
Mobile Application Framework
(MAF)

442/454
ADF Essentials Training by Deepak Bhagat
32.1 Mobile Application Framework (MAF)

Create mobile app.

A. Download MAF 2.4.0 Extension and add it to JDeveloper 12.2.1.0.0:


1 Download MAF 2.4.0 extension from the above given second link.
2 In JDeveloper, click on Help > Check for Updates.
3 In Check for Updates wizard, check Install From Local File check box on Source page.
Click on Browse button and select the extension file in zip format.

4 Click on Next button. Click on I Agree button on License Agreements page, click on Next
button. Click on Finish.

443/454
ADF Essentials Training by Deepak Bhagat
B. Download and Install Android Studio:
1. Download Android Studio from https://developer.android.com/studio/index.html.

5 Run the android-studio-ide-171.4443003-windows.exe to install the Android


Studio. In the process of installing you can select where the files for the SDK should
be placed. Below is what was used for this sample. (At the time of writing this
example, this was the name of the file. It may differ at later dates.)
6 Open Android Studio. Click on Tools menu > Android > SDK Manger.

7 Select Android 5.1 Lollipop in SDK Platforms page. (Uncheck defaults) Click on OK.
8 Click on SDK Tools tab. Make sure Android SDK Build-Tools, Android SDK Platform-Tools,
Android SDK Tools, Intel x86 Emulator Accelerator (A=HAXM Installer), Android Support
Repository, Google Repository packages were installed.

444/454
ADF Essentials Training by Deepak Bhagat
445/454
ADF Essentials Training by Deepak Bhagat
C. Setting Preferences in JDev and in (Android Virtual Device) AVD Manager:
1. Open JDeveloper. Click on Tools > Preferences. On the left side of the Preferences screen,
click and expand the Mobile Application Framework node. If you are using the Mobile
Application Framework extension for the first time, you may need to click the Load Extension
button.

9 Select required platform. (Android Low is recommended).


10 Select Android Platform from the list.

446/454
ADF Essentials Training by Deepak Bhagat
11 Update all entries with the correct directory locations and click on OK button.
12 Re-open the Android Studio. Click on Tools > Android > AVD Manager.

13 Click on Create Virtual Device button at the bottom in Your Virtual Devices page.

447/454
ADF Essentials Training by Deepak Bhagat
14 Click on New Hardware Profile button at the bottom in Select Hardware page.

448/454
ADF Essentials Training by Deepak Bhagat
15 Specify the above values to the properties. Click on Finish.
16 Click on Next button in Select Hardware page.

449/454
ADF Essentials Training by Deepak Bhagat
17 Download required OS in System Image page. (select Lollipop for this sample)
18 Click on Next and click on Finish.
19 Click on Run ( ) icon in Your Virtual Devices page. (It may take a few minutes for the
emulator to be invoked and start running. Once it's running, you may continue and test your
mobile deployment.)

450/454
ADF Essentials Training by Deepak Bhagat
20 Open the command prompt and run the following commands to check status of Emulator.

While the emulator is starting it shows the status as ‘unauthorized’.


Once the emulator has started it shows the status as ‘device’.

1) Create the new application named BATMoblie_Eg with package bat.


2) Create the HTML page named Index.html.
3) Type the following text “Deployment Successful” in Index page editor.
4) In the Properties window, expand Style node and in Font Size field, enter xx-large.
5) Expand the VeiwController > Application Sources > META-INF and double-click the
maf.feature.xml.
6) In the Features table, click icon to add the new feature.

451/454
ADF Essentials Training by Deepak Bhagat
7) In the Create MAF Feature window, in the Feature Name field, enter Success, in the
Feature ID field, enter bat.Sucess.
8) In the Features table, select newly created feature bat.Success. Under Features table,
click Content tab, and locate Content table.
9) Notice the content item bat.Success.1 is created by default.
10) In the Content area, in the Type field, enter Local HTML.
11) In the Content section, find URL text box. On right side of URL text box, select Index.html
from system by clicking magnifying glass icon.
12) Confirm your emulator is still running. At bottom of emulator.
13) Click the Applications icon and all installed applications will be visible. Keep emulator open
and return to JDeveloper.
14) Create the New Deployment Profile.
15) In the Create Deployment Profile window, in Profile Type field, select MAF for Android
from drop-down and in Deployment Profile Name field, enter Android2.
16) Click the Application menu > Deploy > select Android 2 from context-menu.
17) In the Deploy window, select Deploy application to emulator and click Finish.
18) Observe the Deployment Log window. If compilation and deployment process complete
as expected, you should see Deployment Log window with Success.
19) Navigate back to Emulator. You should see BATMAF_Eg application you just created and
deployed.
20) Click the BATMAF_Eg icon to start application.
21) BATMAF_Eg application currently contains your HTML page running inside MAF application.
Here you can see text Deployment Successful.
22) If you are finished. Close emulator, but remember to restart it before you want to deploy
to it again.

452/454
ADF Essentials Training by Deepak Bhagat
32.2 Advance ADF Extended Example -x

This advance ADF topics may be found as independent extended example under
…\BATHandouts\BATXtEg-Proprietary\L32-BATXtEg-Integrating-MAF. For hands-
on practice, please refer to Deepak Bhagat’s Blog at https://cloudadfdeepakb.blogspot.com or
download from the above location.

453/454
ADF Essentials Training by Deepak Bhagat
32.3 More Examples on Integrating Oracle MAF with ADF -d

This topic is part of the Advance Oracle ADF extended example, taken from the web. For optional
self-paced hands-on practice, it may be further downloaded from
…\BATHandouts\OADFXtEg-Downloaded\L32-ADFXtEg-Integrating-MAF\.
These examples demonstrate ADF integration with Oracle Mobile Application Framework (MAF).

454/454
ADF Essentials Training by Deepak Bhagat

You might also like