Creating a custom business activity monitoring user interface using DB2 Alphablox Query Builder

In this tutorial, you'll learn about the powerful features of the DB2® Alphablox Query Builder, included with WebSphere® Business Monitor, to build a custom user interface for monitoring solutions. This approach is useful when you don't want to use Business Space, but need an interface that's easy to customize to your desired look and feel, or when you want to embed the monitoring application into an existing UI.

Manisha Sharma Kohli (shmanisha@in.ibm.com), Consulting IT Specialist (BPM), IBM

Manisha Sharma Kohli is a BPM architect in the World Wide WebSphere Business Partners Organization, which is a part of IBM Software Group. She has almost 10 years of experience in the IT industry, and her area of specialization includes the complete IBM WebSphere BPM portfolio, covering WebSphere Business Modeler, WebSphere Process Server (now part of IBM Business Process Manager V7.5), WebSphere Business Monitor, WebSphere Business Services Fabric, IBM BlueWorks Live, WebSphere Business Space and ILOG BRMS.

In her current role, Manisha works with IBM's strategic business partners to drive their technology adoption, support them on proof of concepts (POCs), request for proposals (RFPs), architecture development and enablement. She has successfully led several partner and customer engagements and is a well-known BPM subject matter expert in IBM and the partner community.

Manisha is also an avid innovator and has made significant contributions to IBM's intellectual property, including patents, the Technical Experts Council (Academy of Technology affiliate) and forums like developerWorks. Manisha can be reached at shmanisha@in.ibm.com.



17 August 2011

Also available in Portuguese

Before you start

Learn what to expect from this tutorial, and how to get the most out of it.

About this tutorial

This article presents a simple scenario for using the DB2 Alphablox Query Builder tool to build a custom JSP-based web application rather than using WebSphere Business Space to pull the dimensional data from the Monitor cubes in the WebSphere Business Monitor (hereafter called Monitor) database.

The Dimensions widget supplied with Business Space is a monitoring widget that provides out-of-the-box capabilities to enable dimensional analysis of the monitored data. So for example, if you want to measure the total number of orders processed, you can combine this data with certain categories, such as "country", to measure total nunmber of orders processed in France or Japan, and so on.

While building a business activity monitoring solution, developers and architects do not always want to use the built-in Dimensions widget supplied with Business Space, and would rather build their own custom user interface to provide more flexible analytical capabilities for the monitored data.

The solution described in this tutorial is particularly useful for scenarios in which developers are willing to build a custom UI to retrieve dimensional data and are able to provide the same analytical capabilities in their user applications as are provided by Business Space. For information on the concepts used in multidimensional modeling in a monitoring application, refer to Dimensional analysis in business activity monitoring (BAM), Part 1: Leverage WebSphere Business Monitor V6.2 to perform dimensional analysis.

Note: The example in this tutorial was built using WebSphere Business Monitor V6.2. You can successfully migrate and run models built in this tutorial in WebSphere Business Monitor V7 and IBM Business Monitor V7.5. However, Alphablox is deprecated in IBM Business Monitor V7.5. Instead, we strongly recommend that customers use the embedded Cognos® Business Intelligence capability for building custom analytical reports. Your existing monitor model definitions are compatible with Cognos-based reports and you will benefit from a much wider array of custom report authoring capabilities using the embedded Cognos Business Intelligence feature. Refer to the Business Process Manager V7.5 Information Center for more information.

Objectives

In this tutorial, you will learn how to:

  • Use the Alphablox Query Builder tool to write queries to retrieve data from the Monitor cubes.
  • Create a JSP-based web application to present the queried cube data in the desired format, similar to the Dimensions widget of Business Space.

Prerequisites

This tutorial is written for business activity monitoring application developers whose skills and experience are at an intermediate level. You should have a familiarity with the dimensional and analytical capabilities of Monitor and should also have experience working with the monitoring widgets in Business Space.

System requirements

To run the examples in this tutorial, you need a Microsoft® Windows® computer with the following products installed:

  • WebSphere Integration Developer V6.2
  • WebSphere Business Monitor Toolkit and WebSphere Business Monitor server test environment V6.2 on top of WebSphere Integration Developer for the development of monitoring application

The screen shots and steps in this tutorial are based on WebSphere Integration Developer V6.2. If you want to build a solution using a standalone Monitor server, you will also need the following software:

  • WebSphere Business Monitor server V6.2 to run the monitoring application
  • WebSphere Process Server V6.2 to run the process and BPEL application

Business process scenario

The article uses a simple order processing scenario, in which a business process serves as the event emitter application. The process accepts a purchase order object as an input and returns the same object with an updated status of Approved or Rejected. The criteria for approval or rejection of the purchase order is as follows:

  • If PurchaseOrder.Price >= 2000, the order is approved.
  • If PurchaseOrder.Price < 2000, the order is rejected.

The BPEL process and various activities within the flow are configured to emit common event infrastructure (CEI) events to be monitored by the BAM application. Figures 1 and 2 depict the BPEL flow and the purchase order business object definition.

Figure 1. BPEL flow for an order processing system
BPEL flow for an order processing process
Figure 2. Purchase order business object definition
Purchase order business object definition

Developing the monitoring application

The BPEL process defined above is monitored by a monitor application, which consists of a single monitoring context that receives all emitted events from the BPEL.

The monitoring context defines two custom metrics that capture the following data from the incoming events:

  • Order Status of type String, which captures the status of an order after it is processed by the BPEL. The valid values of this metric are: Approved and Rejected.
  • Order Date of type datetime, which captures the date when the order was placed.

Figure 3 shows how these custom metrics are defined in a monitoring context called mybpel.

Figure 3. Custom metrics in the monitoring context
Custom metrics in the monitoring context

A cube is created in the Dimensional Model tab of the monitoring model for the mybpel monitoring context. The Total no. of processed orders business measure is defined in this cube, using Count as an aggregate function to calculate the total number of orders processed. This business measure is calculated by counting all the orders processed by the order processing BPEL.

The cube also contains a dimension with the following two dimensional levels:

  • Order status - populated by the Order Status metric
  • Order date - populated by the Order Date metric

By default, Date or Datetime type of metrics, if used as dimensions, automatically create three dimensional levels - year, month and date. However, if you want to track a business measure to the level of a specific hour in a day or a minute in an hour, you can convert the datetime metric to a String using built-in functions and define separate custom metrics for Year, Month, Day, Hour and Minute by using the substring() function, as shown in Figures 4 and 5.

Figure 4. Defining custom date/time metrics
Defining custom date/time dimensions
Figure 5. Defining custom measures and dimensions for Date/Time metrics
Defining custom date/time dimensions

The monitoring application also defines a KPI called Average working duration of the process, which is not the focus of discussion for this article.

Figure 6. Defining KPIs
Defining KPIs

Creating the cube data

Once complete, you can deploy both the BPEL and the monitoring application deployed to the test environment of the Monitor server, available with WebSphere Integration Developer. For ease of use, you can augment a Monitor server profile on top of a Process Server profile.

You can test the process using the Business Process Choreographer (BPC) explorer using the scenarios below. Figure 7 shows how you specify test values in the BPC explorer:

  1. Test Set 1
    • Input:
      • Purchase Order
        • Name: Laptop
        • Quantity: 1
        • Price: 30000
        • Status: [not required]
        • Date: 5/12/10 12:45 PM
    • Output:
      • Purchase Order
        • Name: Laptop
        • Quantity: 1
        • Price: 30000
        • Status: [not required]
        • Date: 5/12/10 12:45 PM
  2. Test Set 2
    • Input:
      • Purchase Order
        • Name: Bag
        • Quantity: 1
        • Price: 1500
        • Status: [not required]
        • Date: 5/13/10 12:45 PM
    • Output:
      • Purchase Order
        • Name: Bag
        • Quantity: 1
        • Price: 1500
        • Status: [not required]
        • Date: 5/13/10 12:45 PM
Figure 7. Running the BPEL process using BPC explorer
Running the BPEL process using BPC explorer

Verifying the dimensional data in Business Space

Before building our custom analytical user application, it's a good idea to configure a Dimensions widget in WebSphere Business Space to make sure the data is getting generated according to the modeled dimensions. For information on how to configure this view, refer to the "Analyze data in dashboards" section of Dimensional analysis in business activity monitoring (BAM), Part 1: Leverage WebSphere Business Monitor V6.2 to perform dimensional analysis. Figure 8 shows a sample Dimensions widget that enables viewing of the monitored data against certain pre-defined dimensions:

Figure 8. Purchase order business object definition
Purchase order business object definition

Creating the the custom analytic user application using Alphablox Query Builder

All the dimensional analysis capabilities offered by the Business Monitor server are provided by the built-in DB2 Alphablox server. Complete the following steps to create a custom JSP application to view the dimensional data monitored by the monitoring application.

Creating the Blox tag

  1. Open the Alphablox Query Builder and connect to the MONITOR_CUBE data source by pointing your browser to the AlphabloxAdmin URL at http://<monitor_server_host:monitor_server_port>/AlphabloxAdmin/home and clicking the Alphablox Query Builder button.
  2. Click Connection Settings in the Alphablox Query Builder window shown Figure 9, and select MONITOR_CUBE, which is the data source to connect to your Monitor database, then click Connect. All other details will be pulled automatically from the data source.
    Figure 9. Alphablox Query Builder tool
    Alphablox Query Builder tool
    You will be connected to the data source and will see all available cubes within your Alphablox database. A default query is generated for you in the Query pane of the Query Builder, as shown in Figures 10 and 11.
    Figure 10. Data source connection settings in Alphablox Query Builder
    Data source connection settings in Alphablox Query Builder
    Figure 11. Data source connection in Alphablox Query Builder
    Data source connection in Alphablox Query Builder
  3. Change the default query to select from <your_monitor_model_cube> and click Execute Query. You'll see the dimensional data populated in a PresentBlox pane on the Query window. The query will be also updated if you check Automatically update queries. The layout of the PresentBlox pane, shown in Figure 12, is configurable.
    Figure 12. PresentBlox pane
    PresentBlox pane
  4. In the Data Layout section of the PresentBlox pane, rearrange the Measures and Dimensions under Page, Row or Column to the layout you desire. In Figure 13 each Page appears as a drop-down selection of Business Measures, each Row represents the custom metrics Order Date and Order Status, and each Column represents the dimension CreationTime. This enables you to see the status of the orders (approved or rejected) and the exact time when these orders were placed against time axis (year/month/day).
    Figure 13. PresentBlox display
    PresentBlox display
    When you modify the layout of the PresentBlox pane, the SQL query should be modified automatically to something similar to Listing 1.
    Listing 1. SQL query generated by the Query Builder
    SELECT
    DISTINCT( {[MYMONITOR_MYBPEL_CUBE].[CreationTime].[All CreationTime]} ) ON AXIS(0),
    DISTINCT( crossjoin ( {[MYMONITOR_MYBPEL_CUBE].[Order Date].[All Order Date]},
    [MYMONITOR_MYBPEL_CUBE].[Order Status].[All Order Status]})  )  ON AXIS(1)
    FROM [MYMONITOR_MYBPEL_CUBE]
    WHERE
    (
    [MYMONITOR_MYBPEL_CUBE].[Measures].[Total Orders Processed],
    [MYMONITOR_MYBPEL_CUBE].[TerminationTime].[All TerminationTime]
    )
  5. Click Generate Blox Tag in the PresentBlox pane. This generates an XML tag named blox, as shown in Figure 14. Copy this tag and paste it into a text file. You will use this tag later. A snapshot of the generated blox tag is shown below:
    Figure 14. Generated Blox tag
    Generated Blox tag

Creating the JSP-based application for dimensional analysis

To create the JSP application, complete the following steps:

  1. Create a new dynamic web project using WebSphere Integration Developer as shown in Figure 15.
    Figure 15. Create a new web project
    Create a new web project
  2. Add the Alphablox tag library to the web project by selecting aastaglib.jar from the Alphablox installation directory (lt;wid_install_dir>/pf/<server_profile_name>/Alphablox_<server_name>/lib/), as shown in Figure 16. Copy the jar file to web_project_name\WebContent\WEB-INF\lib.
    Figure 16. Select aastaglibs.jar file from the Alphablox installation directory
    Select aastaglibs.jar file from Alphablox installation directiory
  3. Modify the deployment descriptor (web.xml) of your web project to include the changes shown in Listing 2.
    Listing 2. Alphablox specific changes in the deployment descriptor of the UI project
    <servlet>
            <servlet-namegt;AlphabloxServerlt;/servlet-name>
            <servlet-class>
                    com.alphablox.server.webapps.server.AlphabloxServer
            </servlet-class>
    </servlet>
    <servlet-mapping>
            <servlet-namegt;AlphabloxServerlt;/servlet-name>
            <url-pattern>/abx/*</url-pattern>
    </servlet-mapping>
  4. Create a new JSP and copy the Blox tag saved in step 5 above. Add the following to the JSP: lt;%@ taglib uri="bloxtld" prefix="blox" %gt;

    Listing 3 shows the final JSP after these changes.

    Listing 3. Final Alphablox specific changes in the deployment descriptor of the UI project
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ taglib uri="bloxtld" prefix="blox" %>
    <html>
    <head>
    <blox:header/>
    </head>
    <body>
    <h2>Simple Analytic Application</h2>
    
    </body>
    <blox:present
        id="queryBuilder4_present"
        calculationEditorEnabled="true"
        height="500"
        width="100%">
        <blox:grid/>
        <blox:chart
            chartCurrentDimensions="[MYMONITOR_MYBPEL_CUBE].[Order Date].
    		[All Order Date]"/>
        <blox:page/>
        <blox:data
            dataSourceName="MONITOR_CUBE"
            onErrorClearResultSet="true"
            query=" SELECT
    DISTINCT( {[MYMONITOR_MYBPEL_CUBE].[CreationTime].[All CreationTime]} )  ON AXIS(0)
    , DISTINCT( crossjoin ( {[MYMONITOR_MYBPEL_CUBE].[Order Date].[All Order Date]}, 
    {[MYMONITOR_MYBPEL_CUBE].[Order Status].[All Order Status]})  )  ON AXIS(1)
    FROM [MYMONITOR_MYBPEL_CUBE]
    WHERE
    (
    [MYMONITOR_MYBPEL_CUBE].[Measures].[Total Orders Processed],
    [MYMONITOR_MYBPEL_CUBE].[TerminationTime].[All TerminationTime]
    )" selectableSlicerDimensions="[MYMONITOR_MYBPEL_CUBE].[Measures]"
            useAliases="true"/>
        <blox:toolbar visible="false"/>
        <blox:dataLayout visible="false"/>
        <bloxui:calculationEditor />
    </blox:present>
    </html>
  5. Save and build the application.

You have now developed the custom application.


Testing the custom analytic application

To test the custom application, do the following:

  1. Deploy the web application to the application server.
  2. Access the JSP from the browser (Firefox is recommended). For example: http://<Monitor_server_IP:port/webapp_name/jsp_name.jsp>
  3. You should see a screen like Figure 17, in which you can test drilling down, drilling up, filtering on the grid (middle pane), and the Chart view (far right).
    Figure 17. Figure 17. User interface for custom analytic application
    User interface for custom analytic application
  4. You can customize these views using the custom attributes of the blox:data tag. For more information, refer to the AlphaBlox documentation listed in the Resources section.

Resources

  • Alphablox information center: Get product documentation for Alphablox.
  • WebSphere Business Monitor : Get product information for WebSphere Business Monitor.
  • WebSphere BPM V6.2 Information Center: Get product doucmentation for WebSphere BPM products, including WebSphere Business Monitor.
  • developerWorks BPM zone: Get the latest technical resources on IBM BPM solutions, including downloads, demos, articles, tutorials, events, webcasts, and more.
  • IBM BPM Journal: Get the latest articles and columns on BPM solutions in this quarterly journal, also available in both Kindle and PDF versions.
  • developerWorks BPM zone: Get the latest technical resources on IBM BPM solutions, including downloads, demos, articles, tutorials, events, webcasts, and more.
  • IBM BPM Journal: Get the latest articles and columns on BPM solutions in this quarterly journal, also available in both Kindle and PDF versions.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Business process management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere, Information Management
ArticleID=752549
ArticleTitle=Creating a custom business activity monitoring user interface using DB2 Alphablox Query Builder
publish-date=08172011