org.neodatis.odb.core.query.execution
Class GenericQueryExecutor
- java.lang.Object
-
- org.neodatis.odb.core.query.execution.GenericQueryExecutor
-
- All Implemented Interfaces:
- IMultiClassQueryExecutor, IQueryExecutor
- Direct Known Subclasses:
- CriteriaQueryExecutor, NativeQueryExecutor, ValuesCriteriaQueryExecutor
public abstract class GenericQueryExecutor extends java.lang.Object implements IMultiClassQueryExecutor
Generic query executor. This class does all the job of iterating in the object list and call particular query matching to check if the object must be included in the query result.
If the query has index, An execution plan is calculated to optimize the execution. The query execution plan is calculated by subclasses (using abstract method getExecutionPlan).
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringLOG_ID
-
Constructor Summary
Constructors Constructor and Description GenericQueryExecutor(IQuery query, IStorageEngine engine)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description OdbComparablebuildOrderByKey(AttributeValuesMap values)OdbComparablebuildOrderByKey(NonNativeObjectInfo nnoi)OdbComparablebuildOrderByKey(java.lang.Object object)TODO very bad.abstract java.lang.ComparablecomputeIndexKey(ClassInfo ci, ClassInfoIndex index)<T> Objects<T>execute(boolean inMemory, int startIndex, int endIndex, boolean returnObjects, IMatchingObjectAction queryResultAction)The main query execution methodbooleanexecuteStartAndEndOfQueryAction()Used to indicate if the execute method must call start and end method of the queryResultAction.abstract java.lang.ObjectgetCurrentObjectMetaRepresentation()This can be a NonNAtiveObjectInf or AttributeValuesMapabstract IQueryExecutionPlangetExecutionPlan()abstract java.lang.StringgetFullClassName(IQuery query)IQuerygetQuery()IStorageEnginegetStorageEngine()abstract booleanmatchObjectWithOid(OID oid, boolean loadObjectInfo, boolean inMemory)Check if the object with oid matches the query, returns true This method must compute the next object oid and the orderBy key if it exists!abstract voidprepareQuery()voidsetClassInfo(ClassInfo classInfo)The class on which to execute the queryvoidsetExecuteStartAndEndOfQueryAction(boolean yes)
-
-
-
Field Detail
-
LOG_ID
public static final java.lang.String LOG_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GenericQueryExecutor
public GenericQueryExecutor(IQuery query, IStorageEngine engine)
-
-
Method Detail
-
getExecutionPlan
public abstract IQueryExecutionPlan getExecutionPlan()
-
prepareQuery
public abstract void prepareQuery()
-
computeIndexKey
public abstract java.lang.Comparable computeIndexKey(ClassInfo ci, ClassInfoIndex index)
-
getCurrentObjectMetaRepresentation
public abstract java.lang.Object getCurrentObjectMetaRepresentation()
This can be a NonNAtiveObjectInf or AttributeValuesMap- Returns:
-
matchObjectWithOid
public abstract boolean matchObjectWithOid(OID oid, boolean loadObjectInfo, boolean inMemory)
Check if the object with oid matches the query, returns true This method must compute the next object oid and the orderBy key if it exists!- Parameters:
oid- The object positionloadObjectInfo- To indicate if object must loaded (when the query indicator 'in memory' is false, we do not need to load object, only ids)inMemory- To indicate if object must be actually loaded to memory
-
execute
public <T> Objects<T> execute(boolean inMemory, int startIndex, int endIndex, boolean returnObjects, IMatchingObjectAction queryResultAction)
Description copied from interface:IQueryExecutorThe main query execution method- Specified by:
executein interfaceIQueryExecutor- Returns:
-
getFullClassName
public abstract java.lang.String getFullClassName(IQuery query)
- Specified by:
getFullClassNamein interfaceIQueryExecutor
-
buildOrderByKey
public OdbComparable buildOrderByKey(java.lang.Object object)
TODO very bad. Should remove the instanceof- Parameters:
object-- Returns:
-
buildOrderByKey
public OdbComparable buildOrderByKey(NonNativeObjectInfo nnoi)
-
buildOrderByKey
public OdbComparable buildOrderByKey(AttributeValuesMap values)
-
executeStartAndEndOfQueryAction
public boolean executeStartAndEndOfQueryAction()
Description copied from interface:IMultiClassQueryExecutorUsed to indicate if the execute method must call start and end method of the queryResultAction. The default is yes. For MultiClass Query executor, it is set to false to avoid to reset the result- Specified by:
executeStartAndEndOfQueryActionin interfaceIMultiClassQueryExecutor- Returns:
- true or false to indicate if start and end method of queryResultAction must be executed
-
setExecuteStartAndEndOfQueryAction
public void setExecuteStartAndEndOfQueryAction(boolean yes)
- Specified by:
setExecuteStartAndEndOfQueryActionin interfaceIMultiClassQueryExecutor
-
getStorageEngine
public IStorageEngine getStorageEngine()
- Specified by:
getStorageEnginein interfaceIMultiClassQueryExecutor
-
getQuery
public IQuery getQuery()
- Specified by:
getQueryin interfaceIMultiClassQueryExecutor
-
setClassInfo
public void setClassInfo(ClassInfo classInfo)
Description copied from interface:IMultiClassQueryExecutorThe class on which to execute the query- Specified by:
setClassInfoin interfaceIMultiClassQueryExecutor
-
-
DataMelt 3.0 © DataMelt by jWork.ORG