wt.query
Class BasicPageableQuerySpec

java.lang.Object
  extended bywt.query.PageableQuerySpec
      extended bywt.query.BasicPageableQuerySpec
All Implemented Interfaces:
Externalizable, PageableSessionQuerySpec, Serializable, StatementSpec

public class BasicPageableQuerySpec
extends PageableQuerySpec
implements PageableSessionQuerySpec, Externalizable

This class provides a standard implementation for establishing a paging session. It also extends the PageableQuerySpec and can be used to retrieve an intial result page.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private  boolean backgroundThreadEnabled
           
private static String CLASSNAME
           
static boolean DEBUG
           
private static DMLGenerator dmlGenerator
           
static long EXTERNALIZATION_VERSION_UID
           
private  Object fetchInfo
           
private  int groupFromIndex
           
private  boolean isAllPersistable
           
private  boolean limitModeEnabled
           
private static DebugWriter LOG
           
protected static long OLD_FORMAT_VERSION_UID
           
private  int pageThreshold
           
private  boolean pagingRuleHintEnabled
           
private  int pagingSnapshotQueryLimit
           
private  StatementSpec pagingSpec
           
private static String RESOURCE
           
private static String RULE_HINT
           
(package private) static long serialVersionUID
           
private  StatementSpec snapshotSpec
           
 
Fields inherited from class wt.query.PageableQuerySpec
 
Fields inherited from interface wt.query.PageableSessionQuerySpec
BACKGROUND_THREAD_ENABLED, FETCH_INFO, GROUP_FROM_INDEX, LIMIT_MODE_ENABLED, OFFSET_BIND_INDEX, PAGE_THRESHOLD, PAGING_RULE_HINT_ENABLED, PAGING_SNAPSHOT_QUERY_LIMIT, PRIMARY_STATEMENT, RANGE_BIND_INDEX, SESSION_ID_BIND_INDEX, SNAPSHOT_SPEC
 
Fields inherited from interface wt.pds.StatementSpec
ADVANCED_QUERY, ADVANCED_QUERY_ENABLED, AGGREGATE_SELECT, CORRELATED_CLASS_ATTRIBUTES, FETCH_SIZE, PRIMARY_CLASS, QUERY_LIMIT, RESULT_BUILDER, RESULT_CURSOR, SINGLE_RESULT_COMPATIBLE, STATEMENT_BUILDER, USE_BIND
 
Constructor Summary
BasicPageableQuerySpec()
           
 
Method Summary
private  void appendOrderBy(QuerySpec pagingSpec, int fromCount)
           
private  void appendOrderBySelect(QuerySpec pagingSpec, int fromCount, boolean isSelectOnly)
           
private  void buildSpecs(List a_objArray, int a_groupFromIndex, long a_sessionId)
           
private  void buildSpecsInternal(QuerySpec snapshotSpec, QuerySpec pagingSpec, Hashtable aliasMap, List objArray, int groupFromIndex, long sessionId)
           
private  String[] getAliasArray(int count, OrderByClause a_orderByClause)
           
private  DMLGenerator getDMLGenerator()
           
 Object getFetchInfo()
          Gets the value of the attribute: fetchInfo.
 int getGroupFromIndex()
          Gets the value of the attribute: groupFromIndex; Specifies a FromIndex from the snapshor query that will be used to group results for paging.
private  String[] getOrderAttribute(int fromCount)
           
 int getPageThreshold()
          Gets the value of the attribute: pageThreshold; Specifies threshold at which a paging session will be established.
 PagingSessionSpec getPagingSessionSpec(long a_sessionId, int a_totalSize)
          This method returns a PagingSessionSpec that can be used to fetch subsequent pages for the established session.
 PagingSessionSpec getPagingSessionSpec(long a_sessionId, int a_totalSize, List a_objArray, int a_groupFromIndex)
          This method returns a PagingSessionSpec that can be used to fetch subsequent pages for the established session.
 int getPagingSnapshotQueryLimit()
          Gets the value of the attribute: pagingSnapshotQueryLimit; Specifies the limit for the number of paging snapshot query result.
 StatementSpec getPrimaryStatement()
          Gets the object for the association that plays role: primaryStatement.
 StatementSpec getSnapshotSpec()
          Gets the value of the attribute: snapshotSpec; StatementSpec instance used to retrieve the intial "snapshot" of the entire results for a paging session.
 boolean isBackgroundThreadEnabled()
          Gets the value of the attribute: backgroundThreadEnabled.
 boolean isLimitModeEnabled()
          Gets the value of the attribute: limitModeEnabled.
 boolean isPagingRuleHintEnabled()
          Gets the value of the attribute: pagingRuleHintEnabled.
 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(BasicPageableQuerySpec thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
private  void respecifyOrderSelect(QuerySpec a_spec, String[] a_alias)
           
 void setBackgroundThreadEnabled(boolean a_BackgroundThreadEnabled)
          Sets the value of the attribute: backgroundThreadEnabled.
 void setFetchInfo(Object a_FetchInfo)
          Sets the value of the attribute: fetchInfo.
 void setGroupFromIndex(int a_GroupFromIndex)
          Sets the value of the attribute: groupFromIndex; Specifies a FromIndex from the snapshor query that will be used to group results for paging.
 void setLimitModeEnabled(boolean a_LimitModeEnabled)
          Sets the value of the attribute: limitModeEnabled.
 void setPageThreshold(int a_PageThreshold)
          Sets the value of the attribute: pageThreshold; Specifies threshold at which a paging session will be established.
 void setPagingRuleHintEnabled(boolean a_PagingRuleHintEnabled)
          Sets the value of the attribute: pagingRuleHintEnabled.
 void setPagingSnapshotQueryLimit(int a_PagingSnapshotQueryLimit)
          Sets the value of the attribute: pagingSnapshotQueryLimit; Specifies the limit for the number of paging snapshot query result.
 void setPrimaryStatement(StatementSpec a_PrimaryStatement)
          Sets the object for the association that plays role: primaryStatement.
 String toString()
           
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class wt.query.PageableQuerySpec
getBindParameterCount, getCorrelatedClassAttributes, getFetchSize, getOffset, getPrimaryClass, getQueryLimit, getRange, getResultBuilder, getResultCursor, getStatementBuilder, isAdvancedQuery, isAdvancedQueryEnabled, isAggregateSelect, isSingleResultCompatible, isUseBind, readVersion, setAdvancedQueryEnabled, setBindParameterAt, setFetchSize, setLocale, setOffset, setRange, setUseBind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wt.pds.StatementSpec
getBindParameterCount, getCorrelatedClassAttributes, getFetchSize, getPrimaryClass, getQueryLimit, getResultBuilder, getResultCursor, getStatementBuilder, isAdvancedQuery, isAdvancedQueryEnabled, isAggregateSelect, isSingleResultCompatible, isUseBind, setAdvancedQueryEnabled, setBindParameterAt, setFetchSize, setLocale, setUseBind
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

groupFromIndex

private int groupFromIndex

pageThreshold

private int pageThreshold

pagingSnapshotQueryLimit

private int pagingSnapshotQueryLimit

limitModeEnabled

private boolean limitModeEnabled

fetchInfo

private Object fetchInfo

backgroundThreadEnabled

private boolean backgroundThreadEnabled

pagingRuleHintEnabled

private boolean pagingRuleHintEnabled

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

DEBUG

public static final boolean DEBUG

LOG

private static final DebugWriter LOG

snapshotSpec

private transient StatementSpec snapshotSpec

pagingSpec

private transient StatementSpec pagingSpec

isAllPersistable

private transient boolean isAllPersistable

dmlGenerator

private static DMLGenerator dmlGenerator

RULE_HINT

private static final String RULE_HINT
See Also:
Constant Field Values
Constructor Detail

BasicPageableQuerySpec

public BasicPageableQuerySpec()
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
Overrides:
writeExternal in class PageableQuerySpec
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
Overrides:
readExternal in class PageableQuerySpec
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(BasicPageableQuerySpec 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

getSnapshotSpec

public StatementSpec getSnapshotSpec()
                              throws WTException
Gets the value of the attribute: snapshotSpec; StatementSpec instance used to retrieve the intial "snapshot" of the entire results for a paging session.

Supported API: false

Specified by:
getSnapshotSpec in interface PageableSessionQuerySpec
Returns:
StatementSpec
Throws:
WTException

getGroupFromIndex

public int getGroupFromIndex()
Gets the value of the attribute: groupFromIndex; Specifies a FromIndex from the snapshor query that will be used to group results for paging.

Supported API: true

Specified by:
getGroupFromIndex in interface PageableSessionQuerySpec
Returns:
int

setGroupFromIndex

public void setGroupFromIndex(int a_GroupFromIndex)
                       throws WTPropertyVetoException
Sets the value of the attribute: groupFromIndex; Specifies a FromIndex from the snapshor query that will be used to group results for paging.

Supported API: true

Specified by:
setGroupFromIndex in interface PageableSessionQuerySpec
Parameters:
a_GroupFromIndex -
Throws:
WTPropertyVetoException

getPageThreshold

public int getPageThreshold()
Gets the value of the attribute: pageThreshold; Specifies threshold at which a paging session will be established. If the snapshot query contains fewer items than this threshold, then those items will be returned and no paging session will be established. The default value for this attribute is obtained from the system property "wt.pom.paging.threshold".

Supported API: true

Specified by:
getPageThreshold in interface PageableSessionQuerySpec
Returns:
int

setPageThreshold

public void setPageThreshold(int a_PageThreshold)
                      throws WTPropertyVetoException
Sets the value of the attribute: pageThreshold; Specifies threshold at which a paging session will be established. If the snapshot query contains fewer items than this threshold, then those items will be returned and no paging session will be established. The default value for this attribute is obtained from the system property "wt.pom.paging.threshold".

Supported API: true

Specified by:
setPageThreshold in interface PageableSessionQuerySpec
Parameters:
a_PageThreshold -
Throws:
WTPropertyVetoException

getPagingSnapshotQueryLimit

public int getPagingSnapshotQueryLimit()
Gets the value of the attribute: pagingSnapshotQueryLimit; Specifies the limit for the number of paging snapshot query result. If the snapshot query reach the limit , a PersistenceException will be thrown with proper message. The default value for this attribute is obtained from the system property "wt.pom.paging.snapshotQueryLimit".

Supported API: false

Specified by:
getPagingSnapshotQueryLimit in interface PageableSessionQuerySpec
Returns:
int

setPagingSnapshotQueryLimit

public void setPagingSnapshotQueryLimit(int a_PagingSnapshotQueryLimit)
                                 throws WTPropertyVetoException
Sets the value of the attribute: pagingSnapshotQueryLimit; Specifies the limit for the number of paging snapshot query result. If the snapshot query reach the limit , a PersistenceException will be thrown with proper message. The default value for this attribute is obtained from the system property "wt.pom.paging.snapshotQueryLimit".

Supported API: false

Specified by:
setPagingSnapshotQueryLimit in interface PageableSessionQuerySpec
Parameters:
a_PagingSnapshotQueryLimit -
Throws:
WTPropertyVetoException

isLimitModeEnabled

public boolean isLimitModeEnabled()
Gets the value of the attribute: limitModeEnabled.

Supported API: false

Specified by:
isLimitModeEnabled in interface PageableSessionQuerySpec
Returns:
boolean

setLimitModeEnabled

public void setLimitModeEnabled(boolean a_LimitModeEnabled)
Sets the value of the attribute: limitModeEnabled.

Supported API: false

Specified by:
setLimitModeEnabled in interface PageableSessionQuerySpec
Parameters:
a_LimitModeEnabled -

getFetchInfo

public Object getFetchInfo()
Gets the value of the attribute: fetchInfo.

Supported API: false

Specified by:
getFetchInfo in interface PageableSessionQuerySpec
Returns:
Object

setFetchInfo

public void setFetchInfo(Object a_FetchInfo)
Sets the value of the attribute: fetchInfo.

Supported API: false

Specified by:
setFetchInfo in interface PageableSessionQuerySpec
Parameters:
a_FetchInfo -

isBackgroundThreadEnabled

public boolean isBackgroundThreadEnabled()
Gets the value of the attribute: backgroundThreadEnabled.

Supported API: false

Specified by:
isBackgroundThreadEnabled in interface PageableSessionQuerySpec
Returns:
boolean

setBackgroundThreadEnabled

public void setBackgroundThreadEnabled(boolean a_BackgroundThreadEnabled)
Sets the value of the attribute: backgroundThreadEnabled.

Supported API: false

Specified by:
setBackgroundThreadEnabled in interface PageableSessionQuerySpec
Parameters:
a_BackgroundThreadEnabled -

isPagingRuleHintEnabled

public boolean isPagingRuleHintEnabled()
Gets the value of the attribute: pagingRuleHintEnabled.

Supported API: false

Specified by:
isPagingRuleHintEnabled in interface PageableSessionQuerySpec
Returns:
boolean

setPagingRuleHintEnabled

public void setPagingRuleHintEnabled(boolean a_PagingRuleHintEnabled)
Sets the value of the attribute: pagingRuleHintEnabled.

Supported API: false

Specified by:
setPagingRuleHintEnabled in interface PageableSessionQuerySpec
Parameters:
a_PagingRuleHintEnabled -

getPagingSessionSpec

public PagingSessionSpec getPagingSessionSpec(long a_sessionId,
                                              int a_totalSize,
                                              List a_objArray,
                                              int a_groupFromIndex)
                                       throws WTException
This method returns a PagingSessionSpec that can be used to fetch subsequent pages for the established session.

Supported API: false

Specified by:
getPagingSessionSpec in interface PageableSessionQuerySpec
Parameters:
a_sessionId - uniquely idnentifies the paging session
a_totalSize - specifies the total number of results that can be paged through
a_objArray -
a_groupFromIndex -
Returns:
PagingSessionSpec
Throws:
WTException

getPagingSessionSpec

public PagingSessionSpec getPagingSessionSpec(long a_sessionId,
                                              int a_totalSize)
                                       throws WTException
This method returns a PagingSessionSpec that can be used to fetch subsequent pages for the established session.

Supported API: false

Specified by:
getPagingSessionSpec in interface PageableSessionQuerySpec
Parameters:
a_sessionId - uniquely idnentifies the paging session
a_totalSize - specifies the total number of results that can be paged through
Returns:
PagingSessionSpec
Throws:
WTException

getPrimaryStatement

public StatementSpec getPrimaryStatement()
Gets the object for the association that plays role: primaryStatement.

Supported API: true

Specified by:
getPrimaryStatement in interface PageableSessionQuerySpec
Overrides:
getPrimaryStatement in class PageableQuerySpec
Returns:
StatementSpec

setPrimaryStatement

public void setPrimaryStatement(StatementSpec a_PrimaryStatement)
                         throws WTPropertyVetoException
Sets the object for the association that plays role: primaryStatement.

Supported API: true

Specified by:
setPrimaryStatement in interface PageableSessionQuerySpec
Overrides:
setPrimaryStatement in class PageableQuerySpec
Parameters:
a_PrimaryStatement -
Throws:
WTPropertyVetoException

toString

public String toString()

buildSpecs

private void buildSpecs(List a_objArray,
                        int a_groupFromIndex,
                        long a_sessionId)
                 throws WTException
Throws:
WTException

buildSpecsInternal

private void buildSpecsInternal(QuerySpec snapshotSpec,
                                QuerySpec pagingSpec,
                                Hashtable aliasMap,
                                List objArray,
                                int groupFromIndex,
                                long sessionId)
                         throws WTException,
                                WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

appendOrderBy

private void appendOrderBy(QuerySpec pagingSpec,
                           int fromCount)
                    throws WTException
Throws:
WTException

appendOrderBySelect

private void appendOrderBySelect(QuerySpec pagingSpec,
                                 int fromCount,
                                 boolean isSelectOnly)
                          throws WTException
Throws:
WTException

respecifyOrderSelect

private void respecifyOrderSelect(QuerySpec a_spec,
                                  String[] a_alias)
                           throws WTException,
                                  WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

getOrderAttribute

private String[] getOrderAttribute(int fromCount)

getAliasArray

private String[] getAliasArray(int count,
                               OrderByClause a_orderByClause)

getDMLGenerator

private DMLGenerator getDMLGenerator()