Adf Sample Application Essay

Once you have opened the projects in JDeveloper, you can then begin to review the artifacts within each project. The development environment for the core Summit ADF sample application is divided into two projects: the project and the project.

The project contains the classes that allow the product data to be displayed in the web application. Figure 2-5 shows the project and its associated directories.

The project contains the files for the web interface, including the backing beans, deployment files, and JSF and JSFF files. Figure 2-6 shows the project and its associated folders.

2.3.2.1 Browsing the Application

Start the core Summit ADF sample application by running the page in the project. For details about running the application using the default target, , see Section 2.3, "Running the Core Summit ADF Sample Application in the SummitADF Workspace."

The page is organized by an ADF page template which provides the structure for the page and contains uses an component to identify the page fragments to display in each of the tab panels.

When you enter the Summit ADF website, the site opens on the index page with three tabs displayed: Welcome, Summit Management, and Inventory Control. Click on each tab to view the separate page fragments referenced as regions by the index page.

The Summit Management region is the main region where you can browse the list of customers and their orders. This regions is defined by the page fragment and is itself organized by ADF Faces components that provide tabbed panels. The Browse and Search panels are one component and the Customer, Order, and Order Dashboard panels belong to another component.

Figure 2-7 shows the index page with an order displayed in the Summit Management region.

Figure 2-7 Index Page with Multiple Regions


Where to Find Implementation Details

Following are the sections of Developing Fusion Web Applications with Oracle Application Development Framework that describe how to create a databound web page:

  • Providing the structure for the web page

    The index page separates features of the site into regions that are implemented using a combination of ADF Faces templates and JavaServer Faces (JSF) page fragments. ADF Faces templates and the fragments allow you to add ADF databound components. For information about the steps you perform before adding databound user interface components to a web page, see Section 26.1, "About Developing a Web Application with ADF Faces."

  • Displaying data in a web page

    To support data binding, the featured items on the tabbed Customers page fragment of the Summit Management region use EL (Expression Language) expressions to reference ADF data control usages in the declarative ADF page definition file. The page definition file, which JDeveloper creates for you when you work with the Data Controls panel to drag and drop databound ADF Faces components, is unique to each web page or page fragment. The ADF data control usages enable queries to the database and ultimately works with the JSF runtime to render the databound ADF Faces components, such as the ADF Faces image component used to display customer details such as their name and phone number from the table. For information about creating a databound web page that references the ADF page definition file, see Section 28.1, "About Creating a Basic Databound Page."

  • Designing the user interface using a variety of components

    JDeveloper allows you to create databound components declaratively for your JSF pages, meaning you can design most aspects of your pages without needing to look at the code. By dragging and dropping items from the Data Controls panel, JDeveloper declaratively binds ADF Faces UI components and ADF Data Visualization graph components to attributes on a data control using an ADF binding. For more information, see Section 35.1, "About ADF Data Visualization Graph and Gauge Components."

  • Managing entry points to the application

    The page fragments of the index page are supported by individual ADF task flows. In general, the Fusion web application relies on this ADF Controller feature to define entry points to the application. When your application uses more than one page, you define an unbounded task flow to control the entry point of the application. JDeveloper helps you to create task flows with visual design elements that you drag and drop from the Components window. For more information about specifying the entry points to the application using an ADF unbounded task flows, see Section 20.1, "About ADF Task Flows."

2.3.2.1.1 Browsing the Customers List

To view the list of customers, click the Browse tab and in the Customers tree, expand a country node to view the list of customers for that country. The customers list is layed out with collapsing nodes organized by an ADF Faces component. The dropdown menu on the tree component lets you choose to organize the branches by country or by sale representative. The nodes of the tree display data from the database corresponding to the name and ID of each customer.

Figure 2-8 shows the tree expanded with a customer node selection.

Figure 2-8 Databound Tree Component Displays Customer Names and ID


Where to Find Implementation Details

Following are the sections of Developing Fusion Web Applications with Oracle Application Development Framework that describe how to develop the components used to support browsing product details:

  • Triggering an action to display data

    To display data from the data model, user interface components in the web page are bound to ADF Model layer binding objects using JSF Expression Language (EL) expressions. For example, when the user expands a country node in the Customers tree to display the list of customers for that country, the JSF runtime evaluates the EL expression for the UI component and pulls the value from the ADF Model layer. At design time, when you work with the Data Controls panel to drag an attribute for an item of a data collection into you web page, and then choose an ADF Faces component to display the value, JDeveloper creates all the necessary JSF tag and binding code needed to display and update the associated data. For more information about the Data Controls panel and the declarative binding experience, see Section 17.1, "About Using ADF Model in a Fusion Web Application."

2.3.2.1.2 Searching for Customers

To search the customer list, click the Search tab in the Summit Management region. When you click the tab, the Browse panel changes to allow you to enter a search criteria in the query search form and view the search results in the table below. The layout of the search panel is defined by an ADF Faces component.

You use the input fields on the Search form to perform a simple keyword search against the attributes common to all customers, such as customer names or cities. For example, you might query the database for the list of customers that begin with a particular letter.

Figure 2-9 shows the search results returned for the customers residing in a city that begins with "S".

Figure 2-9 Query Search Component Filters Customer List


Where to Find Implementation Details

Following are the sections of Developing Fusion Web Applications with Oracle Application Development Framework that describe how to define queries and create query search forms:

  • Defining the query for the search form to display

    A query is associated with an ADF Business Components view object that you create for the data model project to define a particular query against the database. In particular, a query component is the visual representation of the view criteria defined on that view object. If there are multiple view criteria defined, each of the view criteria can be selected from the Saved Search dropdown list. These saved searches are created at design time by the developer. When the query associated with that view object is executed, both view criteria are available for selection. For more information, see Section 33.1, "About Creating Search Forms."

  • Creating a search form

    You create a query search form by dropping a named view criteria item from the Data Controls panel onto a page. You have a choice of dropping only a search panel, dropping a search panel with a results table, or dropping a search panel with a tree table. For more information, see Section 33.2, "Creating Query Search Forms."

  • Displaying the results of a query search

    Normally, you would drop a query search panel with the results table or tree table. JDeveloper will automatically wire up the results table or tree table with the query panel. If you drop a query panel by itself and want a separate results component, you can set the query component's attribute to the relative expression of the results component. For more information, see Section 33.2.3, "How to Create a Query Search Form and Add a Results Component Later."

2.3.2.1.3 Viewing Customer Details

To begin browsing the orders for a customer, click the Summit Management tab and make a selection in the expanded Customers tree from the Browse tab or Search tab. This action changes the details displayed in the Summit Customer Management tab to display details about the selected customer.

In the Customer details tab you can collapse and expand the panels to view various details of the selected customer. The first three panels display input forms consisting of individual input fields corresponding to the customer details. The customer you select also has one or more orders displayed in the Orders panel as a table, where each row comprises a single order and its details.

This relationship between a customer and their orders represents a business object relationship known as master and detail. In this case, the master, or parent object, can have many detail rows, or child objects. In turn the business objects in the core Summit ADF sample application, correspond to the and tables in the database.

The table of orders is defined by an ADF Faces component. You can sort the table rows by clicking the sort buttons in any cell of the table header.

Figure 2-10 shows the customers page fragment with the details of the customer displayed in the top portion and the list of orders specific to the customer in the bottom portion.

Figure 2-10 Customers Page Fragment with Orders List


Where to Find Implementation Details

Following are the sections of Developing Fusion Web Applications with Oracle Application Development Framework that describe how to use tables and forms to display master-detail related objects:

  • Dragging and dropping master and detail components

    You can create pages that display master-detail data using the Data Controls panel. The Data Controls panel displays master-detail related objects in a hierarchy that mirrors the one you defined in the data model for the ADF application module, where the detail objects are children of the master objects. All you have to do is drop the collections on the page and choose the type of component you want to use. For example, in the core Summit ADF sample application, the page fragment displays the master list of customer categories in an component and displays the detail list of orders in an component. For more information about the data model, see Section 17.3, "Exposing Application Modules with ADF Data Controls." For more information about various types of pages that display master-detail related data, see Section 31.1, "About Displaying Master-Detail Data."

  • Sorting data that displays in tables

    When you create an ADF Faces table component you bind the table to the complete collection or to a range of data objects from the collection. The specific components that display the data in the columns are then bound to the attributes of the collection. The iterator binding handles displaying the correct data for each object, while the table component handles displaying each object in a row. You can set the Sort property for any column when you want the iterator to perform an order-by query to determine the order. You can also specify an clause for the query that the view object in the data model project defines. For more information about binding table components to a collection, see Section 29.1, "About Creating ADF Databound Tables." For more information about creating queries that sort data in the data model, see Section 5.2, "Populating View Object Rows from a Single Database Table."

2.3.2.1.4 Viewing Order Details

To update the details of an existing order, select an order from the Orders table displayed in the Customer tab and click the Order tab. The Order tab displays the same data that appeared in the row you selected, but organized as an edit form with fields that you can update. To change the order status, for example, you can select a choice from the OrderFilled radio button. The selection you make on the ADF Faces component updates the corresponding table column.

Figure 2-11 shows the Order page fragment with Order 1075 selected in the Customer details tab. Data for Order 1075 in both the order form and the Customer details tab are coordinated by the application to reflect changes in the database. Change the status of OrderFilled to Yes, and return to the Customer details tab to verify that the status is consistent.

Figure 2-11 Orders Page Fragment Displays Order Details


Other types of data, such as dates and currency, can be displayed using ADF Faces components to handle formatting of the values. Figure 2-12 shows the Order page fragment with a system error that enforces date formats that have been defined on the attribute underlying the Date Shipped field.

Figure 2-12 Orders Page Fragment Displays Format Mask Error


Validation rules based on Groovy calculated expressions can be defined on data updates. Figure 2-13 shows the Order page fragment with a validation error that calculates the customer's credit score before allowing a Payment Type of CREDIT to be selected.

Figure 2-13 Orders Page Fragment Displays Payment Type Validation Error


Where to Find Implementation Details

Following are the sections of Developing Fusion Web Applications with Oracle Application Development Framework that describe how to create edit forms:

  • Creating a databound edit form

    When you want to create a basic form that collects values from the user, instead of having to drop individual attributes, JDeveloper allows you to drop all attributes for an object at once as an input form. You can create forms that display values, forms that allow users to edit values, and forms that collect values. For example, in the core Summit ADF sample application, the page fragment displays a form to display order information. For more information, see Section 28.6, "Creating a Form to Edit an Existing Record."

  • Requiring values to complete a form

    The input form displays attributes of a data collection that you drop from the Data Controls panel. You can set the property of individual components in the form to control whether an attribute value is mandatory. For details about how to customize the property, see Section 28.2, "Creating Text Fields Using Data Control Attributes." Alternatively, you can set a display control hint property directly on the attribute where it is defined by an ADF Business Components entity object. The entity object is a data model component that represents a row from a specific table in the database and that simplifies modifying its associated attributes. For details about using control hints to make an attribute mandatory, see Section 4.10, "Setting Attribute Properties."

  • Defining a list of values for selection lists

    Input forms displayed in the user interface can utilize databound ADF Faces selection components to display a list of values (LOV) for individual attributes of the data collection. To facilitate this common design task, ADF Business Components provides declarative support to specify the LOV usage for attributes in the data model project. For example, in the core Summit ADF sample application, the component for the payment type field displayed in the page fragment is bound to an LOV-enabled attribute configured for the view object. For more information about configuring attributes for LOV usage, see Section 5.12, "Working with List of Values (LOV) in View Object Attributes."

  • Defining format masks for forms

    Format masks help ensure the user supplies attribute values in the required format. To facilitate this task, ADF Business Components provides declarative support known as control hints for attributes in the data model project. For example, in the core Summit ADF sample application, the attribute for the view object used to specify the date shipped is configured with a format mask hint and enforced in the page fragment . For information on defining format masks for input form components, see Section 5.13, "Defining UI Hints for View Objects."

  • Defining validation rules for data updates

    Validation rules help ensure the user supplies attribute values that meet particular business needs. To facilitate this task, ADF Business Components provides declarative validation for attributes in the data model project. For example, in the core Summit ADF sample application, the attribute for the entity object used to specify the payment type is configured with a validation rule and enforced in the page fragment . For information on defining validation rules for attributes of entity objects and view objects, see Chapter 11, "Defining Validation and Business Rules Declaratively."

2.3.2.2 The Ordering Process

Creating a new customer order requires a database transaction that involves updating the records of the customer's order while decreasing the quantity of products remaining in the Summit inventory. When you click New on Customer page above the list of orders, the site creates a new order form with only the date displayed.

Figure 2-14 shows the new order form with no products added.

Figure 2-14 Order Page Fragment Displays New Empty Order


To create the order, click New above the empty list of products. Then, next to the ProductId field, click the Search icon. The component launches the popup window that you can use to search the database for the product. To make searching easier, the popup window displays a limited number of fields from the table, including product ID and product Name. This type of filtering for display at runtime is performed by the ADF data binding that backs the databound component.

Select a product in the popup window and click OK. The Order tab updates to display the selection in the product table.

Figure 2-15 shows the Order tab with an order comprising a single product.

Figure 2-15 Order Page Fragment DIsplays Order Entry


To complete the order enter the ID of a sales representative and then click the Commit button in the top right corner of the Summit Customer Management page. This updates the database with the new order detail and reduced product inventory.

To visualize the customer's order history, click the Orders Dashboard tab. The dashboard displays various graphs using ADF Faces DVT components. The Shipping Time graph is an component. This component relies on information that is calculated only when the order ship date is updated; the data to display is not obtained from a database table since it must be determined at runtime. To display the Shipping Time data the bar graph relies on an ADF Business Components method call to return the number of days for shipping for each order.

Figure 2-16 shows dashboard information for three orders made by the Acme Sporting Goods company.

Figure 2-16 Order Page Fragment Displays Dashboard Details


To visualize how orders affect the product inventory, click the Inventory Control tab, next to the Summit Management tab. The Inventory Control page displays only those products that are below the reorder threshold. The low stock is displayed both visually with the component and in table format with the component. Select an item from the low stock carousel and notice that the table updates to make the selected item the current row. The current row in a table is the one that is highlighted. These two components are synchronized through the ADF data binding layer with a Java method call that is executed when the carousel selection is made.

Figure 2-17 shows the inventory status of item 13 out of 26. The current row selection in the low stock table reflects the selection displayed in the inventory carousel.

Figure 2-17 Inventory Control Page Fragment Displays Low Stock Items


Where to Find Implementation Details

Following are the sections of Developing Fusion Web Applications with Oracle Application Development Framework that describe how to develop database forms like the ones used to update the database in the Orders and Inventory Control page fragments:

  • Triggering data updates with command components

    To support data updating, the Orders page fragment of the Summit Management region uses command components represented as components to allow users to execute specific ADF data control operations in the declarative ADF page definition file. The built operations of the ADF data control enable you to declaratively handle common form functions such as navigating between records and committing changes to a database. Most operations are available for individual data collections in a data control. The Commit and Rollback operations are available on the whole data control. By dragging and dropping an operation from the Data Controls panel, you are prompted to choose what kind of command component to create, such as a button or a link. For information about triggering built-in operations, see Section 28.4, "Creating Command Components Using Data Control Operations."

  • Triggering backing bean method calls with command components

    To support operations that may require custom logic to handle an interaction with the database, the InventoryControl page fragment of the Summit Management region uses the on the components to trigger a custom method defined on the backing bean . When you select an item in the carousel, the action listener triggers the backing bean method which updates the current row for the component iterator binding. For details about executing Java code in backing beans, see Section 34.3.1, "How to Create a Databound Carousel Component."

  • Keeping track of transient session information and triggering business component method calls

    When you create a data model project that maps attributes to columns in an underlying table, your ADF view objects can include transient attributes that display calculated values (for example, using Java or Groovy expressions) or that are value holders. For example, in the core Summit ADF sample application, the Orders Dashboard tab on the page fragment displays the value of the attribute calculated by the expression defined on the view object. The expression invokes a method on the client interface for the view row. For more information about defining transient attributes in the data model project, see Section 4.11, "Adding Transient and Calculated Attributes to an Entity Object." For more information about implementing custom Java methods in view objects, see Section 13.9.3, "How to Generate Client Interfaces for View Objects and View Rows."

This chapter describes how to run the StoreFront module of the Fusion Order Demo (FOD) application created as a sample to demonstrate the use of the Fusion web application technology stack to create transaction-based web applications as required for a web shopping storefront. Details about the schema and features that implement the Fusion Order Demo application are also provided. The demonstration application is used as an example throughout this guide to illustrate points and provide code samples.

Before examining the individual components and their source code in depth, you may find it helpful to install and become familiar with the functionality of the Fusion Order Demo application.

2.1 Introduction to the Oracle Fusion Order Demo

In this sample application, electronic devices are sold through a storefront-type web application. Customers can visit the web site, register, and place orders for the products. In order to register customers and fulfill orders, currently only a single application is in place. In a future release, several applications, will cooperate. For a detailed description of how the application works at runtime, see Section 2.5, "Taking a Look at the Fusion Order Demo Application."

In order to view and run the demo, you need to install Oracle JDeveloper 11g. You then need to download the application for this demonstration. Instructions to complete these tasks appear in this chapter. For complete details, see Section 2.2, "Setting Up the Fusion Order Demo Application."

Once the application is installed and running, you can view the code using Oracle JDeveloper. You can view the application at runtime by logging in as an existing customer and placing an order.

2.2 Setting Up the Fusion Order Demo Application

The Fusion Order Demo application runs using an Oracle database and Oracle JDeveloper 11g. The platforms supported are the same as those supported by JDeveloper.

To prepare the environment and run the Fusion Order Demo application, you must:

  1. Install Oracle JDeveloper 11g and meet the installation prerequisites. The Fusion Order Demo application requires an existing Oracle database. For details, see Section 2.2.1, "How to Download the Application Resources."

  2. Install the Fusion Order Demo application from the Oracle Technology Network. For details, see Section 2.2.2, "How to Install the Fusion Order Demo Schema."

  3. Install Mozilla FireFox, version 2.0 or higher, or Internet Explorer, version 7.0 or higher.

  4. Run the application on a monitor that supports a screen resolution of 1024 X 768 or higher. For details, see Section 2.3, "Running the Fusion Order Demo Application StoreFront Module."

2.2.1 How to Download the Application Resources

The Fusion Order Demo application requires an existing Oracle database. You run the Fusion Order Demo application using Oracle JDeveloper 11g.

Do the following before installing the Fusion Order Demo application:

2.2.2 How to Install the Fusion Order Demo Schema

You can download the Fusion Order Demo application from the Oracle Technology Network (OTN) web site.

To download the demo and install the FOD schema to your database:

  1. Navigate to and download the ZIP file to a local directory.

  2. Start Oracle JDeveloper 11g and from the main menu choose File > Open.

  3. In the Open dialog, browse to the location where you extracted the ZIP file to in Step 1 and select Infrastructure.jws from the infrastructure directory. Click Open.

  4. In the Application Navigator, expand MasterBuildScript and then Resources, and double-click build.properties.

  5. In the editor, modify the properties shown in Table 2-1 for your environment.

    Table 2-1 Properties Required to Install the Fusion Order Demo Application

    PropertyDescription

    The root directory where you have Oracle JDeveloper 11g installed. For example:

    The base JDBC URL for your database in the format . For example:

    The port for your database. For example:

    The SID of your database. For example:

    or

    The administrative user for your database. For example:

    The table space name where FOD users will be installed. For example:


  6. From the JDeveloper main menu, choose File > Save All.

  7. In the Application Navigator, under the Resources node, right-click build.xml and choose Run Ant Target > buildAll.

  8. In the Enter Property dialog, enter the password for the database system user and click Continue.

    Once you enter the password, the Ant build script creates the FOD users and populates the tables in the FOD schema. In the Apache Ant - Log window, you will see a series of SQL scripts and finally:


    For more information on the demo schema and scripts, see the file in the project.

2.2.3 Overview of the Fusion Order Demo Schema

Figure 2-1 shows a simplified representation of the schema for the Fusion Order Demo application. The blue shapes in the diagram represent the four core tables. The other tables and views are shown as yellow shapes that sometimes represent several tables to help simplify the diagram. Some of the tables use sequences, but only those used by the core tables are shown.

Figure 2-1 Schema Diagram for the Fusion Order Demo Application


The core tables represented by the blue diagram elements include:

  • : This table stores all the users who interact with the system, including customers, staff, and suppliers. The first and last name, email address, and person type code of each user is stored. A user is uniquely identified by an ID. Other IDs provide foreign keys to tables with address information and, in the case of customer's, membership information.

  • : This table represents activity by specific customers. When an order is created, the date of the order, the total amount of the order, the ID of the customer who created it, and the status of the order are all recorded. After the order is fulfilled, the order status and order shipped date are updated. All orders are uniquely identified by a sequence-assigned ID.

  • : For each order, there may be many order items recorded. The unit price and quantity of each order item are recorded. The order line item and its order ID uniquely identify each order item.

  • : This table stores all of the products available in the store. For each product, the name and cost are recorded. All products are uniquely identified by a sequence-assigned ID. The image of the product and its description are stored in separate tables, which each reference the product ID. The columns are reserved for future use with descriptive flexfields (commonly required by Oracle E-Business Suite schema).

The sequences that the core tables use include:

  • : Populates the ID for for each new person.

  • : Populates the ID for each new order.

  • : Populates the ID for each new order item.

  • : Populates the ID for each product.

The PL/SQL package contains a procedure used to illustrate a simple example of how to set per-user database state from inside an application module.

Note the view is reserved for future use and is not currently used in the Fusion Order Demo.

To support tracking of change history in the Fusion Order Demo, every table contains the history column , , , , and , as shown in Figure 2-2.

Figure 2-2 History Columns for Tables in FOD Schema


2.2.3.1 Translation Support in the Fusion Order Demo Schema

To support localization of the Fusion Order Demo, the table lists all available languages. In this table, only one row will have the set to corresponding to the current user's language.

Translations exist for the following base tables: , , , and .

Taking the Shipping Options group, as shown in Figure 2-3: is fully populated so that each product has one row for each language. The column holds the translation language identifier. The entry itself may not yet be translated, in which case the column holds the language that the entry is currently in. When a value has been translated, and will hold the same value. The PL/SQL package creates the custom variable that specifies the runtime locale used to pull the correct translations from into the view along with the table data. Each order has one set of Shipping Options associated with it.

Figure 2-3 Shipping Options Grouping for the Fusion Order Demo Schema


2.2.3.2 Lookup Tables in the Fusion Order Demo Schema

The code lookup table table contains codes that are used throughout the Fusion Order Demo application. For example, the table contains the columns , , and . These codes have corresponding rows in the table, discriminating on the column. Foreign keys are not defined for these rows, but instead are enforced in the user interface by populating user interface components with values for a particular lookup type. For example, when creating a new registration (also known as a person) in the user interface, the values that can be used for the are populated in a dropdown list from the values with .

The table also supports the localization of the user interface. The table uses a combined key of code and language (obtained from runtime locale or preference) to determine the code's meaning. Each code has an entry for each supported language, as described in Section 2.2.3.1, "Translation Support in the Fusion Order Demo Schema."

Using addresses as an example, as shown in Figure 2-4: uses an intersection to accommodate multiple address information. In addition uses to store both and information, returning the (see table extract in Figure 2-5). directly accesses to look up and use the associated with the stored in . The table also directly stores by a direct lookup to .

Figure 2-4 LOOKUP_CODES Usage in the Fusion Order Demo Schema


The correct translation is applied by using the columns in both and with the runtime locale/preference.

Figure 2-5 LOOKUP_CODES Sample Data in the Fusion Order Demo Schema


The lookup table defines the various options within the Fusion Order Demo application that are switched on. It also caches general configuration information such as email addresses and phone numbers to use as overrides in this demonstration scenario (for example, where email addresses are fictitious). This table is reserved for future use.

2.3 Running the Fusion Order Demo Application StoreFront Module

The Fusion Order Demo application consists of a web user interface and a business components layer. Specifically, the following projects are part of the Fusion Order Demo application:

  • : Provides access to the storefront data and provides transaction support to update data for customer information and orders.

  • : Provides web pages that the customer uses to browse the storefront, place orders, register on the site, view order information, and update the user profile.

You run the StoreFront module of the Fusion Order Demo application in JDeveloper by running the page in the project. The project uses JavaServer Faces (JSF) as the view technology, and relies on the ADF Model layer to interact with ADF Business Components in the project. To learn more about the Fusion Order Demo application and to understand its implementation details, see Section 2.5, "Taking a Look at the Fusion Order Demo Application."

A second module of the Fusion Order Demo application is available to process the orders that you place using the StoreFront module. For example, the WebLogic Fusion Order Demo module uses various internal and external applications, including a customer service application, a credit validation system, and both an internal vendor and external vendor. These composite services are the subject of another developer's guide and are not addressed in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework. For details about the WebLogic Fusion Order Demo module used to demonstrate the capabilities of Oracle SOA Suite, see the Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.

You cannot run the WebLogic Fusion Order Demo module in JDeveloper. When you want to integrate the storefront portion with the composite services portion of the application, you must deploy the Fusion Order Demo application to a SOA-enabled Oracle WebLogic Server. Instructions to deploy any SOA web application to Oracle WebLogic Server, are addressed in the Fusion Order Demo home page on OTN at this link .

The easiest way to run the Fusion Order Demo application is to open only the StoreFront module in JDeveloper and run the page in the project.

To run the StoreFront module of the Fusion Order Demo application:

  1. Open the application in Oracle JDeveloper:

    1. From the JDeveloper main menu, choose File > Open.

    2. Navigate to the location where you extracted the demo ZIP file to and select the StoreFrontModule.jws application workspace from the StoreFrontModule directory. Click Open.

      Figure 2-6 shows the Application Navigator after you open the file for the application workspace. For a description of each of the projects in the workspace, see Section 2.5, "Taking a Look at the Fusion Order Demo Application."

      Figure 2-6 The Fusion Order Demo Projects in Oracle JDeveloper


  2. In the Application Navigator, click the Application Resources accordion title to expand the panel.

  3. In the Application Resources panel, expand the Connections and Database nodes.

  4. Right-click FOD connection and choose Properties.

  5. In the Edit Database Connection dialog, modify the connection information shown in Table 2-2 for your environment.

    Table 2-2 Connection Properties Required to Run the Fusion Order Demo Application

    PropertyDescription

    Host Name

    The host name for your database. For example:

    JDBC Port

    The port for your database. For example:

    SID

    The SID of your database. For example:

    or


    Do not modify the user name and password fod/fusion. These must remain unchanged. Click OK.

  6. In the Application Navigator, right-click StoreFrontService and choose Rebuild.

  7. In the Application Navigator, right-click StoreFrontUI and choose Run.

    The Configure Default Domain dialog displays the first time you run the application and start a new domain in Integrated WebLogic Server. Use the dialog to define an administrator password for the new domain. Passwords you enter can be eight characters or more and must have a numeric character.

    The page within the project is the default run target. When you run the default target, JDeveloper will launch the browser and display the Fusion Order Demo application home page.

Once the home page appears, you can browse the web site as an anonymous user, or you can choose to log in and place orders (may require registering as a customer first). Because the Fusion Order Demo application implements ADF Security to manage access to Oracle Application Development Framework (Oracle ADF) resources, only the authenticated user will be able to view orders in their cart. Table 2-3 shows the users who are authorized as members of the role to log into the Fusion Order Demo application.

Note:

The Fusion Order Demo application ships with predefined user data. The schema for the application defines different types of users including customer, supplier, and staff types. All users are members of the role and are authorized to log in. However, only is the user type (customer). When you log in as any other user, you will need to register as a customer before you can place an order. These additional users were created to support roles in other modules of the Fusion Order Demo application.

Table 2-3 Supplied Users in the Fusion Order Demo Application

UsernamePasswordApplication RoleNotes

Can add items to cart, check out, and view order information. This is the only user who is preregistered as a customer in the StoreFront module of Fusion Order Demo.

Can add items to cart, but must register as a customer to check out and view order information. This user also has administration privileges () in the MasterPriceList module of Fusion Order Demo.

Can add items to cart, but must register as a customer to check out and view order information. This user also has read-only privileges () in the MasterPriceList module of Fusion Order Demo.

/

Can add items to cart, but must register as a customer to check out and view order information. These users may be added to to other roles in a future version of Fusion Order Demo.


2.4 Running the Fusion Order Demo Standalone Applications

The Fusion Order Demo application includes a set of sample applications that allow you to investigate Oracle ADF functionality that does not appear in the StoreFront module. Collectively, these sample applications are referred to as standalone applications. The standalone sample applications appear in five application workspaces, each consisting of several projects, located in the StandaloneExamples directory where you extracted the demo ZIP file.

In general, almost all of the standalone applications demonstrate concepts of ADF Business Components and data model projects. References to these standalone applications appear throughout the chapters contained in Part II, "Building Your Business Services" and Part VI, "Advanced Topics" of this developer's guide. As you read sections this guide, you may want to run the corresponding standalone application to investigate the concepts further. For a brief description of each application workspace and links to the documentation, refer to the tables in Section 2.4.2 through Section 2.4.5.

2.4.1 How to Run the Standalone Applications

How you use JDeveloper to run a standalone application depends on the individual application. Some applications are set up to use the interactive testing tool JDeveloper provides for the ADF Business Components data model project (this tool is known as the Business Component Browser). Other applications provide Java test clients (with file names like ) that use the ADF Business Components API to execute queries and display results. In the case of the Business Component Browser, you work entirely in the tool, which essentially provides a convenient user interface for interacting with business components. In the case of the Java clients, the program files output their results and print statements to the JDeveloper Log window.

Familiarize yourself with the following general procedures about how to run the standalone applications. The first procedure describes how to run an application with its provided test client. The second describes how to launch the Business Component Browser on the data model project's ADF application module. Then read Section 2.4.2 through Section 2.4.5 for more details about the individual standalone applications.

Before you begin:

  • In the Database Navigator, modify the connection information for the FOD database connection so it has the connection information for your environment, as described in Section 2.3, "Running the Fusion Order Demo Application StoreFront Module."

  • Some of the standalone applications work with a modified version of the FOD schema. For standalone applications that require schema changes, the application's project will contain a SQL script that you must run within JDeveloper.

    Once you are through investigating a standalone application, you can use the script to back out the schema changes.

To run a standalone application from its provided test client:

  1. Open the application in Oracle JDeveloper:

    1. From the JDeveloper main menu, choose File > Open.

    2. Navigate to the location where you extracted the demo ZIP file to, open the StandaloneExamples directory, then open the desired standalone application directory and select the application workspace (.jws) from the folder. Click Open.

  2. In the Application Navigator, expand the project folder and locate the test client () file. In some cases, the test client is added to a package located in the Application Sources folder. In other cases, the Resources folder contains the test client.

    For example, Figure 2-7 shows the expanded ApplicationModules project with the Java file node TestClientCustomInterface.java selected.

    Figure 2-7 Test Client Selected in Application Navigator


  3. Right-click the test client and choose Run.

    For the names and location of the test clients provided with the standalone applications, see the tables in Section 2.4.2 through Section 2.4.5.

    The Configure Default Domain dialog displays the first time you run the application and start a new domain in Integrated WebLogic Server. Use the dialog to define an administrator password for the new domain. Passwords you enter can be eight characters or more and must have a numeric character.

  4. Examine the JDeveloper Log window for the test client's output.

    Refer to the referenced documentation for details about the expected results.

When the standalone application does not provide a test client to programmatically exercise the ADF Business Components API, you will use the interactive testing tool, known as the Business Components Browser.

To run a standalone application in the Business Component Browser:

  1. Open the application in Oracle JDeveloper:

    1. From the JDeveloper main menu, choose File > Open.

    2. Navigate to the location where you extracted the demo ZIP file to, open the StandaloneExamples directory, then open the desired standalone application directory and select the application workspace (.jws) from the folder. Click Open.

  2. In the Application Navigator, expand the project folder and locate the application module in a package in the Application Sources folder.

    For example, Figure 2-8 shows the expanded ConditionalDelete project with the application module AppModule selected and a tooltip for the node displayed.

    Figure 2-8 Application Module Node Selected in Application Navigator


  3. Right-click the application module node and choose Run.

    For the names of the runnable application modules, see the tables in Section 2.4.2 through Section 2.4.5.

    The Configure Default Domain dialog displays the first time you run the application and start a new domain in Integrated WebLogic Server. Use the dialog to define an administrator password for the new domain. Passwords you enter can be eight characters or more and must have a numeric character.

  4. Use the Business Component Browser to interact with the view instances of the standalone application.

    Refer to the referenced documentation for details about the application. For details about using the Browser to interact with the data model, see Section 6.3, "Testing View Object Instances Using the Business Component Browser."

2.4.2 Standalone Applications in the DevGuideExamples Application Workspace

Two of the standalone applications in the application workspace use programmatic test clients to demonstrate concepts related to the ADF Business Components framework. The third application demonstrates framework functionality when you run the application in the Business Component Browser.

Figure 2-9 shows the Application Navigator after you open the application workspace.

Figure 2-9 Runnable Applications in the DevGuideExamples Application Workspace


Note that the test clients for the standalone applications provide a good starting point for understanding how to exercise methods of the ADF Business Components API. They also make good samples for test clients that you may want to create to test business component queries in a data model project. For background on working with test clients, see Section 6.4, "Testing View Object Instances Programmatically."

Table 2-4 describes the standalone applications in the application workspace. Examples from these applications appear throughout the chapters contained in Part II, "Building Your Business Services" of this guide.

Table 2-4 Standalone Applications in the DevGuideExamples Application Workspace

Project NameRunnable Class or Project TargetDocumentation

Run TestClientCustomInterface.java in the package in the Application Sources folder.

Exercises custom methods of StoreFrontService application module's client interface and prints to the JDeveloper Log window to indicate the results.

For details about the test client, see Section 9.10.1, "How to Work Programmatically with an Application Module's Client Interface."

For details about the methods of the client interface, see the examples in Section 4.12, "Working Programmatically with Entity Objects and Associations."

Launch the Business Component Browser on AppModule in the Application Sources folder.

Overrides a method in the generated entity class that conditionally prevents deletion of entity rows. In the Business Component Browser, click Delete the Current Row and observe the exception statement. Then, click Insert a New Row and delete the new row.

For a description of overriding the method that you generate in the entity implementation class file, see Section 8.12, "Conditionally Preventing an Entity Row from Being Removed."

Run TestClient.java in the Resources folder.

Programmatically iterates over the view instance using methods of the Business Components API interface and prints to the JDeveloper Log window.

For details about iterating over a collection, see Section 6.4.5, "How to Count the Number of Rows in a Row Set."

For details about how to create test clients, see Section 6.4, "Testing View Object Instances Programmatically."

Run TestClient2.java in the Resources folder.

Programmatically iterates over the view instance, accesses the detail collection using a view link accessor attribute, and prints to the JDeveloper Log window.

For details about iterating over a detail collection, see Section 5.6.6, "How to Access the Detail Collection Using the View Link Accessor."

For more details about the test client, see Section 6.4.6, "How to Access a Detail Collection Using the View Link Accessor."

Run TestClient3.java in the Resources folder.

Programmatically iterates over the view instance using a strongly-typed interface and prints to the JDeveloper Log window.

For details about iterating over a collection using the view row accessor attribute, see Section 39.3.1.3, "Exposing View Row Accessors to Clients."

Run TestClientBindVars.java in the Resources folder.

Programmatically sets the clause for the view instance using bind variables to filter the collection and prints to the JDeveloper Log window.

For details about setting bind variables, see Section 5.10.6, "How to Set Existing Bind Variable Values at Runtime."

For more details about the test client, see Section 5.10.5, "How to Add a WHERE Clause with Named Bind Variables at Runtime."

Run TestClientViewCriteria.java in the Resources folder.

Programmatically sets a view criteria for the view instance to filter the collection and prints to the JDeveloper Log window.

For details about the ADF Business Component's view criteria API, see Section 5.11.9, "What You May Need to Know About the View Criteria API."

For more details about the test client, see Section 5.11.7, "How to Create View Criteria Programmatically."


2.4.3 Standalone Applications in the AdvancedExamples Application Workspace

The standalone applications assembled in the application workspace demonstrate advanced concepts that apply to the entire ADF Business Components framework.

Figure 2-10 shows the Application Navigator after you open the application workspace.

Figure 2-10 Runnable Applications in the AdvancedExamples Application Workspace


Table 2-5 describes the standalone applications in the application workspace. Examples from this application workspace are described in Chapter 37, "Advanced Business Components Techniques."

Table 2-5 Standalone Applications in the AdvancedExamples Application Workspace

Project NameRunnable Class or Project TargetDocumentation

Run TestClient.java in the Application Sources folder.

For details about how to extend business components to create a customized versions of the original, see Section 37.8, "Creating Extended Components Using Inheritance."

Run the scripts in the Application Sources folder against the connection to set up the additional database objects required for the project.

Launch the Business Component Browser on ProductModule in the Application Sources folder.

For details about how to provide an alternative message string for the builtin error codes in a custom message bundle, see Section 37.7, "Customizing Business Components Error Messages."

Not runnable.

Programmatically iterates over the view instance using methods of the Business Components API interface and prints to the JDeveloper Log window.

For details about how to substitute business components, see Section 37.9, "Substituting Extended Components in a Delivered Application."

Not runnable.

Provides template class files that you can use to modify your own generated ADF Business Components classes.

For details about framework extensions, see Section 37.1, "Extending the ADF Business Components Framework."

Run TestClient.java in the Application Sources folder.

For details about how to communicate custom declarative information about business components to the generic code in framework extension classes, see Section 37.2, "Customizing Framework Behavior with Extension Classes."

Run the scripts in the Application Sources folder against the connection to set up the additional database objects required for the project.

Run TestClient.java in the Application Sources folder.

For details about how to code custom Java classes for business components that invoke database stored procedures and functions, see Section 37.4, "Invoking Stored Procedures and Functions."


2.4.4 Standalone Applications in the AdvancedEntityExamples Application Workspace

The standalone applications assembled in the application workspace demonstrate advanced concepts that apply to ADF Business Components entity objects.

Figure 2-11 shows the Application Navigator after you open the application workspace.

Figure 2-11 Runnable Applications in the AdvancedEntityExamples Application Workspace


Table 2-6 describes the standalone applications in the application workspace. Examples from this application workspace are described in Chapter 38, "Advanced Entity Object Techniques."

Table 2-6 Standalone Applications in the AdvancedEntityExamples Application Workspace

Project NameRunnable Class or Project TargetDocumentation

Launch the Business Component Browser on ProductsModule in the Application Sources folder.

For details about controlling the posting order resulting from DML operations to save changes to a number of related entity objects, see Section 38.8, "Controlling Entity Posting Order to Avoid Constraint Violations."

Run the scripts in the Application Sources folder against the connection to set up the additional database objects required for the project.

Launch the Business Component Browser on ProductsModule in the Application Sources folder.

For details about overriding the default DML processing event for an entity object to invoke methods in a PL/SQL API PL/SQL package that encapsulates insert, update, and delete access to an underlying table, see Section 38.5, "Basing an Entity Object on a PL/SQL Package API."

Run the script in the Application Sources folder against the connection to set up the additional database objects required for the project.

Run TestEntityPolymorphism.java in the Resources folder. Also, run TestViewRowPolymorphism.java in the Resources folder.

For details about creating an entity object inheritance hierarchy, see Section 38.7, "Using Inheritance in Your Business Domain Layer."

Run the script in the Application Sources folder against the connection to set up the additional database objects required for the project.

Launch the Business Component Browser on PersonModule in the Application Sources folder.

For details about creating custom data types, see Section 38.1, "Creating Custom, Validated Data Types Using Domains."


2.4.5 Standalone Applications in the AdvancedViewObjectExamples Application Workspace

The standalone applications assembled in the application workspace demonstrate advanced concepts that apply to ADF Business Components view objects.

Figure 2-12 shows the Application Navigator after you open the application workspace.

Figure 2-12 Runnable Applications in the AdvancedViewObjectExamples Application Workspace


Table 2-4 describes the standalone applications in the application workspace. Examples from this application workspace are described in Chapter 39, "Advanced View Object Techniques."

Table 2-7 Standalone Applications in the AdvancedViewObjectExamples Application Workspace

Project NameRunnable Class or Project TargetDocumentation

Launch the Business Component Browser on AppModule in the Application Sources folder.

For details about how to use custom metadata properties to control insert, update, or delete on a view object, see Section 39.11, "Declaratively Preventing Insert, Update, and Delete."

Launch the Business Component Browser on AppModule in the Application Sources folder.

Illustrates using the in-memory sorting and filtering functionality from the client side using methods on the interfaces in the package.

For details about how to use view objects to perform in-memory searches and sorting to avoid unnecessary trips to the database, see Section 39.5, "Performing In-Memory Sorting and Filtering of Row Sets."

Launch the Business Component Browser on AppModule in the Application Sources folder.

For details about creating a view object with multiple updatable entities to support creating new rows, see Section 39.9, "Creating a View Object with Multiple Updatable Entities."

Run TestClientMultipleViewCriteria.java in the Application Sources folder.

For details about how to programmatically filter query results, see Section 39.4, "Working Programmatically with Multiple Named View Criteria."

Run TestClientReadXML.java in the Resources folder. Then run TestClientWriteXML.java in the Resources folder.

For details about how to produce XML from queried data, see Section 39.7, "Reading and Writing XML."

Run the scripts in the Application Sources folder against the connection to set up the additional database objects required for the project,

Launch the Business Component Browser on OrdersModule in the Application Sources folder.

For details about how to use PL/SQL to open a cursor to iterate through the results of a query, see Section 39.8.4, "How to Create a View Object on a REF CURSOR."


2.5 Taking a Look at the Fusion Order Demo Application

Once you have opened the projects in Oracle JDeveloper, you can then begin to review the artifacts within each project. The development environment for the Fusion Order Demo application is divided into two projects: the project and the project.

The project contains the classes that allow the product data to be displayed in the web application. Figure 2-13 shows the project and its associated directories.

Figure 2-13 The StoreFrontService Project


The project contains the following directories:

  • : Contains the files used to access the product data. Included are the metadata files used by Oracle Application Development Framework (Oracle ADF) to bind the data to the view.

  • : Contains a file used in deployment.

The project contains the files for the web interface, including the backing beans, deployment files, and JSPX files. Figure 2-14 shows the project and its associated directories.

Figure 2-14 The StoreFrontUI Project


The project contains the following directories:

  • : Contains the code used by the web client, including the managed and backing beans, property files used for internationalization, and the metadata used by Oracle ADF to display bound data.

  • : Contains the web files, including the JSP files, images, skin files, deployment descriptors, and libraries.

2.5.1 Anonymous Browsing

You start the Fusion Order Demo application by running the page in the project. For details about running the application using the default target, page, see Section 2.3, "Running the Fusion Order Demo Application StoreFront Module."

When you enter the storefront site, the site is available for anonymous browsing. You can use this page to browse the catalog of products without logging into an account. The initial view shows the featured products that the site wishes to promote and gives you access to the full catalog of items. Products are presented as images along with the name of the product. Page regions divide the product catalog area from other features that the site offers.

Figure 2-15 shows the home page.

Figure 2-15 Home Page with Multiple Regions


Where to Find Implementation Details

Following are the sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework that describe how to create a databound web page:

  • Providing the structure for the web page

    The home page separates features of the site into regions that are implemented using a combination of ADF Faces templates and JavaServer Faces (JSF) page fragments. ADF Faces templates and the fragments allow you to add ADF databound components. For information about the steps you perform before adding databound user interface components to a web page, see Section 20.1, "Introduction to Developing a Web Application with ADF Faces."

  • Displaying information on a web page

    To support data binding, the featured items on the tabbed region of the home page use EL (Expression Language) expressions to reference ADF data control usages in the declarative ADF page definition file. The page definition file, which JDeveloper creates for you when you work with the Data Controls panel to drag and drop databound ADF Faces components, is unique to each web page or page fragment. The ADF data control usages enable queries to the database and ultimately work with the JSF runtime to render the databound ADF Faces components, such as the ADF Faces image component used to display images from the table. For information about creating a databound web page that references the ADF page definition file, see Section 22.1, "Introduction to Creating a Basic Databound Page."

  • Managing entry points to the application

    The home page is supported by an ADF unbounded task flow. In general, the Fusion web application relies on this ADF Controller feature to define entry points to the application. The unbounded task flow for the entire home page and its page fragments describes view activities for displaying the home page, displaying the orders page, displaying the register user page, and it defines a task flow reference to manage the checkout process. JDeveloper helps you to create the task flow with visual design elements that you drag and drop from the Component Palette. When you create an unbounded task flow, the elements allow you to identify how to pass control from one activity in the application to the next. Because a view activity must be associated with a web page or page fragment, JDeveloper allows you also to create the files for the web page or fragment directly from the task flow diagram. The process of creating a task flow adds declarative definitions to an ADF task flow configuration file. The resulting diagram lets you work with a visual control flow map of the pages and referenced task flows for your application. For more information about specifying the entry points to the application using an ADF unbounded task flows, see Section 14.1, "Introduction to ADF Task Flows."

2.5.1.1 Viewing Product Details

To view detailed product information, you can click the product name link for any product in the home page. The product information is laid out with collapsing nodes organized by categories.

Figure 2-16 shows the detail dialog that you can view for a product.

Figure 2-16 Home Page - Product Details Popup


You can also select the Statistics subtab on the home page to view a graphical representation of the number of orders that customers have placed for the featured items. To present the information so that quantities are easily compared, the graph sorts the products by the number of items ordered, in descending order.

Figure 2-17 shows the bar graph used to display the featured products' current order details.

Figure 2-17 Home Page - Statistics for Featured Items


Where to Find Implementation Details

Following are the sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework that describe how to develop the components used to support browsing product details:

  • Triggering an action to display data

    To display data from the data model, user interface components in the web page are bound to ADF Model layer binding objects using JSF Expression Language (EL) expressions. For example, when the user clicks on a link to display an informational dialog, the JSF runtime evaluates the EL expression for the dialog's UI component and pulls the value from the ADF Model layer. At design time, when you work with the Data Controls panel to drag an attribute for an item of a data collection into you web page, and then choose an ADF Faces component to display the value, JDeveloper creates all the necessary JSF tag and binding code needed to display and update the associated data. For more information about the Data Controls panel and the declarative binding experience, see Section 12.1, "Introduction to ADF Data Binding."

  • Displaying data in graphical format

    JDeveloper allows you to create databound components declaratively for your JSF pages, meaning you can design most aspects of your pages without needing to look at the code. By dragging and dropping items from the Data Controls panel, JDeveloper declaratively binds ADF Faces UI components and ADF Data Visualization graph components to attributes on a data control using an ADF binding. For more information, see Section 26.1, "Introduction to Creating ADF Data Visualization Components."

2.5.1.2 Browsing the Product Catalog

To begin browsing, click the Start Shopping tab in the home page. This action changes the region of the page used to display details about featured products to a region that displays a product categories tree. You can collapse and expand the branch nodes of the tree to view the various product categories that make up the product catalog. The tree displays the product categories in alphabetical order, by category names. When you want to view all the products in a particular category, click its category node in the tree (for example, click Electronics, Media, or Office). The site refreshes the product information region to display the list of products organized as they appear in the database with an image and an accompanying description.

Figure 2-18 shows the home page with all the products in the Electronics category displayed.

Figure 2-18 Home Page - Product Categories View


Where to Find Implementation Details

Following are the sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework that describe how to use tables and forms to display master-detail related objects:

  • Dragging and dropping master and detail components

    You can create pages that display master-detail data using the Data Controls panel. The Data Controls panel displays master-detail related objects in a hierarchy that mirrors the one you defined in the ADF application module data model, where the detail objects are children of the master objects. All you have to do is drop the collections on the page and choose the type of component you want to use. For example, in the Fusion Order Demo application, the page displays the master list of product categories in an component and displays the detail list of products in an component. For more information about the data model, see Section 3.4, "Overview of the UI-Aware Data Model." For more information about various types of pages that display master-detail related data, see Section 24.1, "Introduction to Displaying Master-Detail Data."

  • Sorting data that displays in tables

    When you create an ADF Faces table component you bind the table to the complete collection or to a range of data objects from the collection. The specific components that display the data in the columns are then bound to the attributes of the collection. The iterator binding handles displaying the correct data for each object, while the table component handles displaying each object in a row. You can set the Sort property for any column when you want the iterator to perform an order-by query to determine the order. You can also specify an clause for the query that the view object in the data model project defines. For more information about binding table components to a collection, see Section 23.1, "Introduction to Adding Tables." For more information about creating queries that sort data in the data model, see Section 5.2, "Populating View Object Rows from a Single Database Table."

2.5.1.3 Searching for Products

To search the product catalog, you have several choices. You can begin either by clicking the disclosure icon (a + symbol) on the Search tab on the panel accordion or by clicking the Search for Deals tab in the main region. When you click either of these, the home page displays both regions at once to allow you to enter a search criteria and view the search results. You use the Search tab on the accordion panel to perform a simple keyword search against the attributes common to all products, such as product names or product descriptions. When you select the attribute to search on from the dropdown list, the panel renders a search field using an appropriate input component to accept the search criteria. For example, in the case of the default searchable attribute ProductId, where a numeric value is expected, the search field uses a spinbox (the ADF Faces component ) to return the product ID.

Figure 2-19 shows the home page with the search results returned for the product with an ID equal to 7.

Figure 2-19 Home Page - Search View


As an alternative to entering a simple search, you can use the advanced search feature to define and save search criteria based on any combination of searchable fields that you select for the product. Click the Advanced link to open the Advanced Search dialog. Developer-defined saved searches like Find Products By Name appear in the Saved Search dropdown list.

Figure 2-20 shows the Advanced Search dialog with a single search criteria, Name, that the Find Products By Name saved search defines.

Figure 2-20 Home Page - Advanced Search Dialog


In addition to the developer-defined saved searches available in the Advanced Search dialog, the end user can create saved searches that will persist for the duration of their session. Enter the product search criteria in the Advanced Search dialog, then click the Save button to open the Create Saved Search dialog.

Figure 2-21 shows the Create Saved Search dialog that you use to specify how you want to save the search criteria you entered in the Advanced Search dialog. You can name the search, for example, Treo product name search, so that it will display in the Saved Search dropdown list of the Advanced Search dialog.

Figure 2-21 Home Page - Advanced Search Dialog - Saved Searches Option


You can also manage your saved searches by selecting the Personalize function in the Saved Search dropdown list of the Advanced Search dialog.

Figure 2-22 shows the Personalize Saved Search dialog for the Find Products By Name search, with Show in Search List enabled so that it will appear in the Saved Search dropdown list. Note that because this search is not a user-defined saved search, the personalization options appear disabled.

Figure 2-22 Home Page - Advanced Search Dialog - Personalization Option


Where to Find Implementation Details

Following are the sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework that describe how to define queries and create query search forms:

  • Defining the query for the search form to display

    A query is associated with an ADF Business Components view object that you create for the data model project to define a particular query against the database. In particular, a query component is the visual representation of the view criteria defined on that view object. If there are multiple view criteria defined, each of the view criteria can be selected from the Saved Search dropdown list. These saved searches are created at design time by the developer. For example, in the Fusion Order Demo application, the view object defines two view criteria. When the query associated with that view object is run, both view criteria are available for selection. For more information, see Section 27.1, "Introduction to Creating Search Forms."

  • Creating a quick search form

    A quick query search form has one search criteria field with a dropdown list of the available searchable attributes from the associated data collection. By default, the searchable attributes are all the attributes in the associated view object. You can exclude attributes by setting the attribute's Display control hint to Hide in the view object. The user can search against the selected attribute or search against all the displayed attributes. The search criteria field type will automatically match the type of its corresponding attribute type. For more information, see Section 27.1.2, "Quick Query Search Forms."

  • Creating a search form

    You create a query search form by dropping a named view criteria item from the Data Controls panel onto a page. You have a choice of dropping only a search panel, dropping a search panel with a results table, or dropping a search panel with a tree table. For more information, see Section 27.2, "Creating Query Search Forms."

  • Displaying the results of a query search

    Normally, you would drop a query search panel with the results table or tree table. JDeveloper will automatically wire up the results table or tree table with the query panel. If you drop a query panel by itself and want a separate results component, you can set the query component's attribute to the relative expression of the results component. For example, in the Fusion Order Demo application, the page displays an with the ID and the results ID of the advanced search dialog is assigned this ID. For more information, see Section 27.2.2, "How to Create a Query Search Form and Add a Results Component Later."

2.5.2 The Login Process

Until you attempt to access secure resources in the storefront site, you are free to browse the product catalog and update the shopping cart as an anonymous user. However, when you click the My Orders or Checkout links that appear at the top of the home page, you will be challenged by the web container running the site to supply login credentials. The site requires that you enter a valid user name and password before it completes your request to display the linked page.

Note:

The Fusion Order Demo application supports the new customer registration process, but that user is not added to the security implementation. Thus, you must use a predefined customer's user name and password to log in, as shown in Table 2-3.

Figure 2-23 shows the login page fragment that displays before you can view order details or purchase items from the store. For demonstration purposes, log in as a customer by entering and for the Username and Password, respectively.

Figure 2-23 Login Region


When you click the Log In button, the web container will compare your entries with the credential information stored in its identity store. If the web container is able to authenticate you (because you have entered the user name and password for a registered user), then the web container redirects to the web page specified by your link selection; otherwise, the site prompts you to create an account or to continue browsing as an unauthenticated user.

Where to Find Implementation Details

Following are the sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework that describe how to secure Oracle ADF resources so that users are required to log in to access those resources:

  • Enabling fine-grained security to secure Oracle ADF resources

    ADF Security is a framework that provides a security implementation that is based on Java Authentication and Authorization Service (JAAS). The Oracle ADF implementation of JAAS is role-based. In JDeveloper, you define these roles and then make permission grants based on these roles to enable fine-grained security for Oracle ADF resources. JDeveloper supports declaratively defining the policy store for an ADF bounded task flow or individual web pages associated with their ADF page definition. For information about securing Oracle ADF resources, see Section 30.5, "Defining ADF Security Policies."

  • Triggering dynamic user authentication

    When you use ADF Security, authentication is triggered automatically if the user is not yet authenticated and tries to access a page that is not granted to the role. After successfully logging in, another check will be done to verify if the authenticated user has view access to the requested page. For more information, see Section 30.3.5, "What You May Need to Know About ADF Authentication."

  • Performing permission checking within the web page

    At runtime, the security policy you define for ADF resources is enforced using standard JAAS permission authorization to determine the user's access rights. If your application requires it, you can use Expression Language (EL) to perform runtime permission checks within the web page to hide components that should not be visible to the user. For example, in the Fusion Order Demo application, the page uses an expression with the value to test the user's authorization privileges before displaying their account number. For more information, see Section 30.11.1, "Using Expression Language (EL) with ADF Security."

2.5.3 The Ordering Process

You begin the order process by browsing the product catalog. When you click Add next to a product, the site updates the shopping cart region to display the item.

Figure 2-24 shows the cart summary with a single item added. The summary shows a subtotal for the items that appear in the cart.

Figure 2-24 Home Page - Shopping Cart Summary


When you are satisfied with the items in the cart, you can complete the order by clicking the Checkout link at the top of the home page. To check out and complete the order, you must become an authenticated user, as described in Section 2.5.2, "The Login Process."

After you log in, the site displays the checkout page with order details, such as the name and address of the user you registered as. The order is identified by an Order Information number that is generated at runtime and assigned to the order. An Order Summary region displays the order items that comprise the new order. This region is similar to the cart summary on the home page, except that it adds the cost of shipping and deducts any discounts that apply to the order to calculate the total purchase amount.

Figure 2-25 shows the checkout page with an order comprising four order items.

Figure 2-25 Checkout Page - Order Details Form


You can use the checkout page to customize details of the order information. For example, click the Edit icon next to the Payment Option Code field to display and edit payment funding information for the order.

Figure 2-26 shows the detail dialog for the Payment Option Code field.

Figure 2-26 Checkout Page - Payment Option Detail Dialog


Many of the fields of the payment options dialog offer user interface hints that guide you to enter specific information.

Figure 2-27 shows an example of a date entry (01/15) that the format mask (mm-yy) defines for the Expiration Date field.

Figure 2-27 Checkout Page - Payment Options Detail Dialog - Date Format Mask


The Card Type field displays a dropdown that allows you to select from a valid list of credit card types.

Figure 2-28 displays the list of values for the Card Type field.

Figure 2-28 Checkout Page - Payment Options Detail Dialog - List of Values (LOV) Choice List


If you close the payment options dialog and click the Submit Order button in the checkout page, the purchase order is created and sent into a process flow.

After you place an order using the StoreFront module, a second module of the Fusion Order Demo application is available to process the order. For details about the WebLogic Fusion Order Demo module used to demonstrate the capabilities of Oracle SOA Suite, see Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite. For information about running this portion of the Fusion Order Demo application, see Section 2.3, "Running the Fusion Order Demo Application StoreFront Module."

Where to Find Implementation Details

Following are the sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework that describe how to develop forms like the ones used in the order checkout process:

  • Creating a databound edit form

    When you want to create a basic form that collects values from the user, instead of having to drop individual attributes, JDeveloper allows you to drop all attributes for an object at once as an input form. You can create forms that display values, forms that allow users to edit values, and forms that collect values. For example, in the Fusion Order Demo application, the checkout page displays one form to display user information and another form to collect shipping information for the user's order. For more information, see Section 22.6, "Creating an Input Form."

  • Defining format masks for input forms

    Format masks help ensure the user supplies attribute values in the required format. To facilitate this task, ADF Business Components provides declarative support known as control hints for attributes in the data model project. For example, in the Fusion Order Demo application, the attribute for the view object used to assign the user's credit card expiration date is configured with a format mask hint and enforced in the Payment Options page fragment . For information on defining format masks for input form components, see Section 5.13, "Defining Control Hints for View Objects."

  • Defining a list of values for selection lists

    Input forms displayed in the user interface can utilize databound ADF Faces selection components to display a list of values (LOV) for individual attributes of the data collection. To facilitate this common design task, ADF Business Components provides declarative support to specify the LOV usage for attributes in the data model project. For example, in the Fusion Order Demo application, the three components displayed in the Payment Options page fragment are bound to LOV-enabled attributes configured for the view object. For more information about configuring attributes for LOV usage, see Section 5.12, "Working with List of Values (LOV) in View Object Attributes."

  • Keeping track of transient session information

    When you create a data model project that maps attributes to columns in an underlying table, your ADF view objects can include transient attributes that display calculated values (for example, using Java or Groovy expressions) or that are value holders. For example, in the Fusion Order Demo application, the order summary page displays the value of the attribute calculated by the expression defined on the

0 thoughts on “Adf Sample Application Essay

Leave a Reply

Your email address will not be published. Required fields are marked *