Documente Academic
Documente Profesional
Documente Cultură
D53979GC11
Edition 1.1
May 2009
D60501
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Authors
Pam Gamer
Gary Williams
Disclaimer
Glenn Maslen
Ken Cooper
Joe Huang
Taj-ul Islam
Duncan Mills
Kenichi Mizuta
Frank Nimphius
Dan Pillay
Blaise Ribet
Oliver Steinmeier
Editors
Steve Elwood
Jothi Lakshmi
Raj Kumar
Aju Kumar
Publisher
Jayanthy Keshavamurthy
This course in any form, including its course labs and printed matter, contains
proprietary information that is the exclusive property of Oracle. This course and the
information contained herein may not be disclosed, copied, reproduced, or distributed
to anyone outside Oracle without prior written consent of Oracle. This course and its
contents are not part of your license agreement nor can they be incorporated into any
contractual agreement with Oracle or its subsidiaries or affiliates.
This course is for informational purposes only and is intended solely to assist you in
planning for the implementation and upgrade of the product features described. It is
not a commitment to deliver any material, code, or functionality, and should not be
relied upon in making purchasing decisions. The development, release, and timing of
any features or functionality described in this document remain at the sole discretion
of Oracle.
This document contains proprietary information and is protected by copyright and
other intellectual property laws. You may copy and print this document solely for your
own use in an Oracle training course. The document may not be modified or altered in
any way. Except where your use constitutes "fair use" under copyright law, you may
not use, share, download, upload, copy, print, display, perform, reproduce, publish,
license, post, transmit, or distribute this document in whole or in part without the
express authorization of Oracle.
The information contained in this document is subject to change without notice. If you
find any problems in the document, please report them in writing to: Oracle University,
500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
warranted to be error-free.
Restricted Rights Notice
If this documentation is delivered to the United States Government or anyone using
the documentation on behalf of the United States Government, the following notice is
applicable:
U.S. GOVERNMENT RIGHTS
The U.S. Governments rights to use, modify, reproduce, release, perform, display, or
disclose these training materials are restricted by the terms of the applicable Oracle
license agreement and/or the applicable U.S. Government contract.
Trademark Notice
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other
names may be trademarks of their respective owners.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Technical Contributors
and Reviewers
Contents
iii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Preface
iv
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Exposing Data
Objectives 5-2
Oracle ADF Application Module (AM) 5-3
Characteristics of an Application Module 5-4
Creating an Application Module 5-5
Defining the Data Model for the Application Module 5-6
Using MasterDetail View Objects in Application Modules 5-7
Determining the Size of an Application Module 5-8
Business Components Transactions 5-9
Using Nested Application Modules 5-11
Application Module Pooling 5-12
Managing Application State 5-13
The Role of ADF Model 5-14
Describing the Course Application: Database Objects 5-15
Describing the Course Application: View Objects 5-16
Describing the Course Application: Data Controls 5-18
v
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
vi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Summary 5-19
Practice 5 Overview: Defining Application Modules 5-20
vii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
viii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Summary 7-50
Practice 7 Overview: Programmatically Modifying Business Components 7-51
ix
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Summary 8-39
Practice 8 Overview: Implementing Validation 8-40
10 Understanding UI Technologies
Objectives 10-2
Enabling the World Wide Web with HTML and HTTP 10-3
Describing the Java Programming Language 10-4
Using Java as a Language for Web Development 10-6
What Are Servlets? 10-8
What Are JavaServer Pages (JSP)? 10-9
What Are JavaBeans? 10-10
What Is JavaServer Faces (JSF)? 10-11
JSF Key Concepts 10-13
JSF Component Model 10-14
JSF Multiple Renderers 10-15
Traditional Navigation 10-16
Defining Navigation by Using the JSF Controller 10-17
JSF Navigation: Example 10-18
Using JSF Components 10-19
Using JSF Managed Beans 10-20
Overview of JSF Page Life Cycle 10-21
Formal Phases of the JSF Life Cycle 10-22
Key Characteristics of Rich User Interfaces 10-24
Adding to JSF with ADF Faces 10-25
Using the ADF Controller 10-26
ADF Life Cycle Phases 10-27
Summary 10-28
11 Binding UI Components to Data
Objectives 11-2
Creating a JSF Page 11-3
Adding UI Components to the Page 11-5
Using the Component Palette 11-6
Using the Context Menu 11-7
x
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xiii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
16 Ensuring Reusability
Objectives 16-2
Benefits of Reusability 16-3
Designing for Reuse 16-4
Using a Resource Catalog 16-5
Creating a Resource Catalog 16-6
Reusing Components 16-7
Creating an ADF Library 16-8
Adding an ADF Library to a Project by Using the Resource Palette 16-9
Removing an ADF Library from a Project 16-10
Restricting BC Visibility in Libraries 16-11
Types of Reusable Components 16-12
Using Task Flow Templates 16-13
xiv
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
18-33
18-34
18-35
18-36
18-37
18-38
18-39
xvi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xvii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Using the Contextual Event Framework to Coordinate Page Regions: Step 8 18-40
Using the Contextual Event Framework to Coordinate Page Regions: Step 9 18-41
Summary 18-42
Practice 18 Overview: Responding to Events 18-43
xviii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xix
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Preface
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Profile
Before You Begin This Course
Before you begin this course, you should have:
Preface - 3
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Related Publications
Oracle Publications
Title
Part Number
B31974-01
B31973-01
Preface - 4
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Typographic Conventions
The following two lists explain Oracle University typographical conventions for
words that appear within regular text or within code samples.
Convention
Object or Term
Example
Courier New
User input;
commands;
column, table, and
schema names;
functions;
PL/SQL objects;
paths
Initial cap
Triggers;
Assign a When-Validate-Item trigger to
user interface object the ORD block.
names, such as
button names
Click the Cancel button.
Italic
Titles of
courses and
manuals;
emphasized
words or phrases;
placeholders or
variables
Lesson or module
titles referenced
within a course
Quotation marks
Preface - 5
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Convention
Object or Term
Example
Uppercase
Commands,
functions
SELECT employee_id
FROM employees;
Lowercase,
italic
Syntax variables
Initial cap
Forms triggers
Lowercase
Column names,
table names,
filenames,
PL/SQL objects
. . .
OG_ACTIVATE_LAYER
(OG_GET_LAYER ('prod_pie_layer'))
. . .
SELECT last_name
FROM
employees;
Bold
Preface - 6
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Lesson Aim
When designing an application to interact with the database, an understanding of the database
schema is essential, along with the ability to modify the schema as needed. This lesson shows
you how to use JDeveloper tools to define a model of a database schema and to use the model to
modify the schema.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Objectives
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Diagrammer:
Create and modify objects by dragging from Component
Palette and Database Navigator.
Import objects from offline database model.
Generate changes to online schemas.
Copyright 2009, Oracle. All rights reserved.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Select objects.
Specify operation.
Set database options.
Set SQL script options.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Summary
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Practice Overview:
Modeling the Schema for the Course Application
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Lesson Aim
This lesson teaches you how to deploy an ADF BC application by using JDeveloper or by using
the WebLogic Server console. You also learn how to use Ant to automate the deployment
process.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Objectives
Deployment tasks:
Prepare application or project for deployment.
Prepare Oracle WebLogic Server (WLS) for ADF
deployment.
Deploy the application with one of the following
techniques:
Deploy directly from JDeveloper to WLS.
Deploy to an EAR file and use application server tool for
deploying to the application server.
Use a script to deploy.
Deployment tasks:
Prepare application or project for deployment.
Prepare Oracle WebLogic Server (WLS) for ADF
deployment.
Deploy the application with one of the following
techniques:
Deploy directly from JDeveloper to WLS.
Deploy to an EAR file and use application server tool for
deploying to the application server.
Use a script to deploy.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Deployment descriptors
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Creating an application
deployment profile
For the
View-Controller
project
Deployment profiles:
Specify how application is packaged for deployment
Can be application level or project level
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2
4
Context root becomes part of URL
to access the Web application.
Copyright 2009, Oracle. All rights reserved.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Deployment tasks:
Prepare application or project for deployment.
Prepare Oracle WebLogic Server (WLS) for ADF
deployment.
Deploy the application with one of the following
techniques:
Deploy directly from JDeveloper to WLS.
Deploy to an EAR file and use application server tool for
deploying to the application server.
Use a script to deploy.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
OR
Configure an existing
domain for ADF
Copyright 2009, Oracle. All rights reserved.
You can now start the Oracle WebLogic Server by running the command-line script
<ORACLE_HOME>\user_projects\domains\domain_name\bin\startWebLogi
c.cmd and stop the server using the stopWebLogic.cmd script in the same directory.
Access the Oracle WebLogic Server Administration Console by using the URL
http://localhost:7001/console.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2
4
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Name
JNDI Name
Database Type
Oracle
Database Driver
Host Name
Port
Database User
Username and password of the schema in your JDev
Name and Password connection, such as fod / fusion
-
On the Test Database Connection page of the wizard, review the values and click
Test Configuration, which should return a message Connection test succeeded.
Click Next (do not click Finish until you complete the next page.)
- On the Select Targets page of the wizard, select the DefaultServer check box and
click Finish.
4. So that the configuration takes effect, stop and then restart the WLS Server instance by
using the Start menu (or JDeveloper if stopping the integrated server).
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Connection Type
JDBC DataSource
Datasource Name
On the Properties tab, set jbo.locking.mode to optimistic, the preferred locking mode
for Web applications.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Deployment tasks:
Prepare application or project for deployment.
Prepare Oracle WebLogic Server (WLS) for ADF
deployment.
Deploy the application with one of the following
techniques:
Deploy directly from JDeveloper to WLS.
Deploy to an EAR file and use application server tool for
deploying to the application server.
Use a script to deploy.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Creating a Connection to an
Application Server
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3. Select a deployment
profile.
4. Select to deploy to an
EAR file, an existing
connection, or a new
connection.
3
4
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Deployment tasks:
Prepare application or project for deployment.
Prepare Oracle WebLogic Server (WLS) for ADF
deployment.
Deploy the application with one of the following
techniques:
Deploy directly from JDeveloper to WLS.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Deployment tasks:
Prepare application or project for deployment.
Prepare Oracle WebLogic Server (WLS) for ADF
deployment.
Deploy the application with one of the following
techniques:
Deploy directly from JDeveloper to WLS.
Deploy to an EAR file and use application server tool for
deploying to the application server.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Advantages of Ant:
Well-documented
Widely adopted
Easy to configure
Extensible
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
<delete>: Deletes a single file, a specified directory and all its files and subdirectories,
or a set of files specified by one or more FileSets
<java>: Executes a Java class within the running (Ant) VM or forks another VM if
specified
The following core Ant tasks are useful for remote deployment:
<ftp>: Implements a basic FTP client that can send, receive, list, and delete files, and
create directories
Adding a target:
Adding a task:
1
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Running
on a target
Running on
a project
Running Ant from the toolbar
Copyright 2009, Oracle. All rights reserved.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
the existing data store, and can also merge application-level security policies with domainlevel policies. Refer the JDeveloper online Help.
For the most common use cases (migrating an applications credentials in cwallet.sso
or the security policies in jazn-data.xml to the WLS domains cwallet.sso or
system-jazn-data.xml file), you can use a simplified method that uses an Ant
script.
(http://www.oracle.com/technology/products/jdev/tips/muench/credmig111100/index.htm)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Summary
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Practice Overview:
Deploying the Web Application
Appendix C
Practices and Solutions
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Table of Contents
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the practices for this lesson, you start JDeveloper, set preferences for the IDE, and
create a JDeveloper application, project, and database connection. You then view the
course application in a browser and identify the functionality of the pages.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
to start JDeveloper.
b) In the Select Role dialog box, select the Default Role option and click OK.
d) JDeveloper starts by displaying the Tip of the Day. Deselect the Show tips at
startup check box and then click Close.
e) Close the Start page by clicking the X on the right of its tab (the X is not visible
until you position the cursor over the tab.)
2) Set global naming preferences for your ADF BC objects. Entity objects, view objects,
and application modules should by default have the suffixes EO, VO, and AM,
respectively, and should be created in the entity, uiview, and module packages,
respectively.
a) From the JDeveloper menu, select Tools > Preferences > Business Components
> Object Naming.
b) In the dialog box, set suffixes as follows:
Entity
EO
View Object
VO
Application Module
AM
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
entity
View Object
uiview
Application Module
module
d) Click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Select Packages in the list at the left and set the following values:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Project Properties dialog box, select Business Components from the tree at
the left.
c) In the Business Components panel, select the Initialize Project for Business
Components check box.
d) Click Create a new database connection
field.
FOD
Connection Type
Oracle (JDBC)
Username
Password
fusion
Deploy Password
ii) In the lower half of the page, Oracle (JDBC) Settings, leave the Driver field at
its default, thin, and enter the Host Name, JDBC Port, and SID as given to
you by the instructor if using a shared database, or localhost, 1521, and XE
if using a local XE database.
iii) Click Test Connection. You should see that the Status box displays the word
Success!.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Click OK to dismiss the Create Database Connection dialog box and return to the
Business Components page of the Project Properties dialog box.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
g) Click OK to set the project properties and dismiss the Project Properties dialog
box.
b) When you select to open a new application, a file dialog box enables you to
navigate to the directory where the application resides:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) If there is no open application currently, you can click the Open Application link
in the Application Navigator
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) A list of Music products appears in the right panel. Notice that there are
breadcrumbs along the top of the table that enable you to navigate to the Media
subcategory, or to the main-level list of categories if you click Store. For now,
click the name of one of the products.
c) Details about the selected product are shown. Buttons enable you to add the item
to your cart, to search for products, or to return to the shopping page. For now,
click Search.
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 15
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Click the Playstation Portable link to display details about this product.
f) Click Add Item to Cart to add the Playstation Portable to the shopping cart and
display the cart.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) On the Search page, enter Pla in the ProductName field and click Search. A list
of products beginning with Pla is returned.
h) With the Playstation Portable selected, click Delete to remove it from your cart.
i) Click Details to display details about the selected product in a separate pop-up
window.
j) Click OK to dismiss the pop-up window, and then click Checkout to begin the
checkout process.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
g) The shopping cart is displayed. It is populated with the shopping cart items of a
default user, and the Playstation Portable has been added. Resize the right panel
of the page so that the line total is visible, and then change the quantity of the
Playstation Portable to 2. Click Update to show the updated line total.
l) The second page of the checkout process displays billing information. Navigate to
the next page either by clicking Next or by clicking the Confirmation train stop
at the top of the panel.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
k) The first page of the checkout process displays shipping information. Navigate to
the next page either by clicking Next or by clicking the Billing train stop at the
top of the panel.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Note: The Submit button does not actually do anything except perform
navigation, but in a complete application it could fire off some additional services,
such as creating an order in the database, sending information about the order to
the shipping department and the billing department, and sending an email
confirmation to the customer. This functionality is outside the scope of the course
application.
d) The new row appears at the top of the list, with a supplier ID that is automatically
assigned. Click Delete to delete the supplier.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) The New Supplier page initially displays an error because the required field is
blank. Ignoring that error, enter any supplier name and select a supplier status
from the drop-down list, then click Save.
j) The application is undeployed when the log window displays the message:
[Application Storefront-CompletedApp stopped and
undeployed from Server Instance DefaultServer].
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, you can continue
working in the same project. However, if you prefer to start with a clean application that
contains everything completed up to the start of this lesson, then you need to open
Storefront-03.jws, and edit the database information as described in step 4 of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you create a business model 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.
d) Click OK.
2) In the Create Business Components from Tables Wizard, create entity objects for the
ORDERS, ORDER_ITEMS, and PERSONS tables. Name them OrderEO,
OrderItemEO, and PersonEO.
a) On the Entity Objects page of the wizard, ensure that the schema from the
connection that you created previously is the selected schema.
b) Ensure that the package name is oracle.fod.storefront.entity.
c) Enter ORD into the Name Filter field. Click Query to see the available tables
(ORDERS and ORDER_ITEMS).
d) Click Add All
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Based on
ShoppingCartVO
OrderEO
ShoppingCartItemVO
OrderItemEO
a) On the Updatable View Objects page of the wizard, ensure that the package name
is oracle.fod.storefront.uiview.
d) Rename the OrderVO by selecting it in the Selected pane and changing the
Object Name to ShoppingCartVO. The reason for this is that you are creating a
model for a shopping application, where an order is represented as a customers
shopping cart.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Select ORDERS in the Selected pane and change the Entity Name to OrderEO
(instead of OrdersEO).
f) Click Next.
g) The next page is for creating read-only view objects. These are based on SQL
queries rather than on entity objects. For now, you will not create read-only VOs,
so click Next.
4) Continuing in the Create Business Components from Tables Wizard, create an
application module to provide access to your components. You will later create
application modules that are customized for your application, but you can use a
default application module for testing your components. Create an application module
named TestAM in the oracle.fod.storefront.test package.
a) On the Application Module page of the wizard, ensure that the Application
Module check box is selected.
b) To separate this test application module from those that you customize for the
Storefront application, change the package name to
oracle.fod.storefront.test.
c) Change the application module name to TestAM.
d) Click Next.
5) Complete the wizard to finish creating the business components. Do not create a
business components diagram.
a) On the Diagram page of the wizard, ensure that the Business Components
Diagram check box is not selected.
b) Click Next.
c) The last page of the wizard shows the components that you have chosen to create.
It should show the following components to be created:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Click Finish to create the business components. This may take a few moments.
e) Click Save All to save your work.
f) The StorefrontModel project in the Applications Navigator should look like this:
Notice that the wizard created not only EOs, VOs, and an AM, but also two
associations and a view link based on the foreign key relationships that are
defined in the database.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Click the Source tab at the bottom of the editor to view and examine the XML
source.
2) Test the default components by running the application module in the Business
Component Browser.
a) In the Application Navigator, right-click the application module (TestAM) in the
oracle.fod.storefront.test package and select Run.
b) In the Select Business Components Configuration dialog box, note that the
Connection name is FOD (the connection information is disabled) and click
Connect.
c) The Business Component Browser may take a few minutes to appear, and it may
come up behind other windows. You can click its icon
on the taskbar to
display it. The Browser should initially look similar to this (the objects may be in
a different order):
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Each of the other panels (General, Validators, Java, and View Accessors) shows
different aspects of the OrderEO entity. Click and examine each panel.
e) In the top portion of the page, click Move to the next row
to navigate
through rows in the Orders view. Notice the order items change as you move to a
new order.
f) Open the other views and examine the contents as you choose.
g) When you are finished, close the Business Component Browser.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Now you begin to create components that are more customized for your application. First
you determine the LOVs that your application needs, and you create read-only view
objects to support those LOVs. Next you create entity objects for tables that the
application will update, and you also create updatable view objects based on these. You
also create and refactor associations and view links. For now, you place all of the view
objects and links in the TestAM application module so that you can test them; in the next
set of practices you create custom application modules that are designed for your
application.
If you successfully completed all sections of the previous practice, you can continue
working in the same project. However, if you prefer to start with a clean application that
contains everything completed up to the start of this lesson, then you need to open
Storefront-04.jws, and edit the database information as described in step 4 of
Practice 2-4.
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the last set of practices, you used the Create Business Components from Tables
Wizard to create multiple types of objects at once. You performed some limited
customization of components as enabled by the wizard, such as changing default names
and locations.
Because these read-only view objects are based on SQL queries, you do not need an
existing entity object on which to base them. You create them by using either of two
wizards:
Create View Object Wizard: Creates view objects individually; you must write
the query
Business Components from Tables Wizard: Creates multiple view objects at
once; you select the table for the query that is automatically generated
1) Create a single read-only view object to query the LOOKUP_CODES table, using a bind
variable for the LOOKUP_TYPE. Name the view object LookupCodeVVO. Create it in
the oracle.fod.storefront.view package. Put the view object in your TestAM
application module. Use the following query statement for the VO (you can copy the
code from LookupCodes.txt in the \files subdirectory of your \labs
directory for this course):
SELECT
LOOKUP_CODES.LOOKUP_TYPE LOOKUP_TYPE,
LOOKUP_CODES.LOOKUP_CODE LOOKUP_CODE,
LOOKUP_CODES.MEANING MEANING,
LOOKUP_CODES.DESCRIPTION DESCRIPTION,
LOOKUP_CODES.LANGUAGE LANGUAGE
FROM
LOOKUP_CODES
WHERE
LOOKUP_CODES.LANGUAGE = SYS_CONTEXT('USERENV', 'LANG')
AND LOOKUP_CODES.LOOKUP_TYPE = :BindLookupType
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Most of the view objects in your application are needed for updating information.
However, some view objects exist only to provide data for lists of values. In this practice,
you create read-only view objects to support LOVs.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
USAGE_TYPE_CODE
PRODUCT_STATUS_CODE
PERSON_TITLE_CODE
CARD_TYPE_CODE
MEMBERSHIP_TYPE_CODE
ORDER_STATUS_CODE
ID_TYPE_CODE
SUPPLIER_STATUS_CODE
f) When you have finished testing, close the Business Component Browser.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
VO
CountryVVO
COUNTRY_CODES
CustomerVVO
PERSONS
PaymentOptionVVO
PAYMENT_OPTIONS
ProductVVO
PRODUCTS
WarehouseVVO
WAREHOUSES
Note: Creating all of these view objects is optional. You can create them all if
you want to, but you may choose to create only the first two. If you create only a
subset of the objects, you will need to start the practices for the next lesson by
opening the starter application.
a) As you did in Practice 3-1, step (1), invoke the Create Business Components
from Tables Wizard.
b) Navigate to the Read-Only View Objects page of the wizard:
i) Set the package name to oracle.fod.storefront.view.
ii) Select your schema (FODxx) from the drop-down list.
iii) Use the Name Filter, or simply click Query, to find and select the tables and
views shown above and modify the name in each case as before (note the VVO
suffix.)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Create the following read-only view objects (note the VVO suffix) in the
oracle.fod.storefront.view package:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you create several database view-based entity objects and designate their
primary keys.
1) Create an entity object named ProductCategoryEO and base it on the
Product_Categories database view. Set the CategoryId to be its primary key.
a) To invoke the Entity Object Wizard, you could use the New Gallery. However,
there is an even easier way to invoke the wizards:
i) In the Application Navigator, expand the StorefrontModel project.
ii) Expand the Application Sources and oracle.fod.storefront nodes.
iii) Right-click the entity node and select New Entity Object.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This application has some EOs that are based on database views, and it is necessary to
designate a primary key for such EOs. You can do that with the Create Entity Object
Wizard.
2) Optional step (if you choose not to create these objects, you can begin the
practices for the next lesson by opening the starter application): In a similar
fashion, create the following entity objects that are based on database views:
EO
Primary Key
PersonInformationEO
PERSON_INFORMATION
CustomerId
ProductEO
PRODUCTS
ProductId
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Based on
AddressEO
ADDRESSES
AddressUsageEO
ADDRESS_USAGES
CountryEO
COUNTRY_CODES
LookupCodeEO
LOOKUP_CODES
PaymentOptionEO
PAYMENT_OPTIONS
SupplierEO
SUPPLIERS
WarehouseEO
WAREHOUSES
WarehouseStockLevelEO
WAREHOUSE_STOCK_LEVELS
Note: Creating all of these entity objects is optional. You can create them all if
you want to, but you may choose to create only the first two. If you create only a
subset of the objects, you will need to start the practices for the next lesson by
opening the starter application.
a) In the Application Navigator, right-click the oracle.fod.storefront.entity
package, and choose New Business Components from Tables.
b) In the Entity Objects page of the Business Components from Tables Wizard,
check that the package name is oracle.fod.storefront.entity and the
schema is FODxx. Click Query.
c) As you did in an earlier practice, Ctrl-click to select multiple tables for which to
create entity objects, and rename the entity objects, according to the table shown
above.
d) Click Finish to create the entity objects.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Name
Source
Destination
OrdersOrderItemsAssoc
OrderEO.OrderId
OrderItemEO.OrderId
ProductCategoriesProductsAssoc
ProductCategoryEO.
CategoryId
ProductEO.CategoryId
3) Optional step (if you choose not to create this association, you must begin the
practices for the next lesson by opening the starter application):
In a similar manner, create an association named OrderItemsProductsAssoc
between the ProductId fields of the OrderItemEO and ProductEO entity objects.
The application needs to access the product for a particular order item, but never
needs to access order items that pertain to a particular product, so expose accessors
only in the destination entity for this association (deselect the check box in the
Source Accessor section.)
4) Save your work. The entity package in the Application Navigator should now look
like this:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2) Optional step (if you choose not to create these associations, you must begin the
practices for the next lesson by opening the starter application):
In a similar manner, create the following additional associations, with accessors in
both source and destination (leave both check boxes selected):
ii) Click Test to ensure that the query is valid, and click OK to acknowledge the
message.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the application that you are building, the user interface displays categories and
subcategories. To accomplish this, the model requires two view objects: one that displays
the root categories (those without a parent category), and another that displays the
subcategories. A view link is also required to set up this masterdetail relationship.
2) The two view objects that you just created should be related by
ProductCategoriesSubProductCategoriesAssoc in a view link named
RootCategoriesSubCategoriesLink. Create this view link.
a) Right-click the oracle.fod.storefront.uiview package and select New
View Link.
b) On the Name page of the Create View Link Wizard, enter a name of
RootCategoriesSubCategoriesLink, and then click Next.
c) From the Select Source Attribute list, select oracle.fod.storefront.uiview >
RootCategoryVO > ProductCategoriesSubProductCategoriesAssoc.
d) From the Select Destination Attribute list, select oracle.fod.storefront.uiview >
SubCategoryVO > ProductCategoriesSubProductCategoriesAssoc.
e) Click Add.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Click Next several times until you reach the Application Module page. Select the
Application Module check box and browse to select the TestAM application
module in the oracle.fod.storefront.test package. Click Finish to create the view
link.
3) Optional step (if you choose not to create this object, you can begin the practices
for the next lesson by opening the starter application):
In a similar fashion, create one more updatable view object named SupplierVO in
the oracle.fod.storefront.uiview package. Base it on SupplierEO,
including all attributes. Do not include a WHERE clause. Add the view object to the
TestAM application module.
4) Save your work and then test the view objects and view link that you just created.
a) Run TestAM as before.
b) Check that the RootCategory1 view object instance displays the data you expect
(only those categories without a ParentCategoryId.)
c) Check that the SubCategory1 view object instance displays the data you expect
(only those categories with a ParentCategoryId.)
d) Test that the RootCategoriesSubCategoriesLink displays the masterdetail
relationship between root categories and subcategories, similar to the following:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Close the Business Component Browser when you have finished testing.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Move Business Components dialog box, enter the Package name of
oracle.fod.storefront.assoc and click OK.
d) Confirm that you would like to create the package by clicking Yes.
e) JDeveloper creates the assoc package and moves the associations into it. This
may take several minutes.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) Test the application module to ensure that all view links still function correctly.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the interest of time, you create only two of the five application modules that are
needed for the Storefront application, although you have the knowledge to create all five.
When you begin to develop the user interface, you will start with a completed model with
all the objects and application modules that you need.
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-05.jws, and edit the database information as
described in step 4 of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you take some of the view objects you have created and add them to
application modules. You create two application modules in this practice. The first
application module displays categories and subcategories. The second application module
is for displaying and managing a customers shopping cart.
b) On the Name page of the Create Application Module Wizard, ensure that the
package name is oracle.fod.storefront.module. Enter the name
FODCategoryAM and click Next.
c) On the Data Model page, expand oracle.fod.storefront.uiview and
RootCategoryVO.
d) Select RootCategoryVO and shuttle it to the Data Model.
e) With RootCategory1 selected in the Data Model panel, shuttle SubCategoryVO
via RootCategoriesSubCategoriesLink to the Data Model.
f) Click Finish to create the application module.
g) Save your work.
2) Test the application module and then close the Business Component Browser when
you have finished.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) On the Name page of the Create Application Module Wizard, enter the name
FODShoppingCartAM and click Next.
c) On the Data Model page, expand oracle.fod.storefront.uiview and
ShoppingCartVO.
d) Select ShoppingCartVO and shuttle it to the Data Model.
e) With ShoppingCart1 selected in the DataModel, shuttle ShoppingCartItemVO
via OrderItemsOrdersFkLink to the Data Model.
f) Click Finish to create the application module.
g) Save your work.
2) Test the application module and then close the Business Component Browser when
you have finished.
Note: At first, this application module shows all orders. In the practices for a later
lesson, you add code so that it displays the shopping cart (status CART order) for a
particular user.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, you can continue
working in the same project. However, if you prefer to start with a clean application that
contains everything completed up to the start of this lesson, then you need to open
Storefront-06.jws, and edit the database information as described in step 4 of
Practice 2-4.
d) In the Edit Attribute dialog box, select Control Hints in the list at the left.
e) Set the Format Type to Currency.
f) Set the Label Text to Order Total by using a resource bundle (for translatable
text), as follows:
i) Click the ellipsis to the right of the Label Text field.
ii) In the Select Text Resource dialog box:
(1) In the Display Value field, enter Order Total. This automatically
populates the Key field, but you could change the Key value if desired.
However, you can leave it at the default for this attribute.
(2) Enter the following in the Description field: Label for OrderTotal
attribute.
(3) Click Save and Select.
Note: Whether or not the instructions specifically direct you to do so, you can use
a text resource in a resource bundle for any translatable text throughout these
practices, as you would need to do for a real application. However, in the interest
of time, you may choose to simply type in the hard-coded text.
g) Set appropriate tool tip text, using a resource bundle.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This ensures that when a new row is committed with a null primary key, the value from
the database sequence populates the primary key. When you use a database trigger to
populate the primary key, there are few gaps in the sequence of the primary keys, because
the database sequence does not get used until the row is committed.
On the Business Components model side, all that is required is to populate the value
temporarily, so that the NOT NULL primary key can be committed. That is what happens
when you declaratively set the column to use a database sequence, as you do in this
practice.
1) Set SupplierEO to use a database sequence at commit time for its primary key.
There is already a database trigger defined that populates the primary key from a
database sequence if it is null.
a) In the Application Navigator, double-click SupplierEO to open it in the editor.
b) Click the Attributes navigation tab.
c) Select the SupplierId attribute and click Edit
d) In the Edit Attribute dialog box, select Entity Attribute in the list at the left.
e) Select DBSequence from the Type drop-down list.
f) Click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) In the Edit Attribute dialog box, select Entity Attribute in the list at the left.
e) Select the History Column check box and select created on from the drop-down
list.
f) Click OK.
g) In a similar fashion, edit the following attributes by selecting the History Column
check box and choosing the following values from the drop-down list:
Attribute Name
LastUpdateDate
modified on
ObjectVersionId
version number
h) To populate the history columns for created by and modified by, there must
be a logged-in user. You later designate these attributes as history columns, but in
order to test with the Business Components Tester with no logged-in user, you
simply give these columns default values. Set the default Value of the
CreatedBy and LastUpdatedBy attributes to anonymous (ensure that
Literal is selected as the option for Value Type.)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you modify three of the entity objects so that the history columns are
populated automatically.
c) Click Insert
d) Ensure that a temporary SupplierId appears (it should be a negative number) and
that the history columns are populated.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Double-click Supplier1.
f) Click Delete
in the lower and then in the upper sections of the panel to delete
the new rows without committing them.
g) Close the Business Component Browser when you have finished.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Ensure that the history columns are populated in the new row.
d) In the Create View Criteria dialog box, select the Edit Query Criteria tab and
click Add Item.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Attribute
CustomerId
Operator
Equal to
Operand
Bind Variable
Parameter
Usage
Optional
List Name
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
You can create join views when using the Create View Object Wizard. If you already
have a view object to which you want to add a reference entity, you can do so by editing
the view object to create the join view. That is what you do in this practice.
1) Add all the attributes from PersonEO as an inner join to be used as reference in the
ShoppingCartVO view object.
a) In the Application Navigator, double-click the ShoppingCartVO view object in
the oracle.fod.storefront.uiview package to open it in the editor.
b) Click the Entity Objects navigation tab at the left of the editor.
c) Expand oracle.fod.storefront.entity and shuttle PersonEO to the Selected list.
d) Select PersonEO in the Selected list. Ensure that the Association is set to
OrdersPersonsFkAssoc.Person and that the Join Type is set to inner join.
Ensure that the Updatable check box is not selected, and that the Reference
check box is selected.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
For example, the OrderEO contains information about an order, including the
CustomerId, whereas PersonEO contains information about persons, including
customers. In the ShoppingCartVO view object, you may want to display the customer
name or other customer information, which is part of PersonEO. To accomplish this, you
can include PersonEO in the view object as a reference entity, creating a join view.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Attributes
ProductEO
ProductId
ProductName
Description
AdditionalInfo
ListPrice
ProductCategoryEO
CategoryId
CategoryName
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) Optional step (do this only if you added history columns to the
ShoppingCartItemEO entity):
Delete the history attributes from ShoppingCartItemVO. You do not need these
mandatory attributes in the view object because you have set their values in the entity
object.
a) If it is not already open, double-click the ShoppingCartItemVO view object in
the oracle.fod.storefront.uiview package of the Application Navigator
to open it in the editor.
b) Click the Attributes navigation tab and delete the following attributes:
CreatedBy, CreationDate, LastUpdatedBy, LastUpdateDate, and
ObjectVersionId.
c) Save your work.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-07.jws, and edit the database information as
described in step 4 of Practice 2-4.
b) Click Edit
c) Select the Generate Entity Object Class check box and click OK.
d) Save your work.
2) Generate the Java class for OrderEO and add the following method for adding an item
to the cart (you can copy the code from the addItemToOrder.txt file in the
\files subdirectory of your \labs directory):
/**
* Add an item to the order. Typically used to add items to the
shopping cart.
*
* @param productId
*/
public void addItemToOrder(Number productId) {
if (productId == null) {
System.err.println("NO PRODUCT ID!!!");
throw new NullPointerException();
}
RowIterator orderItems = getOrderItem();
assert orderItems != null;
OrderItemEOImpl row;
boolean found = false;
for (row = (OrderItemEOImpl)orderItems.first(); row != null;
row = (OrderItemEOImpl)orderItems.next()) {
if (row.getProductId().equals(productId)) {
found = true;
break;
}
}
if (found) {
Number qty = (Number)row.getQuantity();
if (qty == null)
qty = new Number(1);
else
qty = qty.add(1);
row.setQuantity(qty);
} else {
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Open OrderItemEO in the editor and click the Java navigation tab.
newItem.setProductId(new Number(productId));
newItem.setQuantity(new Number(1));
newItem.setUnitPrice(unitPrice);
try {
getDBTransaction().validate();
} catch (TxnValException e) {
System.out.println(e.getMessage());
for (Throwable t : e.getExceptions()) {
System.out.println(t.getMessage());
}
} catch (JboException e) {
System.out.println(e.getMessage());
}
}
}
c) Notice that the Structure window shows the methods that are included in the class
(if the Structure window is not visiblethe default location is the lower left of the
IDEthen you can select View > Structure to open it.) You can see accessors
(getters and setters) for all of the OrderEO attributes. You can double-click any
method to navigate to it in the editor.
d) In the editor, scroll to the bottom of the file and just above the closing right brace
add the code shown above. You can copy the code from the
addItemToOrder.txt file in the \files subdirectory of your \labs
directory.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
new Key(new
Object[] { productId }));
Number unitPrice = (Number)productEO.getAttribute("ListPrice");
f) Right-click the editor and select Make from the context menu, then save your
work.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Set the OrderItemEO to use a database sequence for the line item ID by
supplementing the initDefaults() method with the following code (ou can copy
the code from the initDefaults.txt file in the \files subdirectory of your
\labs directory):
SequenceImpl seq = new SequenceImpl("ORDER_ITEMS_SEQ",
getDBTransaction());
populateAttributeAsChanged(LINEITEMID,
seq.getSequenceNumber());
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Right-click the method name initDefaults and then select the option Quick
JavaDoc from the context menu. JDeveloper displays an explanation of the
method.
g) Right-click the editor and select Make.
h) Save your work.
2) Test the assignment of the line item ID.
a) Run the FODShoppingCartAM application module.
b) Double-click OrderItemsOrdersFkLink1. This opens the masterdetail window
for Orders and OrderItems.
c) Click Insert a new row
section).
d) Notice the row is created with a LineItemId value defaulted from the database
sequence ORDER_SEQ.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Because there are a number of mandatory columns, do not commit the new row.
Close the BC Browser without committing the row.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
CreatedBy
created by
LastUpdatedBy
modified by
2) Optional step (if you choose not to complete this step, you must begin the
practices for the next lesson by opening the starter application):
In a similar fashion, designate the same columns as history columns in OrderEO and
OrderItemEO.
3) As you did previously for OrderEO and OrderItemEO, generate the entity object
class for SupplierEO.
4) In the entity object class for SupplierEO, override the
getHistoryContextForAttribute() method with the following code,
which you can from the getHistoryContextForAttribute.txt file in the
\files subdirectory of your \labs directory:
protected Object
getHistoryContextForAttribute(AttributeDefImpl
attributeDefImpl) {
Object value =
super.getHistoryContextForAttribute(attributeDefImpl);
// If value is null and is modify user or create user
// history column then return "anonymous"
if (value == null && (attributeDefImpl.getHistoryKind()
== AttributeDefImpl.HISTORY_MODIFY_USER ||
attributeDefImpl.getHistoryKind() ==
AttributeDefImpl.HISTORY_CREATE_USER))
{
return "anonymous";
}
return value; }
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you add code to entity objects to automatically populate the CreatedBy
and LastUpdatedBy history columns.
d) Substitute the code shown above for the generated code. You can copy the code
from the getHistoryContextForAttribute.txt file in the \files
subdirectory of your \labs directory.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Override Methods dialog box, select the check box to the left of the
getHistoryContextForAttribute(AttributeDefImpl) : Object method and click
OK.
6) Run the TestAM application module and perform the same tests as you did in Step 4
of practice 6-3, except that if you test the shopping cart you will not be able to see
how the history columns appear in the shopping cart item record because the history
columns are no longer part of the ShoppingCartItemVO view object.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
to:
ViewObject vo = am.findViewObject("PaymentOptionV1");
4) Right-click the editor and select Run. The test client runs and should display the data
in the log window. It ends when the log displays the message: Process exited
with exit code 0.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Configuration.releaseRootApplicationModule(am, true);
Add the following code (you can copy it from the TestClient.txt file in the
\files subdirectory of your \labs directory):
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the Java class that you create in this practice, the customer name is hard coded to
simulate a name that would ordinarily be retrieved from a login module.
And replace it with the following code (you can copy it from the
getUserPrincipalName.txt file in the \files subdirectory of your \labs
directory):
/* TODO: This should be removed as soon
* as we have a working security model
*/
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
if (mCurrentUser == null) {
String userPrincipal = "DRAPHEAL";
mCurrentUser = userPrincipal;
}
return mCurrentUser;
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) You can see that the view objects and some operations are exposed to the client.
Now you add some service methods and expose them to the client as well.
2) Add a method to the shopping cart application module to initialize the shopping cart
to that of the current user of the application (remember that you hard coded the user
name in BaseApplicationModuleImpl.java). The code is shown here (you
can copy the code from the ShoppingCartInit.txt file in the \files
subdirectory of your \labs directory):
public void init() {
DBTransactionImpl trx = (DBTransactionImpl)getDBTransaction();
ApplicationModuleImpl am =
(ApplicationModuleImpl)trx.getRootApplicationModule();
String user = am.getUserPrincipalName().toUpperCase();
System.out.println("The session user is: " + user);
ViewObjectImpl vo;
vo = getShoppingCart1();
String bindUser =
(String)vo.getNamedWhereClauseParam("CurrentUser");
if (! user.equals(bindUser)) {
vo.setNamedWhereClauseParam("CurrentUser", user);
/* The ShoppingCart is guaranteed to only have one row.
* However, we may not always properly initialize this
* from the UI because the actual row from ShoppingCart is
* not really needed. The following initializes the view
* object so that the view link to the shopping cart items
* properly works.
*/
vo.executeQuery();
Row cart = vo.first();
if (cart == null) {
cart = vo.createRow();
// TODO: Need to finish this off.
cart.setAttribute("OrderDate",
((DBTransactionImpl)getDBTransaction()).getCurrentDbTime());
cart.setAttribute("OrderStatusCode", "CART");
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Expand the Data Controls panel and expand each of the FOD application
modules.
}
}
3) Now add a method that adds an item to the users shopping cart. This method should
call an entity object method that you added earlier to OrderEOImpl.java. Use the
following code (you can copy from addItemToCart.txt):
public void addItemToCart(Number productId) {
init();
ViewObject shoppingCartVO = getShoppingCart1();
assert shoppingCartVO != null;
ViewRowImpl shoppingCartRow =
(ViewRowImpl)shoppingCartVO.first();
assert shoppingCartRow != null;
OrderEOImpl orderEO = (OrderEOImpl)shoppingCartRow.getEntity(0);
orderEO.addItemToOrder(productId);
}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Add the code shown above just before the closing right brace (press [Alt] +
[Enter] if prompted to import oracle.jbo.Row,
oracle.jbo.server.DBTransactionImpl, and
oracle.jbo.server.ApplicationModuleImpl):
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) Select Query > Bind Variables in the tree at the left.
iii) In the Bind Variables panel, click New.
iv) Enter a variable Name of CurrentUser and click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Double-click ShoppingCart1.
f) In the Bind Variables dialog box, click Cancel, because the init() method
already assigned the value to the bind variable.
g) One record should be returned by the query: the status CART order for DRAPHEAL.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-08.jws, and edit the database information as
described in step 4 of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you add several types of both declarative and programmatic validation to
entity objects.
c) You can invoke the Add Validation Rule dialog box either from the Attribute
Editor, or with the attribute selected, from the Validation Rules accordion of the
Entity Object Editor. Invoke the Add Validation Rule dialog box in one of the
following ways:
i) With the OrderStatusCode attribute selected, click Edit. Then in the
Attribute Editor, select Validation in the tree at the left, and then click New.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Entity Object Editor, select the Attributes node, and then select the
OrderStatusCode attribute.
v) Click Test to test the query. A message should inform you that the query is
valid; click OK to dismiss the message.
e) On the Failure Handling tab, check that the Validation Failure Severity option
button is set to Error, and then, to define a translatable string in a resource
bundle, click
interest of time, you can simply type in the text rather than clicking
to define a
text resource. If you choose this option, type You have entered an invalid
value in the Message Text field and skip to step (g) below.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
g) Click OK to save your validation definition, and then click OK to dismiss the
Attribute Editor if you used it to invoke the Add Validation Rule dialog box.
2) Save your work. You test this validation after all validation is defined.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) In the Entity Object Editor for the OrderEO entity, select the Validators node.
iv) Click OK to save your validation definition. You should see the new
validation rule in the Validation Rules section of the OrderEO editor.
2) Save your work. You test this validation after all validation is defined.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) In the editor for the OrderEO entity, select the Attributes node, and then select
the OrderShippedDate attribute.
b) Invoke the Add Validation Rule dialog box as you did previously for the
OrderStatusCode attribute.
c) In the Add Validation Rule dialog box:
i) Select Method in the Rule Type drop-down list.
ii) Ensure that the Create and Select Method check box is selected.
iii) For Method Name, enter the value
validateShippedDateAfterOrderDate
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Add a Method validator to verify that the shipping date of an order is not prior to the
order date, and display a meaningful error message when validation fails. You can
use the following code (you may copy the code from the
ShippedDateAfterOrderDate.txt file in the \files subdirectory of your
\labs directory):
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Enter the same value in Order Shipped Date that is in Order Date. You should be
able to tab out of the field with no error.
c) Enter a value in Order Shipped Date that is earlier than the value in Order Date.
You should receive the warning message that you defined (the JBO key is
different if you typed in hard-coded message text rather than defining a text
resource.)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Tab out of the field. You should receive the error message that you defined.
d) Click OK to acknowledge the message. You should notice that navigation to the
next field was successful, because you defined failure handling to be an
informational warning rather than an error.
e) Close the Business Component Browser.
4) Run TestAM to test the domain that you defined and applied to the SupplierEO entity
object.
a) In the Application Navigator, right-click TestAM and select Run.
b) Click Connect to establish the connection.
c) When the Business Component Browser comes up, double-click the Supplier1
node.
d) Navigate to a supplier with a phone number. Change the phone number in various
ways, such as by deleting the dots (.) or by making the phone number longer.
Each time that the phone number does not conform to the format
xxx.xxx.xxxx, you should not be able to tab out of the field. Doing so should
result in receiving the error message that you defined.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Note: This practice is optional, and does not affect subsequent practices. Do this
practice only if you have extra time.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Most of the techniques for troubleshooting are used mainly for debugging a user
interface. However, you can run the JDeveloper debugger with the Business Component
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 features of the JDeveloper
debugger.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) To set a breakpoint, click in the left margin of the code editor next to the first line
of executable code in the init() method.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) The Breakpoints window shows the breakpoints that you have set, in addition to
those persistent breakpoints that are set by default.
c) Right-click the Breakpoints window to see the options that are available in the
context menu (but do not make any changes.)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) From the JDeveloper main menu, select View > Debugger > Breakpoints (or use
the shortcut key combination [Ctrl] + [Shift] +[R].)
b) Before the Business Component Browser comes up, the debugger is invoked in
the JDeveloper IDE. Examine the information in the IDE.
i) BaseApplicationModuleImpl.java is shown in the editor with a watchpoint
icon and a pointer displayed to the left of the line setting mCurrentUser to
null. This is because the application has hit the watchpoint breakpoint that
you set on this variable.
ii) If the Stack window is not visible, from the JDeveloper main menu, select
View > Debugger > Stack. You can see by the Stack window that the
BaseApplicationModuleImpl class is in the process of being initialized,
and that it was called by the initialization of FODShoppingCartAMImpl.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Step through the code and use debugger features to figure out the problem.
i) Click Step Into on the JDeveloper toolbar. You can see the pointer move
to the next executable line of code in the editor window.
ii) In either the Data or the Smart Data panel of the debugger, expand this. Note
that the value of mCurrentUser is null. You want to keep track of the value
of this variable, so right-click it in the Smart Data or in the Data panel and
select Watch. This adds the variable to a watch list where you can keep track
of various values all in one place.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
vi) If you step into the code at this point, you would need to have the ADF source
because ADF source classes are called in the next lines. Because you dont
have the source, just click Step Over
to advance to the next line of code in
this classeverything still executes, but you just dont step into the called
classes. Note: Be sure to click Step Over and not Step To End of Method,
whose icon looks similar.
vii) Click Step Over again to advance to the line of code that assigns a value to
the user variable. This assignment calls the getUserPrincipalName()
method of the application module base class, which is overridden in
BaseApplicationModuleImpl.java.
viii) You are interested in two variable values: user and mCurrentUser Click
the Smart Data tab (if it is not available, use the View > Debugger menu to
invoke it.)
ix) On the Smart Data tab, right-click user and select Watch.
The Watches tab now shows both the this.mCurrentUser and user
variables so that you can easily track their values.
x) Click Step Into
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xiv) In the Modify Value dialog box, change the value to DRAPHEAL, which is the
correct spelling for the username of the user whose shopping cart you want
to display, and then click OK.
xv) Click Step Into (you may have to click it twice.) On the Watches tab, you
should see that mCurrentUser now has the value DRAPHEAL, the correct
spelling.
xvi) Click Step Out to execute the remaining lines of code in this method and
return to the FODShoppingCartImpl class.
xvii) Click the Watches tab, and then click Step Into
value DRAPHEAL being assigned to user.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xiii) In the Smart Data panel, right-click the userPrincipal variable and select
Modify Value.
So you have seen some features of the debugger and how being able to view variable and
parameter values as the code runs can help you to figure out a coding problem. This code
was so simple that you probably could have easily figured it out just by looking at it, but
the debugger can be very useful for troubleshooting complex code. You were able to
change a value while code execution was paused, so that you could see the outcome. Of
course, you would also have to fix the code itself instead of just changing a variable value
in the debugger, but that is not part of this exercise.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
xxi) Click Resume , and then in the Business Component Browser doubleclick ShoppingCart1. Click Cancel in the Bind Variables dialog box so that
the value set by the init method is used. You should see the correct record
now appear.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Even if you successfully completed all sections of previous practices, do not continue
working in the same project, because there was not time to create all of the elements
needed for the UI. You need to open Storefront-11.jws, and then edit the database
information as described in step 4 of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Categories list, select Web Tier > JSF. Select JSF Page in the Items list
and click OK.
c) In the Create JSF Page dialog box:
i) Enter a file name of Products.
ii) To the Directory path, add \oracle\storefront\ui\pages.
iii) Ensure that Create as XML Document (*.jspx) is selected, and then click
OK.
2) After the designer initializes, the new blank page opens in the editor. Add to the page
two databound tables for product categories and subcategories as master-detail tables.
a) In the Data Controls panel, expand FODProductAMDataControl >
BrowseCategory1.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
StorefrontUI and select New from the context menu, or you could click New
in the toolbar.)
3) By default, all attributes of the view objects were added to the tables. You want to
display only the category name and description. Delete the ones you dont want to
display, and set the master table to enable row selection.
a) To edit the master table, select the top table (BrowseCategory) in either the
visual editor or the Structure window and click Edit in the Property Inspector (if
the Property Inspector is not visible, use the View menu to display it.)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Hint: When you select an attribute, it is best to select the first column, Display
Label, because that is the only column that does not invoke a pop-up list.
d) Select the second table (BrowseSubCategory1) in either the visual editor or the
Structure window and click Edit in the Property Inspector.
e) Set the column list to match the following (remove the extra columns and reorder
as needed):
CategoryName
CategoryDescription
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
NOTE: Although this short list of attributes is easy to reorder, a quick way to
reorder attributes is to select the one you want last in the list (in this case,
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Deselect the Row Selection check box and click OK. The page should now look
similar to the following screenshot, in which some of the extra white space has
been cut out:
Notice that the table does not fill the page. In the practice for the lesson titled
Achieving the Required Layout, you modify the layout so that the table fills
the page.
d) Leave the browser window open to refer to in the next task.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
The page should look similar to the following screenshot, in which some of
the extra white space has been cut out:
Answer:
#{bindings.BrowseCategory1.hints.CategoryName.label}
2) Select the CategoryName output text under the column header. What is its value?
__________________________________________________________________
Answer: #{row.bindings.CategoryName.inputValue}
3) The reference to row is to a variable that is defined on the table. 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.BrowseCategory1.collectionModel}"
4) At run time, what appears in the browser for the first columns heading?
__________________________________________________________________
Answer: The column heading is Category Name.
5) In JDeveloper, open the ProductCategoryEO entity object and edit the CategoryName
attribute. Where does the Category Name label in the UI come from?
__________________________________________________________________
__________________________________________________________________
Answer: Category Name comes from the entity object attributes control hints
for Label.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
__________________________________________________________________
7) 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: ProductsPageDef.xml
8) In the Model section of the page definition file, trace the source of the
BrowseCategory1 binding. Where does the data come from?
__________________________________________________________________
__________________________________________________________________
Answer: The data comes from the BrowseCategory1 view object instance in the
FODProductAMDataControl. The data is held in the entity object on which the
BrowseCategory view object is based, and the values ultimately come from the
database.
9) At the top of the page, click the link to the Data Binding Registry. What is the name
of this file?
__________________________________________________________________
Answer: DataBindings.cpx
10) When does this data binding registry file get created? Hint: The answer is right on
the Overview page for the data binding registry file.
__________________________________________________________________
Answer: The file is created the first time you bind a UI component to data in the
application.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Answer: Office, Electronics, and Media are the category names in the
rowset; they are the input values for the category names in the rows.
Answer: It shows the mapping of page definition file IDs to paths of their page
definition files.
13) What does the Data Control Usages section of this file show?
__________________________________________________________________
Answer: It shows the data controls that are used in the application.
14) Close the browser and the files that you have open in the JDeveloper editor. As you
add pages to the application, you can reexamine the data-binding registry to see how
page mappings, page definition usages, and data control usages are shown for the
additional pages.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
__________________________________________________________________
4) From the Create menu, select Tables > ADF Read-only Table.
5) Do not enable Row Selection.
6) Include the following attributes in order, deleting the other attributes, and then click
OK:
ProductName
Description
ListPrice
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) Drag the BrowseSubCategory1 > BrowseProduct1 data control to the af:form node
in the Structure window.
7) Run the page to test it. Now when you run the page, the log window shows that the
application is undeployed and then redeployed to the default server.
a) You should notice that although the top two tables are coordinated with one
another, the products that appear in the bottom table are those of the first
category/subcategory, and the display of products does not change when different
categories or subcategories are selected. In the practice for the lesson titled
Achieving the Required Layout, you use partial page rendering to refresh the
Products table so that it coordinates with the record that is selected in the
Subcategory table.
b) Close the browser when you are finished and undeploy the application as
described in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) When you are finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
3) The Access Denied error that you received is indicative of a problem with data
bindings. Fix the problem without re-creating the tables on the page.
a) Click the Bindings tab in the editor of the ProductCatalog page to see that there
are no data bindings for the page.
b) In the Application Navigator, navigate to StorefrontUI > Application Sources >
oracle.storefront.ui and open DataBindings.cpx.
c) Map the existing page definition file to the renamed page: In the Page Mappings
section of DataBindings.cpx, edit the path. Change Products in the path to
ProductCatalog. You can do this by selecting the page mapping and then
editing the path in the Property Inspector.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This changes the id of the page definition. Alternatively, you could change the id
in the Property Inspector.
h) In the Application Navigator, navigate to StorefrontUI > Application Sources >
oracle.storefront.ui and open DataBindings.cpx.
i) Map the renamed page definition file to path of the existing page: In the Page
Definition Usages section of DataBindings.cpx, select the path, and then in the
Property Inspector, change the value of path from ProductsPageDef to
ProductCatalogPageDef.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, you can continue
working in the same project. However, if you prefer to start with a clean application that
contains everything completed up to the start of this lesson, then you need to open
Storefront-12.jws, and edit the database information as described in step 4 of
Practice 2-4.
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the practices for this lesson, 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.
b) Drag ProductCatalog.jspx from the Application Navigator to the task flow that
is open in the editor.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) You have already started developing the ProductCatalog page. To begin planning the
rest of the application, add the ProductCatalog page to the applications unbounded
task flow.
2) Create two additional view activities in the unbounded task flow named
ProductSearch and ProductDetails.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Select the view activity in the task flow editor and look at its Property Inspector.
You can see that it is linked to the ProductCatalog page that you created.
a) In the Component Palette, ensure that ADF Task Flow is selected in the dropdown list at the top. Expand the Components category and drag a View activity
to the editor.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Notice the yellow warning symbol on the view activities that you just created.
This means that they do not yet point to pages.
3) Add a Control Flow Case from ProductSearch to ProductDetails and name it detail.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Change the name of the view activity to ProductSearch by entering the new
name either directly on the diagram or in the Property Inspector.
c) Enter detail as the name of the case. You can type directly on the diagram, or
it may be easier to use the Property Inspector and enter the name as the fromoutcome of the control flow case.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
4) In the same way, add a Control Flow Case from ProductDetails to ProductSearch
and name it search.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
9) Finally, create a View activity called FODShoppingDashboard. The page for this
view activity will be the main page of the application from which all parts of the
application are accessed.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Items list, select ADF Task Flow and click OK.
e) Notice that the newly created task flow appears in the Application Navigator in
two places, both under WEB-INF and under Page Flows.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
v) Click OK.
Notice that the view activity is surrounded with a green halo. This indicates that it
is the default activity, or entry point, of the task flow. A bounded task flow must
have one, and only one, default activity. Only bounded task flows show default
activities, because unbounded task flows do not have a defined entry point.
g) Add a Task Flow Return and name it Shop.
h) In the Property Inspector for the Shop task flow return activity, set the Outcome
name to shop. This means that when the task flow returns to the one that called
it, it navigates by using a control flow case whose from-outcome is named
shop.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) The Shopping Cart flow opens in the editor. Add a view activity and name it
ShoppingCart.
j) In a similar fashion, add another task flow return activity called Checkout, with a
control flow case named checkout from ShoppingCart to it and with an outcome
also named checkout.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
i) Add a Control Flow Case from ShoppingCart to the Shop task flow return
activity and name it too as shop.
From
To
Name
SupplierUpdate
Wildcard
Save
Cancel
save
cancel
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) In the Extract Bounded Task Flow dialog box, enter a file name of
ShoppingFlow, add \oracle\storefront\ui\flow to the directory path,
and then click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Right-click one of the selected objects and select Extract Task Flow.
f) Right-click the ProductCatalog view activity and select Mark Activity >
Default Activity.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-13.jws, and edit the database information as
described in step 4 of Practice 2-4.
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the practices for this lesson, you begin to add functionality to pages by using ADF
Faces components. You create search and detail pages and another page that displays a
hierarchical tree of categories and subcategories. You also create several pages that
display input components as a list of values.
2) Create a read-only table on the page to display the users cart, showing the product
name, list price, quantity, and line total of items that are ordered. Users should be able
to use a mouse to select a line item.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Create JSF Page dialog box, ensure that Create as XML Document is
selected, so that the file that is created can be used as metadata (this option should
be selected and disabled.)
Note: Select and remove the other attributes by clicking Delete. You can
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) The ShoppingCart page opens in the editor. From the Data Controls panel, drag
FODShoppingCartAMDataControl > ShoppingCart1 > ShoppingCartItem1
to the page as an ADF Read-only table.
Note: You receive this message because you are running the page directly
instead of running it within the context of the bounded task flow. You do not
need to use the ADF Controller in this case because you are not utilizing any
control flows to test this single page. In most cases, however, you should run
pages from a task flow rather than running them directly.
You also receive several compilation warnings: XML-24521: (Error) Element
not completed: 'view', because you have created several activities in task
flows that have not been completed, such as view activities without
corresponding pages. You can safely ignore these warnings.
c) The page runs but doesnt show any data. The ShoppingCart is tied to specific
user; however, you havent yet told it what user.
d) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
4) Add to the page an invocation of the application modules init() method that
initializes the application to show shopping cart data for a specific user. The method
interrogates the system user (a hard-coded name is used until security is implemented
in a later practice) and uses that name as the user name for the shopping cart. Hint:
This involves adding a method action binding and an invoke action binding to the
page definition.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) In the Insert Item dialog box, select methodAction and click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) In the Insert Item dialog box, select invokeAction and then click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Close your browser and undeploy the application as described in step 6(i) of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2) Add a query component to the ProductSearch page to query for products. The search
results should appear in a table that shows product name, category name, list price,
and description. The user should be able to select a row.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Create JSF Page dialog box, ensure that Create as XML Document is
selected, so that the file that is created can be used as metadata (this option should
be selected and disabled).
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
iii) Click OK. The page should look similar to the following:
Notice that the table does not fill up the page. You must scroll to see all of the
columns. You later improve the look of the table in the practice for the lesson
titled Achieving the Required Layout.
c) Experiment with the functionality of the page.
i) Enter a percent sign (%) in the ProductName field and click Search. All of the
products appear.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) Resize columns in the table by dragging the lines between the column
headers.
iii) Reorder columns in the table by dragging column headers.
iv) Click Advanced to enable more search options.
v) Select Contains from the operators drop-down list.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
vii) Select Does not contain from the operators drop-down list and click
Search. Now the table displays only those products that do not contain the
string Pla.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
vi) Enter Pla in the ProductName search field and click Search. Notice that the
table displays products that contain Pla.
ix) For the Price criterion, select Greater than from the operators drop-down
list, enter a value of $1000 (ListPrice is formatted as currency), and then click
Search. Now the table displays only those products that do not contain the
string Pla and whose list price is more than $1000.
x) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Create a .jspx page in the directory where you are creating pages
(\oracle\storefront\ui\pages).
2) Add a read-only form to the ProductDetails page to display details of the selected
product, including product name, category name, and list price.
a) Drag the Data Control FODProductAMDataControlBrowseProduct to the
visual editor and select FormsADF Read-only form from the context menu.
Note: Select and remove the other attributes by clicking the X icon. The
attributes can be reordered by selecting an attribute and using the up and
down arrows as required.
ii) Do not include Submit Button or Navigation Controls.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) Run the page to test it. Run it directly rather than from the task flow because you have
not added navigation yet. The page should look similar to the following, displaying
only one record, which may not be the same as the record shown:
4) When you have finished, close the browser and undeploy the application as described
in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2) Create a read-only table on the page to list the suppliers, displaying the supplier ID,
name, status, phone number, and email address. The table should be sortable, and
users should be able to select a row.
a) Create an ADF Read-only Table on the page from
FODSupplierAMDataControl Supplier1.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Test that you are able to sort columns and select rows.
c) Create a .jspx page in the directory where you are creating pages
(\oracle\storefront\ui\pages).
2) Add a tree to the ProductCategory page to display categories and subcategories.
a) From the Data Controls panel, drag to the page FODCategoryAMDataControl >
RootCategory1 as a Trees > ADF Tree.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Edit Tree Binding dialog box, select SubCategory from the Add Rule
(green plus) drop-down list.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Note: This shows up at run time as a hierarchical tree with nodes and subnodes
displaying category names and subcategory names. Note that both
RootCategoryVO and BrowseSubCategoryVO are based on the same entity
object, ProductCategoryEO. The queries are differently defined to select those
with no parent category for RootCategoryVO and all categories for
BrowseSubCategory. The view link defined to link the two view objects restricts
the second view to display only those subcategories whose parent category is the
root category. This becomes clearer when you run the page.
b) Note that you can expand the nodes, but nothing happens when you click the links
other than that the tree is refreshed. You change this behavior in a later practice.
c) When finished, close the browser and undeploy the application as described in
step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
l) Click Cancel to close the window, and then close the EO and VO editors.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Test the page by running it directly. The page should look similar to the following
with the list of values dropped down:
e) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the list at the left of the Project Properties editor, choose Resource Bundle.
Make sure the Resource Bundle Type property is set to Properties Bundle and
select the One Bundle Per Project option. Set the Default Project Bundle Name
to oracle.storefront.ui.StorefrontUIBundle.
c) Click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However if you prefer to start with a
clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-14.jws, and edit the database information as
described in step 4 of Practice 2-4.
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this set of practices, you implement navigation on pages by creating buttons, links,
breadcrumbs, and a train.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) The ManageSupplierFlow task flow has a global control flow rule whose fromoutcome is cancel. Add a Cancel button to the page in the task flow to implement
this global rule. Create the label for the button as a translatable string.
(Alternatively, you could right-click the button in the editor or in the Structure
window and select Select Text Resource for > Text from the context menu.)
e) In the Select Text Resource dialog box:
i) Ensure that StorefrontUIBundle is the selected resource bundle.
ii) Enter a Display Value of Cancel, which populates the Key value with
CANCEL.
iii) Enter a Description of Label for the Cancel button.
iv) Click Save and Select.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) To define text for the button label and store it in a resource bundle, in the Property
Inspector click the arrow to the right of the Text property and select Select Text
Resource from the context menu.
g) Select the button and in the Property Inspector click the drop-down arrow at the
end of the Action property and select cancel from the drop-down list.
This ensures that the cancel control flow is executed when the user clicks the
Cancel button.
h) To enable users to cancel and leave the form without entering the required fields,
set the Immediate property to true on the Behavior panel of the Property
Inspector.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) In a similar fashion, add a button labeled Search to the ProductCatalog page in the
ShoppingFlow task flow. Set the Action to search.
4) Optional step (if you choose not to create these buttons, you can begin the
practices for the next lesson by opening the starter application):
Following a similar series of steps, add the following buttons for navigation,
optionally using a text resource for the label of each:
Task Flow
Page
Button Label
Button Action
ShoppingFlow
ProductDetails
Search (use
the existing
text resource)
search
ShoppingFlow
ProductDetails
Shop
shop
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2) Optional step (if you choose not to create this button, you must begin the
practices for the next lesson by opening the starter application):
The ManageSupplierFlow task flow has a control flow rule from SupplierUpdate to
the Save task flow return activity whose from-outcome is save. Follow a similar
series of steps to add a Save button just to the right of the Cancel button on the
SupplierUpdate page to implement this navigation. Create the label for the button as
a new translatable string and select the save action. Do not change the default value
of the Immediate property for this button.
ShoppingCart
shop
ShoppingCartFlow
ShoppingCart
Checkout
checkout
c) The file should look similar to the following (not all of these entries are present if
you skipped any optional steps):
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
iv) In the Property Inspector, remove the value in the Text property of the
af:commandLink and set the Action to detail.
d) If you run the page from the task flow at this point (see step (f) below for how to
do that if you want to try), the link navigates to the detail page but always
displays details for the first product. The reason for this behavior is that when you
disabled row selection you also disabled row concurrency. Add a method called
setCurrentRowWithKey that sets the row of the Product iterator to whatever
the current row is in the page.
i) In the Data Controls panel, expand FODProductAMDataControl >
BrowseProduct > Operations.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
iii) In the Surround With dialog box, select ADF Faces > Link and click OK.
iii) In the Confirm Component Rebinding dialog box, select the Keep Current
Value check boxes for the text and action properties. Click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) In the Convert Output Text dialog box, select ADF Faces > Link and click OK.
c) In the Confirm Component Rebinding dialog box, select the text check box to
retain its value and click OK.
d) Select af:commandLink and set the Action property to detail.
4) The setCurrentRowWithKeyValue method uses an argument (ND or Named
Data) to tell it which row is current. The argument for setting the current row of
Product is ProductId.
When you created the Product table for this page, you excluded the ProductId because
you do not want to display it. Because it was excluded, it is not in the page bindings.
Before you can use ProductId as an argument to the
setCurrentRowWithKeyValue method, you have to add it to the bindings.
After you add it, you can set the NDValue property of
setCurrentRowWithKeyValue.
a) Go to the Overview tab of the ProductCatalog page definition, or to the
Bindings tab of the page.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Note: This adds the attribute to the bindings, but it does not add it to the table in
the page. It simply makes the attribute available to the page.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Attributes section of the Tree Binding Editor, shuttle the ProductId from
the Available Attributes to the Display Attributes, and then click OK.
e) Test the page by running it from the ShoppingFlow task flow (open the task flow,
right-click the default activity, and select Run.) Remember that the Products table
is not yet coordinated with the Categories and Subcategories tables, so just scroll
to the bottom table and try out the ProductName links. Click Shop to return to the
ProductCatalog page to try different links (if you did not define the Shop button in
the optional steps, then use the browsers Back button to return to the
ProductCatalog page.)
Note: If the bottom Products table shows no data, you can test the links after
you coordinate the Products table with the Subcategories table in a later
practice.
f) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
5) On the ShowSuppliersFlow task flow, create a task flow call activity to invoke the
ManageSupplierFlow task flow, a control flow case named update from
BrowseSuppliers to ManageSupplierFlow, and a control flow case named done from
ManageSupplierFlow to BrowseSuppliers. You want users to be able to click the
SupplierId to be able to update the supplier. Convert the SupplierId on the
BrowseSuppliers page to a link that implements this navigation. You do not need to
disable row selection for this table.
a) Open the ShowSuppliersFlow task flow.
b) From the Application Navigator, drag ManageSupplierFlow to the diagram to
create a task flow call activity.
c) Create a control flow case from BrowseSuppliers to ManageSupplierFlow and
set its from-outcome to update.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
iii) In the Surround With dialog box, select ADF Faces > Link and click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
4) Create the following three View Activities on the CheckoutFlow, and notice that
JDeveloper creates a navigation path as you create the activities:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Name one task flow return SubmitOrder, and set the name of its outcome in the
Property Inspector to submit.
b) Name the other task flow return CancelOrder, and set the name of its outcome
in the Property Inspector to cancel.
c) Add a wildcard control flow rule.
d) Add two control flow cases:
i) One named submit from CheckoutConfirm to SubmitOrder
ii) One named cancel from the wildcard to CancelOrder
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
7) Run the page from the task flow. It has no data on it because the shopping cart
context has not been established. Also notice that there is currently no means of
navigation. You fix these problems in the next steps.
Close the browser and undeploy the application as described in step 6(i) of Practice 24.
8) Establish the context for the shopping cart by calling the init() method defined in
the FODCheckoutAMDataControl application module. Add a reference to the
init() method and execute the method as part of the page load process. This
init() method retrieves the current username (now hard coded, but when security
is implemented will be set programatically), sets the value in a named WHERE clause,
and then reexecutes the query. The result is that the shopping cart is populated with
data from the current user.
To use the init() method, you define a reference for it in the page definition file.
Then you add an invokeAction to the page definition executables. The
invokeAction executes when the page is loaded.
a) Open the Page Definition for the CheckoutShipping page (right-click anywhere
on the page and select Go To Page Definition), or click the Bindings tab on the
page.
b) Click the Add icon (green plus sign) on the Bindings pane.
c) In the Insert Item dialog box:
i) Select Generic Bindings from the drop-down list.
ii) Select methodAction.
iii) Click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
9) Add the ability to navigate to the next page by adding a Train component to the page.
The Train component shows the users relative position in the train. It has train stops
(small boxes) for each of the pages in the train. The current position is highlighted
with a slightly larger box. The Train component can also be used for navigation. The
user can click the previous or next train stop to navigate to that page.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Bind Train dialog box, click OK to accept the default trainModel to bind
to.
10) Add a train button bar to the page. A train button bar displays Back and Next buttons
to navigate to the next or previous train stop.
a) Drag a Train Button Bar from the Component Palette to the Structure window
just after the af:train.
b) In the Bind trainButtonBar dialog box, click OK to accept the default
trainModel to bind to.
Note: Be sure that the train button bar appears in the Structure window between
the train and the panel form layout. The Structure window should look like this (if
not, drag components to rearrange them):
11) Add labels for the train stops: Shipping, Billing, and Confirmation.
JDeveloper currently does not provide a way to use a text resource from a resource
bundle file, so you can just enter the text directly.
a) Open the CheckoutFlow task flow.
b) Select the CheckoutShipping activity.
c) In the Property Inspector, select the Train Stop panel and set the display-name
to Shipping.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) In the page editor for the CheckoutShipping page, drag a Train component from
the Component Palette just inside the top of the form, and select Create Train.
12) Optional step: You may choose to skip this test in the interest of time without
affecting subsequent practices.
Test the train functionality. To see all the train stops, all of the train stop view
activities must be associated with pages, so you have to create the other pages.
However, because you are going to delete them after testing the train, for now just
create a temporary page for each with only an output text item on it. Do not add any
data binding. You can just create the pages in the default directory to separate them
from the more permanent pages that are in your
\oracle\storefront\ui\pages directory.
a) Double-click each view activity in turn (CheckoutPayment and
CheckoutConfirm) and click OK to accept the defaults in the Create JSF Page
dialog box.
b) When the page opens in the designer, drag an Output Text to the page.
c) In the Property Inspector, change the Value of the Output Text item to reflect the
title of the pageCheckout Payment or Checkout Confirm. You do not
need to place that text in the resource bundle because you do not use it on the
permanent page that you create later. You use this Output Text value only to be
able to determine which page appears at run time for the next step.
d) Run the CheckoutShipping page from the task flow to see the results. The
navigation train and button bar appear, with labels for each train stop. You can
use either the Billing link or the Next button to navigate to the payment page.
However, because you have added the train component and train button bar to
only the first page, you cannot navigate to the other pages from the payment page.
You take care of that problem when you create the real pages.
e) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
f) Delete the two temporary pages:
i) In the CheckoutFlow task flow, select the CheckoutPayment and
CheckoutConfirm view activities and delete the value in their page property.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Select one of the search control flow cases and in the Property Palette change its
from-activity-id to the wildcard rule, selecting it from the drop-down list.
d) Delete the other search control flow rule. The diagram should now look similar
to the following screenshot:
e) Select one of the detail control flow rules and in the Property Palette change its
from-activity-id to the wildcard rule, selecting it from the drop-down list.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Drag a Wildcard Control Flow Rule from the Component Palette to the task
flow.
g) Select the shop control flow rule and in the Property Palette change its fromactivity-id to the wildcard rule, selecting it from the drop-down list.
h) Rearrange the items on the diagram to look similar to the following screenshot:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Delete the other detail control flow rule. The diagram should now look similar
to the following screenshot:
e) Drag a Control Flow Case from the wildcard to CheckoutFlow and name the
outcome checkout.
f) From the Application Navigator, drag the ShoppingCartFlow to the
ShoppingFlow task flow diagram in the editor to create a task flow call activity.
g) In the Property Inspector, change the id of the task flow call activity to
AddShoppingCart. Do not change the id in the Task Flow Reference section.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
You later add logic to the application so that there is a difference between
displaying the cart and adding an item to the cart.
l) Open ProductCatalog and to the right of the Search button, add a button
named Show Cart that navigates to the DisplayShoppingCart activity.
i) Using the resource bundle, set the text property to Show Cart.
ii) Set the action to cart.
iii) Test the navigation by running the ProductCatalog page from the
ShoppingFlow task flow.
iv) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 199
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
h) Drag a Control Flow Case from the wildcard to AddShoppingCart and name
the outcome add.
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-15.jws, and edit the database information as
described in step 4 of Practice 2-4.
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the practices so far, you have chosen the default layout for all the components you
have used. Thats a quick way to check that your application is working and that data and
flow are handled correctly. This has resulted in pages that are functional, but not very
visually appealing. In this set of practices, you use layout components and techniques to
enhance the appearance of the application, and you implement partial page rendering to
coordinate products with a selected subcategory.
Table
ProductCatalog
masterDetail1 table
ProductCatalog
Subcategories table
ProductCatalog
Products table
ProductSearch (optional)
ShoppingCart (optional)
Items table
BrowseSuppliers (optional)
Suppliers table
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Stretch the last columns of the following tables, and stretch the tables themselves:
g) Optional step (if you choose not to complete this step, you can begin the
practices for the next lesson by opening the starter application):
In a similar fashion, stretch the table and the last column for all tables in the
following pages:
ProductSearch (Search results table)
ShoppingCart (Items table)
BrowseSuppliers (Suppliers table)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) In the Property Inspector, change the Text property to Categories, being
sure to use a resource bundle.
iii) In a similar fashion, set the Text property for the af:panelHeader
BrowseSubCategory to Subcategories.
2) In the ProductCatalog page, two of the tables and panel headers are grouped under an
af:panelGroupLayout component. Enable this component to display scroll bars when
the browser is too small to display all of its contents, and place the third table in the
same panel group layout.
a) In the Structure window, select af:panelGroupLayout.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) Optional step (if you choose not to complete this step, you must begin the
practices for the next lesson by opening the starter application):
In a similar fashion, set the default Panel Group Layout component to scroll in the
ProductSearch page.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Property Inspector, select scroll from the Layout drop-down list.
d) In the Surround With dialog box, select ADF Faces > Panel Header and click
OK.
e) In the Property Inspector for the panel header, set the Text property to
Products, optionally using a resource bundle.
f) Save your work.
2) On the ProductDetails page, place the Product form, which is contained by default in
a panel form layout, into a panel header titled Product Detail. Add a toolbar for the
existing buttons.
a) Open the ProductDetails page.
b) In the Structure window, expand jsp:root > f:view > af:document > af:form.
c) Right-click af:panelFormLayout and select Surround With.
d) In the Surround With dialog box, select ADF Faces > Panel Header and click
OK.
e) In the Property Inspector:
i) Set the Text property to Product Detail, optionally using the resource
bundle.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
h) Drag the existing Search and Shop buttons to the toolbar, in either the Structure
window or in the editor.
i) Save your work. When you have finished, the page should look similar to this
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
g) Drag a Toolbar from the Component Palette to the toolbar facet of the panel
header, in either the Structure window or in the editor.
3) Optional step (if you choose not to complete this step, you can begin the practices
for the next lesson by opening the starter application):
In a similar fashion on the SupplierUpdate page, put the Supplier form that is
contained in a panel form layout into a panel header. You do not need to change the
heading. Hint: The SupplierUpdate page is in the supplier subdirectory of the
\oracle\storefront\ui\pages directory.
a) Surround the Panel Form Layout with a Panel Header, but do not change the Text
(heading).
b) Add the existing buttons to a toolbar in the toolbar facet of the panel header.
c) For now, do not change the text of the panel header, because later you add a
conditional text display.
d) Set the Width of the panel header to 500 pixels.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
4) Optional step (if you choose not to complete this step, you can begin the practices
for the next lesson by opening the starter application):
In a similar fashion on the BrowseSuppliers page, put the Supplier table into a panel
header with the heading Select a Supplier for Update.
a) Surround the Supplier table with a Panel Header.
b) Using the resource bundle, change the Text to Select a Supplier for
Update.
c) Save your work.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Save your work. When you have finished, the page should look like this
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Drag a Panel Group Layout from the Component Palette to the page and set its
Layout property to scroll.
d) Drag two Panel Headers to the page, one below the other and both within the
panel group layout. You may find it easier to drag the panel headers to the
af:panelGroupLayout in the Structure window.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Create the CheckoutPayment page. The page should contain a panel group layout
with two panel headers, one that displays the billing address and the other displaying
payment options. The layout should be like this:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Save your work. The page should now look like this:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Save your work. Now the page should look like this:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
g) Optional Step: To test your checkout pages, you need to add the same train
components to the second and third train stops. In the lesson titled Ensuring
Reusability, you define a page template to use for all of these pages, and the train
components are on it rather than on the individual pages. However, for now you
temporarily add them to each page for testing. Copy the train and train button bar
from the CheckoutShipping page to each of the other two pages in the
CheckoutFlow.
i) Open the CheckoutShipping page.
ii) In the Structure window, expand jsp:root > f:view > af:document > af:form.
iii) Multiselect af:train and af:trainButtonBar.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you work on the CheckoutPayment page to set the attributes to be visible
only when they are needed, based on the Payment Type. You add Expression Language
to the components that you want to conditionally display, and you use partial page
rendering to refresh only those components, rather than the entire page.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2) Because you are going to use partial page rendering for this action, you need to
reference the component that triggers the partial page rendering. Set an Id and
implement PPR on the triggering component.
In the list at the left of the Expression Builder, select ADF Bindings > bindings >
PaymentTypeCodeValue > inputValue, which inserts
#{bindings.PaymentTypeCodeValue.inputValue} into the expression.
You then can add the condition to the end of the expression and click OK.
Note: Be sure to select the PaymentTypeCodeValue attribute binding and not
the PaymentTypeCode binding.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Note: You can use the Expression Builder to help build the expression. To get to
Expression Builder, click the arrow icon to the right of the Visible property in the
Property Inspector and select Expression Builder.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
4) Now set ExpireDate to be visible only if the Payment Type Code Value is CC.
(The steps and code are similar.)
b) When you are finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
2) Set the Products table to be the PPR target that is refreshed when the selected
subcategory changes.
a) Select the Products table.
b) In the Property Inspector, set the Partial Triggers property to SubCategory
(use the editor, available from the drop-down menu, to add appropriate colons in
front to reference the correct naming container.)
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
The FODShoppingDashboard page is meant to be the main page of the application. Other
applications that will be developed for this company should use a similar look, so you
create a page template that imposes a certain layout. You then create the
FODShoppingDashboard page, using this page template.
The bounded task flows that you have created so far have used pages, not page
fragments. This enabled you to test them independently. However, now you incorporate
these task flows as regions on the main FODShoppingDashboard page. To do so, you
first must convert the bounded task flows to use page fragments.
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-16.jws, and edit the database information as
described in step 4 of Practice 2-4.
This practice contains some optional steps that are similar to steps already done. If you
wish to build the entire application yourself, you can complete the optional steps.
However, in the interest of time, you may wish to skip them. If you do so, you will need
to start the practices for the next lesson by opening the starter application for that lesson.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
When there are several pages that are used in succession, it is a good practice to make
sure 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, like the
CheckoutFlow. To make the layout cleaner and reusable, you create and apply a template
to the pages.
You should also see that the .jspx files for the checkout pages have been
converted to .jsff files.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
CheckoutPageTemplate.jspx
Directory
<ProjHome>\public_html\oracle\storefront\ui\pages\templates
Page
Template
Name
CheckoutPageTemplate
content
Facet
Definitions (select Facet Definitions tab and click Add to add the facet)
Attributes
title
java.lang.String
required
2) To the page template, add the layout and train components that you want to use in all
the checkout pages.
a) Add a Panel Group Layout on the af:pageTemplateDef.
i) Set its Layout property to scroll)
ii) Drag the panel group layout above the af:xmlContent in the Structure
window.
b) Drag a Train to the af:panelGroupLayout.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
To avoid this unnecessary duplication, you now create a template that manages the train
components for each of the pages. The template also contains a Panel Group Layout and
a Panel Header to provide additional layout structure for the checkout pages.
(You can use Expression Builder and select ADF Controller Objects >
controllerContext > currentViewPort > taskFlowContext > trainModel to
insert into the expression.)
Note: If you use the Expression Builder, it displays the code as if it were an error.
It has context for the trainModel but doesnt understand .next in the expression.
You can ignore the error.
3) Add a Facet Reference named content to the template.
a) Drag the Facet Ref to the af:panelHeader.
b) Set the FacetName to content.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
5) Apply the template to the checkout pages. (You cant use the IDE to apply a template
to an existing page. However, you can add the template-related code to an existing
page.)
a) Open CheckoutShipping.jsff.
b) Click the Source tab.
c) In the Structure window, select af:train and af:trainButtonBar. These
components are no longer needed in the page fragment because they are contained
in the page template.
d) Back in the Source editor, replace the highlighted code with the following (you
can copy the code from PageTemplate.txt in your files directory):
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
4) Save your work. The page template should look similar to the following
6) The template contains the outermost Panel Group Layout (which holds the train,
buttons and the Panel Header). Therefore, when you apply the template to your page,
you need to move the content to the template content facet.
a) Using the Structure window, drag the af:panelHeader Shipping
Address to the content facet.
7) Apply the template to the other pages in the checkout flow, using Billing as the title
for the CheckoutPayment page and Confirmation as the title for the CheckoutConfirm
page.
a) Open CheckoutPayment.jsff.
b) Repeat the steps above, changing the value of the title attribute to Billing. (The
content area of this page is in the panelGroupLayout.)
c) Open CheckoutConfirm.jsff.
d) Repeat the steps above, changing the value of the title attribute to
Confirmation. (The content area of this page is in the outermost
panelGroupLayout.)
8) Save your work.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) In the templates subdirectory of your directory for pages, create a new page template
named MainPageTemplate. Define content areas named companyLogo,
tab1Content, tab2Content, and mainContent. Define required attributes
called companyName, tab1Title, and tab2Title.
a) In the Application Navigator, right-click the directory where you already created a
page template and select New.
b) In the New Gallery, select Web Tier > JSF > JSF Page Template.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you create a page template to be used in the main page of any of the
companys applications. You then create the FODShoppingDashboard page and base it
on this template. The layout of the template should be as follows:
MainPageTemplate.jspx
Directory
<ProjHome>\public_html\oracle\storefront\ui\pages\templates
Page
Template
Name
MainPageTemplate
Facet
Definitions
(click Add
to add
each facet)
companyLogo
Attributes
(click Add
to add
each
attribute)
companyName
java.lang.String
required
tab1Title
java.lang.String
required
tab2Title
java.lang.String
required
tab1Content
tab2Content
mainContent
2) The new template opens in the editor. Add a component with resizable vertical panes,
so that page developers can resize it to fit the size of the image they add to the top
pane. The component should be one that automatically stretches its children. Stretch it
to fit the browser vertically and horizontally.
a) Drag a Panel Splitter to the page, being sure that it appears above
af:xmlContent in the Structure window.
i) Set its Orientation to vertical.
ii) Set its SplitterPosition to 125.
3) You want the company logo image and the company name to be arranged
horizontally in the top portion of the page. Add a layout component to accomplish
that, and add the company logo and name.
a) In the Structure window, expand af:panelSSplitter and Panel Splitter facets.
b) Drag a Panel Form Layout to the first facet and set the following properties:
i) Set Rows to 1 (so that the components you add are in one horizontal row).
ii) Set Width to 500 pixels (so that the components you add are next to one
another, instead of spreading out to fit the browser width).
c) Drag a Facet Ref to the af:panelFormLayout and select companyLogo as the
facet name. This provides a spot for users of the page template to place an image.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Set the following properties for the new page template, and then click OK:
4) Below the header section that has the company logo and name, you want two
resizable panels that consume the remainder of the browser area. The left panel
should contain two tabs where page designers can place content, and the right panel
should contain the main content area. Add the layout and components for this area.
a) Drag a Panel Splitter to the second facet of the root af:panelSplitter and set its
Orientation property to horizontal.
b) Expand af:panelSplitter >Panel Splitter facets for the panel splitter that you just
added.
c) Drag a Panel Tabbed component to the first panel splitter facet.
d) One detail item (corresponding to a tab) is created by default for the
af:panelTabbed component. Drag a second Show Detail Item to the
af:panelTabbed component.
i) Set the Text of the first af:showDetailItem to #{attrs.tab1Title}
(you can use Expression Builder.) This enables page designers to supply a
label for the tab.
ii) Set the Text of the second af:showDetailItem to #{attrs.tab2Title}.
e) Drag a Facet Ref to the first af:showDetailItem and select tab1Content as the
facet name.
f) Drag a Facet Ref to the second af:showDetailItem and select tab2Content as
the facet name.
g) Drag a Facet Ref to the second facet of the af:panelSplitter and select
mainContent as the facet name. This provides a spot for page designers to place
the main content of the application.
h) Save your work. You must save a page template before you can use it.
5) On the main unbounded task flow for the application, create the
FODShoppingDashboard page, applying the template that you just created.
a) Open adfc-config.xml.
b) Double-click the FODShoppingDashboard view activity to create the page,
setting the following properties:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) On the Style > Text section of the Property Inspector, set Color to Blue, Size
to xx-large, Bold to bold, and Italic to italic.
File Name
FODShoppingDashboard.jspx
Directory
<ProjHome>\public_html\oracle\storefront\ui\pages
Use Page
Template
MainPageTemplate
6) Use the attributes of the page template to customize the page for the Storefront
application. Supply values for the attributes of the template. The company name
should be Storefront Demo and the tabs should be labeled Categories and Suppliers.
The IDE does not provide a way to use a resource bundle, so you can enter hardcoded strings in this case.
a) Set the attribute values in FODShoppingDashboard. In the editor, click the
FODShoppingDashboard tab, or reopen that file if you have closed it.
b) In the Structure window, select af:pageTemplate.
c) In the Property Inspector, set the following values:
companyName: Storefront Demo
tab1Title: Categories
tab2Title: Suppliers
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) On the Style > Text section of the Property Inspector, set Color to Red.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Select the FODShoppingDashboard page in the editor, and then in the Structure
window click Freeze View , or select View > Options > Freeze View from
the menu.
Shop
Action
shop
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
You accomplish this by using parameters. In the practices for this lesson, you modify the
ProductCatalog page to display specific tables and data based on those parameters.
If you successfully completed all sections of the previous practice, including the optional
steps, you can continue working in the same project. However, if you prefer to start with
a clean application that contains everything completed up to the start of this lesson, then
you need to open Storefront-17.jws, and edit the database information as
described in step 4 of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Initially the Categories table should appear. When the user clicks the name of a
category, the Subcategories table should display the subcategories for the category
that the user clicked. Then if the user clicks a subcategory, the Products table should
display the products for that subcategory.
Value
param_CategoryId
#{pageFlowScope.CategoryId}
param_SubCategoryId
#{pageFlowScope.SubCategoryId}
param_CategoryName
#{pageFlowScope.CategoryName}
param_SubCategoryName
#{pageFlowScope.SubCategoryName}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Select the Categories table either in the Structure window or the visual editor
(the default id of the table was masterDetail1)
The Parameters section of the Create Action Binding Editor should look like:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Leave the page definition file open for the next step.
ii) Repeat this step for BrowseSubCategory1, because you are going to use the
CategoryId that is selected in the SubCategories table to set the
subcategory-related parameters.
b) In the ProductCatalog page, convert the CategoryName field in the
Categories table to be a link. When a user clicks the link, the page should use
setActionListeners to set the pageFlowScope parameters.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the Category and Subcategory tables, convert the category name to a link
that stores the name and ID in pageFlowScope variables. Use a Set Action Listener
operation to store each variable value.
Hint: You first must add the category ID to the page bindings.
To
#{row.CategoryId}
#{row.CategoryName}
#{pageFlowScope.CategoryId}
#{pageFlowScope.CategoryName}
To
#{row.CategoryId}
#{row.CategoryName}
#{pageFlowScope.SubCategoryId}
#{pageFlowScope.SubCategoryName}
5) Modify the rendering of the tables so that only a single table appears at a time.
Hint: If both category and subcategory parameters are null, the Categories table
should appear (no links have been clicked to set the parameters). If only the
categoryId parameter is set, the Subcategories table should appear, because
the user clicked a link on the Categories table to set the category ID. If both
parameters are set, the Products table should be displayed (both Category and
Subcategory links have been clicked, so both parameters have been set).
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 246
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
iv) Select Link, and then click OK in the Confirm Convert dialog box.
c) Select the third af:table (Products) and set the Rendered property so that the
table appears if there is a categoryId and a subCategoryId. (This means that
the page has set a Category and subCategory) The EL code is:
#{bindings.param_CategoryId != null &&
bindings.param_SubCategoryId != null}
6) Modify the layout of the ProductCatalog page so that all tables are under a single
panel header whose title changes depending on the table that appears.
a) In the Structure window for the ProductCatalog page, select af:table
SubCategory in the second af:panelHeader and drag it to the first
af:panelHeader (the one currently labeled Categories.)
b) Drag the af:table from the third af:panelHeader to the first af:panelHeader.
c) Delete the second and third panel headers.
d) Select af:panelHeader and set the Text property to
#{bindings.param_CategoryId == null ||
bindings.param_SubCategoryId == null ?
storefrontuiBundle.CATEGORIES :
storefrontuiBundle.PRODUCTS}
e) Move the command buttons on the page to a toolbar in the toolbar facet of the panel
header.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Select the second af:table (SubCategory) and set the Rendered property so
that the table appears if the CategoryId parameter is set but the
SubCategoryId parameter is null. (This means that the page set a Category
but not a subCategory) The EL code is:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) For the first breadcrumb, you want the Categories table to appear, so reset all the
parameters to null.
Hint: Remember that the parameters get their values from the pageFlowScope
variables.
a) In the ProductCatalog page, select the first af:commandNavigationItemthe
one labeled Store.
b) Add four setActionListeners with the following properties:
From
To
#{null}
#{null}
#{null}
#{null}
#{pageFlowScope.CategoryId}
#{pageFlowScope.CategoryName}
#{pageFlowScope.SubCategoryId}
#{pageFlowScope.SubCategoryName}
Hint: After you add the first setActionListener, you could use the Source tab to copy,
paste, and then modify the code.
2) Set the second breadcrumb to appear only if the user has clicked a category name in
the Categories table. Label the breadcrumb with the Category name that the user
clicked in the Categories table. Set the second breadcrumb to display the
Subcategory table when a user clicks it.
a) Select the second of the three navigation items in the Structure window.
b) Set the Text property to #{bindings.param_CategoryName}. You can use
Expression Builder to set this (ADF Bindings > bindings > param_CategoryName).
d) If a user clicks the second breadcrumb, he or she wants to see the SubCategories.
You use the setActionListeners to reset just the SubCategory parameters.
Add 2 setActionListeners with the following properties:
From
To
#{null}
#{null}
#{pageFlowScope.SubCategoryId}
#{pageFlowScope.SubCategoryName}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
When users click the first breadcrumb, they should return to the top level of the
breadcrumb list to display the Categories table. You have already set the page to use
the pageFlowScope parameters to display the correct section of the page, so in this
practice, you just set those parameters based on which breadcrumb is clicked.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Value
Required
Action
ProductId
#{pageFlowScope.Action}
True
#{pageFlowScope.ProductId} False
2) Add a method call to the shopping cart flow that calls the addItemToCart()
method of FODShoppingCartAM. Set the value of its productId argument to
#{pageFlowScope.ProductId}. Navigate to the ShoppingCart view when
finished.
a) In the Data Controls panel, expand FODShoppingCartAMDataControl.
b) Drag addItemToCart(Number) to the shopping cart flow diagram.
c) In the Edit Action Binding dialog box, set the Value of the productId parameter
to #{pageFlowScope.ProductId}, and then click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Open ShoppingCartFlow.
Note: The ChooseAction property is in the Cases section under the Common tab
of the Property Inspector.
e) Set the display outcome to be the default outcome of the router.
4) The shopping cart flow is expecting parameters named Action and optionally,
ProductId. Modify the shopping flow to send the correct parameters.
a) Open the ShoppingFlow diagram.
b) Two parameters have been added to the DisplayShoppingCart task flow call in
the Parameters section of the Property Inspector. Set a value for the Action
parameter as follows:
Name
Value
Action
Display
ProductId
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Mark the ChooseAction router as the default activity for the page flow.
Value
Action
Add
ProductId
#{requestScope.ProductId}
5) Finally you need to get the productId from the calling page and put it into the
requestScope variable ProductId. The call to add the item to the cart should be
placed on the ProductDetails page. Hint: There is currently no binding for ProductId.
a) Open the ProductDetails page.
b) Add a button to the toolbar of the panel headers toolbar facet and label it Add
Item to Cart. Set its Action to add.
c) Add a binding for ProductId.
i) Click the Bindings tab.
ii) In the Bindings section, click Add (plus icon.)
iii) Add an attributeValues binding whose Data Source is
FODProductAMDataControl.BrowseProduct and whose Attribute is
ProductId.
d) Add a setActionListener to the Add Item to Cart button that sets the value of
#{requestScope.ProductId} to the value of
#{bindings.ProductId.inputValue} when the button is clicked.
Hint: Right-click af:commandButton, select Insert inside > ADF Faces > Set
Action Listener and set the From and To values. Make sure to put the correct
value in the To and the From properties.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
The ShoppingFlow is now set up to send the Action parameter and, if needed, to
send the ProductId as well.
Value
Required
a) Open ManageSupplierFlow.
b) Click the task-flow-definition in the Structure window.
c) Select Parameters in the Property Inspector.
d) Click Add to add the parameter shown above.
2) Add a method call to the ManageSupplierFlow task flow to call the CreateInsert
operation for a new supplier and connect it to the SupplierUpdate activity when
finished.
a) Open the ManageSupplierFlow task flow.
b) In the Data Controls panel, expand FODSupplierAMDataControl > Supplier1
> Operations and drag the CreateInsert operation to the task flow diagram to
create a method call activity.
c) Change the fixed-outcome of the CreateInsert method call activity to done.
d) Drag a Control Flow Case from CreateInsert to SupplierUpdate; its fromoutcome should default to done.
3) Set up the task flow so that a new supplier is created when a parameter passed to it
has a value of New, or that an existing supplier is updated when the parameter value is
Update.
a) Add a Router to the flow and name it ChooseAction.
b) Mark the ChooseAction router as the default activity for the page flow.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Modify the manage supplier flow to accept the following input parameter:
Note: You define these expressions in the Cases section under the Common tab
of the Property Inspector.
Value
SupplierAction #{requestScope.SupplierAction}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
i) You need to make some entries to the resource bundle: Although you could
edit it directly, it may be easier to change the Text to Update Supplier, using
the resource bundle (use UPDATE_SUPPLIER_TITLE as the key), and then
change it again to New Supplier, using the resource bundle (use
NEW_SUPPLIER_TITLE as the key).
ii) Now that you have the text resources entered in the resource bundle, you can
use them in a conditional expression to define the title based on the parameter.
Enter the following in the Text property (all on one line):
#{pageFlowScope.SupplierAction == 'New' ?
storefrontuiBundle.NEW_SUPPLIER_TITLE :
storefrontuiBundle.UPDATE_SUPPLIER_TITLE}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In addition to changing the display based on what the user clicks on the page, you also
want to change the display depending on what the user clicks in the category tree in the
left region of the containing page. When a user clicks a category in the tree, its
subcategories should appear in the shopping region. If the user clicks a subcategory in the
tree, then the shopping region should display its products.
You accomplish this by defining a contextual event that passes parameters from the
ProductCategory (tree) region to the ShoppingFlow region. First you define task flow
parameters on the ShoppingFlow, and then you enable the category tree to pass
parameters (through the use of a bean) to the Shopping flow. You use a contextual event
to coordinate this interaction between the regions on the main page.
If you successfully completed all sections of the previous practice, you can continue
working in the same project. However, if you prefer to start with a clean application that
contains everything completed up to the start of this lesson, then you need to open
Storefront-18.jws, and edit the database information as described in step 4 of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the previous set of practices, you enabled a different table to appear based on
parameters that were set in the ProductCatalog page. You may wonder why you used
page parameters instead of using the pageFlowScope variables directly. This is because
using parameters enables your page to accept values from outside the task flow as well.
Value
CategoryId
#{pageFlowScope.CategoryId}
CategoryName
#{pageFlowScope.CategoryName}
SubCategoryId
#{pageFlowScope.SubCategoryId}
SubCategoryName
#{pageFlowScope.SubCategoryName}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
to receive values that are set in another region. In this practice, you define input
parameters on the ShoppingFlow task flow as the first step in setting up a contextual
event.
In the remaining practices in this lesson, you use a contextual event to pass values
to these parameters when a node in the category tree is clicked.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
javax.el.ELContext;
javax.el.Expression;
javax.el.ExpressionFactory;
javax.el.MethodExpression;
javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import oracle.adf.model.BindingContext;
import oracle.adf.model.DataControlFrame;
/**
* Provides various utility methods that are handy to
* have around when working with ADF.
*/
public class ADFUtil {
/**
* When a bounded task flow manages a transaction (marked as
* requires-transaction, requires-new-transaction, or
* requires- existing-transaction), then the task flow must
* issue any commits or rollbacks that are needed.
* This is essentially to keep the state of the transaction
* that the task flow understands in synch with the state
* of the transaction in the ADFbc layer.
* Use this method to issue a commit in the middle of a task
* flow while staying in the task flow.
*/
public static void saveAndContinue() {
Map sessionMap =
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
dcFrame.commit();
dcFrame.beginTransaction(null);
}
/**
* Programmatic evaluation of EL.
*
* @param el EL to evaluate
* @return Result of the evaluation
*/
public static Object evaluateEL(String el) {
FacesContext facesContext =
FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext,
el, Object.class);
return exp.getValue(elContext);
}
/**
* Programmatic invocation of a method that an EL evaluates
* to. The method must not take any parameters.
*
* @param el EL of the method to invoke
* @return Object that the method returns
*/
public static Object invokeEL(String el) {
return invokeEL(el, new Class[0], new Object[0]);
}
/**
* Programmatic invocation of a method that an EL evaluates
to.
*
* @param el EL of the method to invoke
* @param paramTypes Array of Class defining the types of the
* parameters
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 262
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
(BindingContext)sessionMap.get(BindingContext.CONTEXT_ID);
String currentFrameName =
context.getCurrentDataControlFrame();
DataControlFrame dcFrame =
context.findDataControlFrame(currentFrameName);
facesContext.getApplication().getExpressionFactory();
MethodExpression exp =
expressionFactory.createMethodExpression(elContext,
el, Object.class, paramTypes);
return exp.invoke(elContext, params);
}
/**
* Sets a value into an EL object. Provides similar
* functionality to
* the <af:setActionListener> tag, except the
* <code>from</code> is
* not an EL. You can get similar behavior by using the
* following...<br>
* <code>setEL(<b>to</b>, evaluateEL(<b>from</b>))</code>
*
* @param el EL object to assign a value
* @param val Value to assign
*/
public static void setEL(String el, Object val) {
FacesContext facesContext =
FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext,
el, Object.class);
exp.setValue(elContext, val);
}
}
6) Right-click anywhere in the code editor and select Make to compile the class.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Generate accessors for these variables using either the toolbar button
(on the
visual editor pane) or use the menu SourceGenerate Accessors. Select the toplevel check box to select all accessors. Click OK to generate the accessors.
2) Add a method named onNodeClicked() that returns a bean with values set based
on the values of the node that the user clicked (you can copy it from
onNodeClicked.txt in the \files subdirectory of your course directory):
/**
* Evaluates the currently selected node in the tree returns a
* bean representing that node.
*
* @return FODCategoryBean with all properties set
*/
public FODCategoryBean onNodeClicked() {
JUCtrlHierNodeBinding node =
(JUCtrlHierNodeBinding)ADFUtil.evaluateEL("#{node}");
Row nodeRow = node.getRow();
JUCtrlHierNodeBinding parentNode = node.getParent();
Row parentRow = parentNode.getRow();
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) JDeveloper prompts you to import the supporting packages. Import the following:
oracle.jbo.Row;
oracle.jbo.domain.Number;
oracle.jbo.uicli.binding.JUCtrlHierNodeBinding;
oracle.storefront.ui.common.ADFUtil
Note: If you are not prompted for the oracle.jbo.domain.Number package, add
it to the imports manually. Otherwise, the code will use the wrong Number class
and you will get errors when you call it.
4) Compile the class and create a data control from it.
a) Right-click anywhere in the code editor and select Make. This compiles the class.
b) Right-click the bean (FODCategoryBean.java) in the Application Navigator and
select Create Data Control, or alternatively just drag the bean from the
Application Navigator to the Data Control panel.
c) Check the Data Controls panel to ensure that the bean was added. If it is not there,
click the refresh icon
on the Application Navigator.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Drag the FODCategoryBean > onNodeClicked() method from the Data Controls
panel to the af:commandLink and select Bind Existing Link.
d) Insert an event inside the event list and set the name property to
FODSelectCategory.
The Binding Structure should look like:
You now have specified that at run time clicking a node in the Category Tree calls the
onNodeClicked() method and raises the FODSelectCategory event.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, you create the method that is used by the consumer of the event. It
handles the information that is passed to the consumer region (the payload) as follows:
Sets the requestScope variables to reflect which Category was selected in the
tree
Encapsulates the requestScope variables in a bean that is used by the
consumer of the event (the ProductCatalog page)
3) JDeveloper prompts you to import the supporting package. Import the following:
oracle.storefront.ui.common.ADFUtil;
4) As you did with the other bean, compile the class and create a data control from it.
The Data Control panel should now look like this:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
The handler method that you defined for the event sets several requestScope variables.
In this practice, you define region parameters to pass these variables into the Shopping
region. The region parameters have the same name as the task flow parameters that you
defined in the first practice for this lesson. So the values come through the event to
requestScope variables and are passed to region parameters. The region parameter
values are passed to the task flow parameters, which in turn set the pageFlowScope
variables that the ProductCatalog page uses to conditionally render tables and
breadcrumbs, as you defined in an earlier practice.
1) One of the tasks accomplished by the refreshCategory() method in the
FODShoppingDashboard bean is to set a Boolean requestScope variable named
refreshLocalArea to true. Set a refresh condition on the ShoppingFlow region to
make use of the value of this variable, so that the region is refreshed only if
refreshLocalArea is set to true.
a) Still in the FODShoppingDashboard page definition (binding tab of the page),
select Executables > ShoppingFlow1 in the Structure window.
b) Set the RefreshCondition to #{requestScope.refreshLocalArea}.
2) Set region parameter values to the requestScope values that are set by the
refreshCategory() method in the FODShoppingDashboard bean.
a) Click the Parameters tab in the Property Inspector. Notice that the task flow
binding parameters are listed.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
That completes building the event map and defining the producer and consumer methods.
Now you need to set the ShoppingFlow to be refreshed based on a requestScope
parameter and to accept the other parameters needed by the ProductCatalog page.
Value
CategoryId
#{requestScope.CategoryId}
CategoryName
#{requestScope.CategoryName}
SubCategoryId
#{requestScope.SubCategoryId}
SubCategoryName
#{requestScope.SubCategoryName}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Modify the getPhaseId() method to return the PhaseId of whatever life cycle
phase being executed with the following code:
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
g) Modify the afterPhase() method to store the view ID when the view is first
restored:
public void afterPhase(PhaseEvent phaseEvent) {
if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW) {
storedViewId =
phaseEvent.getFacesContext().getViewRoot().getViewId();
}
}
h) Modify the beforePhase() method so that just before the page is rendered a
message appears if the current view ID is not the same as the stored view ID:
public void beforePhase(PhaseEvent phaseEvent) {
if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
{
String viewId =
phaseEvent.getFacesContext().getViewRoot().getViewId();
if (storedViewId != null &&
!viewId.equalsIgnoreCase(storedViewId)) {
System.out.println("Changing pages");
}
storedViewId = null;
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 275
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
3) Test the functionality by invoking the application and changing views. Because you
have only one view activity in the application, with all others being part of a region
on the same page, you need to add another page to the application to test it.
a) Open adfc-config and add a view activity called Start.
b) Add a control flow case from Start to FODShoppingDashboard whose fromoutcome is start.
c) Create the Start.jspx page by double-clicking the Start view activity in the
editor.
d) Add a button to the page labeled Start Shopping! and set its Action to start.
e) Run the Start page from the adfc-config diagram.
f) When the page comes up, right-click the JDeveloper log and select Clear.
g) Click Start Shopping!. You should see the message in the log, Changing
pages.
h) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Enter the complete path to the phase listener and the class name:
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In this practice, 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.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) From the Data Controls panel, drag the Commit operation from
FODShoppingCartAMDataControl > Operations to the ShoppingCartFlow
page flow.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Name
FODCommitDeleteBean
Class
oracle.storefront.ui.bean.
FODCommitDeleteBean
Scope
request
4) Complete the ShoppingCart page by adding buttons for Update, Delete, and Details;
these buttons should relate to the rows of the table. Add a panel collection around the
table to contain the buttons.
a) Open the ShoppingCart page fragment.
b) Surround the af:table with a Panel Collection.
c) Insert a Toolbar inside the Panel Collection's toolbar facet.
d) Drag the FODShoppingCartAMDataControl > Commit operation to the
toolbar as an ADF Toolbar Button. This adds the button and also adds the
Commit operation to the page definition.
e) Set the following properties on the toolbar button:
Id
updateMenu
Update
Action
<default>
Disabled
f) Add a second Toolbar Button to the toolbar. This time add it from the
Component Palette, or right-click and select insert inside.
g) Set the following properties on the second toolbar button:
Id
deleteMenu
Delete
Action
<default>
ActionListener
#{FODCommitDeleteBean.onDeleteItem}
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Add a managed bean by clicking the Add (green plus sign) with the following
attributes:
Leave blank
Details
Action
<default>
5) The method you added in the managed bean uses a commit binding and a delete
binding. When you added the commit button from the Data Control panel, JDeveloper
added the commit binding for you. Now manually add the delete binding to the page.
a) Select the Bindings tab in the editor of the ShoppingCart page fragment.
b) In the Bindings section, click Add.
c) In the Insert Item dialog box, select Generic Bindings > action and click OK.
d) In the Create Action Binding dialog box:
i) Expand FODShoppingCartAMDataControl and select ShoppingCart1.
ii) From the Select an Iterator drop-down list, select
ShoppingCartItem1Iterator.
iii) From the Operation drop-down list, select Delete and click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Remove the value from the Label attribute on the Input Text.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
9) Use a pop-up window to display details of the item when a user clicks the Details
button.
a) In ShoppingCart.jsff, drag a Popup from the Component Palette to the
af:panelCollection in the Structure window.
b) Set the following properties on the pop-up:
Id
ProductDetails
ContentDelivery
LazyUncached
ok
Title
#{bindings.ProductName.inputValue}
f) Add a call to the pop-up from the Details button: Click back on the ShoppingCart
page, insert a Show Popup Behavior in the Details button, and set the PopupId
to ProductDetails.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
b) When you have finished, close the browser and undeploy the application as
described in step 6(i) of Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Select the SubmitOrder task flow return and set the End Transaction property
to commit.
d) Select CancelOrder task flow return and set the End Transaction property to
rollback.
2) Test. When you click Commit, any changes you have made to the shipping and
billing information is committed. In a real SOA-integrated application, this could, for
example, commit an order and start some back-end processing.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) On the Behavior panel of the Property Inspector, set the transaction property to
new-transaction. This means that when this flow is called, it starts a new
transaction.
1) Add transaction control to the ManageSupplierFlow task flow as you did with the
ShoppingCartFlow, with commit and rollback functionality.
a) Open ManageSupplierFlow in the editor.
b) In the Structure window, select task-flow-definition ManageSupplierFlow.
c) In the Property Inspector, click the Behavior navigation tab and set transaction
to new-transaction.
d) In the editor, select the Save task flow return and set its End Transaction
property to commit.
e) In the editor, select the Cancel task flow return and set its End Transaction
property to rollback.
f) Save your work.
2) Add the ability to delete a supplier to the BrowseSuppliers page.
a) Open the BrowseSuppliers page in the editor.
b) Check that the table has row selection enabled by selecting af:table in the
Structure window and then clicking Edit
in the Property Inspector. Ensure
that the Row Selection check box is selected.
c) In the Data Control panel, expand FODSupplierAMDataControl > Supplier1 >
Operations and drag the Delete operation to the toolbar in the toolbar facet of
the Panel Header on the page, creating an ADF Toolbar Button and set the
following properties on the button:
Id
ActionListener
deleteSupplier
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This practice is optional because the steps are similar to what you have done
previously. If you choose not to add CRUD functionality for Suppliers, you must
begin the practices for the next lesson by opening the starter application.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
f) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you successfully completed all sections of the previous practice, you can continue
working in the same project. However, if you prefer to start with a clean application that
contains everything completed up to the start of this lesson, then you need to open
Storefront-20.jws, and edit the database information as described in step 4 of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
In the practices for this lesson, you set up the application to use security. You create users
and roles in an identity store, and you assign permissions to roles. You also create login
and error pages. You then use ADF security to manage access to pages, task flows, and
entity objects, and you programmatically access the security context by using global
security expressions and a security proxy bean.
2) Invoke the Configure ADF Security Wizard and configure the application to use ADF
security for both authentication and authorization.
a) With the StorefrontUI project selected in the Application Navigator, select Tools
> Configure ADF Security.
b) On the ADF Security page of the wizard, select the ADF Authentication and
Authorization option, and then click Next.
c) On the Authentication Type page of the wizard, select the Form-Based
Authentication option and the Generate Default Pages check box. Click Next.
d) On the Identity Store page of the wizard, select the Application XML option and
then click Next.
e) On the Automatic Policy Grants page of the wizard, select the Grant to All
Objects option and then click Next.
f) Click Next to skip the Authenticated Welcome page of the wizard without
redirecting to another page (you can change this later, if needed).
g) The Summary page of the wizard displays a list of files that will be changed or
created. Click Finish to create the security configuration.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Examine the existing files in the Descriptors node of the Application Resources
panel.
4) If you look in the file system, you can compare the modified dates to see which files
have been changed.
a) First, look in the .adf > META-INF subdirectory of your application. You can
see that the adf-config.xml file has just been changed.
b) Next, look in the src > META-INF subdirectory of your application. You can
see that all files except for weblogic-application.xml have been changed.
c) Finally, look in the StorefrontUI > public-html > WEB-INF subdirectory
of your application. You can see that web.xml and weblogic.xml have been
changed (actually, weblogic.xml is a new file).
d) Notice that the changed files are the ones that the Summary page of the Configure
ADF Security Wizard reported to be created or changed.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
The default realm name for the optional XML identity store.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Add User dialog box, enter the name (such as DRAPHEAL) and the
crendentials (welcome1), and then click OK.
d) Repeat steps b) and c) for each user; the users appear in the Users list. Instead of
pgamer, you can add your own name if you would prefer to.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Edit JPS Identity & Policy Store dialog box, select Identity Store >
jazn.com > Users in the tree at the left, and then click Add in the Users panel.
SKING
clerk
BERNST
customer
developer
a) With Roles selected in the tree on the left, select the Member Users tab.
b) In the Roles list, select manager.
c) On the Member Users tab, select SKING in the Available list and shuttle to the
Selected list.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Select Roles dialog box, select the check boxes for fod_manager,
fod_clerk, and fod_developer, and then click OK.
Note: If all of the roles do not appear in the Select Roles dialog box, then close
jazn-data.xml and reopen it. The roles should then appear.
d) With the fod_clerk role selected in the Granted to Roles column, select the
View check box in the Actions column.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Select the ManageSupplierFlow task flow, and in the Granted to Roles column,
click Add Application Role
.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the login page, enter a fake username and password, and then click Submit.
Note: When using Internet Explorer, you may receive an HTTP error instead
of seeing the error page.
2) Test authorization.
a) Click the browsers Back button.
b) In the login page, enter the username SKING, a valid user who is not authorized to
use the shopping application. Enter the password welcome1, and then click
Submit. The FODShoppingDashboard page appears, but the shopping application
is not visible. You see data only when you select the Suppliers tab.
Note: If you encounter an error when entering login information after using the
Browsers Back button, then rerun the application.
c) Click the Suppliers tab, and then click the SupplierId in one of the rows. The
supplier detail is shown.
d) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
e) Run the application again and enter credentials for DRAPHEAL, who does have
access to the shopping application. The FODShoppingDashboard page should
then appear with the shopping application visible.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
g) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Edit Security dialog box, enable security on all operations, and then click
OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Roles
Read
fod_user
Update
Delete
fod_clerk, fod_developer
f) Click OK.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Close the browser and run the application again, this time logging in as SKING,
who has the manager role. Click the Suppliers tab. You should see that the
Delete button is disabled. However, when you click New Supplier, or when you
click a supplier ID link, you should be able to navigate to the New Supplier or the
Update Supplier window.
f) Close the browser and undeploy the application as described in step 6(i) of
Practice 2-4.
g) Run the application again, this time logging in as BERNST, who has the clerk
role, or as PGAMER, who has the developer role. Click the Suppliers tab. You
should see that the Delete button is now enabled. Also, when you click New
Supplier, or when you click a supplier ID link, you should be able to navigate to
the New Supplier or the Update Supplier window.
h) Close the browser and undeploy the application.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Click the Suppliers tab. You should notice that the Delete button is disabled.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Add the following code just above the closing right brace:
e) Select isUserInRole from the Method drop-down list and enter customer as the
Value. Click Execute. You should see the Return value of true.
f) Change the Value to manager and click Execute. The Return value should be
false.
g) Close the Business Component Browser.
h) If you would like to do so, you can run the Application Module again and test
users that are in different roles. Close the Business Component Browser after each
test.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Select getUserName from the Method drop-down list and click Execute. You
should see the Return value of DRAPHEAL.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) You know that customers do not have the view permission for the
ManageSupplierFlow task flow. Set a property on the button that invokes that task
flow so that it does not appear for customers.
4) Ensure that the button appears if authentication security is not enabled. Instead of
using a global security expression, write a security proxy bean to check the security.
Name the bean FODSecurityBean.
a) Create a new Java class in your oracle.storefront.ui.bean package with the
following code (you can copy the code from SecurityBean.txt in the \files
subdirectory):
package oracle.storefront.ui.bean;
import oracle.adf.share.ADFContext;
public class FODSecurityBean {
public FODSecurityBean() {
}
public boolean isAuthorizationEnabled() {
return
(ADFContext.getCurrent().getSecurityContext().isAuthorizati
onEnabled());
}
}
Value
Name
FODSecurityBean
Class
oracle.storefront.ui.bean.FODSecurityBean
Scope
request
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) Click the New Supplier button and set the Rendered property to
#{securityContext.taskflowViewable['']}, and then paste the
complete task flow name between the single quotation marks.
c) Test the functionality as before, making sure that the button appears for clerks,
managers, or developers, and that it does not appear for customers.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
to
String userPrincipal;
if
(ADFContext.getCurrent().getSecurityContext().isAuthorizati
onEnabled())
userPrincipal = getUserName();
else
userPrincipal = "DRAPHEAL";
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
If you choose to work on this practice, start with a clean application by opening
Storefront-A.jws and editing the database information as described in step 4 of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This practice is optional and does not affect any of the other practices. You should
work on it only if you have extra time.
c) Expand the FOD node to view the types of database objects that the schema
contains.
2) Create a new database diagram named FODSchema and put it in the
oracle.fod.storefront.design package.
a) In the Application Navigator, right-click the StorefrontModel project and select
New from the context menu.
b) In the New Gallery:
i) Expand the General node if it is not already expanded.
ii) Select Diagrams.
iii) In the Items panel, select Database Diagram.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the Specify Location dialog box, change the offline database name to FodDB
and then click OK to copy the database objects to the new offline database in
your project and to place them on your diagram.
d) The two tables are depicted on your diagram. Notice that the table icon has two
compartments. The top compartment displays the column names and their data
types, and the bottom compartment displays information about primary and
foreign keys. Your diagram should look something like the screenshot below.
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 313
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) You can modify column information in the diagram, although you shouldnt
modify any of the table information at this time. To modify column information,
you can click a column in the Orders table to select it, and then click again. You
can modify the name, data type, and size of the column on the diagram.
Alternatively you can double-click the table itself to invoke the Edit Table dialog
box, where you can make more detailed modifications to columns and other table
information. Again, dont modify any columns for this practice.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) In the Component Palette, ensure that Database is selected from the drop-down
list at the top. The list below it now displays components suitable for adding to a
schema diagram.
c) In the Component Palette, select Table and drag it onto the schema diagram.
d) In the Specify Location dialog box, accept the default location of the FodDB
offline database and click OK.
e) In the name area at the top of the table icon, type Shippers.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Ensure that the Component Palette is visible to the right of the diagram. If it is
not, select View > Component Palette.
ii) In a similar fashion, add a Shipper_Name column, with the default values
for data type and size. This is not a mandatory column.
iii) In the list at the left of the Edit Table dialog box, select Primary Key and set
the primary key as follows:
(1) Select SHIPPER_ID in the Available Columns list.
(2) Click Add
2) Generate the DDL for adding the new table to the database, but do not actually add
the table.
a) Right-click the SHIPPERS table in the diagram, and from the context menu
select Synchronize with Database > Generate To > SQL Script (you can also
choose to generate to FOD, which brings up the same dialog box with different
default options that you can change.)
Oracle Fusion Middleware 11g: Build Applications with ADF I C - 316
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
iii) Choose the SQLScript option in the Specify Target page, and click Next.
iv) The Object Picker page should show SHIPPERS in the Selected list. Click
Next.
v) In the Choose Operation page, select the Create option and click Next.
vi) In the SQL Script Options page, change the name of the SQL file to
CreateShippersTable.sql and click Next.
vii) Click Finish to generate the script.
c) When the wizard is complete, the script file opens in a SQL worksheet. Examine
the file contents.
d) Do not run the script, but note that to run the script you can right-click the script
and choose Run Script from the context menu, or click Run Script .
e) Save your work.
f) When you have finished, close the script file and the database diagram. To close
all the open windows at once, right-click one of the tabs and select Close All.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
ii) On Specify Source page, check the location of the objects to be generated in
the Specify Source page, and then click Next.
If you choose to work on this practice, start with the completed application by opening
Storefront-B.jws and editing the database information as described in step 4 of
Practice 2-4.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
This practice is optional and does not affect any of the other practices. You should
work on it only if you have extra time.
b) In the New Gallery, select General > Deployment Profiles > WAR File.
c) In the Create Deployment Profile dialog box, enter a Deployment Profile Name of
myStorefrontUI and click OK.
d) In the Edit WAR Deployment Profile Properties dialog box, select the Specify
Java EE Web Context Root option and enter a context root of Storefront.
e) Click OK twice.
2) Create a deployment profile named myStorefront for the application, specifying
that it should contain the myStorefrontUI WAR file and the JAR file for the
StorefrontModel project.
a) Invoke the Application menu and select Application Properties.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) In the Application Navigator, select the StorefrontUI project, and then select File
> New.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) From the Windows Start menu, select Programs > Oracle Fusion Middleware >
User Projects > MyWLS_domain > Admin Server Console. The console
application deploys and then runs.
Note: If the Administration Server Console does not run, then make sure that the
WebLogic Server is running. If it is not running, invoke the same menu except
select as the final item Start Admin Server for WebLogic Server Domain.
After the server has started, you can minimize the startWebLogic command
window.
b) Log in to the Administration Server Console with the user name of weblogic
and the password of weblogic.
c) In the Domain Structure menu at the left of the window, expand the Services and
JDBC nodes, and then select the Data Sources node.
Value
Name
FODLocal
JNDI Name
jdbc/FODDS
Database Type
Oracle
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
1) Set up a data source named FODLocal in the basic_domain domain of the standalone Oracle WebLogic Server, setting the JNDI name to jdbc/FODDS. Set other
properties so that it connects to the same schema that you have been using.
Database Driver
Database Name
XE
Host Name
localhost
Port
1521
Password
fusion
f) On the next page of the wizard, click Test Configuration. If the test is successful,
click Next (do not click Finish).
g) On the next page of the wizard, select the AdminServer check box as a target to
deploy the data source, and then click Finish. You should receive a message that
the changes are activated, and your new data source should be listed.
2) Configure the application modules to use the data source, rather than the JDBC URL
connection that you have been using.
a) In the JDeveloper Application Navigator, right-click the FODCategoryAM
application module and select Configurations.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Value
Configuration Name
Connection Type
JDBC DataSource
Datasource Name
Java:comp/env/jdbc/FODDS
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
d) Click OK twice.
iii) Repeat steps i) and ii) for all five application server data control usages.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Value
Connection Name
myWLS
Password
weblogic
Deploy Password
Checkbox selected
Port
7001
WLS Domain
myWLS_domain
d) On the last page of the wizard, click Test, and then click Finish if the connection
is successful.
e) The connection appears in the Application Server Navigator. Expand the myWLS
and deployments nodes so that you can see what is already deployed.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
b) Right-click the Application Servers node and select New Application Server.
The log window displays deployment messages. It may take a few minutes to
finish the deployment; wait until the window displays the message that the
deployment is finished.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
a) Invoke the Application menu and select Deploy > myStorefront > to > myWLS.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
e) Select the Install this deployment as an application option and click Next.
f) Select the Copy this application onto every target for me option and click
Next.
g) Select the option Yes, take me to the deployment's configuration screen and
click Finish.
h) Review the configuration options, but do not change them. Click Save.
i) Click back to Deployments on the menu. You should see that the application is
deployed.
3) Test the deployment as you did above.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
c) In the log file, make note of the location of the EAR file.