Process Class Relationships

filenet.vw.api
Class VWRosterQuery

java.lang.Object
  |
  +--filenet.vw.api.VWQuery
        |
        +--filenet.vw.api.VWRosterQuery

public final class VWRosterQuery
extends filenet.vw.api.VWQuery

Use this class to query roster elements or work objects.

An instance of this class will return only one type of item. For example, if the next() or the deprecated fetchWorkObjects method fetches Work Objects, an error occurs if the fetchRosterElements method attempts to fetch additional query items. A query completes when a fetch method returns null values.

VWRosterQuery implements Iterator methods next() and hasNext() which emulate the new collection model in Java 2.

See Also:
VWRoster.startQuery(java.lang.String, java.lang.Object[], java.lang.Object[], int, java.lang.String, java.lang.Object[]), VWRoster.createQuery(java.lang.String, java.lang.Object[], java.lang.Object[], int, java.lang.String, java.lang.Object[], int)

Field Summary
static int QUERY_GET_TRANSLATED_SYSTEM_FIELDS
           
static int QUERY_LOCK_OBJECTS
          Value of 16 Flag used to specify that items returned from a query should become locked.
static int QUERY_MAX_VALUES_INCLUSIVE
          Value of 64 Flag used to specify that maximum values passed in a query are inclusive, i.e.
static int QUERY_MIN_VALUES_INCLUSIVE
          Value of 32 Flag used to specify that minimum values passed in a query are inclusive, i.e.
static int QUERY_READ_BOUND
          Value of 2 Flag used to specify that items returned from a query should include those that are already bound to a user or machine.
static int QUERY_READ_LOCKED
          Value of 1 Flag used to specify that items returned from a query should include those that are already locked.
static int QUERY_READ_UNWRITABLE
          Value of 4 Flag used to specify that items returned from a query should include those that are read-only.
 
Method Summary
 int fetchCount()
          Gets the integer value indicating the number of records that can be retrieved, using this rosterquery definition.
 VWRosterElement[] fetchRosterElements(int bufferSize)
          Fetches a specified number of roster elements.
 VWWorkObject[] fetchWorkObjects(int bufferSize)
          Deprecated. Replaced by next()
 int getElementType()
          Gets the fetch type for the VWRosterQuery object.
 VWRoster getRoster()
          Gets a roster that was retrieved by the query initiated by either the VWRoster.createQuery() or VWRoster.startQuery() methods.
 boolean hasNext()
          Determines whether or not another element can be fetched.
 boolean isDone()
          Deprecated. Replaced by next()}
 java.lang.Object next()
          Retrieves the element for each query.
 void resetFetch()
          Resets the last element fetched for this RosterQuery object.
 java.lang.String toString()
          Gets the name of the roster retrieved in a query.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_READ_LOCKED

public static final int QUERY_READ_LOCKED
Value of 1 Flag used to specify that items returned from a query should include those that are already locked.
See the queryFlags parameter of VWRoster.startQuery(..), VWQueue.createQuery(..), and VWQueue.startQuery(..)(deprecated)

QUERY_READ_BOUND

public static final int QUERY_READ_BOUND
Value of 2 Flag used to specify that items returned from a query should include those that are already bound to a user or machine.
See the queryFlags parameter of VWRoster.startQuery(..), VWQueue.createQuery(..), and VWQueue.startQuery(..)(deprecated)

QUERY_READ_UNWRITABLE

public static final int QUERY_READ_UNWRITABLE
Value of 4 Flag used to specify that items returned from a query should include those that are read-only.
See the queryFlags parameter of VWRoster.startQuery(..), VWQueue.createQuery(..), and VWQueue.startQuery(..)(deprecated)

QUERY_LOCK_OBJECTS

public static final int QUERY_LOCK_OBJECTS
Value of 16 Flag used to specify that items returned from a query should become locked. See the queryFlags parameter of VWRoster.startQuery(..), VWQueue.createQuery(..), and VWQueue.startQuery(..)(deprecated)

QUERY_MIN_VALUES_INCLUSIVE

public static final int QUERY_MIN_VALUES_INCLUSIVE
Value of 32 Flag used to specify that minimum values passed in a query are inclusive, i.e. the comparison should be "greater than or equal to" rather than "greater than" (which is the default).
See the queryFlags parameter of VWRoster.startQuery(..), VWQueue.createQuery(..), and VWQueue.startQuery(..)(deprecated)

QUERY_MAX_VALUES_INCLUSIVE

public static final int QUERY_MAX_VALUES_INCLUSIVE
Value of 64 Flag used to specify that maximum values passed in a query are inclusive, i.e. the comparison should be "less than or equal to" rather than "less than" (which is the default).
See the queryFlags parameter of VWRoster.startQuery(..), VWQueue.createQuery(..), and VWQueue.startQuery(..)(deprecated)

QUERY_GET_TRANSLATED_SYSTEM_FIELDS

public static final int QUERY_GET_TRANSLATED_SYSTEM_FIELDS
Method Detail

fetchRosterElements

public VWRosterElement[] fetchRosterElements(int bufferSize)
                                      throws VWException
Fetches a specified number of roster elements. Call the method repeatedly to retrieve the needed number of roster elements for the query. If the number of requested elements (specified in the bufferSize parameter) is greater than the number of elements returned in the query, all remaining elements are returned in a single fetch.

An instance of this class can return only one type of item. Therefore, an error occurs if the next() or the deprecated fetchWorkObjects method has previously been called.

Parameters:
bufferSize - An integer value specifying the maximum number of elements to return in a fetch operation. Specify a value greater than 0 (zero). The server imposes a maximum limit; therefore, the number of returned elements might be smaller than the number specified in this parameter - if the number of roster elements is large enough.
Returns:
An array of VWRosterElement objects that represent the fetched items. If no more elements can be fetched, the method returns null.
Throws:
VWException - Thrown if it cannot fetch a specified number of roster elements.

fetchWorkObjects

public VWWorkObject[] fetchWorkObjects(int bufferSize)
                                throws VWException
Deprecated. Replaced by next()

Fetches a specified number of work objects. Call this method repeatedly to retrieve the needed number of work objects for the query. If the number of requested elements (specified in the bufferSize parameter) is greater than the number of elements returned in the query, all remaining elements are returned in a single fetch.

An instance of this class can return only one type of item. Therefore, an error occurs if the next or fetchRosterElements method has previously been called.

Parameters:
bufferSize - An integer value specifying the maximum number of elements to return in a fetch operation. Specify a value greater than 0 (zero). The server imposes a maximum limit; therefore, the number of returned elements might be smaller than the number specified in this parameter - if the number of work objects is large enough.
Returns:
An array of VWWorkObject objects that represent the fetched items. If no more elements can be fetched, the method returns null.
Throws:
VWException - Thrown if it cannot fetch a specified number of work objects.

getRoster

public VWRoster getRoster()
Gets a roster that was retrieved by the query initiated by either the VWRoster.createQuery() or VWRoster.startQuery() methods.
Returns:
A VWRoster object that represent the query result for either the VWRoster.createQuery() or VWRoster.startQuery() methods.
See Also:
VWRoster

isDone

public boolean isDone()
               throws VWException
Deprecated. Replaced by next()}

Determines whether or not the query is complete.
Returns:
A Boolean value. The method returns true if all available elements have been fetched, which indicates the query is complete; otherwise, the method returns false.
Throws:
VWException - The method throws an exception if the object was created with the VWRoster.createQuery() method, which contains the fetchType parameter.

toString

public java.lang.String toString()
Gets the name of the roster retrieved in a query.
Overrides:
toString in class java.lang.Object
Returns:
The name of the roster retrieved as a result of a query.

getElementType

public int getElementType()
Gets the fetch type for the VWRosterQuery object.
Returns:
An integer value associated with the element type to be retrieved.

Valid fetch type values are as follows:

  • 1: work object (VWFetchType.FETCH_TYPE_WORKOBJECT)
  • 4: Roster element (VWFetchType.FETCH_TYPE_ROSTER_ELEMENT)
  • -1: None (VWFetchType.FETCH_TYPE_NONE); this value is returned only if the deprecated VWRoster.startQuery was used to create this object.

See Also:
VWFetchType.FETCH_TYPE_WORKOBJECT, VWFetchType.FETCH_TYPE_ROSTER_ELEMENT

next

public java.lang.Object next()
                      throws VWException
Retrieves the element for each query. Call this method repeatedly to retrieve the needed number of elements If no more elements can be returned, the method returns null. Elements are retrieved from the database in the blocks specified in VWRoster.setBufferSize().

The method return items sequentially (one by one) to the user. An element will be returned as long as there are objects matching the query in the database. The server is queried for the next block of data as items are requested if the buffered items have been exhausted. The server imposes a maximum limit for the block size; therefore, the effective block size at any given time might be smaller than the number specified in VWRoster.setBufferSize() method, if the elements are large, or the server limit was reached. Change the buffer size in the VWRoster and create a new VWRosterQuery object, to get the desired performance on retrievals from the server.

In order to use this method, this VWRosterQuery object must have been created with VWRoster.createQuery() method , which requires the type to be specified. The buffer size for retrievals from the server must be set in the VWRoster object before the VWRosterQuery object is created. An exception will be thrown, if the deprecated startQuery was used to create the VWRosterQuery.

Returns:
An object that represents the items of the fetch type specified in the VWRoster.createQuery() method, which created the VWRosterQuery object. The object should be cast to the fetch type specified. If no more objects can be retrieved, the method returns null.
Throws:
VWException - The method throws an exception if it cannot retrieve the subsequent element for the query, before the final element in the block was called.

resetFetch

public void resetFetch()
Resets the last element fetched for this RosterQuery object. Previously fetched elements will included in the new fetch results.
Since:
VWWS3.10

hasNext

public boolean hasNext()
                throws VWException
Determines whether or not another element can be fetched. Note: if buffer size to fetch is 1, this check will not work as intended.
Returns:
A Boolean value. Returns true if there are more elements to get. Note: if buffer size to fetch is 1, this check will not work as intended.
Throws:
VWException - The method throws an exception if the object was created by the deprecated VWRoster.startQuery() method.

fetchCount

public int fetchCount()
               throws VWException
Gets the integer value indicating the number of records that can be retrieved, using this rosterquery definition. Results are approximate because the record set may change before the query returns.
Returns:
An integer value indicating the number of records that could be retrieved in the roster, using this rosterquery object roster.
Throws:
VWException - The method throws an exception if it cannot get the integer value indicating the number of records that can be retrieved, using this rosterQuery object roster. One cause of this is an incorrect query parameter.
Since:
VWWS3.10

Process Class Relationships

Copyright © 2002 FileNET Corporation. All rights reserved.