Displaying a List of Queues

All work items for each workflow user (workflow participant or Tracker) reside in queues — either in a User queue (holds work items waiting to be processed by that specific user) and possibly one or more Work queues (hold work items that can be completed by any one of a group of users — to which this user belongs — or by an automated process). Thus, a required operation for a User Inbox (User Tasks Page) application is to retrieve a list of queues containing work items for that user and display them, so that the user can then select which queue he/she wishes to work on.

Note For details on these APIs, see the Process API JavaDoc documentation. For additional information on queues, see Working with Queues.

This topic describes how to query for and display a list of queues using the Process Java APIs as follows:

  1. If you do not already have a VWSession object, you must login to the Process Engine server and establish a Process session using the VWSession API.
  2. Get the names of queues accessible through the session by this user by calling the VWSession.fetchQueueNames() method. The fetchflag(int) flag specifies the types of queues to be returned. For example:
     // Fetch a list of queue names for Work queues (QUEUE_PROCESS)
     // and User Queues (QUEUE_USER_CENTRIC)
    int myQueueFlags = (VWSession.QUEUE_PROCESS | VWSession.QUEUE_USER_CENTRIC);
    String[] QueueNames = null;
    QueueNames = MySession.fetchQueueNames(myQueueFlags);
    
  3. Note that when fetching the queue names, you will have to filter out the Component queues programmatically. To filter out the Component queues, get the queue (see next step) and check the property by using the vwQueue.getIsConnectorQueue() method (this method returns a boolean value indicating whether or not this queue is a Connector queue).

  4. You can use the queue names returned by this method to create an instance of the VWQueue class (the VWSession.getQueue() method creates an instance of the VWQueue class). Get the VWQueue object for the queueName passed in. For example:

    if (queueName != null) vwQueue = vwSession.getQueue(queueName);
    Tip You may find it helpful to use a queueHelper class similar to the queueHelper API sample documented elsewhere in this guide.

  5. Display the list of queue names as is appropriate for your application.