The work items in a queue for a workflow step include Queue Elements (each Queue Element contains system fields that describe the work item and its state at a point in time). User Inbox queries generally query for Queue Elements to display the work items to the user.
The instructions for querying queues for Queue Elements is the same as querying for Step Elements or Work Objects. The optimizations recommended are also the same. See Querying for Step Elements or Work Objects for this information.
The following example QueueQueryDisplay class queries a queue to retrieve VWQueueElement objects and display them. It also illustrates creating QueueHelper, Logger, and SessionHelper objects using the QueueHelper and SessionHelper sample helper classes.
import filenet.vw.api.*; /* * This sample QueueQueryDisplay class illustrates how to query queues * and display queue results using the VWQueueElement class. */ public class QueueQueryDisplay extends Object { // declare variables /* * Constructor - performs initialization and establishes * the Process session. */ public QueueQueryDisplay(VWSession vwSession, Logger logger, String queueName) { QueueHelper queueHelper = null; VWQueue vwQueue = null; VWQueueElement vwQueueElement = null; try { logger.logAndDisplay("\n~ Starting QueueQueryDisplay execution."); // create the helper class queueHelper = new QueueHelper(vwSession, logger); // get the requested queue vwQueue = queueHelper.getQueue(queueName); if (vwQueue != null) { // get a Queue Element vwQueueElement = queueHelper.getQueueElement(vwQueue); if (vwQueueElement != null) { // set the comments vwQueueElement.setComment("This is the user's comment."); // display the Queue Element information logger.displayQueueElementInfo(vwQueueElement); } { // display the queue contents displayQueueContents(VWQueue vwQueue); } } } catch(Exception ex) { if (logger != null) logger.log(ex); else ex.printStackTrace(); } finally { if (logger != null) logger.logAndDisplay("~ QueueQueryDisplay execution complete.\n"); } } /* * Creates the Logger and SessionHelper objects, then * instantiates the outer class. * * Define the Main method and variables */ public static void main(String args[]) { String queueName = null; String outputFileName = null; Logger logger = null; SessionHelper sessionHelper = null; VWSession vwSession = null; QueueQueryDisplay sampleClass = null; try { // did the user supply enough arguments? if (args.length < 4 || (args.length > 0 && args[0].compareTo("?") == 0)) { System.out.println("Usage: QueueQueryDisplay username password router_URL queueName [output_filename]"); System.exit(1); } // the file name (for output) is optional if (args.length > 4) outputFileName = args[4]; else outputFileName = new String("QueueQueryDisplay.out"); // create and initialize the logger logger = new Logger(outputFileName); // create the session and log in sessionHelper = new SessionHelper(args[0], args[1], args[2], logger); vwSession = sessionHelper.logon(); if (vwSession != null) { // create the sample class sampleClass = new QueueQueryDisplay(vwSession, logger, args[3]); } } catch (Exception ex) { if (logger != null) logger.log(ex); else ex.printStackTrace(); } finally { // logoff if (sessionHelper != null) sessionHelper.logoff(); } } }