public abstract class AbstractQuery extends java.lang.Object implements P2JQuery
Joinable
interface and provides base services common to all query implementations.P2JQuery.Parameter, P2JQuery.ParamResolver, P2JQuery.QueryEventListener, P2JQuery.QueryOpenedListener| Modifier and Type | Field and Description |
|---|---|
private java.util.LinkedHashMap<Accumulator,java.lang.Boolean> |
accumulators
Accumulators added to this query, mapped to their deferred status
|
private boolean |
browsed
Is query associated with a UI browse widget?
|
protected boolean |
closed
Flag indicating if this query was explicitly closed.
|
protected boolean |
dynamicPredicate
Flag indicating this query is associated with a dynamically prepared query resource.
|
protected ErrorManager.ErrorHelper |
errorHelper
Context-local error helper used for silent mode operations.
|
private boolean |
errorIfNull
Should the failed first/last/unique retrievals raise error?
|
private java.util.List<P2JQuery.QueryEventListener> |
eventListeners
Registry of listeners who are notified of query is about to (re-)open.
|
protected java.util.Map<DataModelObject,Property[]> |
excluded
The excluded properties for each DMO (EXCEPT option).
|
private RecordBuffer[] |
externalBuffers
Set of external buffers, if any, referenced by this query
|
private RecordBuffer[] |
externalBuffersDefs
Set of external buffer definitions, if any, referenced by this query
|
private boolean |
fatalError
Flag indicating fatal error was encountered processing query substitution parameters
|
private boolean |
fetchOnReposition
Should the next row be fetched after a reposition?
|
private boolean |
fillingBrowseRows
This flags brackets the code which is invoked by browse widgets for populating its rows.
|
private boolean |
ignoreAfterRepo
Flag indicating if
afterReposition(boolean) calls are skipped. |
protected java.util.Map<DataModelObject,Property[]> |
included
The included properties for each DMO (FIELDS option).
|
protected boolean |
indexedReposition
Flag to indicate if this query is optimized using indexed reposition
|
protected boolean |
inverseSorting
Indicates whether the query has the inverse sorting direction against
the original sorting.
|
private boolean |
iterating
Flag indicating whether the query is used inside a FOR EACH block.
|
protected boolean |
lenientOffEnd
false if running off end of results should raise error |
private static CentralLogger |
LOG
Logger
|
private boolean |
notificationActive
Flag to avoid infinite recursion in reposition notification
|
private boolean |
omitAlias
Flag indicating that a DMO alias should not be used in this query's FQL statement
|
protected boolean |
outer
Marks this as a left outer join component of the query.
|
protected ParameterFilter |
parameterFilter
The filter that handles parameters passed to the query.
|
private boolean |
presort
Flag indicating whether the BREAK BY statement is present
|
private DataRelation |
relation
The recursive DATA-RELATION the query is to FILL for
|
private WeakList<RepositionListener> |
repoRegistry
Registry of listeners who are notified of query repositions
|
private boolean |
skipDeletedRecord
Internal value of SKIP-DELETED-RECORD.
|
private boolean |
standalone
Does this query stand alone or is it contained by a query wrapper ?
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractQuery()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
_getNext()
Conversion of GET-NEXT method (KW_GET_NEXT), which returns a Java boolean, for internal usage.
|
(package private) boolean |
_isSkipDeletedRecord()
Test whether the SKIP-DELETED-RECORD attribute is set.
|
protected void |
accumulate()
Notify accumulators attached to this query (if any) that a new result
row has been accessed, and that they should update their internal state.
|
private void |
accumulate(Accumulator accum,
boolean deferred)
Invoke the appropriate
iterate method variant on the
specified accumulator. |
void |
addAccumulator(Accumulator accum)
Add an accumulator to this query.
|
void |
addAccumulator(Accumulator accum,
boolean deferred)
Add an accumulator to this query.
|
logical |
addBuffer(Buffer buf)
Adds one new buffer to a query object or dynamic DataSet object,
without affecting the other buffers, if any.
|
logical |
addBuffer(handle bufHandle)
Adds one new buffer to a query object or dynamic DataSet object,
without affecting the other buffers, if any.
|
P2JQuery |
addExternalBuffers(DataModelObject... dmos)
Add one or more buffers to the list of those which this query references externally.
|
void |
addQueryEventListener(P2JQuery.QueryEventListener listener)
Adds a listener to be notified when this query is open.
|
void |
addRepositionListener(RepositionListener listener)
Register a listener to receive notifications reposition events for this
query.
|
protected void |
afterReposition(boolean permitFetch)
This method should be called by subclasses after any reposition of the
query.
|
protected void |
afterReposition(boolean permitFetch,
boolean error)
This method should be called by subclasses after any reposition of the
query.
|
protected void |
afterReposition(boolean permitFetch,
integer oldCurrentRow)
This method should be called by subclasses after any reposition of the
query.
|
handle |
bufferHandle()
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(character bufferName)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(int bufferSequenceNumber)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(int64 bufferSequenceNumber)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(java.lang.String bufferName)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
protected static boolean |
buffersMatch(RecordBuffer buf,
RecordBuffer defBuf)
Check if the two buffers differ.
|
void |
changeForwardOnly(boolean forwardOnly)
Conversion of FORWARD-ONLY attribute (KW_FWD_ONLY).
|
void |
changeForwardOnly(logical forwardOnly)
Conversion of FORWARD-ONLY attribute (KW_FWD_ONLY).
|
void |
cleanup()
Clean up resources associated with this query when its scope ends.
|
void |
close()
Explicitly close the prepared query.
|
private void |
collectFields(java.util.Map<DataModelObject,Property[]> target,
DataModelObject dmo,
java.lang.String[] fields,
RecordBuffer buffer)
Populate the map of with the ORM properties specified in the given fields.
|
logical |
createResultListEntry()
Creates an entry in the result list for the current row.
|
logical |
deleteResultListEntry()
Deletes the current row of a query's result list.
|
logical |
deleteResultListEntry(boolean allowBetweenRows)
Deletes the current row of a query's result list.
|
void |
exclude(DataModelObject dmo,
java.lang.String... fields)
Specifies the fields excluded from a record retrieval.
|
logical |
forwardOnly()
Conversion of FORWARD-ONLY attribute (KW_FWD_ONLY).
|
private static LockType |
fromLockNowait(long lock,
long nowait)
Return the
LockType instance for the given internal lock and nowait with corresponding query
processing. |
integer |
getCache()
Getter for the CACHE attribute.
|
logical |
getCurrent()
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(LockType lockType)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(long lock)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(long lock,
long nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(long lock,
NumberType nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(NumberType lock)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(NumberType lock,
long nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(NumberType lock,
NumberType nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
DataRelation |
getDataRelation()
Get the recursive DATA-RELATION the query is to FILL for.
|
protected LockType |
getDefaultLock()
Get the default lock type for this query.
|
protected ErrorManager.ErrorHelper |
getErrorHelper()
Retrieve the context-local error helper used for silent mode operations.
|
protected RecordBuffer[] |
getExternalBuffers()
Get the external buffers, if any, associated with this query.
|
protected RecordBuffer[] |
getExternalBuffersDefs()
Get the external buffers definitions, if any, associated with this query.
|
logical |
getFirst()
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(LockType lockType)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(long lock)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(long lock,
long nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(long lock,
NumberType nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(NumberType lock)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(NumberType lock,
long nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(NumberType lock,
NumberType nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getLast()
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(LockType lockType)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(long lock)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(long lock,
long nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(long lock,
NumberType nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(NumberType lock)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(NumberType lock,
long nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(NumberType lock,
NumberType nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getNext(LockType lockType)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(long lock)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(long lock,
long nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(long lock,
NumberType nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(NumberType lock)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(NumberType lock,
long nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(NumberType lock,
NumberType nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
integer |
getNumResults()
Conversion of NUM-RESULTS attribute (KW_NUM_RES).
|
logical |
getPrevious()
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(LockType lockType)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(long lock)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(long lock,
long nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(long lock,
NumberType nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(NumberType lock)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(NumberType lock,
long nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(NumberType lock,
NumberType nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
RecordBuffer[] |
getReferencedBuffers()
Get an array of all record buffers referenced by this query, including those directly
involved in the query, as well as those (if any) indirectly referenced by inlined,
converted, CAN-FIND expressions, and that which represents the inverse buffer of a natural
join.
|
protected boolean |
hasAccumulators()
Check if query has attached accumulators.
|
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 |
include(DataModelObject dmo,
java.lang.String... fields)
Specifies the fields included in a record retrieval.
|
character |
indexInformation()
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
character |
indexInformation(int n)
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
character |
indexInformation(NumberType n)
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
boolean |
isBrowsed()
Report whether this query is associated with a browse widget.
|
boolean |
isDynamicPredicate()
Check if this query is originating from a dynamic predicate.
|
protected boolean |
isErrorIfNull()
Indicate whether failed
FIRST, LAST, and
UNIQUE retrieval attempts should be considered an error
condition. |
protected boolean |
isFatalError()
Indicate whether there was a fatal error during query substitution parameter processing
which should abort this query at the earliest appropriate time.
|
boolean |
isFetchOnReposition()
Is this query set to fetch the next record after a reposition?
|
boolean |
isFillingBrowseRows()
Test whether the flag was set.
|
boolean |
isIndexedReposition()
Disable indexed reposition optimization to disallow repositioning to
unflushed records.
|
boolean |
isIterating()
Indicate whether the query is defined inside the scope of FOR EACH block.
|
protected boolean |
isLastOfBreakGroup(Resolvable key)
Determine whether the query result row currently being visited is the
last row within a break group whose category is identified by the
specified resolvable object.
|
protected boolean |
isLenientOffEnd()
Indicate whether this query will throw a
QueryOffEndException when it runs off the end of its
results. |
protected boolean |
isNewBreakGroup(Resolvable key)
Subclasses which support the concept of break groups in query results
should override this method to report whether the current result row
being visited represents a new break group, for the given break group
key.
|
logical |
isOffEnd()
Indicate whether the cursor has run off one or the other end of the
associated query's list of available results.
|
protected boolean |
isOmitAlias()
Determine whether DMO property references in this query's FQL should be unqualified by a
DMO alias name.
|
logical |
isOpen()
Conversion of IS-OPEN attribute (KW_IS_OPEN).
|
boolean |
isPresort()
Indicate whether the query is of presort type.
|
protected boolean |
isRepositionNotificationActive()
Indicate if we are currently notifying listeners of a reposition event.
|
logical |
isSkipDeletedRecord()
Get value of SKIP-DELETED-RECORD attribute of the query.
|
boolean |
isStandalone()
Indicate whether this query stands alone, or is wrapped by a query
wrapper.
|
protected void |
loadRowAtCursor()
Synchronize the query with the cursor by causing the query to load the
current row's results (if any) into its backing buffer(s).
|
void |
notifyQueryCloseListeners()
Notifies the registered QUERY-CLOSE listeners that the event is about to happen.
|
void |
notifyQueryOpenListeners(boolean evaluate)
Notifies the registered QUERY-OPEN listeners that the event is about to happen.
|
void |
notifyRepositionListeners(boolean closed,
boolean error,
int targetRepositionRow)
Notify all registered listeners that query is repositioned or closed.
|
integer |
numBuffers()
Conversion of NUM-BUFFERS() method (KW_NUM_BUFF).
|
static integer |
numResults(character queryName)
Implementation of NUM-RESULTS P4GL function.
|
static integer |
numResults(P2JQuery query)
Implementation of NUM-RESULTS P4GL function.
|
void |
open()
Reposition the prepared query to the first result if the query is being
browsed.
|
logical |
prepare(character predicate)
Compiles a predicate (query condition).
|
logical |
prepare(java.lang.String predicate)
Compiles a predicate (query condition).
|
protected boolean |
prepareFetch()
Prepare to perform a fetch.
|
character |
prepareString()
Conversion of PREPARE_STRING attribute (KW_PREP_STR).
|
protected static boolean |
preprocessSubstitutionArguments(BufferManager bufMgr,
java.util.function.Supplier<java.lang.Boolean> isFindByRowid,
boolean suppressNestedQueryError,
java.lang.Object[] args)
Iterate the array of query substitution parameters, if any, and resolve any which are
instances of
P2JQuery.Parameter in silent error mode. |
logical |
queryBackward(int rows)
Conversion of REPOSITION-BACKWARD() method (KW_REPOS_B).
|
logical |
queryBackward(NumberType rows)
Conversion of REPOSITION-BACKWARD() method (KW_REPOS_B).
|
logical |
queryClose()
Conversion of QUERY-CLOSE() method (KW_QRY_CLOS).
|
logical |
queryForward(int rows)
Conversion of REPOSITION-FORWARD() method (KW_REPOS_F).
|
logical |
queryForward(NumberType rows)
Conversion of REPOSITION-FORWARD() method (KW_REPOS_F).
|
logical |
queryOpen()
Opens a query object.
|
logical |
queryReposition(int n)
Conversion of REPOSITION-TO-ROW() method (KW_REPOS_2R).
|
logical |
queryReposition(NumberType n)
Conversion of REPOSITION-TO-ROW() method (KW_REPOS_2R).
|
logical |
queryRepositionByID(rowid id1,
rowid... joinIDs)
Conversion of REPOSITION-TO-ROWID() method (KW_REPOS_2I).
|
void |
releaseBuffers()
Default, no-op implementation which should be overridden by subclasses
which need to release the current record of each of their buffers in
response to a fetch request while an error is pending in the error
manager.
|
void |
removeRepositionListener(RepositionListener listener)
Unregister a listener that was receiving notifications on reposition events for this
query.
|
void |
setBrowsed(boolean browsed)
Indicate to this query that whether it is associated with a browse widget or not.
|
logical |
setBuffers(Buffer... bufs)
Sets buffers for the query.
|
logical |
setBuffers(handle... hBuffers)
Sets buffers for the query.
|
void |
setCache(integer n)
Setter for the CACHE attribute.
|
void |
setCache(long n)
Setter for the CACHE attribute.
|
void |
setDataRelation(DataRelation relation)
Set the recursive DATA-RELATION the query is to FILL for.
|
void |
setDynamicPredicate(boolean dynamic)
Set this query in a 'dynamic' mode, to mark the fact that it was used as a dynamic delegate in a query
resource.
|
void |
setErrorIfNull(boolean errorIfNull)
Set a mode such that setting a null record into a backing buffer may or
may not result in an error condition.
|
protected void |
setFatalError()
Remember there was a fatal error during query substitution parameter processing and that
this query should abort at the earliest appropriate time.
|
void |
setFetchOnReposition(boolean enable)
Set this query to automatically fetch the next record after a
reposition, or turn this feature off.
|
void |
setFillingBrowseRows(boolean on)
Informs the query that the next operations will be performed for filling browse rows, so it should not
return deleted rows/records (if argument is
true). |
void |
setIndexedReposition()
This flag is used in order to allow reposition to unflushed records (ones
which were not in the database when the query was opened).
|
void |
setIterating(boolean iterating)
Indicate whether the query is defined inside the scope of FOR EACH block.
|
void |
setLenientOffEnd(boolean lenientOffEnd)
Set the behavior of this query as a record retrieval request moves off
the end of its results.
|
protected void |
setOmitAlias(boolean omitAlias)
Specify whether DMO property references in this query's FQL should be unqualified by a DMO
alias name.
|
void |
setOuter(boolean outer)
Sets the left-outer-join property for this query.
|
void |
setParameterFilter(ParameterFilter parameterFilter)
Set the filter that handles parameters passed to the query.
|
void |
setPresort(boolean presort)
Indicate whether the query is of presort type.
|
void |
setScrolling()
Enable results list scrolling/repositioning.
|
void |
setSkipDeletedRecord(logical on)
Setter for SKIP-DELETED-RECORD query attribute.
|
void |
setStandalone(boolean standalone)
Change the standalone nature of this query.
|
boolean |
silentCurrent()
Reload the record most recently loaded into the backing record buffer,
if any.
|
boolean |
silentCurrent(LockType lockType)
Reload the record most recently loaded into the backing record buffer,
if any.
|
boolean |
silentFirst()
Navigate to the first record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
silentFirst(LockType lockType)
Navigate to the first record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
silentLast()
Navigate to the last record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
silentLast(LockType lockType)
Navigate to the last record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
silentNext()
Navigate to the next record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
silentNext(LockType lockType)
Navigate to the next record which meets the query criteria and retrieve
it into its record buffer.
|
boolean |
silentPrevious()
Navigate to the previous record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
silentPrevious(LockType lockType)
Navigate to the previous record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
silentUnique()
Navigate to a particular record which meets the query criteria and
retrieve it into its record buffer.
|
boolean |
silentUnique(LockType lockType)
Navigate to a particular record which meets the query criteria and
retrieve it into its record buffer.
|
protected static java.lang.String |
translateSort(RecordBuffer[] bound,
RecordBuffer[] definition,
java.util.List<SortCriterion> defSort)
Translate this
sort clause to use the bound DMOs' alias and property names,
instead the definition (conversion-time) alias and property names. |
protected static java.lang.String |
translateSort(RecordBuffer bound,
RecordBuffer definition,
java.lang.String sort)
Translate this
sort clause to use the bound DMO's alias and property names,
instead the definition (conversion-time) alias and property names. |
protected java.lang.String |
translateWhere(java.util.List<RecordBuffer> bound,
java.util.List<RecordBuffer> definition,
java.lang.String where)
Translate this
where clause to use the bound DMO's alias and property names,
instead the definition (conversion-time) alias and property names. |
private logical |
wrapCurrent(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getCurrent() implementations
|
private logical |
wrapFirst(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getFirst() implementations
|
private logical |
wrapLast(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getLast() implementations
|
private logical |
wrapNext(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getNext() implementations
|
private logical |
wrapPrevious(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getPrevious() implementations
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait_isOffEnd, addDynamicFilter, backward, backward, clearDynamicFilters, clearResults, close, current, current, currentRow, currentRowImpl, first, first, forward, forward, getBasicLogging, getJoin, getNext, getOffEnd, getOffEndListeners, getRecordBuffers, getTableCount, hintFullResults, isFindByRowid, isFirstOfGroup, isFirstOfGroup, isLastOfGroup, isLastOfGroup, isNativelyPreselect, isPreselect, isScrolling, last, last, next, next, previous, previous, queryRepositionByID, reposition, reposition, repositionByID, repositionByID, repositionByID, resetQuery, setBasicLogging, setBasicLogging, size, unique, uniqueaddBuffer, addBuffer, setBuffersprivate static final CentralLogger LOG
protected boolean inverseSorting
find next tt use-index si-name. find prev tt use-index si-name.will be converted to the code having a couple of AdaptiveFind queries:
AdaptiveFind query1 = new AdaptiveFind(tt, null, "tt.name asc"); AdaptiveFind query2 = new AdaptiveFind(tt, null, "tt.name desc", true);and the second query will have the inverse sorting direction.
protected boolean closed
protected ParameterFilter parameterFilter
protected boolean dynamicPredicate
protected boolean indexedReposition
protected java.util.Map<DataModelObject,Property[]> included
protected java.util.Map<DataModelObject,Property[]> excluded
private boolean fatalError
private boolean errorIfNull
protected boolean lenientOffEnd
false if running off end of results should raise errorprotected boolean outer
protected ErrorManager.ErrorHelper errorHelper
private boolean standalone
private boolean fetchOnReposition
private boolean browsed
private boolean skipDeletedRecord
private boolean iterating
private boolean presort
private boolean fillingBrowseRows
private java.util.LinkedHashMap<Accumulator,java.lang.Boolean> accumulators
private WeakList<RepositionListener> repoRegistry
private java.util.List<P2JQuery.QueryEventListener> eventListeners
private boolean notificationActive
private RecordBuffer[] externalBuffers
private RecordBuffer[] externalBuffersDefs
private boolean omitAlias
private boolean ignoreAfterRepo
afterReposition(boolean) calls are skipped.private DataRelation relation
public static integer numResults(character queryName)
queryName - A character expression that evaluates to the name of a currently open,
scrolling query.queryName does not resolve to the name of a query, or if the query is not open or
not scrolling, then the function returns the Unknown value (?).public static integer numResults(P2JQuery query)
query - A character expression that evaluates to the name of a currently open,
scrolling query.queryName does not resolve to the name of a query, or if the query is not open or
not scrolling, then the function returns the Unknown value (?).protected static boolean preprocessSubstitutionArguments(BufferManager bufMgr, java.util.function.Supplier<java.lang.Boolean> isFindByRowid, boolean suppressNestedQueryError, java.lang.Object[] args)
P2JQuery.Parameter in silent error mode.
Those one which are instances of Resolvable are resolved in normal mode
An important secondary purpose of this method is to check whether we are processing a query within the context of another query and raising an error condition if this is the case.
If an error is encountered resolving a parameter, the method will abort and set all values
in the args array to null. In this case, the method will return false instead of true, and it is up to the caller to handle the null
arguments appropriately.
This error handling behavior differs from the 4GL, in which an error may preempt processing some elements of the where clause, but continue evaluating others. This difference can become significant if the processing of certain parameters has side effects (for example, a user-defined function, which can do almost anything). This difference is a current limitation of the FWD runtime.
bufMgr - BufferManager instance for the current user context.isFindByRowid - A lambda expression which should return true if the current database operation
represents a legacy FIND by RECID/ROWID, else false.suppressNestedQueryError - true to suppress (i.e., handle as a warning only, but do not alter control flow) a
nested query error; false to allow such an error to alter control flow by permitting
an ErrorConditionException thrown during nested query detection to propagate upward
from this method.args - Array of query substitution arguments, or null if there are none.true if all arguments were resolved without error, false if any
error occurred.ErrorConditionException - if a query is executed within the WHERE clause of another query and such an error is not
suppressed.protected static java.lang.String translateSort(RecordBuffer bound, RecordBuffer definition, java.lang.String sort)
sort clause to use the bound DMO's alias and property names,
instead the definition (conversion-time) alias and property names.bound - The runtime-bound buffer.definition - The buffer as it was used to generate the sort clause at conversion
time.sort - The sort clause to be translated.protected static java.lang.String translateSort(RecordBuffer[] bound, RecordBuffer[] definition, java.util.List<SortCriterion> defSort)
sort clause to use the bound DMOs' alias and property names,
instead the definition (conversion-time) alias and property names.bound - The runtime-bound buffers.definition - The buffers as it was used to generate the sort clause at conversion
time.defSort - The sort clause to be translated as a list of SortCriterion.protected java.lang.String translateWhere(java.util.List<RecordBuffer> bound, java.util.List<RecordBuffer> definition, java.lang.String where)
where clause to use the bound DMO's alias and property names,
instead the definition (conversion-time) alias and property names.bound - The runtime-bound buffers.definition - The buffers as it was used to generate the where clause at conversion
time.where - The HQL to be translated.protected static boolean buffersMatch(RecordBuffer buf, RecordBuffer defBuf)
buf - The first buffer.defBuf - The second buffer.true if the buffers are different instances or have different
backing DMO interface.private static LockType fromLockNowait(long lock, long nowait) throws ErrorConditionException
LockType instance for the given internal lock and nowait with corresponding query
processing.
lock - The lock type as an integer value (see lock type constants in LockType).nowait - The wait type as an integer value (see wait type constants in LockType).LockType instance.ErrorConditionException - If the operation fails.public void setDynamicPredicate(boolean dynamic)
setDynamicPredicate in interface P2JQuerydynamic - Flag indicating that this is a dynamic delegate for a query resource.public boolean isDynamicPredicate()
isDynamicPredicate in interface P2JQuerydynamicPredicate value.public void setScrolling()
setScrolling in interface P2JQuerypublic void setLenientOffEnd(boolean lenientOffEnd)
next and previous which do not find a record
do not raise a QueryOffEndException. By default, this
would normally raise the exception.setLenientOffEnd in interface P2JQuerylenientOffEnd - true to suppress QueryOffEndException
for next and previous requests;
false to permit these exceptions.protected boolean isLenientOffEnd()
QueryOffEndException when it runs off the end of its
results.true if an exception will be thrown, else
false.public void setIndexedReposition()
setIndexedReposition in interface P2JQuerypublic boolean isIndexedReposition()
isIndexedReposition in interface P2JQuerytrue if this query is indexed reposition.public void open()
public logical isOffEnd()
true,
this indicates that the query cannot produce any more results in the
current scroll direction.public void addAccumulator(Accumulator accum)
This implementation assumes the accumulator is not associated with a break group.
addAccumulator in interface P2JQueryaccum - Accumulator to be registered with this query.public void addAccumulator(Accumulator accum, boolean deferred)
This implementation assumes the accumulator is not associated with a break group.
addAccumulator in interface P2JQueryaccum - Accumulator to be registered with this query.deferred - If true, calls to accumulate() will not cause the accumulator to recalculate
immediately, but instead to update the accumulator's state such that the next invocation of
Accumulator.accumulate() will trigger the actual accumulation update.
If false, the accumulator recalculates its internal state immediately.public boolean isFetchOnReposition()
isFetchOnReposition in interface P2JQuerytrue if set to fetch after reposition, else
false.public void setFetchOnReposition(boolean enable)
setFetchOnReposition in interface P2JQueryenable - true to enable automatic fetching;
false to disable.public void addQueryEventListener(P2JQuery.QueryEventListener listener)
Note that this method is only called for dynamic queries only (for the moment).
addQueryEventListener in interface P2JQuerylistener - The listener to be notified.public void notifyQueryOpenListeners(boolean evaluate)
notifyQueryOpenListeners in interface P2JQueryevaluate - Flag indicating that the dynamic query must evaluate its dynamic calls (like DYNAMIC-FUNCTION)
in the WHERE clause.public void notifyQueryCloseListeners()
notifyQueryCloseListeners in interface P2JQuerypublic void addRepositionListener(RepositionListener listener)
addRepositionListener in interface P2JQuerylistener - Reposition listener to be registered.public void removeRepositionListener(RepositionListener listener)
removeRepositionListener in interface P2JQuerylistener - Reposition listener to be unregistered.public void setBrowsed(boolean browsed)
setBrowsed in interface P2JQuerybrowsed - true to indicate the query has an associated browse widget, else false.public void setFillingBrowseRows(boolean on)
true). That is, temporarily overwrite the
SKIP-DELETED-RECORDS until the flag is turned off.setFillingBrowseRows in interface P2JQueryon - if true the deleted rows will not be returned because the query is managed by the
browse widget.public void notifyRepositionListeners(boolean closed,
boolean error,
int targetRepositionRow)
notifyRepositionListeners in interface P2JQueryclosed - A true value will inform all listeners that the query was explicitly
closed.error - true if an error happened during reposition.targetRepositionRow - Row used as the target for reposition. If it was deleted, reposition with fetching
may end up on a different row.public boolean isStandalone()
isStandalone in interface P2JQuerytrue if standalone, else false.public void setStandalone(boolean standalone)
setStandalone in interface P2JQuerystandalone - true to set query as standalone;
false to set query as contained.public void cleanup()
This default implementation does nothing.
public void close()
This default implementation calls cleanup().
public void setOuter(boolean outer)
outer - true iif this is a left outer join component of the query.public boolean isPresort()
public void setPresort(boolean presort)
setPresort in interface P2JQuerypresort - true indicating that a query of presort type.
false is not of presort type.public void setIterating(boolean iterating)
setIterating in interface P2JQueryiterating - true indicating that a query is inside FOR EACH block;
false is defined outside of a FOR EACH.public boolean isIterating()
isIterating in interface P2JQuerytrue if the query was defined inside a FOR EACH block.public void setErrorIfNull(boolean errorIfNull)
FIRST, LAST, and UNIQUE
records.setErrorIfNull in interface P2JQueryerrorIfNull - 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.public boolean isBrowsed()
public P2JQuery addExternalBuffers(DataModelObject... dmos)
addExternalBuffers in interface P2JQuerydmos - One or more external buffers.public RecordBuffer[] getReferencedBuffers()
protected ErrorManager.ErrorHelper getErrorHelper()
protected LockType getDefaultLock()
LockType.NONE if this is a dynamic delegate for a query resource, or
LockType.SHARE otherwise.protected RecordBuffer[] getExternalBuffers()
null.protected RecordBuffer[] getExternalBuffersDefs()
null.protected boolean isFatalError()
true if there was a query substitution parameter processing error, else
false.protected void setFatalError()
protected boolean isErrorIfNull()
FIRST, LAST, and
UNIQUE retrieval attempts should be considered an error
condition.true if failed first/last/unique retrievals
should be considered an error; false is such
failures should be considered a query off-end condition.protected boolean isOmitAlias()
true if the DMO alias should be omitted from property references, else
false.protected void setOmitAlias(boolean omitAlias)
omitAlias - true if the DMO alias should be omitted from property references, else
false.protected void afterReposition(boolean permitFetch)
P2JQuery.next() method). If any listeners are
registered to receive notifications of reposition events, they are
notified now.permitFetch - true to permit immediate record fetch;
false to override fetchOnReposition
flag and explicitly disallow immediate record fetch.protected void afterReposition(boolean permitFetch,
boolean error)
P2JQuery.next() method). If any listeners are
registered to receive notifications of reposition events, they are
notified now.permitFetch - true to permit immediate record fetch;
false to override fetchOnReposition
flag and explicitly disallow immediate record fetch.error - true if error happened during reposition.protected void afterReposition(boolean permitFetch,
integer oldCurrentRow)
P2JQuery.next() method). If any listeners are
registered to receive notifications of reposition events, they are
notified now.This method also brings the query to the required state if reposition has failed.
permitFetch - true to permit immediate record fetch;
false to override fetchOnReposition
flag and explicitly disallow immediate record fetch.oldCurrentRow - Current row at the start of the reposition. Can be unknown.protected boolean isRepositionNotificationActive()
true if a reposition notification is active, else
false.protected void loadRowAtCursor()
This implementation does nothing; it should be overridden to implement this behavior as needed.
protected final void accumulate()
protected boolean hasAccumulators()
true if accumulators attached to the query.protected boolean isNewBreakGroup(Resolvable key)
key - Resolvable object which is used as the key to identify the
break group category being tested.true if the current result represents the first
entry in a new break group; else false. This
default implementation always returns false.protected boolean isLastOfBreakGroup(Resolvable key)
key - Break group category key. May be null (which
should always trigger a false return).false; subclasses should override this method if
a different result is required.protected boolean prepareFetch()
false if an error is pending, else
true.public void releaseBuffers()
releaseBuffers in interface P2JQueryprivate void accumulate(Accumulator accum, boolean deferred)
iterate method variant on the
specified accumulator. If the accumulator manages only a primary
statistic (i.e., no break groups have been added), the simple form
is invoked. If break groups have been added to the accumulator, the
more complex form is invoked.accum - Target accumulator object.deferred - true if the accumulator was registered to this
query as a deferred accumulator, else false.addAccumulator(com.goldencode.p2j.util.Accumulator)public handle bufferHandle()
bufferHandle in interface BufferCollectionpublic handle bufferHandle(java.lang.String bufferName)
bufferHandle in interface BufferCollectionbufferName - buffer-name. A CHARACTER expression that evaluates to the name
of a buffer in the query or DataSet object.public handle bufferHandle(character bufferName)
bufferHandle in interface BufferCollectionbufferName - buffer-name. A CHARACTER expression that evaluates to the name
of a buffer in the query or DataSet object.public handle bufferHandle(int bufferSequenceNumber)
bufferHandle in interface BufferCollectionbufferSequenceNumber - buffer-sequence-number. An INTEGER that represents the sequence
number of the desired buffer.public handle bufferHandle(int64 bufferSequenceNumber)
bufferHandle in interface BufferCollectionbufferSequenceNumber - buffer-sequence-number. An INTEGER that represents the sequence
number of the desired buffer.public logical queryClose()
queryClose in interface P2JQuerytrue if QUERY-CLOSE() succeeds,
else false.public logical queryBackward(NumberType rows)
queryBackward in interface P2JQuerytrue if REPOSITION-BACKWARD() succeeds,
else false.public logical queryBackward(int rows)
queryBackward in interface P2JQuerytrue if REPOSITION-BACKWARD() succeeds,
else false.public logical queryForward(NumberType rows)
queryForward in interface P2JQuerytrue if REPOSITION-FORWARD() succeeds,
else false.public logical queryForward(int rows)
queryForward in interface P2JQuerytrue if REPOSITION-FORWARD() succeeds,
else false.public logical queryReposition(int n)
queryReposition in interface P2JQueryn - An integer expression representing the sequence number.true if REPOSITION-TO-ROW() succeeds,
else false.public logical queryReposition(NumberType n)
queryReposition in interface P2JQueryn - An integer expression representing the sequence number.true if REPOSITION-TO-ROW() succeeds,
else false.public logical queryRepositionByID(rowid id1, rowid... joinIDs)
queryRepositionByID 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.true if REPOSITION-TO-ROWID() succeeds,
else false.public integer getNumResults()
getNumResults in interface P2JQuerypublic logical addBuffer(handle bufHandle)
addBuffer in interface BufferCollectionbufHandle - A buffer handle to add.public logical addBuffer(Buffer buf)
addBuffer in interface BufferCollectionbuf - A buffer to add.public logical setBuffers(handle... hBuffers)
addBuffer() method to add one
buffer to the object, without affecting the other buffers, if any.
This method is the equivalent of SET-BUFFERS() method
from 4GL.setBuffers in interface BufferCollectionhBuffers - Variable argument list of buffer handles to be set.
In 4GL, the maximum number of buffers per query is 18.public logical setBuffers(Buffer... bufs)
addBuffer() method to add one
buffer to the object, without affecting the other buffers, if any.
This method is the equivalent of SET-BUFFERS() method
from 4GL.setBuffers in interface BufferCollectionbufs - Variable argument list of Buffer to be set.
In 4GL, the maximum number of buffers per query is 18.public logical prepare(java.lang.String predicate)
QUERY-PREPARE() method from 4GL.public logical prepare(character predicate)
QUERY-PREPARE() method from 4GL.public logical queryOpen()
QUERY-OPEN() method from 4GL.
Note: You must perform prepare() on a query
object before you perform queryOpen on it.public character indexInformation()
indexInformation in interface IndexInformationindexInformation in interface P2JQuerypublic character indexInformation(int n)
indexInformation in interface IndexInformationindexInformation in interface P2JQueryn - An integer expression that evaluates to the level of join for which you want
index information.public character indexInformation(NumberType n)
indexInformation in interface IndexInformationindexInformation in interface P2JQueryn - An integer expression that evaluates to the level of join for which you want index
information.public logical forwardOnly()
forwardOnly in interface P2JQuerypublic void changeForwardOnly(logical forwardOnly)
changeForwardOnly in interface P2JQueryforwardOnly - New value of FORWARD-ONLY attribute.public void changeForwardOnly(boolean forwardOnly)
changeForwardOnly in interface P2JQueryforwardOnly - New value of FORWARD-ONLY attribute.public character prepareString()
prepareString in interface P2JQuerypublic integer getCache()
public void setCache(integer n)
public void setCache(long n)
public logical isOpen()
public boolean _getNext()
public logical getNext(LockType lockType)
getNext in interface P2JQuerylockType - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).public logical getNext(long lock)
getNext in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getNext(NumberType lock)
getNext in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getNext(long lock, long nowait)
getNext in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getNext(long lock, NumberType nowait)
getNext in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getNext(NumberType lock, long nowait)
getNext in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getNext(NumberType lock, NumberType nowait)
getNext in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getPrevious()
getPrevious in interface P2JQuerytrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).public logical getPrevious(long lock)
getPrevious in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getPrevious(LockType lockType)
getPrevious in interface P2JQuerylockType - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).java.lang.IllegalArgumentException - if lock has not valid internal value.public logical getPrevious(NumberType lock)
getPrevious in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getPrevious(long lock, long nowait)
getPrevious in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getPrevious(NumberType lock, long nowait)
getPrevious in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getPrevious(long lock, NumberType nowait)
getPrevious in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getPrevious(NumberType lock, NumberType nowait)
getPrevious in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException - If the operation fails.public logical getFirst()
public logical getFirst(long lock)
getFirst in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException - If lock has not valid internal value.ErrorConditionException - If the operation fails.public logical getFirst(NumberType lock)
getFirst in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getFirst(LockType lockType)
getFirst in interface P2JQuerylockType - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException - if lock has not valid internal value.public logical getFirst(long lock, long nowait)
getFirst in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException - If lock or nowait have not valid internal values.ErrorConditionException - If the operation fails.public logical getFirst(NumberType lock, long nowait)
getFirst in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getFirst(long lock, NumberType nowait)
getFirst in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException - If lock or nowait have not valid internal values.ErrorConditionException - If the operation fails.public logical getFirst(NumberType lock, NumberType nowait)
getFirst in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getLast()
public logical getLast(long lock)
getLast in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getLast(NumberType lock)
getLast in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getLast(LockType lockType)
getLast in interface P2JQuerylockType - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException - if lock has not valid internal value.public logical getLast(long lock, long nowait)
getLast in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getLast(NumberType lock, long nowait)
getLast in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getLast(long lock, NumberType nowait)
getLast in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getLast(NumberType lock, NumberType nowait)
getLast in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException - If the operation fails.public logical getCurrent()
getCurrent in interface P2JQuerytrue if GET-CURRENT() succeeds, else false.public logical getCurrent(long lock)
getCurrent in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if GET-CURRENT() succeeds, else false.ErrorConditionException - If the operation fails.public logical getCurrent(NumberType lock)
getCurrent in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue if GET-CURRENT() succeeds, else false.ErrorConditionException - If the operation fails.public logical getCurrent(LockType lockType)
getCurrent in interface P2JQuerylockType - of LockTypetrue if GET-CURRENT() succeeds, else false.public logical getCurrent(long lock, long nowait)
getCurrent in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if GET-CURRENT() succeeds, else false.ErrorConditionException - If the operation fails.public logical getCurrent(NumberType lock, long nowait)
getCurrent in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if GET-CURRENT() succeeds, else false.ErrorConditionException - If the operation fails.public logical getCurrent(long lock, NumberType nowait)
getCurrent in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if GET-CURRENT() succeeds, else false.ErrorConditionException - If the operation fails.public logical getCurrent(NumberType lock, NumberType nowait)
getCurrent in interface P2JQuerylock - SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait - NO-WAITtrue if GET-CURRENT() succeeds, else false.ErrorConditionException - If the operation fails.public logical hasAny()
Default substitution arguments and a lock type of NONE are used for this test.
public logical hasAny(java.lang.Object[] values)
The specified substitution arguments and a lock type of NONE are used for this test.
public logical hasAny(LockType lockType)
Default substitution arguments and the specified lock type are used for this test.
hasAny in interface P2JQuerylockType - The lock type for the query. This lock is not actually acquired, only tested for availability.true if the first record exists, else false.java.lang.UnsupportedOperationException - Always, this method must be implemented in derived classes.public logical hasAny(java.lang.Object[] values, LockType lockType)
The specified substitution arguments and lock type are used for this test.
hasAny in interface P2JQueryvalues - Query substitution parameters.lockType - The lock type for the query. This lock is not actually acquired, only tested for availability.true if the first record exists, else false.java.lang.UnsupportedOperationException - Always, this method must be implemented in derived classes.public logical hasOne()
Default substitution arguments and a lock type of NONE are used for this test.
public logical hasOne(java.lang.Object[] values)
The specified substitution arguments and a lock type of NONE are used for this test.
public logical hasOne(LockType lockType)
Default substitution arguments and the specified lock type are used for this test.
hasOne in interface P2JQuerylockType - The 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.java.lang.UnsupportedOperationException - Always, this method must be implemented in derived classes.public logical hasOne(java.lang.Object[] values, LockType lockType)
The specified substitution arguments and lock type are used for this test.
hasOne in interface P2JQueryvalues - Query substitution parameters.lockType - The 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.java.lang.UnsupportedOperationException - Always, this method must be implemented in derived classes.public boolean silentFirst()
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
true 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 silentFirst(LockType lockType)
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentLast()
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentLast(LockType lockType)
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentNext()
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.
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentNext(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.
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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.public boolean silentPrevious()
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.
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentPrevious(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.
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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.public boolean silentUnique()
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentUnique(LockType lockType)
This operation is executed in silent mode.
Additional methods are defined for specific queries such as:
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 silentCurrent()
This operation is executed in silent mode.
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.public boolean silentCurrent(LockType lockType)
This operation is executed in silent mode.
lockType - 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.public void include(DataModelObject dmo, java.lang.String... fields)
include in interface P2JQuerydmo - DMO proxy which defines the buffer for which the fields are specified.fields - The fields included in a record retrieval. If no fields are specified, only record
identifiers are retrieved. No subscripts can be specified for extent fields.public void exclude(DataModelObject dmo, java.lang.String... fields)
public integer numBuffers()
numBuffers in interface BufferCollectionpublic logical deleteResultListEntry()
deleteResultListEntry in interface P2JQuerytrue on success.public logical deleteResultListEntry(boolean allowBetweenRows)
deleteResultListEntry in interface P2JQueryallowBetweenRows - If true then the cursor can be positioned between rows (the next
row will be deleted). false for conventional DELETE-RESULT-LIST-ENTRY()
mode where the cursor should be positioned on a row (otherwise false is
returned).public logical createResultListEntry()
createResultListEntry in interface P2JQuerytrue on success.public void setSkipDeletedRecord(logical on)
setSkipDeletedRecord in interface P2JQueryon - New value for the attribute.public logical isSkipDeletedRecord()
isSkipDeletedRecord in interface P2JQuerypublic void setParameterFilter(ParameterFilter parameterFilter)
setParameterFilter in interface P2JQueryparameterFilter - The filter that handles passed parameters.public boolean isFillingBrowseRows()
isFillingBrowseRows in interface P2JQuerytrue during the returning of rows for populating a browse widget.setFillingBrowseRows(boolean)boolean _isSkipDeletedRecord()
private logical wrapNext(LockType lockType)
lockType - instance of LockTypetrue if GET-NEXT() succeeds, else false.private logical wrapPrevious(LockType lockType)
lockType - instance of LockTypetrue if GET-PREV() succeeds, else false.private logical wrapFirst(LockType lockType)
lockType - instance of LockTypetrue if GET-FIRST() succeeds, else false.private logical wrapLast(LockType lockType)
lockType - instance of LockTypetrue if GET-LAST() succeeds, else false.private logical wrapCurrent(LockType lockType)
lockType - instance of LockTypetrue if GET-CURRENT() succeeds, else false.private void collectFields(java.util.Map<DataModelObject,Property[]> target, DataModelObject dmo, java.lang.String[] fields, RecordBuffer buffer)
target - The target map.dmo - The DMO instance.fields - The fields to resolve.buffer - The buffer instance.public DataRelation getDataRelation()
getDataRelation in interface P2JQuerypublic void setDataRelation(DataRelation relation)
setDataRelation in interface P2JQueryrelation - the relation in question