wt.fc
Class QueryResult

java.lang.Object
  extended bywt.fc.QueryResult
All Implemented Interfaces:
Enumeration, Externalizable, Serializable
Direct Known Subclasses:
PagingQueryResult

public class QueryResult
extends Object
implements Enumeration, Externalizable

The QueryResult class is a container of results returned from a query. Normally, these results are accessed via the Enumeration interface which is implemented by this class. The Enumeration interface provides generic access to elements of type Object. The actual runtime type for the element is based on the type of query that is performed. For simple queries using the QuerySpec where only a single class is specified in the constructor, the element type will be Persistable. For all other queries, the safest assumption is to consider the element type to be an Object array (i.e. Object[]). In the Windchill Object-to-Relational mapping, an element in the Enumeration corresponds to a row in the result set of the query. In general, multiple classes can be specified in the query so each Object is returned as an array indexed value.

An instance of this object will internally reference each item returned from a query. When processing very large result sets, this could lead to performance issues. To handle processing large results sets, the getEnumeration() method can be called to return an Enumeration which will internally "free" references as each element is returned. This will allow the result objects to be garbage collected as soon as the object is processed and no other external references exist. When using this technique, it is important to remove (e.g. set to null) any references to the QueryResult itself, after the getEnumeration() method is called.

Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
(package private) static class QueryResult.ChunkedExternalization
          Class used when streaming large results set to overcome scalability limitations of object streams by resetting stream at reasonable intervals.
(package private) static class QueryResult.DuplicateStringEliminator
          Class used to eliminate duplicate strings from large query result stream.
 
Field Summary
private  ObjectVectorIfc anOV
           
private static int CHUNK_SIZE
           
private static String CLASSNAME
           
private  Enumeration e
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
 
Constructor Summary
QueryResult()
          

Supported API: false
QueryResult(ObjectVectorIfc v)
          

Supported API: false
 
Method Summary
 void append(ObjectVectorIfc ov)
          

Supported API: false
 void appendObjectVector(ObjectVector ov)
          Deprecated.  
 Enumeration getEnumeration()
          Returns an Enumeration of the results optimized to remove references to elements as they are returned.
 ObjectVector getObjectVector()
          Deprecated. Replaced by getObjectVectorIfc()
 ObjectVectorIfc getObjectVectorIfc()
          Returns an ObjectVector of the results.
 boolean hasMoreElements()
          Indicates if more elements are available for this enumeration of the results.
 Object nextElement()
          Returns the next element in this enumeration of the results.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(QueryResult thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 Enumeration reset()
          Reset the enumeration to start of set.
 int size()
          Answer the number of objects in the result set.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

CHUNK_SIZE

private static int CHUNK_SIZE

anOV

private ObjectVectorIfc anOV

e

private transient Enumeration e
Constructor Detail

QueryResult

public QueryResult()


Supported API: false


QueryResult

public QueryResult(ObjectVectorIfc v)


Supported API: false

Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(QueryResult thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

size

public int size()
Answer the number of objects in the result set.

Supported API: true

Returns:
size

reset

public Enumeration reset()
Reset the enumeration to start of set.

Supported API: true

Returns:
Enumeration of objects

getEnumeration

public Enumeration getEnumeration()
Returns an Enumeration of the results optimized to remove references to elements as they are returned. For very large results sets, this method can improve performance by allowing the elements to be garbage collected as soon as the object is processed and no other external references exist. When using this method, it is important to remove (e.g. set to null) any references to the QueryResult itself after this method is called.

Supported API: true

Returns:
Enumeration of objects

hasMoreElements

public boolean hasMoreElements()
Indicates if more elements are available for this enumeration of the results.

Supported API: true

Specified by:
hasMoreElements in interface Enumeration
Returns:
true if more elements are available

nextElement

public Object nextElement()
Returns the next element in this enumeration of the results.

Supported API: true

Specified by:
nextElement in interface Enumeration
Returns:
next result object

getObjectVectorIfc

public ObjectVectorIfc getObjectVectorIfc()
Returns an ObjectVector of the results.

Supported API: true


getObjectVector

public ObjectVector getObjectVector()
Deprecated. Replaced by getObjectVectorIfc()



Supported API: false


appendObjectVector

public void appendObjectVector(ObjectVector ov)
Deprecated.  



Supported API: false


append

public void append(ObjectVectorIfc ov)


Supported API: false