This section gives an overview over query properties, as well as the the scenario that is employed in this sample.
The scenario for this sample is the insurance claim process, in which an insurance company assesses a customer's claim and decides whether or not it will pay for it. The process is triggered when a message is received that contains information about the customer, as well as about the insurance claim. In the next step, a human task is created and an employee of the insurance company will review the given claim information. Depending on the employee's decision, the claim will be approved or rejected.
In this scenario, it is often required that all insurance claim review tasks that are not yet finished are retrieved so that the employees can see which
tasks still need to be worked on. They can select a task from this list, do the review on the insurance claim, and then check again the list of all remaining tasks
to select the next one.
Another common event is that a customer calls and requests information about the state of an insurance claim.
Therefore, the service employee who handles this call has to be able to search for tasks that are associated to the customer's ID.
In both cases, it is necessary to be able to perform queries on task data.
The Business Process Choreographer uses a relational database to store both template and instance data. This data can be used to search for business process- and task-related objects and to retrieve specific properties of these objects. In order to do so, query properties can be defined for a business process and can be used to specify a query. Such a query can subsequently be employed in order to find and retrieve stored information about process instances, activities and tasks.
Note:
There are two kinds of query properties: One for filtering data from a single process, and one for filtering data from multiple processes.
Refer to the Information center
to read more about these
different kinds of query properties.
This sample shows exclusively the usage of query properties for filtering data from a single process.
Query properties are defined during modeling for specific parts of variables in a business process. It is not possible to define query properties for variables below the process level. Every query property is defined through
Note:
In this sample, only the name is being used to identify the query properties in the queries (see section Code Review).
This has been done in order to simplify the example queries.
However, be aware that it is only possible to use the name of a query property as the sole identifier if this name is unique within the process and with respect to other
processes that are also running on the same WebSphere Process Server. If this cannot be guaranteed, for example because another query property exists that has the same name but
different content, it is possible that results are unintentionally and wrongly included in the result set of the query. Moreover, if more than one query property
with this name exists for a single process instance, a query using the query table API can fail because the one to zero-or-one relationship is violated (refer to the description
of Query tables in Business Process Choreographer
and of Composite query tables
for details).
As an example from this sample's scenario, the following screenshot shows the definition of a query property for the process variable customer.
The query property customerID has been defined for the customerNumber field of the variable. This query property can now be utilized in a query to retrieve every task that is part of a process whose business data contains a given customer number. The service employee is therefore able to provide the required information about the inquiring customer's insurance claim review tasks.
The namespace of a query property is created implicitly when the query property is defined in WebSphere Integration Developer. To look up this namespace, open the process in which the query property is defined, go to the Properties view and select the Description tab.
The implicitly created namespace of a query property is the namespace of the process in which it is defined. The customerID query property therefore has the namespace http://QueryProperties/bpc/samples
.
Query properties store business-relevant data for a process, its activities and inline tasks, and are updated whenever the associated variable is updated. An update can thus be triggered by activities like Receive, Assign, Invoke, and Java Snippets.
Each query is written in an SQL-like syntax, and has three parts:
Query properties can be used within each of these three parts. The SQL-like statements can be defined on the basis of predefined database views, which provide the means to access the query properties and data about processes, activities and tasks. You can use the Information center to get more information about the different views available for creating a query. Moreover, refer to the Information center on more details how to define a query.