abstract class DynamicQuery extends AbstractQuery implements Scrollable
The primary purpose of this class is to manage a query cursor for results list scrolling and repositioning, and to provide an API to client code to perform these tasks, and to interrogate the cursor for state data.
This class implements the RecordChangeListener interface.
When the setScrolling() method is invoked, this object is registered
as a listener with the context-local ChangeBroker instance, so
that it can receive notifications of record deletions. If the deleted
record was in this query's cache, the cache is expired. Subclasses must
implement the recordBuffers() method.
P2JQuery.Parameter, P2JQuery.ParamResolver, P2JQuery.QueryEventListener, P2JQuery.QueryOpenedListener| Modifier and Type | Field and Description |
|---|---|
protected Cursor |
cursor
Cursor which scrolls query results
|
private int |
moveCount
Number of times the query's position has moved (non-scrolling only)
|
closed, dynamicPredicate, errorHelper, excluded, included, indexedReposition, inverseSorting, lenientOffEnd, outer, parameterFilter| Modifier | Constructor and Description |
|---|---|
protected |
DynamicQuery()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
_isOffEnd()
Indicate whether the cursor has run off one or the other end of the
associated query's list of available results.
|
boolean |
backward(int rows)
Move the current cursor position backward by the specified number of
rows.
|
boolean |
backward(NumberType rows)
Move the current cursor position backward by the specified number of
rows.
|
void |
clearResults()
Clear the current results from the query, so the same query instance can be executed again, without
having to
re-open it. |
integer |
currentRow()
Get the 1-based index of the current row in the result set.
|
integer |
currentRowImpl()
Get the 1-based index of the current row in the result set.
|
boolean |
forward(int rows)
Advance the current cursor position forward by the specified number of
rows.
|
boolean |
forward(NumberType rows)
Advance the current cursor position forward by the specified number of
rows.
|
protected abstract java.lang.Object |
getBreakValue()
Return an object which represents a property value which defines the
end of a sort band.
|
protected void |
incrementMoves()
Increment the counter of how many times the current result row of this
query has changed.
|
boolean |
isNativelyPreselect()
Indicate whether this query is a preselect query by its nature.
|
boolean |
isPreselect()
Indicate whether this query preselects all of its results.
|
boolean |
isScrolling()
Indicate whether this query's
scrolling flag has been set. |
void |
open()
Open the prepared query and reset the cursor.
|
void |
reposition(int row)
Reposition the query to the specified row in the result set.
|
void |
reposition(NumberType row)
Reposition the cursor to the specified row in the result set.
|
boolean |
repositionByID(java.lang.Long... serIDs)
Reposition the cursor such that a request to retrieve the next result will retrieve the
result which matches the specified array of primary key IDs.
|
void |
repositionByID(recid id)
Reposition the cursor such that a request to retrieve the next result
will retrieve the result which matches the specified primary key ID.
|
void |
repositionByID(rowid id1,
rowid... joinIDs)
Reposition the cursor such that a request to retrieve the next result
will retrieve the result which matches the specified array of primary
key IDs.
|
protected void |
reset()
Reset the query to a clean state.
|
protected void |
resetScrolling()
Create a query cursor to enable results list scrolling/repositioning.
|
void |
setScrolling()
Create a query cursor to enable results list scrolling/repositioning.
|
integer |
size()
Get the current size of the cached results list.
|
protected void |
verifyScrolling()
Verify that this query is a scrolling query; that is, that it has an
associated cursor.
|
_getNext, _isSkipDeletedRecord, accumulate, addAccumulator, addAccumulator, addBuffer, addBuffer, addExternalBuffers, addQueryEventListener, addRepositionListener, afterReposition, afterReposition, afterReposition, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, buffersMatch, changeForwardOnly, changeForwardOnly, cleanup, close, createResultListEntry, deleteResultListEntry, deleteResultListEntry, exclude, forwardOnly, getCache, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getDataRelation, getDefaultLock, getErrorHelper, getExternalBuffers, getExternalBuffersDefs, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNumResults, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getReferencedBuffers, hasAccumulators, hasAny, hasAny, hasAny, hasAny, hasOne, hasOne, hasOne, hasOne, include, indexInformation, indexInformation, indexInformation, isBrowsed, isDynamicPredicate, isErrorIfNull, isFatalError, isFetchOnReposition, isFillingBrowseRows, isIndexedReposition, isIterating, isLastOfBreakGroup, isLenientOffEnd, isNewBreakGroup, isOffEnd, isOmitAlias, isOpen, isPresort, isRepositionNotificationActive, isSkipDeletedRecord, isStandalone, loadRowAtCursor, notifyQueryCloseListeners, notifyQueryOpenListeners, notifyRepositionListeners, numBuffers, numResults, numResults, prepare, prepare, prepareFetch, prepareString, preprocessSubstitutionArguments, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, releaseBuffers, removeRepositionListener, setBrowsed, setBuffers, setBuffers, setCache, setCache, setDataRelation, setDynamicPredicate, setErrorIfNull, setFatalError, setFetchOnReposition, setFillingBrowseRows, setIndexedReposition, setIterating, setLenientOffEnd, setOmitAlias, setOuter, setParameterFilter, setPresort, setSkipDeletedRecord, setStandalone, silentCurrent, silentCurrent, silentFirst, silentFirst, silentLast, silentLast, silentNext, silentNext, silentPrevious, silentPrevious, silentUnique, silentUnique, translateSort, translateSort, translateWhereclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpeekNext, peekPrevious_getNext, addAccumulator, addAccumulator, addDynamicFilter, addExternalBuffers, addQueryEventListener, addRepositionListener, changeForwardOnly, changeForwardOnly, cleanup, clearDynamicFilters, close, close, createResultListEntry, current, current, deleteResultListEntry, deleteResultListEntry, exclude, first, first, forwardOnly, getBasicLogging, getCache, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getDataRelation, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getJoin, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNumResults, getOffEnd, getOffEndListeners, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getRecordBuffers, getTableCount, hasAny, hasAny, hasAny, hasAny, hasOne, hasOne, hasOne, hasOne, hintFullResults, include, indexInformation, indexInformation, indexInformation, isBrowsed, isDynamicPredicate, isFetchOnReposition, isFillingBrowseRows, isFindByRowid, isFirstOfGroup, isFirstOfGroup, isIndexedReposition, isIterating, isLastOfGroup, isLastOfGroup, isOffEnd, isPresort, isSkipDeletedRecord, isStandalone, last, last, next, next, notifyQueryCloseListeners, notifyQueryOpenListeners, notifyRepositionListeners, prepare, prepare, prepareString, previous, previous, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, queryRepositionByID, releaseBuffers, removeRepositionListener, resetQuery, setBasicLogging, setBasicLogging, setBrowsed, setCache, setCache, setDataRelation, setDynamicPredicate, setErrorIfNull, setFetchOnReposition, setFillingBrowseRows, setIndexedReposition, setIterating, setLenientOffEnd, setParameterFilter, setPresort, setSkipDeletedRecord, setStandalone, unique, uniqueaddBuffer, addBuffer, addBuffer, addBuffer, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, numBuffers, setBuffers, setBuffers, setBuffersprivate int moveCount
protected Cursor cursor
public void clearResults()
re-open it.clearResults in interface P2JQuerypublic void setScrolling()
setScrolling in interface P2JQuerysetScrolling in class AbstractQuerypublic void repositionByID(recid id)
repositionByID in interface P2JQueryid - A primary key ID, representing the target record (in the case
of a join, this ID is associated with the left-most record in
the join).ErrorConditionException - if the specified ID represents the unknown value.public void repositionByID(rowid id1, rowid... joinIDs)
repositionByID in interface P2JQueryid1 - A primary key ID, representing the target record (in the case
of a join, this ID is associated with the left-most record in
the join).joinIDs - All remaining primary key IDs, if any, arranged from left to
right to coincide with the records being joined by the
underlying query.ErrorConditionException - if any of the specified IDs represents the unknown value.public boolean repositionByID(java.lang.Long... serIDs)
repositionByID in interface P2JQueryserIDs - A set of primary key IDs, arranged from left to right to coincide with the records
being joined by the underlying query.true on success.ErrorConditionException - if any of the specified IDs represents the unknown value.public void reposition(NumberType row)
reposition in interface P2JQueryrow - 1-based index of the target position.ErrorConditionException - if this query is not a scrolling query;
if row represents unknown value.public void reposition(int row)
reposition in interface P2JQueryrow - 1-based index of the target position.ErrorConditionException - if this query is not a scrolling query.public boolean forward(NumberType rows)
forward in interface P2JQueryrows - Number of rows to scroll the cursor forward.true if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false is returned then it is
possible that cursor's position was moved but not with rows rows.ErrorConditionException - if this query is not a scrolling query;
if rows represents the unknown value.public boolean forward(int rows)
forward in interface P2JQueryrows - Number of rows to scroll the cursor forward.true if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false is returned then it is
possible that cursor's position was moved but not with rows rows.ErrorConditionException - if this query is not a scrolling query.public boolean backward(NumberType rows)
backward in interface P2JQueryrows - Number of rows to scroll the cursor backward.true if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false is returned then it is
possible that cursor's position was moved but not with rows rows.ErrorConditionException - if this query is not a scrolling query;
if rows represents the unknown value.public boolean backward(int rows)
backward in interface P2JQueryrows - Number of rows to scroll the cursor backward.true if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false is returned then it is
possible that cursor's position was moved but not with rows rows.ErrorConditionException - if this query is not a scrolling query.public integer size()
size in interface P2JQueryErrorConditionException - if this query is not a scrolling query.public integer currentRow()
currentRow in interface P2JQueryErrorConditionException - if this query is not a scrolling query.public integer currentRowImpl()
currentRowImpl in interface P2JQueryErrorConditionException - if this query is not a scrolling query.public boolean _isOffEnd()
true,
this indicates that the query cannot produce any more results in the
current scroll direction._isOffEnd in interface P2JQuerytrue if the cursor is off either end of its
query's results list.ErrorConditionException - if this query is not a scrolling query.public boolean isPreselect()
isPreselect in interface P2JQueryfalse.public boolean isNativelyPreselect()
isNativelyPreselect in interface P2JQuerytrue.public boolean isScrolling()
scrolling flag has been set.isScrolling in interface P2JQuerytrue if this is a scrolling query; else
false.public void open()
open in interface P2JQueryopen in class AbstractQueryprotected void resetScrolling()
protected void verifyScrolling()
java.lang.UnsupportedOperationException - if a cursor has not been associated with this query.protected void incrementMoves()
protected abstract java.lang.Object getBreakValue()
order by clause.
If the break value for this query currently is non-null,
this indicates that the most recently retrieved record has crossed a
sort band boundary, and that a new band has begun. This value
will only be non-null at the point at which such a record
is found, and will be null for all other records.
Note: break values are only tracked for invocations of
next and previous. Other retrievals will
results in break value being null.
null.protected void reset()