wt.pds
Class ObjectReferenceCursor

java.lang.Object
  extended bywt.pds.ObjectReferenceCursor
All Implemented Interfaces:
Externalizable, ResultCursor, Serializable

public class ObjectReferenceCursor
extends Object
implements ResultCursor, Externalizable

This class implements functionality of a ResultCursor which is specialized to process ObjectReferences in a ResultSet and "inflate" these references into full objects which are then returned as result objects.

This ResultCursor uses a delegate ResultCursor defined for the primary statement which contains the ObjectReference results. It implements the required ResultCursor methods via delegation.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private  WTConnection connection
           
private  int count
           
private  ResultCursor delegate
           
static long EXTERNALIZATION_VERSION_UID
           
private  int inflateCount
           
private  int inflatedIndex
           
private  Persistable[] inflatedObjects
           
private  SequentialResultBuilder inflateResultBuilder
           
private  BasicResultCursor inflateResultCursor
           
private  ObjectReferenceStatementBuilder inflateStatementBuilder
           
private static AccessController NOOP_ACCESS_CONTROLLER
           
protected static long OLD_FORMAT_VERSION_UID
           
private  Hashtable order
           
private  boolean reset
           
private static String RESOURCE
           
private  int resultIndex
           
(package private) static long serialVersionUID
           
 
Fields inherited from interface wt.pds.ResultCursor
CONNECTION, COUNT, QUERY_LIMIT, RESET, RESULT_BUILDER, STATEMENT_BUILDER
 
Constructor Summary
ObjectReferenceCursor()
          

Supported API: false
 
Method Summary
 boolean advance(int a_relative)
          Advances the ResultCursor the relative number of rows without result processing.
 void close()
          Ensures that any associated result sets and/or statements are closed.
private  void delegateValidate(ResultCursor a_Delegate)
           
 WTConnection getConnection()
          Gets the value of the attribute: connection.
 int getCount()
          Gets the value of the attribute: count; Total number of rows that were traversed (not necessarily returned results).
 ResultCursor getDelegate()
          Gets the object for the association that plays role: delegate.
 ObjectReferenceStatementBuilder getInflateStatementBuilder()
          Gets the object for the association that plays role: inflateStatementBuilder.
 int getQueryLimit()
          Gets the value of the attribute: queryLimit.
 ResultBuilder getResultBuilder()
          Gets the object for the association that plays role: resultBuilder.
 int getResultIndex()
          Gets the value of the attribute: resultIndex.
 StatementBuilder getStatementBuilder()
          Gets the object for the association that plays role: statementBuilder.
private  boolean inflateObjects(AccessController a_accessController)
          This method performs the ObjectReference "inflate".
private  void inflateStatementBuilderValidate(ObjectReferenceStatementBuilder a_InflateStatementBuilder)
           
 boolean isReset()
          Gets the value of the attribute: reset; Indicates if the result cursor has been reset.
 Object[] next(AccessController a_accessController)
          Advance to the next valid row in the result set and returned the built objects.
private  boolean queryObjectReferences(OidArray a_oidArray, AccessController a_accessController)
          This method performs the actaul query to "inflate" ObjectReferences.
 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(ObjectReferenceCursor thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setConnection(WTConnection a_Connection)
          Sets the value of the attribute: connection.
 void setDelegate(ResultCursor a_Delegate)
          Sets the object for the association that plays role: delegate.
 void setInflateStatementBuilder(ObjectReferenceStatementBuilder a_InflateStatementBuilder)
          Sets the object for the association that plays role: inflateStatementBuilder.
 void setReset(boolean a_Reset)
          Sets the value of the attribute: reset; Indicates if the result cursor has been reset.
 void setResultBuilder(ResultBuilder a_ResultBuilder)
          Sets the object for the association that plays role: resultBuilder.
 void setResultIndex(int a_ResultIndex)
          Sets the value of the attribute: resultIndex.
 void setStatementBuilder(StatementBuilder a_StatementBuilder)
          Sets the object for the association that plays role: statementBuilder.
 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

count

private int count

resultIndex

private int resultIndex

inflateStatementBuilder

private ObjectReferenceStatementBuilder inflateStatementBuilder

delegate

private ResultCursor delegate

inflateResultCursor

private transient BasicResultCursor inflateResultCursor

inflateResultBuilder

private transient SequentialResultBuilder inflateResultBuilder

reset

private boolean reset

connection

private transient WTConnection connection

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

NOOP_ACCESS_CONTROLLER

private static final AccessController NOOP_ACCESS_CONTROLLER

inflatedIndex

private transient int inflatedIndex

inflatedObjects

private transient Persistable[] inflatedObjects

inflateCount

private transient int inflateCount

order

private transient Hashtable order
Constructor Detail

ObjectReferenceCursor

public ObjectReferenceCursor()
                      throws PersistenceException


Supported API: false

Throws:
PersistenceException
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(ObjectReferenceCursor 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

getCount

public int getCount()
Gets the value of the attribute: count; Total number of rows that were traversed (not necessarily returned results).

Supported API: false

Specified by:
getCount in interface ResultCursor
Returns:
int

getResultIndex

public int getResultIndex()
Gets the value of the attribute: resultIndex.

Supported API: false

Returns:
int

setResultIndex

public void setResultIndex(int a_ResultIndex)
                    throws WTPropertyVetoException
Sets the value of the attribute: resultIndex.

Supported API: false

Parameters:
a_ResultIndex -
Throws:
WTPropertyVetoException

getInflateStatementBuilder

public ObjectReferenceStatementBuilder getInflateStatementBuilder()
Gets the object for the association that plays role: inflateStatementBuilder.

Supported API: false

Returns:
ObjectReferenceStatementBuilder

setInflateStatementBuilder

public void setInflateStatementBuilder(ObjectReferenceStatementBuilder a_InflateStatementBuilder)
                                throws WTPropertyVetoException
Sets the object for the association that plays role: inflateStatementBuilder.

Supported API: false

Parameters:
a_InflateStatementBuilder -
Throws:
WTPropertyVetoException

inflateStatementBuilderValidate

private void inflateStatementBuilderValidate(ObjectReferenceStatementBuilder a_InflateStatementBuilder)
                                      throws WTPropertyVetoException
Parameters:
a_InflateStatementBuilder -
Throws:
WTPropertyVetoException

getDelegate

public ResultCursor getDelegate()
Gets the object for the association that plays role: delegate.

Supported API: false

Returns:
ResultCursor

setDelegate

public void setDelegate(ResultCursor a_Delegate)
                 throws WTPropertyVetoException
Sets the object for the association that plays role: delegate.

Supported API: false

Parameters:
a_Delegate -
Throws:
WTPropertyVetoException

delegateValidate

private void delegateValidate(ResultCursor a_Delegate)
                       throws WTPropertyVetoException
Parameters:
a_Delegate -
Throws:
WTPropertyVetoException

isReset

public boolean isReset()
Gets the value of the attribute: reset; Indicates if the result cursor has been reset.

Supported API: false

Specified by:
isReset in interface ResultCursor
Returns:
boolean

setReset

public void setReset(boolean a_Reset)
              throws WTPropertyVetoException
Sets the value of the attribute: reset; Indicates if the result cursor has been reset.

Supported API: false

Specified by:
setReset in interface ResultCursor
Parameters:
a_Reset -
Throws:
WTPropertyVetoException

getConnection

public WTConnection getConnection()
Gets the value of the attribute: connection.

Supported API: false

Specified by:
getConnection in interface ResultCursor
Returns:
WTConnection

setConnection

public void setConnection(WTConnection a_Connection)
                   throws WTPropertyVetoException
Sets the value of the attribute: connection.

Supported API: false

Specified by:
setConnection in interface ResultCursor
Parameters:
a_Connection -
Throws:
WTPropertyVetoException

getQueryLimit

public int getQueryLimit()
Gets the value of the attribute: queryLimit.

Supported API: false

Specified by:
getQueryLimit in interface ResultCursor
Returns:
int

next

public Object[] next(AccessController a_accessController)
              throws PersistenceException
Advance to the next valid row in the result set and returned the built objects.

Supported API: false

Specified by:
next in interface ResultCursor
Parameters:
a_accessController -
Returns:
Object[]
Throws:
PersistenceException

close

public void close()
Ensures that any associated result sets and/or statements are closed.

Supported API: false

Specified by:
close in interface ResultCursor

advance

public boolean advance(int a_relative)
                throws PersistenceException
Advances the ResultCursor the relative number of rows without result processing.

Supported API: false

Specified by:
advance in interface ResultCursor
Parameters:
a_relative -
Returns:
boolean
Throws:
PersistenceException

getStatementBuilder

public StatementBuilder getStatementBuilder()
Gets the object for the association that plays role: statementBuilder.

Supported API: false

Specified by:
getStatementBuilder in interface ResultCursor
Returns:
StatementBuilder

setStatementBuilder

public void setStatementBuilder(StatementBuilder a_StatementBuilder)
                         throws WTPropertyVetoException
Sets the object for the association that plays role: statementBuilder.

Supported API: false

Specified by:
setStatementBuilder in interface ResultCursor
Parameters:
a_StatementBuilder -
Throws:
WTPropertyVetoException

getResultBuilder

public ResultBuilder getResultBuilder()
Gets the object for the association that plays role: resultBuilder.

Supported API: false

Specified by:
getResultBuilder in interface ResultCursor
Returns:
ResultBuilder

setResultBuilder

public void setResultBuilder(ResultBuilder a_ResultBuilder)
                      throws WTPropertyVetoException
Sets the object for the association that plays role: resultBuilder.

Supported API: false

Specified by:
setResultBuilder in interface ResultCursor
Parameters:
a_ResultBuilder -
Throws:
WTPropertyVetoException

inflateObjects

private boolean inflateObjects(AccessController a_accessController)
                        throws PersistenceException
This method performs the ObjectReference "inflate". The ObjectReferences are obtained via the delegate result cursor in "chunks" of QUERY_SIZE. The internal inflatedObject array is allocated and populated via a call to queryObjectReferences(). The accessController parameter is passed to this method. A NOOP access controller is used for the delegate result cursor.

Parameters:
a_accessController - for the "inflate"
Returns:
boolean indicating if the inflate returned any valid objects
Throws:
PersistenceException

queryObjectReferences

private boolean queryObjectReferences(OidArray a_oidArray,
                                      AccessController a_accessController)
                               throws PersistenceException
This method performs the actaul query to "inflate" ObjectReferences. The internal inflatedObject array is populated with the results. The order of the passed in ObjectReference array is maintained after the query is performed.

Parameters:
a_accessController - for the "inflate"
Returns:
boolean indicating if the inflate is returned any valid objects
Throws:
PersistenceException