public final class FindQuery extends RandomAccessQuery
RandomAccessQuery. Calls to
previous and next will throw a
QueryOffEndException when no data record is found, which is
consistent with the Progress FIND NEXT/PREV statement behavior.
On query off-end, the FIND NEXT/PREV statement will execute the action defined for the END-KEY condition (which defaults to UNDO, LEAVE, but can be overridden by an user-defined action). This behavior is only valid to following blocks:
This class also handles converted CAN-FIND statements.
| Modifier and Type | Class and Description |
|---|---|
private static class |
FindQuery.CanFind
Types of can-find lookups
|
P2JQuery.Parameter, P2JQuery.ParamResolver, P2JQuery.QueryEventListener, P2JQuery.QueryOpenedListener| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object[] |
args
Substitution parameters for HQL queries.
|
private FindQuery.CanFind |
canFindMode
Mode of this query if used for CAN-FIND.
|
private DataModelObject |
dmo
Data Model Object of the buffer in which the records will be retrived.
|
private boolean |
initialized
If the query was already initialized.
|
private DataModelObject |
inverse
DMO to which this query should join via a foreign relation, can be
null. |
private LockType |
lockType
Lock type to apply to records retrieved.
|
private boolean |
readOnly
Flag indicating whether buffer is updated by query.
|
private java.lang.String |
sort
Order by clause, using HQL syntax, can be
null |
private java.lang.String |
where
Where clause, using HQL syntax, can be
null. |
private java.util.function.Supplier<logical> |
whereExpr
Client-side where clause expression, can be
null. |
cursorclosed, dynamicPredicate, errorHelper, excluded, included, indexedReposition, inverseSorting, lenientOffEnd, outer, parameterFilterCURRENT, FIRST, ITERATE, LAST, NEXT, NONE, PREVIOUS, RETRIEVE_MODES, UNIQUE| Constructor and Description |
|---|
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort)
Basic constructor which defaults record lock type to
LockType.SHARE. |
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse)
Constructor which is used when joining to another table using a foreign
key.
|
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
LockType lockType)
Constructor which is used when joining to another table using a foreign
key.
|
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
java.lang.Object[] args)
Constructor which is used when joining to another table using a foreign
key.
|
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType)
Constructor which is used when joining to another table using a foreign
key.
|
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
LockType lockType)
Constructor which sets an explicit, default, record lock type.
|
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.Object[] args)
Constructor which defaults record lock type to
LockType.SHARE and accepts default substitution parameters. |
FindQuery(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.Object[] args,
LockType lockType)
Constructor which sets an explicit, default, record lock type and
accepts default substitution parameters.
|
| Modifier and Type | Method and Description |
|---|---|
FindQuery |
addExternalBuffers(DataModelObject... dmos)
Add one or more buffers to the list of those which this query references externally.
|
private boolean |
canFindImpl(java.lang.Object[] values,
LockType lockType)
Indicate whether a record can be found with meets this query's criteria.
|
boolean |
current()
Reload the record most recently loaded into the backing record buffer,
if any.
|
boolean |
current(LockType lockType)
Reload the record most recently loaded into the backing record buffer,
if any.
|
boolean |
first()
Navigate to the first record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
first(LockType lockType)
Navigate to the first record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
first(java.lang.Object[] values)
Navigate to the first record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
first(java.lang.Object[] values,
LockType lockType)
Navigate to the first record which meets the query criteria and retrieve
it into its record buffer.
|
protected void |
handleExecuteException(LockUnavailableException exc)
Override the superclass' implementation to throw an exception
unconditionally when in read-only mode.
|
protected void |
handleExecuteException(PersistenceException exc)
Override the superclass' implementation to throw an exception
unconditionally when in read-only mode.
|
protected void |
handleExecuteException(ValidationException exc)
Override the superclass' implementation to throw an exception
unconditionally when in read-only mode.
|
logical |
hasAny()
Indicate whether a request to find the first result of this query would succeed or fail.
|
logical |
hasAny(LockType lockType)
Indicate whether a request to find the first result of this query would succeed or fail.
|
logical |
hasAny(java.lang.Object[] values)
Indicate whether a request to find the first result of this query would succeed or fail.
|
logical |
hasAny(java.lang.Object[] values,
LockType lockType)
Indicate whether a request to find the first result of this query would succeed or fail.
|
logical |
hasOne()
Indicate whether this query would produce a unique result.
|
logical |
hasOne(LockType lockType)
Indicate whether this query would produce a unique result.
|
logical |
hasOne(java.lang.Object[] values)
Indicate whether this query would produce a unique result.
|
logical |
hasOne(java.lang.Object[] values,
LockType lockType)
Indicate whether this query would produce a unique result.
|
void |
initializeQuery()
Initializes the query at the latest moment possible (right before executing a find operation).
|
boolean |
isFindByRowid()
Indicate whether this query is a simple RECID/ROWID lookup FIND query.
|
protected boolean |
isIdOnly()
Override the parent's method to return
true if this is a CAN-FIND, else
delegate to the parent's implementation. |
boolean |
last()
Navigate to the last record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
last(LockType lockType)
Navigate to the last record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
last(java.lang.Object[] values)
Navigate to the last record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
last(java.lang.Object[] values,
LockType lockType)
Navigate to the last record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
next()
Navigate to the next record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
next(LockType lockType)
Navigate to the next record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
next(java.lang.Object[] values)
Navigate to the next record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
next(java.lang.Object[] values,
LockType lockType)
Navigate to the next record which meets the query criteria and retrieve
it into its record buffer.
|
protected void |
prepareBuffer()
Prepare buffer associated with this query for the query's execution.
|
boolean |
previous()
Navigate to the previous record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
previous(LockType lockType)
Navigate to the previous record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
previous(java.lang.Object[] values)
Navigate to the previous record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
previous(java.lang.Object[] values,
LockType lockType)
Navigate to the previous record which meets the query criteria and
retrieve it into its record buffer.
|
protected void |
registerChangeListener()
This class doesn't need to register a change listener, so this method does nothing.
|
FindQuery |
setHasAny()
Set this query's can-find mode to 'any', meaning can it find any record
which meets the query's criteria, regardless of duplicates.
|
FindQuery |
setHasOne()
Set this query's can-find mode to 'one', meaning can it find one and
only one record which meets the query's criteria.
|
protected boolean |
suppressNestedQueryError()
Indicate whether a nested query error should be suppressed (i.e., reported only as a warning, but not
interrupt control flow), when detected while preprocessing this query's substitution parameters.
|
private boolean |
testLock(Record dmo,
LockType lockType)
Test whether the specified lock type could be acquired for the given
DMO, but do not actually acquire the lock.
|
protected boolean |
throwExceptionOnFatalError()
Test whether the
first / last navigation will throw QueryOffEndException if the
initialization failed. |
boolean |
unique()
Navigate to a particular record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
unique(LockType lockType)
Navigate to a particular record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
unique(java.lang.Object[] values)
Navigate to a particular record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
unique(java.lang.Object[] values,
LockType lockType)
Navigate to a particular record which meets the query criteria and
retrieve it into its record buffer.
|
protected void |
updateBuffer(Record dmo,
LockType lockType,
boolean errorIfNull,
OffEnd offEnd)
Update the record buffer with the given DMO, applying the specified
lock type and error-if-null setting.
|
activateFirst, activateUnique, addDynamicFilter, cleanup, clearDynamicFilters, clearResults, close, close, execute, forceDynamicOperation, getArgs, getBreakValue, getBuffer, getBundleFql, getCurrentArgs, getExternalBuffers, getHelper, getJoin, getLockType, getOffEnd, getOffEndListeners, getOriginalWhere, getRecordBuffers, getRow, getSortPhrase, getTableCount, hasConstraints, hasWhereExpression, honorRecordNursery, indexInformation, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, initialize, load, makeAdaptiveServerJoinComponent, makePreselectServerJoinComponent, peekFirst, peekLast, peekNext, peekPrevious, prepareFetch, recordBuffers, registerRecordChangeListeners, releaseBuffers, reset, setFullRecords, setRecordAlreadyFound, setReferenceRecord, setResults, setUnknownRecord, silentFirst, silentFirst, silentLast, silentLast, silentNext, silentNext, silentPrevious, silentPrevious, silentUnique, silentUnique, stateChanged, translateWhere_isOffEnd, backward, backward, currentRow, currentRowImpl, forward, forward, incrementMoves, isNativelyPreselect, isPreselect, isScrolling, open, reposition, reposition, repositionByID, repositionByID, repositionByID, reset, resetScrolling, setScrolling, size, verifyScrolling_getNext, _isSkipDeletedRecord, accumulate, addAccumulator, addAccumulator, addBuffer, addBuffer, addQueryEventListener, addRepositionListener, afterReposition, afterReposition, afterReposition, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, buffersMatch, changeForwardOnly, changeForwardOnly, createResultListEntry, deleteResultListEntry, deleteResultListEntry, exclude, forwardOnly, getCache, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getDataRelation, getDefaultLock, getErrorHelper, 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, include, 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, prepareString, preprocessSubstitutionArguments, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, 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, waitgetReferencedBuffers, setErrorIfNull, setOuter, shouldRegisterRecordChangeListeners_getNext, _isOffEnd, addAccumulator, addAccumulator, addQueryEventListener, addRepositionListener, backward, backward, changeForwardOnly, changeForwardOnly, createResultListEntry, currentRow, currentRowImpl, deleteResultListEntry, deleteResultListEntry, exclude, forward, forward, forwardOnly, getBasicLogging, getCache, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getDataRelation, 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, hintFullResults, include, indexInformation, indexInformation, isBrowsed, isDynamicPredicate, isFetchOnReposition, isFillingBrowseRows, isFirstOfGroup, isFirstOfGroup, isIndexedReposition, isIterating, isLastOfGroup, isLastOfGroup, isNativelyPreselect, isOffEnd, isPreselect, isPresort, isScrolling, isSkipDeletedRecord, isStandalone, notifyQueryCloseListeners, notifyQueryOpenListeners, notifyRepositionListeners, open, prepare, prepare, prepareString, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, queryRepositionByID, removeRepositionListener, reposition, reposition, repositionByID, repositionByID, repositionByID, resetQuery, setBasicLogging, setBasicLogging, setBrowsed, setCache, setCache, setDataRelation, setDynamicPredicate, setFetchOnReposition, setFillingBrowseRows, setIndexedReposition, setIterating, setLenientOffEnd, setParameterFilter, setPresort, setScrolling, setSkipDeletedRecord, setStandalone, sizeaddBuffer, addBuffer, addBuffer, addBuffer, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, numBuffers, setBuffers, setBuffers, setBuffersprivate FindQuery.CanFind canFindMode
private boolean readOnly
private DataModelObject dmo
private java.lang.String where
null.private java.util.function.Supplier<logical> whereExpr
null.private java.lang.String sort
null.private DataModelObject inverse
null.private java.lang.Object[] args
private LockType lockType
private boolean initialized
public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort)
LockType.SHARE.dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse)
LockType.SHARE.dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.inverse - DMO to which this query should join via a foreign relation.
May be null.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.Object[] args)
LockType.SHARE and accepts default substitution parameters.dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.args - Substitution parameters for HQL queries. These will be used
if not overridden by a record retrieval method.java.lang.IllegalArgumentException - if any substitution argument provided is not of a supported
type.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse, java.lang.Object[] args)
LockType.SHARE and
accepts default substitution parameters.dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.inverse - DMO to which this query should join via a foreign relation.
May be null.args - Substitution parameters for HQL queries. These will be used
if not overridden by a record retrieval method.java.lang.IllegalArgumentException - if any substitution argument provided is not of a supported
type.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, LockType lockType)
dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.lockType - Lock type to apply to records retrieved, if not overridden by
a record retrieval method.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse, LockType lockType)
dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.inverse - DMO to which this query should join via a foreign relation.
May be null.lockType - Lock type to apply to records retrieved, if not overridden by
a record retrieval method.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.Object[] args, LockType lockType)
dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.args - Substitution parameters for HQL queries. These will be used
if not overridden by a record retrieval method.lockType - Lock type to apply to records retrieved, if not overridden by
a record retrieval method.java.lang.IllegalArgumentException - if any substitution argument provided is not of a supported
type.public FindQuery(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse, java.lang.Object[] args, LockType lockType)
dmo - Data model object which determines the record buffer into which
records are retrieved.where - Where clause, using HQL syntax. May be null.whereExpr - Client-side where clause expression. May be null.sort - Order by clause, using HQL syntax. May be null
only if query is to be navigated only using one of the
unique method variants.inverse - DMO to which this query should join via a foreign relation.
May be null.args - Substitution parameters for HQL queries. These will be used
if not overridden by a record retrieval method.lockType - Lock type to apply to records retrieved, if not overridden by
a record retrieval method.java.lang.IllegalArgumentException - if any substitution argument provided is not of a supported
type.public FindQuery setHasAny()
public FindQuery setHasOne()
public logical hasAny()
Default substitution arguments and a lock type of NONE are used for this test.
hasAny in interface P2JQueryhasAny in class AbstractQuerytrue if any record matching the query's criteria exists, else false.public logical hasAny(java.lang.Object[] values)
The specified substitution arguments and a lock type of NONE are used for this test.
hasAny in interface P2JQueryhasAny in class AbstractQueryvalues - Query substitution parameters.true if any record matching the query's criteria exists, else false.public logical hasAny(LockType lockType)
Default substitution arguments and the specified lock type are used for this test.
hasAny in interface P2JQueryhasAny in class AbstractQuerylockType - Lock type for the query. This lock is not actually acquired, only tested for availability.true if any record matching the query's criteria exists, else false.public logical hasAny(java.lang.Object[] values, LockType lockType)
The specified substitution arguments and lock type are used for this test.
hasAny in interface P2JQueryhasAny in class AbstractQueryvalues - Query substitution parameters.lockType - Lock type for the query. This lock is not actually acquired, only tested for availability.true if any record matching the query's criteria exists, else false.public logical hasOne()
Default substitution arguments and a lock type of NONE are used for this test.
hasOne in interface P2JQueryhasOne in class AbstractQuerytrue if one and only one record matching the query's criteria exists, else
false.public logical hasOne(java.lang.Object[] values)
The specified substitution arguments and a lock type of NONE are used for this test.
hasOne in interface P2JQueryhasOne in class AbstractQueryvalues - Query substitution parameters.true if one and only one record matching the query's criteria exists, else
false.public logical hasOne(LockType lockType)
Default substitution arguments and the specified lock type are used for this test.
hasOne in interface P2JQueryhasOne in class AbstractQuerylockType - Lock type for the query. This lock is not actually acquired, only tested for availability.true if one and only one record matching the query's criteria exists, else
false.public logical hasOne(java.lang.Object[] values, LockType lockType)
The specified substitution arguments and lock type are used for this test.
hasOne in interface P2JQueryhasOne in class AbstractQueryvalues - Query substitution parameters.lockType - Lock type for the query. This lock is not actually acquired, only tested for availability.true if one and only one record matching the query's criteria exists, else
false.public boolean first()
first in interface P2JQueryfirst in class RandomAccessQuerytrue if query could retrieve the first record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean first(java.lang.Object[] values)
first in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.true if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean first(LockType lockType)
first in interface P2JQueryfirst in class RandomAccessQuerylockType - Lock type to acquire for the retrieved record.true if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean first(java.lang.Object[] values,
LockType lockType)
first in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.lockType - Lock type to acquire for the retrieved record.true if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean last()
last in interface P2JQuerylast in class RandomAccessQuerytrue if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean last(java.lang.Object[] values)
last in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.true if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean last(LockType lockType)
last in interface P2JQuerylast in class RandomAccessQuerylockType - Lock type to acquire for the retrieved record.true if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean last(java.lang.Object[] values,
LockType lockType)
last in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.lockType - Lock type to acquire for the retrieved record.true if query could retrieve the last record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if no record
could be found when operating in standalone mode.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean next()
Use the record most recently loaded into the backing buffer as the reference point when determining the next record to visit. If no record has yet been loaded into the buffer, retrieve the first record which meets the query criteria.
next in interface P2JQuerynext in class RandomAccessQuerytrue if query could retrieve the next record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found.public boolean next(java.lang.Object[] values)
Use the record most recently loaded into the backing buffer as the reference point when determining the next record to visit. If no record has yet been loaded into the buffer, retrieve the first record which meets the query criteria.
next in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.true if query could retrieve the next record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found.public boolean next(LockType lockType)
Use the record most recently loaded into the backing buffer as the reference point when determining the next record to visit. If no record has yet been loaded into the buffer, retrieve the first record which meets the query criteria.
next in interface P2JQuerynext in class RandomAccessQuerylockType - Lock type to acquire for the retrieved record.true if query could retrieve the next record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found.public boolean next(java.lang.Object[] values,
LockType lockType)
Use the record most recently loaded into the backing buffer as the reference point when determining the next record to visit. If no record has yet been loaded into the buffer, retrieve the first record which meets the query criteria.
next in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.lockType - Lock type to acquire for the retrieved record.true if query could retrieve the next record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found and lenientOffEnd is
false.public boolean previous()
Use the record most recently loaded into the backing buffer as the reference point when determining the previous record to visit. If no record has yet been loaded into the buffer, retrieve the last record which meets the query criteria.
previous in interface P2JQueryprevious in class RandomAccessQuerytrue if query could retrieve the previous record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found.public boolean previous(java.lang.Object[] values)
Use the record most recently loaded into the backing buffer as the reference point when determining the previous record to visit. If no record has yet been loaded into the buffer, retrieve the last record which meets the query criteria.
previous in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.true if query could retrieve the previous record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found.public boolean previous(LockType lockType)
Use the record most recently loaded into the backing buffer as the reference point when determining the previous record to visit. If no record has yet been loaded into the buffer, retrieve the last record which meets the query criteria.
previous in interface P2JQueryprevious in class RandomAccessQuerylockType - Lock type to acquire for the retrieved record.true if query could retrieve the previous record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found.public boolean previous(java.lang.Object[] values,
LockType lockType)
Use the record most recently loaded into the backing buffer as the reference point when determining the previous record to visit. If no record has yet been loaded into the buffer, retrieve the last record which meets the query criteria.
previous in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.lockType - Lock type to acquire for the retrieved record.true if query could retrieve the previous record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval.QueryOffEndException - if no record could be found and lenientOffEnd is
false.public boolean current()
current in interface P2JQuerycurrent in class RandomAccessQuerytrue if query could retrieve the current record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record reload.public boolean current(LockType lockType)
current in interface P2JQuerycurrent in class RandomAccessQuerylockType - New lock type to apply to the record.true if query could retrieve the current record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record reload, or the lock could
not be transitioned to the requested type.public boolean unique()
unique in interface P2JQueryunique in class RandomAccessQuerytrue if query could retrieve the unique record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if more than
one record is found which match the criteria.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean unique(java.lang.Object[] values)
unique in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.true if query could retrieve the unique record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if more than
one record is found which match the criteria.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean unique(LockType lockType)
unique in interface P2JQueryunique in class RandomAccessQuerylockType - Lock type to acquire for the retrieved record.true if query could retrieve the unique record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if more than
one record is found which match the criteria.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean unique(java.lang.Object[] values,
LockType lockType)
unique in class RandomAccessQueryvalues - Substitution values to use when issuing FQL queries.lockType - Lock type to acquire for the retrieved record.true if query could retrieve the unique record successfully;
false if unsuccessful and lenientOffEnd is set on true.ErrorConditionException - if an error occurred during record retrieval or if more than
one record is found which match the criteria.QueryOffEndException - if no record could be found when operating in compound query
mode.public boolean isFindByRowid()
true if this is a RECID/ROWID lookup FIND query, else false.public FindQuery addExternalBuffers(DataModelObject... dmos)
addExternalBuffers in interface P2JQueryaddExternalBuffers in class RandomAccessQuerydmos - One or more external buffers.public void initializeQuery()
LegacyErrorException and ErrorConditionException that are thrown when the
query is initialized are caught and handled.
Ensures the query is only initialized once.
protected boolean suppressNestedQueryError()
suppressNestedQueryError in class RandomAccessQueryfalse.protected void registerChangeListener()
registerChangeListener in class RandomAccessQueryprotected boolean isIdOnly()
true if this is a CAN-FIND, else
delegate to the parent's implementation.isIdOnly in class RandomAccessQuerytrue to produce a projection query, else false.protected void prepareBuffer()
throws ValidationException
prepareBuffer in class RandomAccessQueryValidationException - if the parent's implementation is invoked and a buffer flush
triggers a validation error for the record currently stored in
the buffer.protected void updateBuffer(Record dmo, LockType lockType, boolean errorIfNull, OffEnd offEnd)
dmo is null.updateBuffer in class RandomAccessQuerydmo - Record to be stored in buffer.lockType - Lock type associated with the record, which will be remembered
by the buffer.errorIfNull - If true, setting a null value as the
current record in an underlying buffer will raise an error
condition (if not in silent error mode); if false,
this action will raise an end condition instead.offEnd - Enum indicating whether query is off-end, and if so, in which
direction.protected void handleExecuteException(LockUnavailableException exc)
When the query is not in read-only mode, handling is delegated to the superclass' implementation.
handleExecuteException in class RandomAccessQueryexc - Cause exception.protected void handleExecuteException(ValidationException exc)
When the query is not in read-only mode, handling is delegated to the superclass' implementation.
handleExecuteException in class RandomAccessQueryexc - Cause exception.protected void handleExecuteException(PersistenceException exc)
When the query is not in read-only mode, handling is delegated to the superclass' implementation.
handleExecuteException in class RandomAccessQueryexc - Cause exception.protected boolean throwExceptionOnFatalError()
first / last navigation will throw QueryOffEndException if the
initialization failed. The super class must throw the exception if it fails the initialization in order
to prematurely exit the loop on basic navigation. Now we are processing a simple FIND statement
which does not require such thing because there is no loop to break.throwExceptionOnFatalError in class RandomAccessQueryfalse.private boolean canFindImpl(java.lang.Object[] values,
LockType lockType)
true if any record can be found which meets the query's
criteria, regardless of duplicates. If no such record is found, return
false.true if one and only one record can be found which meets
the query's criteria. If no such record is found, or if more than one such
record is found, return false.values - Query substitution parameterslockType - Lock type to use when performing test. Lock is not actually acquired, only tested.private boolean testLock(Record dmo, LockType lockType)
Note: because this method does not actually acquire the lock, it is
not a reliable test, since another context could easily acquire the
target lock after this method returns true, but before any
further action is taken on that information in the current context.
dmo - DMO for which the lock test should occur.lockType - Lock type to test.true if the lock could be acquired at the moment
of the test, else false.