Oracle® Fusion Middleware Mobile Client Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1.5.0) Part Number E14826-02 |
|
|
View PDF |
The ADF Mobile client sample application, also referred to as the Fusion Order Demo Mobile Client application, is a modified version of the Fusion Order Demo. It demonstrates the extension of the Fusion application technology to mobile platforms. This application is a companion to this guide and is used as an example throughout to illustrate points and provide code examples.
Before you examine the individual components of the sample application in depth, you may find it helpful to install and become familiar with the functionality of the Fusion Order Demo Mobile Client application.
This chapter includes the following sections:
Section 3.1, "About the Fusion Order Demo Mobile Client Application"
Section 3.3, "Overview of the Fusion Order Demo Mobile Client Application Schema."
Section 3.4, "Running the Fusion Order Demo Mobile Client Application"
Section 3.5, "Taking a Look at the Fusion Order Demo Mobile Client Application"
For information on the Oracle ADF Fusion Order Demo application, see "Introduction to the ADF Sample Application" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
The sample application enables you to browse and edit orders for electronic devices. For more information, see Section 3.5.2, "Runtime Components."
The sample application requires an existing installation of Oracle JDeveloper 11g and an Oracle database. For a complete list of tasks for preparing your environment for the Fusion Order Demo Mobile Client application, see Chapter 2, "Setting Up the ADF Mobile Client Environment."
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:
Navigate to Oracle Technology Network (OTN) http://www.oracle.com/technetwork/index.html
and search for "Fusion Order Demo Sample Application."
Download the ZIP file to a local directory.
Start Oracle JDeveloper 11g and from the main menu choose File then Open.
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.
In the Application Navigator, expand MasterBuildScript and then Resources, and double-click build.properties.
In the editor, modify the properties shown in Table 3-1 for your environment.
Table 3-1 Properties Required to Install the Fusion Order Demo Application
Property | Description |
---|---|
|
The root directory where you have Oracle JDeveloper 11g installed. For example:
|
|
The base JDBC URL for your database in the format
|
|
The port for your database. For example:
|
|
The SID of your database. For example:
|
|
The administrative user for your database. For example:
|
|
The table space name where FOD users will be installed. For example:
|
From the JDeveloper main menu, choose File > Save All.
In the Application Navigator, under the Resources node, right-click build.xml and choose Run Ant Target > buildAll.
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:
buildAll:
BUILD SUCCESSFUL
Total time: nn minutes nn seconds
For more information on the demo schema and scripts, see the README.txt
file in the MasterBuildScript
project.
In addition to installing the FOD database, you also need to install client databases for both Windows Mobile devices and BlackBerry smartphones. The sample client database is delivered on a simulated SD card that is included in the sample application ZIP file, ADFMCSampleApp.zip
. The simulated cards are located within ADFMCSampleApp at WindowsMobileSDCard
and BlackBerrySDCard
.
Use the Windows Mobile simulator to mount the simulated SD card, WindowsMobileSDCard
, that contains the sample client database.
Before you begin:
Create the sample database that represents the database used by the server application as described in Section 3.2, "Installing the Fusion Order Demo Schema," download and extract ADFMCSampleApp.zip
on your computer, and install the Windows Mobile device simulator. You must start and connect the Windows Mobile simulator to the computer as described in Chapter 2, "Setting Up the ADF Mobile Client Environment."
To mount the client database on a Windows Mobile device simulator:
On the Windows Mobile simulator, choose File > Configure.
In the Shared Folder folder, browse to WindowsMobileSDCard in ADFMCSampleApp, as shown in Figure 3-1.
Click OK.
Use the BlackBerry smartphone simulator to mount the sample client database that is contained on the simulated SD card, BlackBerrySDCard
.
Before you begin:
Create the sample database that represents the database used by the server application as described in Section 3.2, "Installing the Fusion Order Demo Schema," download and extract ADFMCSampleApp.zip
on your computer, and install BlackBerry Java Development Environment (JDE 5.0).
Start the BlackBerry smartphone simulator to the computer as described in Chapter 2, "Setting Up the ADF Mobile Client Environment."
To mount the client database on a BlackBerry Smartphone simulator:
On the BlackBerry smartphone simulator, select Simulate > Change SD Card.
Click Add Directory and then browse to, and select, the BlackBerrySDCard folder. Click OK.
Select BlackBerrySDCard as the current SD card as shown in Figure 3-2. Click Close.
The schema of the Fusion Order Demo Mobile Client application consists of the following core tables:
PERSONS:
This table stores all the users who interact with the system, including customers, staff, and suppliers. The first and last name, e-mail 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, membership information (for customers).
ORDERS:
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.
ORDER_ITEMS:
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.
PRODUCTS_BASE:
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.
Queue-based snapshots (described in "Manage Snapshots on SQLite Mobile Client" in Oracle Database Lite SQLite Mobile Client Guide) create a database file called OSE_
<database name>.db
. This database file contains the following tables:
OSE$DATAQ
: The data queue for both In Queue and Out Queue records. This queue is used for all snapshots and contains both In and Out Queue records. The TRID column is positive when the record is an Out Queue record. When you synchronize with queue-based snapshots enabled, new data from the client is uploaded from the OSE$DATAQ
queue table and new data from the Oracle database is downloaded into this queue. For more information, see "SQLITE QUEUES" in Oracle Database Lite SQLite Mobile Client Guide.
OSE$BLOBQ
: A BLOB queue
OSE$TABLES
: A snapshot registry
OSE$TRANS
: A transactions registry
OSE$TRESQ
: A table that contains transaction sequences per publication.
In addition to these tables, SQLite replicates the following:
C$INDEXES
: A table containing replicated index information.
C$SCRIPTS
: A table containing SQL scripts published on the server.
C$WSEQ_CLIENTS
: Simulates sequences
Before you run the demo application on a BlackBerry Smartphone or a Windows Mobile device, you must first do the following:
Open the demo application in JDeveloper.
Install simulators and other required development tools for the target platforms.
Connect and start the simulators.
Deploy the ADF Mobile client runtime components on BlackBerry smartphones and Windows Mobile devices.
Deploy the demo application to the simulators.
Run the demo application.
For more information on Oracle Lite Mobile Development Kit (MDK), Mobile Sync (mSync), and SQLite Mobile Client, see Chapter 2, "Setting Up the ADF Mobile Client Environment."
You run the demo application after you have deployed it to a Windows Mobile device emulator.
To run the demo application:
In JDeveloper, choose Tools the Deploy ADF Mobile Client Runtime then to Windows Mobile.
Choose ADF Mobile Client Runtime and then click Deploy.
Monitor the deployment progress on the Windows Mobile device emulator. Deployment must complete before you deploy another ADF Mobile client runtime component.
Choose Java Virtual Machine and then click Deploy.
Click Close. Verify the deployment by viewing JDeveloper's Deployment-Log file.
In the Application Navigator, right-click the Mobile Client project.
Choose Deploy then choose ADFMCSampleApp_RC1 to Windows Mobile Device.
On the Windows Mobile simulator, use the File Explorer utility to navigate to My Device then Program Files and then MobileFOD.
Select the MobileFOD executable file, as shown in Figure 3-3.
Figure 3-4 shows the Fusion Order Demo Mobile Client application's Browse page, which appears after you click the MOBILEFOD executable. For more information, see Section 3.5, "Taking a Look at the Fusion Order Demo Mobile Client Application."
Before you run the sample application on a BlackBerry Smartphone or simulator, you must download the BlackBerry Java Development Environment (JDE 5.0), the BlackBerry smartphone simulator, and BlackBerry Desktop Manager from BlackBerry (http://na.blackberry.com
).
You run the demo application after you have deployed it to a BlackBerry smartphone or simulator.
Before you begin:
You must set the location of the JDE and the simulator directory in which JDeveloper places the COD file.
To run the demo application:
If needed, stop the BlackBerry smartphone simulator.
In JDeveloper, choose Tools then Deploy ADF Mobile Client Runtime then choose to BlackBerry Simulator.
Choose ADF Mobile Client Runtime and then click Deploy.
In the Application Navigator, right-click the mobile client project.
Choose Deploy then ADFMCSampleApp_BlackBerry to BlackBerry Device.
After the deployment completes, start the BlackBerry smartphone simulator.
On the BlackBerry smartphone or simulator, navigate to the Downloads folder, as shown in Figure 3-5.
Click ADFMCSampleApp_BlackBerry.
Note:
Do not deploy an application to BlackBerry smartphone simulator while it is running. To load the COD file to the simulator, you must first stop it, then restart it. If you would like to deploy a COD file manually, put it in the simulator location specified in the Mobile Client Preferences page described in Chapter 2, "Setting Up the ADF Mobile Client Environment."The design time artifacts of the ADF Mobile sample application are visible in Oracle JDeveloper. Its runtime UI consists of screens that are displayed natively on the device outside of a mobile browser.
After you have opened the projects in Oracle JDeveloper, you can then review the artifacts within each project. The development environment for the Fusion Order Demo Mobile Client application contains a view-controller project named MobileClient and a model project named Model.
MobileClient project contains the files for the interface, including the backing beans, deployment files, and MCX files (the ADF Mobile client equivalent of the JSPX file).
Figure 3-6 shows the MobileClient project and its associated directories. The MobileClient project contains the following directories:
Application Sources
: Contains the code used by the mobile client, including the managed and backing beans, property files used for internationalization, the metadata used by ADF Mobile client to display bound data as well as the MCX files and images. This project also includes MobileClient-task-flow.xml
, the source file for the bounded task flow.
META-INF
(subdirectory of Application Sources
): includes the following:
UiApplication.jad
—the Java Application Descriptor file (JAD) that is required by BlackBerry to deploy applications over the air (OTA).
adfm.xml
—Used at runtime in order to help resolve data bindings.
The Model project (shown in Figure 3-7) is a data model project that contains the data definitions that allow the product data to be displayed in the sample application.
The Model project contains the Application Sources directory, which contains the files used to access the product data. Included are the metadata files used by Oracle Application Development Framework (ADF) to bind the data to the view.
The Fusion Order Demo Mobile Client application displays the following pages at runtime:
Browse Orders (home.mcx
)
Order Details (details.mcx
)
Edit Order (editorder.mcx
)
Order Items (orderitems.mcx
)
You start the Fusion Order Demo Mobile Client application by running the home.mcx
page. This page, which is the entry point of the application, displays on a BlackBerry smartphone or Windows Mobile device as the Browse Orders page. As shown in Figure 3-8, this page contains a dropdown list of order status codes. You use this list in conjunction with the page's Search button to retrieve a list of customers whose orders belong to the category that you selected. Clicking a customer name opens the Order Details page (shown in Figure 3-12), which displays information about the customer.
Clicking Add Order displays the Add Order page, which is comprised mainly of inputText
components. For more information about the Order Details page, see Section 3.5.4, "Viewing Order Details." For more information on the Add Order page, see Section 3.5.5, "Editing or Adding an Order."
After you select an order status and click Search (a commandButton
component), the application performs a search, executes a query and populates the table. Figure 3-9 shows the results of selecting the Order being picked status. As illustrated in Figure 3-9, the table is populated with a status image, the customer name, and read-only information about the date of the order and its total cost. The name is a commandLink
component that enables you to navigate to the details screen.
The images are dynamic, reflecting the status of the order. Note, for example, that the images reflect the Order being picked status in Figure 3-9 and the Order completed status in Figure 3-10.
Where to Find Implementation Details
Following are the sections of Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework and Oracle Fusion Middleware Mobile Client Developer's Guide for Oracle Application Development Framework that describe how to define queries and create query search forms:
Laying out ADF Mobile Tables
The Browse Orders page includes a single-column table which uses panelGroupLayout
components for the status images and the output text. For more information, see Section 6.8, "Creating and Using Tables."
Enable navigation through the application
The demo application provides navigation using commandLink
components, In Figure 3-10, Add Order and the customer names (for example, Nancy Greenberg) are commandLink
components. For more information, see Section 6.9, "Using Buttons and Links."
Creating dynamic images
The page achieves the dynamic, status-related images through an EL expression and a string. For example,
<amc:image id="image1"source="/statusimages/#{row.OrderStatusCode}.gif"/>
For more information see "Creating EL Expressions" in Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework and also "Displaying Images."
Creating a static view object
In the Browse Orders page, the selectOneChoice
component for the order status is backed by a list binding. The Status and StatusDesc attributes of the OrderStatus view object, a static view object, populate the values for the dropdown list. For more information, see "Populating View Object Rows with Static Data" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
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, Oracle 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 selectOneChoice
component displayed in the Browse Orders page is bound to LOV-enabled attributes configured for the OrderStatus view object. For more information about configuring attributes for LOV usage, see "Working with Lists of Values (LOV) in View Object Attribtutes" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Creating menus for Windows Mobile devices and BlackBerry smartphones
Windows Mobile applications have two types of menus: The Main menu and the ALT menu. The Main menu describes the right Standard menu button for the form (such as the Menu button in Figure 3-10) and the ALT menu is the left Standard menu button for the form. For BlackBerry, the MAIN menu describes the Full menu for the form. The ALT menu is amalgamated into the Full menu for the form. For more information, see Section 6.11, "Creating and Using Menus."
The Order Details page displays information about the customer who placed the order.
This page contains two navigational links: Back to Order List, which you use to return to the result list shown in Figure 3-10 and Show Order Items. Clicking Edit enables you to edit the order details. For more information, see Section 3.5.5, "Editing or Adding an Order."
Clicking Show Order Items enables you to drill down to a list of ordered items that match the status that you selected in the Browse Orders page. For example, Figure 3-12 shows customer Nancy Greenberg's items that have the status of Order completed (shown in Figure 3-10). This page also includes a form that enables you to filter order items. For more information, see Section 3.5.6, "Viewing Ordered Items."
Clicking Edit opens a read-write form that enables you to modify order details. This page (editorder.mcx)
displays as either the Edit Order page or the Add Order page depending on if the user is at the Browse Page (home.mcx
) or the Order Details page (details.mcx
).
Where to Find Implementation Details
Following are sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework and Oracle Fusion Middleware Mobile Client Developer's Guide for Oracle Application Development Framework that describe how to create a task flow and how to create an input form with required values.
Laying out the ADF Mobile page
This page, called editorder.mcx
, consists primarily of inputText
components within panelFormLayout
and panelLabelAndMessage
components. For more information, see Section 6.4, "Designing the Layout of the Page."
Grouping activities using a bounded task flow
ADF Mobile client applications use bounded task flows. As described in "Task Flow Types" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework, a bounded task flow has one point of entry, zero or more exits, and represents the reusable portion of an application. The task flow for the demo application (MobileClient-task-flow.xml
) is comprised of view activities (home.mcx
, editorder.mcx
, details.mcx
, and orderitems.mcx
), a router activity, a task flow return, and a wildcard control rule. For more information see Section 6.2, "Creating Task Flows."
Using a router activity
The conditional routing that enables editorder.mcx
page to display as either the Edit Order page or the Add Order page is achieved through a router in the application's task flow that evaluates the applicationScope
EL expression for the panelGroupLayout
component. If the scope variable for addMode
is true (that is, when the user is at the Browse Order page), then the application opens the Add Order page. For more information, see "Using Router Activities" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
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 Order Details displays a form that displays user information and the Add Order and Edit Order forms used for collecting shipping information for the user's order. For more information, see "Creating an Input Form" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework and Section 6.5, "Creating and Using Input Components."
Creating databound UI controls
The page's selectOneChoice
components are used to filter view accessors and lists of values for status codes and for customer ID. Such selectOneChoice
components are created by dragging and dropping the OrderStatus Code and CustomerID attributes of the OrderView data control into the Structure view and then by selecting Select One Choice from the context menu.
Using commit and rollback functions
The page's Save and Undo menu functions are standard ADF commit and rollback operations. For more information, see Section 6.11, "Creating and Using Menus."
The Order Items page lists the items that the customer has ordered, providing information on the number of units and the price of each item. You can filter the results using the search form, as shown in Figure 3-14.
Where to Find Implementation Details
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. The Order Items page includes a search form, one that JDeveloper creates automatically when you drag a view object in to the Structure view and then select Filtering as the Enable ADF Behavior option in the Edit Table Columns dialog. For more information, see "Creating Query Search Forms" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Displaying the results of a query search
Normally, you drop a query search panel with the results table. JDeveloper automatically wires the results table with the query panel. For more information, see "How to Create a Query Search Form and Add a Results Component Later" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.