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
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, inverseSorting, 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.
|
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.
|
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 |
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.
|
accumulate, addAccumulator, addAccumulator, addBuffer, addBuffer, addRepositionListener, afterReposition, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, changeForwardOnly, changeForwardOnly, cleanup, close, deleteResultListEntry, deleteResultListEntry, exclude, forwardOnly, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getNext, 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, isErrorIfNull, isFetchOnReposition, isLastOfBreakGroup, isNewBreakGroup, isOffEnd, isOpen, isRepositionNotificationActive, isSkipDeletedRecord, isStandalone, loadRowAtCursor, notifyRepositionListeners, numBuffers, numResults, numResults, optimize, prepare, prepare, prepareFetch, prepareString, preprocessSubstitutionArguments, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, releaseBuffers, removeRepositionListener, setBrowsed, setBuffers, setBuffers, setErrorIfNull, setExternalBuffers, setFetchOnReposition, setParameterFilter, setSkipDeletedRecord, setStandalone, validateSubstitutionArguments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
peekNext, peekPrevious
addAccumulator, addAccumulator, addBuffer, addBuffer, addRepositionListener, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, changeForwardOnly, changeForwardOnly, cleanup, close, close, current, current, deleteResultListEntry, deleteResultListEntry, exclude, first, first, forwardOnly, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, 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, getTableCount, hasAny, hasAny, hasAny, hasAny, hasOne, hasOne, hasOne, hasOne, include, indexInformation, indexInformation, indexInformation, isBrowsed, isFetchOnReposition, isOffEnd, isOpen, isSkipDeletedRecord, isStandalone, last, last, next, next, notifyRepositionListeners, numBuffers, optimize, prepare, prepare, prepareString, previous, previous, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, removeRepositionListener, setBrowsed, setBuffers, setBuffers, setErrorIfNull, setExternalBuffers, setFetchOnReposition, setParameterFilter, setSkipDeletedRecord, setStandalone, unique, unique
forceDynamicOperation, getArgs, getJoin, getOriginalWhere, getRecordBuffers, getRow, getSortPhrase, hasWhereExpression, load, makeAdaptiveServerJoinComponent, makePreselectServerJoinComponent, peekFirst, peekLast, registerRecordChangeListeners, reset, setFullRecords, setResults, setUnknownRecord
private int moveCount
protected Cursor cursor
public void setScrolling()
setScrolling
in interface P2JQuery
setScrolling
in class AbstractQuery
public void repositionByID(recid id)
repositionByID
in interface P2JQuery
id
- 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 P2JQuery
id1
- 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 void reposition(NumberType row)
reposition
in interface P2JQuery
row
- 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 P2JQuery
row
- 1-based index of the target position.ErrorConditionException
- if this query is not a scrolling query.public boolean forward(NumberType rows)
forward
in interface P2JQuery
rows
- 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 P2JQuery
rows
- 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 P2JQuery
rows
- 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 P2JQuery
rows
- 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 P2JQuery
ErrorConditionException
- if this query is not a scrolling query.public integer currentRow()
currentRow
in interface P2JQuery
ErrorConditionException
- if this query is not a scrolling query.public integer currentRowImpl()
currentRowImpl
in interface P2JQuery
ErrorConditionException
- 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 P2JQuery
true
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 P2JQuery
false
.public boolean isNativelyPreselect()
isNativelyPreselect
in interface P2JQuery
true
.public boolean isScrolling()
scrolling
flag has been set.isScrolling
in interface P2JQuery
true
if this is a scrolling query; else
false
.public void open()
open
in interface P2JQuery
open
in class AbstractQuery
protected 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
.