Use the query interface of the Web services APIs to obtain information about business processes and tasks.
Client applications use an SQL-like syntax to query the database.
Example for Java Web services
string processTemplateName = "ProcessCustomerLR"; query query1 = new query(); query1.selectClause = "DISTINCT PROCESS_INSTANCE.STARTED, PROCESS_INSTANCE.PIID"; query1.whereClause = "PROCESS_INSTANCE.TEMPLATE_NAME = '" + processTemplateName + "'"; query1.orderByClause = "PROCESS_INSTANCE.STARTED"; query1.threshold = null; query1.timeZone = "UTC"; query1.skipTuples = null; queryResponse queryResponse1 = proxy.query(query1);
Information retrieved from the database is returned through the Web services APIs as a query result set.
QueryResultSetType queryResultSet = queryResponse1.queryResultSet; if (queryResultSet != null) { Console.WriteLine("--> QueryResultSetType"); Console.WriteLine(" . size= " + queryResultSet.size); Console.WriteLine(" . numberColumns= " + queryResultSet.numberColumns); string indent = " . "; // -- the query column info QueryColumnInfoType[] queryColumnInfo = queryResultSet.QueryColumnInfo; if (queryColumnInfo.Length > 0) { Console.WriteLine(); Console.WriteLine("= . QueryColumnInfoType size= " + queryColumnInfo.Length); Console.Write( " | tableName "); for (int i = 0; i < queryColumnInfo.Length ; i++) { Console.Write( " | " + queryColumnInfo[i].tableName.PadLeft(20) ); } Console.WriteLine(); Console.Write( " | columnName "); for (int i = 0; i < queryColumnInfo.Length ; i++) { Console.Write( " | " + queryColumnInfo[i].columnName.PadLeft(20) ); } Console.WriteLine(); Console.Write( " | data type "); for (int i = 0; i < queryColumnInfo.Length ; i++) { QueryColumnInfoTypeType tt = queryColumnInfo[i].type; Console.WriteLine( " | " + tt.ToString()); } Console.WriteLine(); } else { Console.WriteLine("--> queryColumnInfo= <null>"); } // - the query result values string[][] result = queryResultSet.result; if (result !=null) { Console.WriteLine(); Console.WriteLine("= . result size= " + result.Length); for (int i = 0; i < result.Length; i++) { Console.Write(indent +i ); string[] row = result[i]; for (int j = 0; j < row.Length; j++ ) { Console.Write(" | " + row[j]); } Console.WriteLine(); } } else { Console.WriteLine("--> result= <null>"); } } else { Console.WriteLine("--> QueryResultSetType= <null>"); }
The query function returns objects according to the caller's authorization. The query result set only contains the properties of those objects that the caller is authorized to see.
ProcessTemplateData[] queryProcessTemplates (java.lang.String whereClause, java.lang.String orderByClause, java.lang.Integer threshold, java.util.TimeZone timezone);For task templates, the query function has the following syntax:
TaskTemplate[] queryTaskTemplates (java.lang.String whereClause, java.lang.String orderByClause, java.lang.Integer threshold, java.util.TimeZone timezone);For the other business-process and task-related objects, the query function has the following syntax:
QueryResultSet query (java.lang.String selectClause, java.lang.String whereClause, java.lang.String orderByClause, java.lang.Integer skipTuples java.lang.Integer threshold, java.util.TimeZone timezone);
The query interface also contains a queryAll method. You can use this method to retrieve all of the relevant data about an object, for example, for monitoring purposes. The caller of the queryAll method must have one of the following Java™ 2 Platform, Enterprise Edition (J2EE) roles: BPESystemAdministrator, BPESystemMonitor, TaskSystemAdministrator, or TaskSystemMonitor. Authorization checking using the corresponding work item of the object is not applied.
Example for .NET
ProcessTemplateType[] templates = null; try { queryProcessTemplates iW = new queryProcessTemplates(); iW.whereClause = "PROCESS_TEMPLATE.STATE=PROCESS_TEMPLATE.STATE.STATE_STARTED"; iW.orderByClause = null; iW.threshold = null; iW.timeZone = null; Console.WriteLine("--> queryProcessTemplates ... "); Console.WriteLine("--> query: WHERE " + iW.whereClause + " ORDER BY " + iW.orderByClause + " THRESHOLD " + iW.threshold + " TIMEZONE" + iW.timeZone); templates = proxy.queryProcessTemplates(iW); if (templates.Length < 1) { Console.WriteLine("--> No templates found :-("); } else { for (int i = 0; i < templates.Length ; i++) { Console.Write("--> found template with ptid: " + templates[i].ptid); Console.WriteLine(" and name: " + templates[i].name); /* ... other properties of ProcessTemplateType ... */ } } } catch (Exception e) { Console.WriteLine("exception= " + e); }
(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)