public abstract class StandardQuery<S extends Storable> extends AbstractQuery<S> implements Appender
QueryExecutor.Query.Controller, Query.Timeout| Modifier | Constructor and Description |
|---|---|
protected |
StandardQuery(Filter<S> filter,
FilterValues<S> values,
OrderingList<S> ordering,
QueryHints hints) |
| Modifier and Type | Method and Description |
|---|---|
<T extends S> |
after(T start)
Returns a query which fetches results for this query after a given
starting point, which is useful for re-opening a cursor.
|
Query<S> |
and(Filter<S> filter)
Returns a new query which has another
filter logically "and"ed to this, potentially reducing the amount of
results. |
void |
appendTo(java.lang.Appendable app)
Append the string representation of this object to the given Appendable.
|
protected void |
clearExecutor()
Clears any cached reference to a query executor.
|
long |
count()
Returns a count of all results matched by this query.
|
long |
count(Query.Controller controller)
Returns a count of all results matched by this query.
|
void |
deleteAll()
Deletes zero or more matching objects.
|
void |
deleteAll(Query.Controller controller)
Deletes zero or more matching objects.
|
protected abstract Transaction |
enterTransaction(IsolationLevel level)
Enter a transaction as needed by the standard delete operation, or null
if transactions are not supported.
|
boolean |
equals(java.lang.Object obj) |
protected QueryExecutor<S> |
executor()
Returns the executor in use by this query.
|
protected abstract QueryExecutorFactory<S> |
executorFactory()
Return a QueryExecutorFactory which is used to get an executor.
|
boolean |
exists()
Returns true if any results are matched by this query.
|
boolean |
exists(Query.Controller controller)
Returns true if any results are matched by this query.
|
Cursor<S> |
fetch()
Fetches results for this query.
|
Cursor<S> |
fetch(Query.Controller controller)
Fetches results for this query.
|
Cursor<S> |
fetchSlice(long from,
java.lang.Long to)
Fetches a slice of results for this query, as defined by a numerical
range.
|
Cursor<S> |
fetchSlice(long from,
java.lang.Long to,
Query.Controller controller)
Fetches a slice of results for this query, as defined by a numerical
range.
|
int |
getBlankParameterCount()
Returns the amount of blank parameters that need to be filled in.
|
Filter<S> |
getFilter()
Returns the query's filter.
|
FilterValues<S> |
getFilterValues()
Returns the query's filter values, which is null if filter has no
parameters.
|
protected OrderingList<S> |
getOrdering() |
java.lang.Class<S> |
getStorableType()
Returns the specific type of Storable managed by this object.
|
int |
hashCode() |
protected abstract StandardQuery<S> |
newInstance(FilterValues<S> values,
OrderingList<S> ordering,
QueryHints hints)
Return a new or cached instance of StandardQuery implementation, using
new filter values.
|
Query<S> |
not()
Returns a new query which produces all the results not supplied in this
query.
|
Query<S> |
or(Filter<S> filter)
Returns a new query which has another
filter logically "or"ed to this, potentially increasing the amount of
results. |
Query<S> |
orderBy(java.lang.String... properties)
Returns a copy of this query ordered by specific property values.
|
Query<S> |
orderBy(java.lang.String property)
Returns a copy of this query ordered by a specific property value.
|
boolean |
printNative(java.lang.Appendable app,
int indentLevel)
Prints the native query to any appendable, which is useful for
performance analysis.
|
boolean |
printPlan(java.lang.Appendable app,
int indentLevel)
Prints the query excecution plan to any appendable, which is useful for
performance analysis.
|
protected abstract QueryFactory<S> |
queryFactory()
Return a QueryFactory which is used to form new queries from this one.
|
protected void |
resetExecutor()
Resets any cached reference to a query executor.
|
protected void |
setExecutor()
Ensures that a cached query executor reference is available.
|
boolean |
tryDeleteOne()
Deletes zero or one matching objects.
|
boolean |
tryDeleteOne(Query.Controller controller)
Deletes zero or one matching objects.
|
Query<S> |
with(boolean value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(byte value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(char value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(double value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(float value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(int value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(long value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(java.lang.Object value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
with(short value)
Returns a copy of this Query with the next blank parameter filled in.
|
Query<S> |
withValues(java.lang.Object... values)
Returns a copy of this Query with the next blank parameters filled in.
|
and, checkSliceArguments, deleteOne, deleteOne, fetchAfter, fetchAfter, loadOne, loadOne, or, printNative, printNative, printPlan, printPlan, toString, tryLoadOne, tryLoadOneprotected StandardQuery(Filter<S> filter, FilterValues<S> values, OrderingList<S> ordering, QueryHints hints)
filter - optional filter object, defaults to open filter if nullvalues - optional values object, defaults to filter initial valuesordering - optional order-by propertieshints - optional query hintspublic java.lang.Class<S> getStorableType()
QuerygetStorableType in interface Query<S extends Storable>public Filter<S> getFilter()
Querypublic FilterValues<S> getFilterValues()
QuerygetFilterValues in interface Query<S extends Storable>public int getBlankParameterCount()
QuerygetBlankParameterCount in interface Query<S extends Storable>public Query<S> with(int value)
Querypublic Query<S> with(long value)
Querypublic Query<S> with(float value)
Querypublic Query<S> with(double value)
Querypublic Query<S> with(boolean value)
Querypublic Query<S> with(char value)
Querypublic Query<S> with(byte value)
Querypublic Query<S> with(short value)
Querypublic Query<S> with(java.lang.Object value)
Querypublic Query<S> withValues(java.lang.Object... values)
QuerywithValues in interface Query<S extends Storable>values - parameter values to fill in; if null or empty, this
Query instance is returnedpublic Query<S> and(Filter<S> filter) throws FetchException
Queryfilter logically "and"ed to this, potentially reducing the amount of
results.and in interface Query<S extends Storable>filter - query filterFetchException - if storage layer throws an exceptionpublic Query<S> or(Filter<S> filter) throws FetchException
Queryfilter logically "or"ed to this, potentially increasing the amount of
results.or in interface Query<S extends Storable>filter - query filterFetchException - if storage layer throws an exceptionpublic Query<S> not() throws FetchException
Querynot in interface Query<S extends Storable>FetchException - if storage layer throws an exceptionpublic Query<S> orderBy(java.lang.String property) throws FetchException
QueryNote: Specification of ordering properties is not cumulative. Calling this method will first remove any previous ordering properties.
orderBy in interface Query<S extends Storable>property - name of property to order byFetchException - if storage layer throws an exceptionpublic Query<S> orderBy(java.lang.String... properties) throws FetchException
QueryNote: Specification of ordering properties is not cumulative. Calling this method will first remove any previous ordering properties.
orderBy in interface Query<S extends Storable>properties - names of properties to order byFetchException - if storage layer throws an exceptionpublic <T extends S> Query<S> after(T start) throws FetchException
Queryordering. If not a total ordering, then query may start at an earlier
position.
Note: The returned query can be very expensive to fetch from repeatedly, if the query needs to perform a sort operation. Ideally, the query ordering should match the natural ordering of an index or key.
after in interface Query<S extends Storable>start - storable to attempt to start after; if null, this query is
returnedFetchException - if storage layer throws an exceptionpublic Cursor<S> fetch() throws FetchException
Queryfetch in interface Query<S extends Storable>FetchException - if storage layer throws an exceptionRepository.enterTransaction(IsolationLevel)public Cursor<S> fetch(Query.Controller controller) throws FetchException
Queryfetch in interface Query<S extends Storable>controller - optional controller which can abort query operationFetchException - if storage layer throws an exceptionRepository.enterTransaction(IsolationLevel)public Cursor<S> fetchSlice(long from, java.lang.Long to) throws FetchException
Queryordering in order for the slice results to be deterministic.fetchSlice in interface Query<S extends Storable>from - zero-based from record number, inclusiveto - optional zero-based to record number, exclusiveFetchException - if storage layer throws an exceptionpublic Cursor<S> fetchSlice(long from, java.lang.Long to, Query.Controller controller) throws FetchException
Queryordering in order for the slice results to be deterministic.fetchSlice in interface Query<S extends Storable>from - zero-based from record number, inclusiveto - optional zero-based to record number, exclusivecontroller - optional controller which can abort query operationFetchException - if storage layer throws an exceptionpublic boolean tryDeleteOne()
throws PersistException
QuerytryDeleteOne in interface Query<S extends Storable>PersistMultipleException - if more than one record matchesPersistException - if storage layer throws an exceptionpublic boolean tryDeleteOne(Query.Controller controller) throws PersistException
QuerytryDeleteOne in interface Query<S extends Storable>controller - optional controller which can abort query operationPersistMultipleException - if more than one record matchesPersistException - if storage layer throws an exceptionpublic void deleteAll()
throws PersistException
QuerydeleteAll in interface Query<S extends Storable>PersistException - if storage layer throws an exceptionpublic void deleteAll(Query.Controller controller) throws PersistException
QuerydeleteAll in interface Query<S extends Storable>controller - optional controller which can abort query operationPersistException - if storage layer throws an exceptionpublic long count()
throws FetchException
Querycount in interface Query<S extends Storable>FetchException - if storage layer throws an exceptionpublic long count(Query.Controller controller) throws FetchException
Querycount in interface Query<S extends Storable>controller - optional controller which can abort query operationFetchException - if storage layer throws an exceptionpublic boolean exists()
throws FetchException
Queryexists in interface Query<S extends Storable>FetchException - if storage layer throws an exceptionpublic boolean exists(Query.Controller controller) throws FetchException
Queryexists in interface Query<S extends Storable>controller - optional controller which can abort query operationFetchException - if storage layer throws an exceptionpublic boolean printNative(java.lang.Appendable app,
int indentLevel)
throws java.io.IOException
QueryprintNative in interface Query<S extends Storable>app - append results hereindentLevel - amount to indent text, zero for nonejava.io.IOExceptionpublic boolean printPlan(java.lang.Appendable app,
int indentLevel)
throws java.io.IOException
Querypublic int hashCode()
public boolean equals(java.lang.Object obj)
public void appendTo(java.lang.Appendable app)
throws java.io.IOException
Appenderprotected OrderingList<S> getOrdering()
protected QueryExecutor<S> executor() throws RepositoryException
RepositoryExceptionprotected void setExecutor()
throws RepositoryException
RepositoryExceptionprotected void resetExecutor()
throws RepositoryException
RepositoryExceptionprotected void clearExecutor()
protected abstract Transaction enterTransaction(IsolationLevel level)
level - minimum desired isolation levelprotected abstract QueryFactory<S> queryFactory()
protected abstract QueryExecutorFactory<S> executorFactory()
protected abstract StandardQuery<S> newInstance(FilterValues<S> values, OrderingList<S> ordering, QueryHints hints)
values - non-null values objectordering - order-by properties, never nullCopyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.