This example shows how to use the query method to retrieve tasks that belong to a BPEL process. The process has query properties defined for it that you want to include in the search.
query ( " DISTINCT TASK.TKIID, TASK_TEMPL.NAME, TASK.STATE,
PROCESS_INSTANCE.NAME",
" QUERY_PROPERTY.NAME = 'customerID' AND " +
" QUERY_PROPERTY.STRING_VALUE = 'CID_12345' AND " +
" QUERY_PROPERTY.NAMESPACE =
'http://www.ibm.com/xmlns/prod/websphere/mqwf/bpel/' AND " +
" TASK.KIND IN
( TASK.KIND.KIND_HUMAN, TASK.KIND.KIND_PARTICIPATING ) AND " +
" TASK.STATE = TASK.STATE.STATE_READY ",
(String)null, (String)null, (Integer)null, (TimeZone)null );
query ( " DISTINCT TASK.TKIID, TASK_TEMPL.NAME, TASK.STATE,
PROCESS_INSTANCE.NAME",
" QUERY_PROPERTY1.NAME = 'customerID' AND " +
" QUERY_PROPERTY1.STRING_VALUE = 'CID_12345' AND " +
" QUERY_PROPERTY1.NAMESPACE =
'http://www.ibm.com/xmlns/prod/websphere/mqwf/bpel/' AND " +
" QUERY_PROPERTY2.NAME = 'Priority' AND " +
" QUERY_PROPERTY2.NAMESPACE =
'http://www.ibm.com/xmlns/prod/websphere/mqwf/bpel/' AND " +
" TASK.KIND IN
( TASK.KIND.KIND_HUMAN, TASK.KIND.KIND_PARTICIPATING ) AND " +
" TASK.STATE = TASK.STATE.STATE_READY ",
(String)null, (String)null, (Integer)null, (TimeZone)null );
If
you add more than one query property to the query, you must number each of
the properties that you add as shown in the code snippet. However, querying
custom properties affects performance; performance decreases with the number
of custom properties in the query.