org.apache.openjpa.kernel
Class ExpressionStoreQuery.AbstractExpressionExecutor

java.lang.Object
  extended by org.apache.openjpa.kernel.AbstractStoreQuery.AbstractExecutor
      extended by org.apache.openjpa.kernel.ExpressionStoreQuery.AbstractExpressionExecutor
All Implemented Interfaces:
StoreQuery.Executor
Direct Known Subclasses:
ExpressionStoreQuery.DataStoreExecutor, ExpressionStoreQuery.InMemoryExecutor, PreparedSQLStoreQuery.PreparedSQLExecutor
Enclosing class:
ExpressionStoreQuery

public abstract static class ExpressionStoreQuery.AbstractExpressionExecutor
extends AbstractStoreQuery.AbstractExecutor
implements StoreQuery.Executor

Provides support for queries that hold query information in a QueryExpressions instance.

Author:
Marc Prud'hommeaux

Constructor Summary
ExpressionStoreQuery.AbstractExpressionExecutor()
           
 
Method Summary
protected  void assertNotContainer(Value val, StoreQuery q)
          Throw proper exception if given value is a collection/map/array.
 ClassMetaData[] getAccessPathMetaDatas(StoreQuery q)
          Return an array of all persistent classes used in this query, or empty array if unknown.
 String getAlias(StoreQuery q)
          If this is not a projection but the candidate results are placed into a result class with an alias, return that alias.
 boolean[] getAscending(StoreQuery q)
          Return the ordering direction for all ordering clauses, or empty array if none.
 int getOperation(StoreQuery q)
          Returns the operation this executor is meant to execute.
 OrderedMap<Object,Class<?>> getOrderedParameterTypes(StoreQuery q)
          Return a map of parameter names to types.
 String[] getProjectionAliases(StoreQuery q)
          Return the alias for each projection element, or empty array if not a projection.
 Class<?>[] getProjectionTypes(StoreQuery q)
          Return the expected types of the projections used by this query, or an empty array if not a projection.
 void getRange(StoreQuery q, Object[] params, StoreQuery.Range range)
          Mutate the given range to set any range information stored in the query string and/or parameters.
 Class<?> getResultClass(StoreQuery q)
          Returns the result class, if any.
 ResultShape<?> getResultShape(StoreQuery q)
           
 Map getUpdates(StoreQuery q)
          Return a map of FieldMetaData to update Constants, in cases where this query is for a bulk update.
 boolean hasGrouping(StoreQuery q)
          Whether the compiled query has grouping.
 boolean isAggregate(StoreQuery q)
          Return true if the compiled query is an aggregate.
 boolean isDistinct(StoreQuery q)
           
 boolean isPacking(StoreQuery q)
          Return true if this executor packs projections into the result class itself.
 Object[] toParameterArray(StoreQuery q, Map<?,?> userParams)
          Creates a Object[] from the values of the given user parameters.
 void validate(StoreQuery q)
          Validate components of query.
 
Methods inherited from class org.apache.openjpa.kernel.AbstractStoreQuery.AbstractExecutor
executeDelete, executeUpdate, getDataStoreActions, getOrderingValue, getParameterTypes, getQueryExpressions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.kernel.StoreQuery.Executor
executeDelete, executeQuery, executeUpdate, getDataStoreActions, getOrderingValue, getParameterTypes, getQueryExpressions
 

Constructor Detail

ExpressionStoreQuery.AbstractExpressionExecutor

public ExpressionStoreQuery.AbstractExpressionExecutor()
Method Detail

assertNotContainer

protected void assertNotContainer(Value val,
                                  StoreQuery q)
Throw proper exception if given value is a collection/map/array.


validate

public final void validate(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Validate components of query.

Specified by:
validate in interface StoreQuery.Executor
Overrides:
validate in class AbstractStoreQuery.AbstractExecutor

getRange

public void getRange(StoreQuery q,
                     Object[] params,
                     StoreQuery.Range range)
Description copied from interface: StoreQuery.Executor
Mutate the given range to set any range information stored in the query string and/or parameters.

Specified by:
getRange in interface StoreQuery.Executor
Overrides:
getRange in class AbstractStoreQuery.AbstractExecutor

getResultClass

public final Class<?> getResultClass(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Returns the result class, if any.

Specified by:
getResultClass in interface StoreQuery.Executor
Overrides:
getResultClass in class AbstractStoreQuery.AbstractExecutor

getResultShape

public final ResultShape<?> getResultShape(StoreQuery q)
Specified by:
getResultShape in interface StoreQuery.Executor
Overrides:
getResultShape in class AbstractStoreQuery.AbstractExecutor

getAscending

public final boolean[] getAscending(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return the ordering direction for all ordering clauses, or empty array if none.

Specified by:
getAscending in interface StoreQuery.Executor
Overrides:
getAscending in class AbstractStoreQuery.AbstractExecutor

getAlias

public final String getAlias(StoreQuery q)
Description copied from interface: StoreQuery.Executor
If this is not a projection but the candidate results are placed into a result class with an alias, return that alias.

Specified by:
getAlias in interface StoreQuery.Executor
Overrides:
getAlias in class AbstractStoreQuery.AbstractExecutor

getProjectionAliases

public final String[] getProjectionAliases(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return the alias for each projection element, or empty array if not a projection.

Specified by:
getProjectionAliases in interface StoreQuery.Executor
Overrides:
getProjectionAliases in class AbstractStoreQuery.AbstractExecutor

getProjectionTypes

public Class<?>[] getProjectionTypes(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return the expected types of the projections used by this query, or an empty array if not a projection.

Specified by:
getProjectionTypes in interface StoreQuery.Executor
Overrides:
getProjectionTypes in class AbstractStoreQuery.AbstractExecutor

getOperation

public final int getOperation(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Returns the operation this executor is meant to execute.

Specified by:
getOperation in interface StoreQuery.Executor
Overrides:
getOperation in class AbstractStoreQuery.AbstractExecutor
See Also:
QueryOperations

isAggregate

public final boolean isAggregate(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return true if the compiled query is an aggregate.

Specified by:
isAggregate in interface StoreQuery.Executor
Overrides:
isAggregate in class AbstractStoreQuery.AbstractExecutor

isDistinct

public final boolean isDistinct(StoreQuery q)
Specified by:
isDistinct in interface StoreQuery.Executor
Overrides:
isDistinct in class AbstractStoreQuery.AbstractExecutor

hasGrouping

public final boolean hasGrouping(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Whether the compiled query has grouping.

Specified by:
hasGrouping in interface StoreQuery.Executor
Overrides:
hasGrouping in class AbstractStoreQuery.AbstractExecutor

getOrderedParameterTypes

public final OrderedMap<Object,Class<?>> getOrderedParameterTypes(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return a map of parameter names to types. The returned Map.entrySet()'s Iterator must return values in the order in which they were declared or used.

Specified by:
getOrderedParameterTypes in interface StoreQuery.Executor
Overrides:
getOrderedParameterTypes in class AbstractStoreQuery.AbstractExecutor

toParameterArray

public Object[] toParameterArray(StoreQuery q,
                                 Map<?,?> userParams)
Creates a Object[] from the values of the given user parameters.

Specified by:
toParameterArray in interface StoreQuery.Executor
Returns:
array with parameter values ordered in the same way as this receiver's executeXXX() method expects.

getUpdates

public final Map getUpdates(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return a map of FieldMetaData to update Constants, in cases where this query is for a bulk update.

Specified by:
getUpdates in interface StoreQuery.Executor
Overrides:
getUpdates in class AbstractStoreQuery.AbstractExecutor

getAccessPathMetaDatas

public final ClassMetaData[] getAccessPathMetaDatas(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return an array of all persistent classes used in this query, or empty array if unknown.

Specified by:
getAccessPathMetaDatas in interface StoreQuery.Executor
Overrides:
getAccessPathMetaDatas in class AbstractStoreQuery.AbstractExecutor

isPacking

public boolean isPacking(StoreQuery q)
Description copied from interface: StoreQuery.Executor
Return true if this executor packs projections into the result class itself. Executors for query languages that allow projections without result clauses must return true and perform the result packing themselves.

Specified by:
isPacking in interface StoreQuery.Executor
Overrides:
isPacking in class AbstractStoreQuery.AbstractExecutor


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.