Query Tables

Query Table Editor

The query table editor is provided as part of a Support Pac called

PA71: WebSphere Process Server - Query Table Builder

This can be found at the following URL:

http://www-01.ibm.com/support/docview.wss?uid=swg24021440

There is detailed documentation associated with using query tables that can be found with the Support Pac.

Installation of Query Table Editor

Download the pa71_<version>.zip file to a directory on the same machine as WID and extract its content. Start WID.

Query Table programming

The query tables can be accessed via REST interfaces. These include:

Task Instance Query Tables Resource

This request retrieves a list of the query tables and their attributes. The general syntax for this request is:

GET /rest/bpm/htm/v1/tasks/queryTables

Task Instance Entity List Resource

This request retrieves instances of rows in the query tables. The general syntax for this request is:

GET /rest/bpm/htm/v1/tasks/query

A mandatory parameter called queryTableName is needed. This is the name of the table that is to be queried.

Additional parameters include queryFilter. This is a HTM standard query that can be used to locate a subset of entries. The default it to return all entries.

An example REST request might be:

/rest/bpm/htm/v1/tasks/query?queryTable=MYTABLE.MYDATA&queryFilter=KIND%3DKIND_PARTICIPATING AND STATE%3DSTATE_READY

Note the escape characater sequence of %3D which is '='.

Using Query Tables with Business Space

As part of the WPS 6.2 Feature Pack that was made available in July 2009, a new set of Business Space widgets were included. Amongst the new collection is widget called Tasks List. It presents lists of Human Tasks in various states. From these tasks, a user can select a task and work upon it.

The basic view of a task in the Tasks List widget looks as follows:

Although this looks fine. We can do better than this. New for the Tasks List widget is the ability to configure in great detail what is shown on a per task basis. Importantly, the columns shown for a task can include data that can allow the user to see into that task without having to open it up.

By way of a trivial example, consider a Business Process that looks like this:

The process includes a human task that is used to present some data to a user. Now assume that the data includes the following Business Object definition:

In the Environment section of the Human Task, a couple of custom properties have been defined:

Wouldn't it be wonderful if the Business Space Tasks List could also display information relating to the task on the list of tasks? It might look something like this:

Notice that the task list contains application data (Customer Name and Balance) that came from custom properties values.

The remainder of this paper will show you exactly how to achieve this effect.

The first thing we need to do is to create a Query Table associated with the data that we want to display for this type of task. A detailed description of Query Tables is beyond the scope of this document. However, the document does assume that the PA71 - Support Pac called WebSphere Process Server – Query Table Builder has been installed. See:

http://www-01.ibm.com/support/docview.wss?uid=swg24021440

Switch the view to Physical resources

In the Business Integration view, click on Physical Resources.

Create a new Query Table for Business Space

Create a new artifact. In the wizard list, expand Business Process Choreographer and select “Composite Query Table Definition for Business Space”.

Give the query table a name

Each query table must be given a name. We will call ours “BANK.ACCOUNT”.

Described the type of Query Table

There are multiple types of query table that can be built. The Query Table we want is to be used to show task lists so we select the Tasks List entry from the set of available query tables.

Open the Query Table builder

When prompted to open the Query Tables perspective, select Yes.

Add the TASK_DESC table

In the result, we want the description of the task to be included so we add the TASK_DESC table as a related table. Drag it from the Human Task predefined tables and drop it on the canvas.

Add the DESCRIPTION into the resulting query table

Drag the DESCRIPTION field from the TASK_DESC table into the BANK.ACCOUNT set of columns. This will allow DESCRIPTION to be shown in the query result set.

Add two TASK_CPROP tables

In our sample, we have two properties associated with a task (Customer Name and Balance). We want these included in the BANK.ACCOUNT query table. Drag two instances of the TASK_CPROP table into the canvas. One will be used for the Customer Name property and the other used for the Balance property.

Configure the Customer Name

Rename the table's short name to be CUSTOMERNAME. Although not required, this aids in readability. In the filter expression used to select the vales, change the filter so that NAME matches 'CustomerName' which is the name of the property.

Configure the Balance

Similar to the previous step, we rename the short name of the table to be BALANCE and set the filter used to select values to be 'Balance' which is the name of the property.

Add CUSTOMERNAME and BALANCE columns to the BANK.ACCOUNT table

Drag and drop the field called STRING_VALUE from both the TASK_CPROP tables into the BANK.ACCOUNT description. This will now include this data in the resulting query.

Examine the completed BANK.ACCOUNT query table

The final BANK.ACCOUNT query table looks as follows. It is a combination of data from a number of different sources and includes the additional data that we want to display.

Click on the white space in the diagram. In the Properties view, click on the Description tab. Enter Bank Account in the Display Name.

This will give a human readable name to the Query Table when we select it in Business Space at a later step.

Repeat this for the columns

When the Tasks List widget displays the data, it uses the column names to display the heading for those columns. These aren't very readable. For each of the columns we want to display, select that column and change its Display Name to be a better value. The following columns should be modified.

Description

Owner

Customer Name

Balance

Open up the Query Table testing tool

Save the query table that we have just built and then right click upon it to open up the context menu. From the context menu, select “Test on local WebSphere Process Server”.

Complete the details for deployment

The testing tool allows us to deploy the query table definition to the running WPS server. Complete the form and then Deploy. Make sure that the check box to deploy the additional properties files is also selected.

Open and configure the Tasks List widget

In Business Space, add a Tasks List widget to the page. Open the configuration panel for the widget.

View the available query tables

In the Content tab, notice that there is now a list of query tables. If we pull down the task list to display, we see that a new one is present called “Bank Account”. Here we can select which columns and their order that should be displayed in the Tasks List.

Change the view of the Tasks List

In the Tasks List widget, pull down the view (currently set to All tasks) and select “Bank Account”. The widget will then change to show the Bank Account view.

Review the result.

Now we see the final result. It is a list of tasks with the data for those tasks taken from the query table that we just built.

No Comments
Back to top