Query results

A query result set contains the results of a query. The elements of the set are objects that the caller is authorized to see. You can read elements in a relative fashion using the next method or in an absolute fashion using the first and last methods. Because the implicit cursor of a query result set is initially positioned before the first element, you must call either first or next methods before reading an element. You can use the size method to determine the number of elements in the set.

An element of the query result set comprises the selected attributes of work items and their associated referenced objects, such as activity instances and process instances. The first attribute (column) of a QueryResultSet element specifies the value of the first attribute specified in the select clause of the query request. The second attribute (column) of a QueryResultSet element specifies the value of the second attribute specified in the select clause of the query request, and so on.

You can retrieve the values of the attributes by calling a method that is compatible with the attribute type and by specifying the appropriate column index. The numbering of the column indexes starts with 1.

Attribute type Method
String
getString
ID
getOID
Timestamp
getTimestamp
getString
Integer
getInteger
getShort
getLong
getString
getBoolean
Boolean
getBoolean
getShort
getInteger
getLong
getString


Example:

The following query is run:

QueryResultSet resultSet = process.query("ACTIVITY.STARTED, 
                                          ACTIVITY.TEMPLATE_NAME AS NAME, 
                                          WORK_ITEM.WIID, WORK_ITEM.REASON",
                                          null, null, null, null);

The returned query result set has four columns:

You can use the following methods to retrieve the attribute values:

while (resultSet.next())
{
	java.util.Calendar activityStarted = resultSet.getTimestamp(1);
	String templateName = resultSet.getString(2);
	WIID wiid = (WIID) resultSet.getOID(3);
	Integer reason = resultSet.getInteger(4);
}

You can use the display names of the result set, for example, as headings for a printed table. These names are the column names of the view or the name defined by the AS clause in the query. You can use the following methods to retrieve the display names in the example:

resultSet.getColumnDisplayName(1) returns "STARTED"
resultSet.getColumnDisplayName(2) returns "NAME"
resultSet.getColumnDisplayName(3) returns "WIID"
resultSet.getColumnDisplayName(4) returns "REASON"


Related concepts
Authorization for EJB renderings



Searchable topic ID:   c6qryres
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/wfapi/concepts/c6qryres.html

Library | Support | Terms of Use | Feedback