This topic applies only to the IBM Business Automation Workflow Advanced
configuration.

Example: Using the queryAll method

This example shows how to use the queryAll method to retrieve all of the activities that belong to a process template.
The queryAll method is available only to users with system administrator or system monitor rights. The following code snippet shows the queryAll method call for the query to retrieve all of the activities that belong to the process template, sampleProcess:
queryAll( "DISTINCT ACTIVITY.AIID", 
       "PROCESS_TEMPLATE.NAME = 'sampleProcess'",  
       (String)null, (String)null, (Integer)null, (TimeZone)null )
The following code snippet shows the SQL query that is generated from the API query:

 SELECT DISTINCT ACTIVITY.AIID
   FROM   ACTIVITY AI, PROCESS_TEMPLATE PT
   WHERE  AI.PTID = PT.PTID
   AND    PT.NAME = 'sampleProcess'  
 
Because the call is invoked by an administrator, an access control condition is not added to the generated SQL statement. A join with the WORK_ITEM view is also not added. This means that the query retrieves all of the activities for the process template, including those activities without work items.
Note: The queryAll method retrieves selected object properties of all objects persistently stored in the database and allows for retrieving a specified set of data only.

You can specify a filter, a starting tuple, or a threshold to restrict the number of tuples returned. The tuples are sorted on the server according to the specified sort criteria. Sorting on the server means that the locale of the server is used.

Specify the parameters of the query, the select-, where-, and order-by-clause, using SQL based on the published views. Execution of the query can thus be shifted to SQL and becomes portable and optimizable.

Note, however, when you use a combination of the order-by-clause, threshold, or skipTuples parameters, the tuples returned depend on your database system. For example, some database systems order all records and then return the requested number of tuples. Other database systems first take the requested number of tuples and then apply the order criteria. With Oracle databases, pagination will not render ordered/consistent data results if an order-by-clause parameter references a single table column that contains duplicate records with the same value.