In this lesson, you will learn how to incorporate BI Beans
objects, which were defined in lessons from the Develop Business Intelligence
Objects focus area, into a Java-Client application and run the application from
within JDeveloper.
Move your mouse over this icon to show all screenshots. You can also move your
mouse over each individual icon to see only the screenshot associated with it.
Overview
BI Beans objects, such as presentations, calculations, and
saved selections, are the building blocks of BI Beans analytic applications.
The definitions of these objects are stored in the local BI Beans catalog on
the developer's machine. These objects can also be copied to a remote BI Beans
catalog. The remote catalog is defined in an Oracle database, which allows analyses
to be shared within a user community.
The BI Beans object definitions only need to be created once.
They can then be referenced in BI Beans Java-Client applications or HTML client
applications alike.
Business Intelligence Beans provides
a set of samples to help you learn how to use the product. These samples
use the Oracle Common Schema analytic workspace as the sample data set.
The BI Beans OBE lessons also use the Common Schema analytic workspace
as the sample data set.
Therefore, if the BI Beans samples have been installed,
you should have access to the analytic workspace for the BI Beans OBE
lessons. If the BI Beans samples have not been installed, see Installing
the Oracle Business Intelligence Samples.
2.
Complete the first three lessons in
the Develop Business Intelligence Objects focus area.
Or,
You can use a BI Beans Project that contains all of the files that would
result from the completion of the tutorials in the first focus area. To
use this project, follow the instructions in Download,
Extract, and Open the BI Beans OBE Project.
Note: If you have completed any other lesson in this
focus area, then you already have the BI Beans OBE project that is required
for this lesson.
Download, Extract,
and Open the BI Beans OBE Project (optional)
To create a BI Beans
application, you must first develop the BI Beans objects that will be used
by the application.
If you have not completed the first three
lessons in the Develop Business Intelligence Objects focus area, or if you
have not already downloaded and extracted the BI Beans OBE Project as part
of another lesson in this focus area, use this optional topic. Otherwise,
skip this topic and move directly to the Generate
a BI Beans Java-Client Application topic.
This topic contains instructions for
downloading and opening the JDeveloper Project that contains all of the files
and objects that you need for this lesson.
To download and open the BI Beans OBE Project, follow
these steps:
1.
First create a new Workspace. From the File
menu, select New. The New Gallery dialog box opens.
2.
In the New Gallery dialog box, under
Categories, select General; under Items, select Workspace
and click OK.
The Create Workspace dialog box opens.
3.
In the Create Workspace dialog box, accept the default
name and directory for the workspace.
Note: Make note of the path for your workspace Directory
Name.
Ensure that the Add a New Empty Project box is not
checked, as shown in the screen shot below:
Click OK to create the Workspace. Click the Save
All tool to save the Workspace.
4.
Save the following self-extracting
archive, Project1.exe, to your local
machine.
For example, use your browser's right-mouse menu
to perform a Save As.
Note: Due to virus protection rules, the self-extracting
archive may copy to your machine with the name Project1,
rather than Project1.exe. If this is the case, you will
need to rename the file on your local machine by adding the .exe
extension before extracting its contents.
Once you have downloaded the archive, and renamed it if necessary, extract
the contents of the archive using the following steps:
A.
Double-click
on the self-extracting archive, Project1.exe.
B.
In the WinZip Self- Extractor dialog
box, use the Browse button to navigate to
the directory that was just established by the creation of your
new JDeveloper Workspace. For example, <JDeveloper_home>\jdev\mywork\Workspace1.
C.
Click the Unzip button.
The BI Beans OBE project is unzipped into your workspace directory.
Close the WinZip Self- Extractor dialog.
5.
In the JDeveloper Applications-Navigator,
select the new Workspace that you just created in Steps 1. - 3.
Then, from the main menu select File > Open.
6.
In the Open dialog, navigate to the Project1
directory below your workspace directory. This directory was created when
you extracted the archive in Step 4.
Select Project1.jpr
Click Open.
The Workspace and associated Project are displayed in the Applications-Navigator.
7.
Expand all of the
nodes in the Workspace, and you should see the following project files
in the Applications-Navigator:
8.
Now, you must specify your database connection to the Oracle
Common Schema analytic workspace in the BIDesigner. To do this, perform
the following:
A.
Right-mouse click on
Project1BIDesigner and select Settings
from the popup menu.
B.
In the BI Designer Settings dialog
box, click the Edit button just beneath the Connection
drop-down box.
The OLAP Connection Editor is displayed.
C.
Select the Connection
tab in the OLAP Connection Editor. Modify the connection details
for your Oracle OLAP data source.
D.
Select the Test
tab. Then, click Test Connection to verify that
your connection is valid.
Click OK to close the OLAP Connection Editor.
Notes:
If the connection fails, return to the Connection tab and re-enter
the connection information for your Oracle Common Schema analytic
workspace data source.
If you have not installed the Common Schema sample data set, follow
the instructions in Installing
the Oracle Common Schema, which is described in the Prerequistes
section.
E.
Click OK to close
the BI Beans Settings dialog box.
9.
From the File menu, choose Save
All.
Generate a BI Beans
Java-Client Application
The BI Java-Client Class wizard may be used to
generate a Java-Client Class application that uses the BI Beans objects that
you specify.
You can generate the application files in the same project
as your BI Beans objects, or you can create a new project to hold your application
files. Here, you will create a new project and then generate the BI Java-Client
application in that new project.
To create the new project for your application,
follow these steps:
1.
In the Applications-Navigator, right mouse
click on Project1 and select New from
the popup menu.
2.
In the New Gallery dialog box, select General
from Categories panel and select Empty Project from the
Items panel
Then click OK.
3.
Accept the default values provided in the
Create Project dialog and click OK.
4.
From the main menu, choose File
> Save All.
Generate a BI Java-Client Application
The BI Java-Client Class wizard guides you through
the process of creating a fully-functional BI Beans Java-Client application
without having to write any code.
In the wiizard, you are asked to select or identify the following:
The BI Designer, which contains
the OLAP data connection information and the location of the BI Beans objects
that will be used by the application.
Whether or not to display a default presentation
(crosstab or graph) in the application.
Which menus and toolbars to include in the
application.
Follow these steps to generate a BI Java-Client application:
1.
In the Navigator, right-click on the Project
that you just created in the previous topic. Select New
from the popup menu.
2.
In the New Gallery dialog box, perform the
following:
A.
In the Categories box,
expand the Business Intelligence Beans node and select
Client Tier for OLAP.
B.
In the Items box, select Java-Client
Class.
C.
Click OK to launch
the BI Java-Client Class Wizard.
3.
The Welcome screen, which describes the wizard steps,
is displayed. Choose Next to continue.
4.
In Step 1, select the the BI Runtime Configuration file
that the application will use. This file contains the connection information
for your OLAP data connection and the location of your BI Beans objects.
Choose Project1OLAPConfig1.xml - [Project1] from the
drop-down list.
Click Next to continue.
5.
In Step 2, specify the presentation that is to be displayed
when the application starts.
Select the Yes option, and choose Browse
to view the presentations that are available for selection.
6.
In the Open dialog box, select Sales Analysis Crosstab
and click OK.
In the Wizard, click Next to continue.
7.
In Step 3, select components such as menus and toolbars
to include in the application. Select the following items as shown below:
Menus, File, Tools,
and Toolbar.
Click Next to continue.
8.
On the Summary screen, review your selections and choose
Finish.
Select File > Save All to save your
work.
Notes:
Application code is generated by the wizard and saved in BIApplication1.java,
which is added to the Navigation window under the project.
In addition, a default deployment profile, bijavaclientarchive1.deploy,
is also created. The deploy file allows the application to be run without
using JDeveloper. For the purposes of this lesson, JDeveloper will be
used to test and run the new Java-Client application. For more information
about deploying and running standalone Java-Client applications, see the
help topic: Deploying a BI Beans Java-Client Application topic in BI Beans
help within JDeveloper.
View the JDeveloper Java Application
Development Environment
When the Java-Client application is generated, your JDeveloper
layout should be divided into four areas as descibed below.
Area 1: Source/Class/Design
Window – Consists of three tabs:
- The Source tab displays the application code and
allows a developer to edit the code directly.
- The Class tab displays the fields/methods and events
that relate to the object.
- The Design tab displays the visual representation of
the application.
Area 2: Applications-Navigator - Shows
a list of project components, such as Designers, Java files, XML files,
HTML FILES, etc.
Area 3: Structure Window – Provides
the following views of the object in a hierarchical drillable tree mode:
Code structure, UI structure, UI Model. Each view can be filtered by sorting,
showing only methods, fields, static members or public members
Area 4: Message/Log Window – Provides
feedback during compilation and execution.
All of these windows are linked.
For example, the Structure window can be used to find, and
then navigate to functions, methods, and other elements in the Java application.
Follow these steps for an illustration of this feature:
1.
In the Structure window, select the Code
Structure tool (paper with pencil icon).
Then, scroll down to and double-click the line that reads FILE_EXIT
: String.
2.
When you double-click on an application element
in the Structure window, the Code window is refreshed and the same java
code that is referenced in the Structure window is now highlighted, as
shown below:
Feel free to examine the application using this Structure window / Source
window navigation mechanism. However, do not modify any of the application
code.
The application is fully functional, and ready to be run without any
modification. Proceed to the next topic for instructions on how to run
the application.
Run and Use the Application
In this topic, you will compile and run the application
from within JDeveloper. You will also use some of the built-in features of the
generated BI Java-Client application to work with the Stoplight Report crosstab
and the Sales Analysis graph.
To compile and launch the application, follow
these steps:
1.
To check the structure of the application,
it is recommended to compile (Make) the application code.
In the Navigator, right-click BIApplication1.java and
choose Make BIApplication1.java from the popup menu.
The message log window should report that the compile process is successful.
2.
Right-click BIApplication1.java
and choose Run BIApplication1.java from the popup menu.
The application is loaded into memory.
After the application loads, it is displayed in a new window.
Use the Crosstab
The application starts by showing the presentation
that was specified in the in the BI Java-Client wizard, in this case, the Stoplight
Report crosstab.
The application also contains a menu that incorporates the
main menu items that you specified in the wizard. The menu options provide access
to various features.
The following steps demonstrate how an end user could interact
with the crosstab in a Java-Client application. In the next subtopic, you will
open and work with the Sales Analysis graph.
1.
The BI Java-Client Class Application runs
in its own window. This is the end user view of the application.
2.
In the Time dimension drop-down on the paging
control, select year 2001. The crosstab is updated to
the specified year and the formatting rules are also applied to the new
time period.
Use the horizontal scroll bar to set all of the product divisions.
3.
Change the layout of the dimensions that are displayed
in the crosstab by practicing drag-and-drop operations.
For example:
A.
Select the Product
dimension by clicking on the three vertical dots to the left of
the dimension tile.
B.
Drag the Product dimension tile,
displayed above the measures in the Column edge, and drop it on
the Geography dimension located in the Row edge.
Product and Geography dimensions should rotate positions.
C.
Using the same drag-and-drop technique,
rotate the Channel and Geography
dimension tiles, so that Geography is displayed on the Page edge,
and Channel is displayed on the Column edge just above the measures.
The crosstab should now look similar to the following layout:
4.
Click the drill icon beside one of the Product division
values to drill to the next level of detail. For example:
5.
Continue to experiment with the crosstab.
Select new dimension members
from the dimension tiles in the Page Items area.
Use the drag-and drop functionality
to re-organize the layout of the crosstab.
Drill on dimension members in the Row
or Column edges.
This is only an example and you will not save these changes now.
Use the Graph
This subtopic demonstrates how to open and work
with the Sales Analysis graph that you created in the Create Business
Intelligence Objects focus area.
You will modify the graph format and the query
that the graph is displaying. Then, you will save the modified graph to your
local BI Beans Catalog using a different name.
1.
From the application's main menu, select
File > Open and choose the presentation
Sales Analysis Graph.
Click OK to open the graph. If you are prompted to save
the modified crosstab, click No.
The graph presentation is displayed in the application replacing the
stoplight report, as shown below.
You can select new members from any of Page Items dimension tiles to
requery the data.
2.
Use the Query Wizard to change the Sales
measure, which is displayed in the graph, to a Sales Revenue Growth %
calculation, by performing the following:
A.
Select Tools
> Edit Query.
B.
In the Query Wizard's Items
tab, click the Remove All Items button ('<<')
to remove Sales Revenue from the query.
Note: If all measures
are removed from the query, the associated dimensions are also removed.
C.
In the Available list, select Sales
Revenue Growth %. Click the Add Selected Items
button ('>').
D.
Click OK to requery
the data.
The graph displays the new calculated data, showing how the top 5 products
in the Photo division performed in the year 2000 in terms of Sales Growth
%, as compared to the previous year.
3.
Use the Query Wizard to change the dimension selection
from America Areas to European Areas.
Follow these steps:
A.
Select Tools
> Edit Query.
B.
In the Query Wizard, click the
Dimensions tab and select click the Geography
from the Choose list.
C.
Click the Remove All Items
button ('<<').
C.
In the Available region, click
the Saved Selections tab and select European
Areas . Click the Add Selected Items button
('>').
D.
Click OK to requery
the data.
The graph should now look similar to the following:
4.
Select new members from the Geography dimension tile
to view the updated graph.
5.
Save the modified graph as a new object.
Select File > Save As. Enter Sales
Growth Analysis Graph as the name of the new graph
and click OK.
The new graph is saved in your local BI Beans Catalog.
To exit the application and close the Java source code
file, perform the following:
1.
From the application
menu, Select File > Exit. In the
Exit prompt box, click Yes.
The application is closed and you are returned to JDeveloper.
2.
In the Source code tab, click
the "X" to close the window.
Summary
In this lesson, you learned how to generate an ad hoc query
and analysis application using the BI Java-Client Class wizard. You also learned
how to use some of the features that are integrated into a generated BI Beans
Java-Client application.