Liquid Data by Example
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
This chapter provides a brief overview of the Avitek Customer Self-Service Sample Application (SampleApp), including a description of data sources, queries, and other application components necessary to develop the SampleApp.
Avitek is a retailer that has grown through acquisitions. Because of this growth it has two different order management systems (OMS) to manage electronics and apparel orders. These systems are under separate platforms and are not integrate with each other. Avitek has a customer relationship management (CRM) system to manage customer profile information. Finally, Avitek also has a Customer Service system to manage the support cases for Electronic products.
Avitek now want to build a customer self-service web site and this chapter will walk you through the the challenges in creating this application and how SampleApp was built to satisfy Avitek's needs.
To run the Avitek Customer Self-Service Sample Application:
Start—>Programs—>BEA WebLogic Platform 8.1—>BEA Liquid Data for WebLogic 8.1—>Liquid Data Samples
—>Sample Application Home
Alternatively, use the following URL to open the SampleApp login page:
http://localhost:7001/LDSampleApp/login.jsp
Log in using one of the names shown in the dialog box. Simply move your mouse over the login name of your choice to fill-in the name and password.
Figure 1-1 Sample App Login Page
The Avitek Customer Self-Service Sample Application shows how you can use Liquid Data to solve the type of data integration problems frequently faced by Information Technology (IT) managers and staff. Issues include:
Other questions may occur. Is the data-rich solution scalable? Is it reusable throughout the enterprise? Are the original data sources transparent to the application — or do they become an issue each time you want to make a minor adjustment?
A survey commissioned by Marketing found Avitek customers to be dissatisfied with the call-in wait time required to track orders or update customer information. In a focus group the idea of a self-service web site resonated with Avitek customers. Customer Service agreed; they have been requesting such a site for years, but the internal costs were always above budget. But now that Marketing is on board ...
Site requirements seem simple. Customers need to:
A business analyst develops the requirements for the application:
An application/UI designer starts "spec out" the required JSPs.
Then an IT data architect analyzes the data requirements. This turns up a problem. In surveying the information needed by the application -- customer data for one data source, order data from two very separate divisions of the company (two more data sources), and customer support data (a fourth data source) — the architect realizes that integrating data from these diverse data sources will be complicated and time consuming. Challenges included:
Perhaps most frustrating: little of the specialized code needed by the application can be reused.
Developing a unified view into distributed data is one of the most persistent challenges faced by IT departments. Just when you get all the available data sources normalized, new sources appear that must be dealt with, but which also make yesterday's data integration solution obsolete.
This problem is so pervasive that each year thousands of arguably critically-needed applications go unwritten, are delayed, or are delivered in highly compromised form because of the data integration challenges faced by even the most sophisticated enterprises.
Compared to the above, the SampleApp team preferred a solution that:
When Avitek looked at Liquid Data, they found a product that addressed the underlying challenges posed by the apparently simple SampleApp:
Specifically, the features that the team found most appealing included:
Data Access. First, Liquid Data puts a common face on the data. This allows you to access information from anywhere in the company — or beyond — through an easily-created virtual data access layer. Once accessed, data can easily be aggregated through a combination of reusable queries and views that are maintained in the Liquid Data server.
Query Development. Then, once the data is collected under a single point of access, it is not difficult to write queries that pull data together from these disparate sources and present a common, reusable view ready for more specialized queries.
The declarative form of Liquid Data artifacts (queries) makes them very readable. These queries are easily developed in the Data View Builder.
Query Deployment. Once developed, queries are easily integrated into a client application such as WebLogic Workshop.
Queries are as readily available to processes client applications thorough a variety of access methods such as an EJB API or a JSP tag library. Alternatively, these queries can also be accessed as web services.
Integration. Business logic for the SampleApp is provided by the NetUI and page flow features of WebLogic Workshop.
However, Liquid Data queries are easily integrated and maintained within the business logic of any J2EE application.
The SampleApp shows how Liquid Data-generated queries can aggregate data from potentially highly disparate data sources, allowing access to that data through a single point of access that itself is easily integrated with the application.
Figure 1-2 Avitek Queries Supported by the rtlBaseView
Note: To simplify the running of the SampleApp, the multiple data sources described in this document are simulated using the PointBase RDBMS which is shipped with Liquid Data. In the original implementation, these databases were represented by major vendor RDBMS systems.
The SampleApp is located in the following directory:
<WL_HOME>/samples/liquiddata/SampleApp
SampleApp project files are available from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject
SampleApp controls, pages, processes, and resources used to create the SampleApp can be found at:
<WL_HOME>/samples/liquiddata/SampleApp/LiquidDataSampleApp
Schemas used in the SampleApp are in the following directory:
<WL_HOME>/samples/domains/liquiddata/ldrepository/schemas/rtl
The Workshop .work
file for the SampleApp is located at:
<WL_HOME>/samples/liquiddata/SampleApp/SampleApp.work
When you install Liquid Data with the WebLogic Platform, the source code for the SampleApp can be accessed from WebLogic Workshop. For instructions, see Viewing the Avitek Customer Self-Service Sample Application Source.
For additional information and references, see:
Several BEA technologies are used in the Avitek Customer Self-Service Sample Application.
The basic steps used to develop the Avitek Customer Self-Service Sample Application were:
Although the SampleApp is very simple, the underlying data acquisition is potentially complex because date comes from four heterogeneous data sources. These are:
RTL-CUSTOMER
.getOpenOrders()
, which takes a customer ID as input and returns a list of customer open order information through a web service, ElectOrderService
.RTL-APPL-OMS
.RTL-SERVICE
.The following section describes work done by the main SampleApp queries.
The RTLBaseView query forms the basis of the parameterized data view of the same name (RTLBaseView.xv
) that supplies data for the Avetek SampleApp queries. Every element in the four underlying data sources is mapped to the customerBaseView.xsd
target schema. A custid
query parameter identifies the particular customer.
Figure 1-3 Project Showing RTLBaseView Query, the Basis for the Data View Underlying RTLSample Queries
A Data View Builder project is available that can help in understanding how this query was developed. You can review and run this project from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject/RTLBaseView.qpr
Once perfected, the RTLBaseView.xq query is turned into a data view. Figure 1-4 shows the data view consolidates disparate data sources into a single complex object which can then be easily mapped to the target schema.
The CustomerView project (CustomerView.qpr
) illustrates how the RTLBaseView data view is used to free the query developer from a need to directly access and map multiple data sources to the target schema. Instead, the RTLBaseView data source becomes a source schema that contains a superset of the data elements needed by any particular query.
Of course other data sources could also be used in creating a query but in this particular case a more effective design consolidating all the data elements into a since data view data source.
This query populates the home page of the SampleApp.
Figure 1-4 CustomerView Project Illustrating How the RTLBaseView Data View Supports Query Development
Using the RTLBaseView data view, the query returns:
A Data View Builder project is available that can help in understanding how this query was developed. You can review and run this project from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject/CustomerView.qpr
Retrieves information about customers from a RDBMS system maintained by the CRM software.
The query ProfileView.xq
returns:
A Data View Builder project is available that can help in understanding how this query was developed. You can review and run this project from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject/ProfileView.qpr
Provides customers with detailed information on any particular order selected from the History or Home page. Data originates in a proprietary order management system (OMS) which is made available to Liquid Data through a web service.
The query ElecOrderDetail.xq
returns:
A Data View Builder project is available that you can use to understand how this query was developed. You can review and run this project from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject/ElecOrderDetailView.qpr
Provides a customer with detailed information on any particular order found in the order history or on the Home page. The data originates in a RDBMS system.
The query AppOrderDetailView.xq
returns the same data elements as ElecOrderDetailView.xq
A Data View Builder project is available for this query. You can review and run this project from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject/ApplOrderDetailView.qpr
Provides customers with summary information about all their orders with the company.
The query RTLOrderSummaryView.xq
returns:
A Data View Builder project is available for this query.You can review and run this project from:
<WL_HOME>/samples/liquiddata/SampleApp/DVBProject/OrderSummaryView.qpr
Table 1-5 shows the relationship between the data sources, major data elements (for RDBMS systems this means tables and columns), sample application JSPs, and the SampleApp web pages.
If you have not already done so, use Quick Start to start the Avitek Customer Self-Service Sample Application. The following table shows the combination of login names and passwords:
Sample App Login Names and PasswordsOnce a customer logs in, she or he sees the Customer Order Status screen (Figure 1-7). This page also serves as the Home page of the application.
Figure 1-7 SampleApp Home Page
The Home page summarizes the customers order status. This customer service home page is controlled by a JSP called default.jsp. Call-outs show the underlying data sources. The page derives its font and other look-and-feel characteristics from a cascading stylesheet. For additional information on how this page is created, see Page from the SampleApp.
In addition to being able to get Order History and Profile information from the SampleApp Home Page, the customer can search for specific orders based on order dates, items, or amounts.
Figure 1-8 Avitek Customer Self-Service Sample Application Search Form
The JSP for this page initiates a small Java program that incorporates the customers input and generates an XQuery based on the selected parameters. See Ad Hoc Query.
The JSP pages and connection logic for the SampleApp were created in WebLogic Workshop. You can view the source for the SampleApp in WebLogic Workshop.
To open the SampleApp project, open the SampleApp.work
file in WebLogic Workshop. The full path is:
<WL_HOME>/samples/liquiddata/SampleApp/SampleApp.work
Note: If you are already running WebLogic Workshop or have previously run it with a different server setting, you may need to fix your application properties settings. If necessary, select the following from the WebLogic Workshop menu:
When opening the Avitek Customer Self-Service Sample Application in WebLogic Workshop, you initially see the application components and the work area.
Figure 1-9 Initial Avitek Customer Self-Service Sample Application Initial Project View
WebLogic Workshop allows you to work with the application you have under development as components or files. Web pages can be displayed and run, page flows and application logic can be developed and tested.
Note: Getting Started with WebLogic Workshop fully describes the development environment and how it can be used to build enterprise applications on the WebLogic Platform 8.1. The on-line document includes numerous examples and tutorials.
The WebLogic Workshop Samples application contains a number of samples relevant to data access and XML. See:
<WL_HOME>/samples/workshop/SamplesApp/SamplesApp.work
All the components of the Avitek Customer Self-Service Sample Application are available from the Liquid Data Samples directory. See Finding the Components.
Figure 1-10 Avitek Customer Self-Service Sample Application Application Palette
When you click on the LiquidDataSampleApp folder in WebLogic Workshop, a number of components become visible. The following components are of special interest.
This control contains methods that allow for updates to customer profile information.demoPageFlowController.jpf
, that make up the SampleApp. The RTLControl contains automatically-generated methods based on a set of Liquid Data stored queries selected by the developer of the control. For information on accessing Liquid Data queries in WebLogic Workshop see "Select Queries to Add to a Control" in Using Workshop Controls to Develop Liquid Data Applications in the Application Developer's Guide.
Figure 1-11 Design View of Liquid Data Control and Control Methods
For information on deploying a Liquid Data stored query see Deploying a Query in the Testing Queries chapter of Building Queries and Data Views.
A portion of the Source View of the RTLOrderSummary
method of the RTLControl.jcx
file is shown in Figure 1-12. Note that the name of the target schema for the query appears in comments.
Figure 1-12 Source view of a Liquid Data Control
Each method in the Liquid Data Control corresponds to a stored query. Each method returns an XMLBean
type. The XMLBeans are generated when the control is created, and are stored in the Libraries directory of the WebLogic Workshop application.
In the Pages folder you can find the Java Server Pages (JSPs) that make up the Avitek Customer Self-Service Sample Application. These were constructed entirely in WebLogic Workshop using queries from the Liquid Data control and NetUI graphical elements.
Figure 1-13 JSP Pages in the SampleApp
The Avitek Customer Self-Service Sample Application is composed of java server pages (JSPs) that are managed by a WebLogic Workshop PageFlowController. In the Avitek Customer Self-Service Sample Application the PageFlowController is named demoPageFlowController.jpf
.
From an application logic perspective, whenever a user releases control of a page by selecting an option such as Next, Previous, Ok, Cancel, and so forth, application logic returns to the PageFlowController. Once that logic is processed, the user see with the appropriate web page.
Using WebLogic Workshop you can inspect, change and extend page flow programmatically or graphically. There are three views of page flow: page flow, action, and source.
The WebLogic Workshop page flow schematic (Figure 1-14) illustrates graphically the relationship between JSPs, including has modeless page flow is determined by user actions.
When you click on a particular page name, the page opens in the WebLogic Workshop development browser.
Figure 1-14 Avitek Customer Self-Service Sample Application Page Flow
The three primary elements found in Page Flow View are:
The Action View tab is help in finding the location of page flow actions associated with the Avitek Customer Self-Service Sample Application.
Figure 1-15 Avitek Customer Self-Service Sample Application Action View
The PageFlowController file contains several parts:
@jpf:forward
calls within comments that associate user actions with appropriate target JSPs. The code in Listing 1-1 shows the application's entry point and page flow options, as determined by whether the customer's login efforts qualify as success
or invalidLogin
.
Listing 1-1 also shows how customer details are obtained from Liquid Data through a query. Some things to note in examining this section of code are:
if/else if
statement allows you to pull data from two independent data sources.Listing 1-1 Page Flow Logic Supporting the OrderDetails.jsp
/**
* @jpf:action
* @jpf:forward name="success" path="OrderDetails.jsp"
*/
protected Forward ViewOrderDetails()
{
String oId = getRequest().getParameter("orderId");
String orderType = getRequest().getParameter("orderType");
ORDERDETAILTYPE[] orders1 = null;
if (orderType.equals("ELEC")){
orders1 = rtlControl.getElecOrderDetailView(oId, customer.getCUSTOMERID()).
getOrderDetailView().getORDERDETAILVIEWArray(0).getORDERDETAILArray();
} else if (orderType.equals("APPL")){
orders1 = rtlControl.getApplOrderDetailView(oId, customer.getCUSTOMERID()).
getOrderDetailView().getORDERDETAILVIEWArray(0).getORDERDETAILArray();
}
order = (orders1 != null && orders1.length > 0) ? orders1[0] : null;
...
return new Forward("success");
}
The OrderHistory page provides pagination; that is it retrieves data in batches and provides an interface to the user to get the next or previous batch of data.
Figure 1-16 Pagination, illustrated in OrderHistory.jsp.
When you click the Next or the Previous button a new parameterized query is executed that retrieves the next five or previous five records from both data sources, even though they do not have a common key between them. A local variable is incremented or decremented as part of the parameterization process.
In the Avitek Customer Self-Service Sample Application two types of data binding occur: read and update.
When creating a page which reads data, you need to follow these steps:
In the Avitek Customer Self-Service Sample Application update is accomplished in two ways.
When a customer changes his or her credit card information, a WebLogic Workshop database control.is used to update the data source using SQL. You can view source for this control in the file process.jpd
in WebLogic Workshop processes folder.
When the customer update profile information, the Liquid Data control invokes a WebLogic Integration (WLI) process that updates the source database and refreshes information in the application.
Figure 1-17 Design View of processControl.jcx
When activated, processControl.jcx
completes its work by refreshing profile information through the Liquid Data server with this Liquid Data control call:
The AdHocQueryProvider.java
has code to construct an XQuery based on inputs (such as an amount, date, or word) a user enters from a web page. Once created, the ad hoc query is called from demoPageFlowController
as part of the SearchOrders
routine.
The SampleApp Home page is called default.jsp
Figure 1-18 Design View of DefaultView.jsp, the SampleApp Home Page
Elements of defaultView.jsp
were built through dragging-and-dropping variables of XMLBean type onto the JSP page. Other points of interest include:
getCustomerView.xq,
which takes a single custID
parameter.
In summary, the Avitek Customer Self-Service Sample Application provides:
Here are some additional resources for learning more about Liquid Data and WebLogic Workshop:
![]() ![]() |
![]() |
![]() |