SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.query
Class QueryImpl

java.lang.Object
  |
  +--com.solarmetric.rd.kodo.query.QueryImpl
All Implemented Interfaces:
javax.jdo.Query, com.solarmetric.rd.kodo.query.Resolver, java.io.Serializable
Direct Known Subclasses:
JDBCQuery

public abstract class QueryImpl
extends java.lang.Object
implements javax.jdo.Query, com.solarmetric.rd.kodo.query.Resolver

Abstract implementation of the Query interface.

See Also:
Serialized Form

Constructor Summary
QueryImpl(com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm)
          Construct a query managed by the given persistence manager.
QueryImpl(com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm, java.lang.Object copy)
          Construct a query managed by the given persistence manager, copying the candidate class, filter, parameters, variables, ordering, and options from the given query.
 
Method Summary
 java.lang.Class classForName(java.lang.String name)
          Resolve the type represented by the given class name.
 void close(java.lang.Object queryResult)
          Close the given query result.
 void closeAll()
          Close all query results.
 void compile()
           
 void declareImports(java.lang.String imports)
           
 void declareParameters(java.lang.String parameters)
           
 void declareVariables(java.lang.String variables)
           
 java.lang.Object execute()
           
 java.lang.Object execute(java.lang.Object p1)
           
 java.lang.Object execute(java.lang.Object p1, java.lang.Object p2)
           
 java.lang.Object execute(java.lang.Object p1, java.lang.Object p2, java.lang.Object p3)
           
protected abstract  com.solarmetric.rd.rop.ResultList executeQuery(com.solarmetric.rd.kodo.meta.ClassMetaData type, boolean subclasses, com.solarmetric.rd.kodo.query.ExpressionFactory factory, com.solarmetric.rd.kodo.query.Expression exp, java.util.Map params)
          Execute the given expression against the given candidate extent.
 java.lang.Object executeWithArray(java.lang.Object[] params)
           
 java.lang.Object executeWithMap(java.util.Map params)
           
protected  java.util.Collection getCandidateCollection()
          Make the candidate collection available to subclasses.
protected  javax.jdo.Extent getCandidateExtent()
          Make the candidate extent available to subclasses.
protected abstract  com.solarmetric.rd.kodo.query.ExpressionFactory getExpressionFactory(com.solarmetric.rd.kodo.meta.ClassMetaData type)
          Return an ExpressionFactory to use to create an expression to be executed against an extent.
 int getFetchBatchSize()
          Return the fetch batch size for large result set support on this query; defaults to the com.solarmetric.kodo.FetchBatchSize setting.
 int getFetchThreshold()
          Return the fetch threshold for large result set support on this query; defaults to the com.solarmetric.kodo.FetchThreshold setting.
 com.solarmetric.rd.kodo.query.FilterListener getFilterListener(java.lang.String tag)
          Return the filter listener for the given tag, or null if none.
 boolean getIgnoreCache()
           
 java.lang.Class getParameterClass(java.lang.String name)
          Return the type of the given parameter, or null if the name does not represent a variable declared in this Query.
 javax.jdo.PersistenceManager getPersistenceManager()
           
 boolean getSortDirection(int orderingIndex)
          Resolves the direction of the sort for the ordering declaration at the given index.
protected abstract  com.solarmetric.rd.kodo.query.FilterListener getStandardFilterListener(java.lang.String tag)
          Return the standard filter extension for the given tag, or null if none.
 java.lang.Class getVariableClass(java.lang.String name)
          Return the type of the given variable, or null if the name does not represent a variable declared in this Query.
 boolean isParameter(java.lang.String name)
          Return true if the given name represents a declared parameter.
 boolean isVariable(java.lang.String name)
          Return true if the given name represents a declared variable.
protected  void lock()
          Synchronizes on an internal lock if the Multithreaded flat is set in the persistence manager.
 void registerListener(com.solarmetric.rd.kodo.query.FilterListener listener)
          Register a filter listener for this particular query.
 void setCandidates(java.util.Collection candidateCollection)
           
 void setCandidates(javax.jdo.Extent candidateExtent)
           
 void setClass(java.lang.Class candidateClass)
           
 void setFetchBatchSize(int fetchBatchSize)
          Set the fetch batch size for large result set support on this query; defaults to the com.solarmetric.kodo.FetchBatchSize setting.
 void setFetchThreshold(int fetchThreshold)
          Set the fetch threshold for large result set support on this query; defaults to the com.solarmetric.kodo.FetchThreshold setting.
 void setFilter(java.lang.String filter)
           
 void setIgnoreCache(boolean flag)
           
 void setOrdering(java.lang.String ordering)
           
 java.lang.String toString()
           
protected  void unlock()
          Releases the internal lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryImpl

public QueryImpl(com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm)
Construct a query managed by the given persistence manager.


QueryImpl

public QueryImpl(com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm,
                 java.lang.Object copy)
Construct a query managed by the given persistence manager, copying the candidate class, filter, parameters, variables, ordering, and options from the given query. If not null, the given query must also be a QueryImpl instance.

Method Detail

getFetchThreshold

public int getFetchThreshold()
Return the fetch threshold for large result set support on this query; defaults to the com.solarmetric.kodo.FetchThreshold setting.


setFetchThreshold

public void setFetchThreshold(int fetchThreshold)
Set the fetch threshold for large result set support on this query; defaults to the com.solarmetric.kodo.FetchThreshold setting.


getFetchBatchSize

public int getFetchBatchSize()
Return the fetch batch size for large result set support on this query; defaults to the com.solarmetric.kodo.FetchBatchSize setting. Note that this property will be ignored for in-memory queries, and possibly under some data stores.


setFetchBatchSize

public void setFetchBatchSize(int fetchBatchSize)
Set the fetch batch size for large result set support on this query; defaults to the com.solarmetric.kodo.FetchBatchSize setting. Note that this property will be ignored for in-memory queries, and possibly under some data stores.


getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()
Specified by:
getPersistenceManager in interface javax.jdo.Query

setClass

public void setClass(java.lang.Class candidateClass)
Specified by:
setClass in interface javax.jdo.Query

setCandidates

public void setCandidates(java.util.Collection candidateCollection)
Specified by:
setCandidates in interface javax.jdo.Query

setCandidates

public void setCandidates(javax.jdo.Extent candidateExtent)
Specified by:
setCandidates in interface javax.jdo.Query

setFilter

public void setFilter(java.lang.String filter)
Specified by:
setFilter in interface javax.jdo.Query

declareImports

public void declareImports(java.lang.String imports)
Specified by:
declareImports in interface javax.jdo.Query

declareVariables

public void declareVariables(java.lang.String variables)
Specified by:
declareVariables in interface javax.jdo.Query

declareParameters

public void declareParameters(java.lang.String parameters)
Specified by:
declareParameters in interface javax.jdo.Query

setOrdering

public void setOrdering(java.lang.String ordering)
Specified by:
setOrdering in interface javax.jdo.Query

setIgnoreCache

public void setIgnoreCache(boolean flag)
Specified by:
setIgnoreCache in interface javax.jdo.Query

getIgnoreCache

public boolean getIgnoreCache()
Specified by:
getIgnoreCache in interface javax.jdo.Query

compile

public void compile()
Specified by:
compile in interface javax.jdo.Query

execute

public java.lang.Object execute()
Specified by:
execute in interface javax.jdo.Query

execute

public java.lang.Object execute(java.lang.Object p1)
Specified by:
execute in interface javax.jdo.Query

execute

public java.lang.Object execute(java.lang.Object p1,
                                java.lang.Object p2)
Specified by:
execute in interface javax.jdo.Query

execute

public java.lang.Object execute(java.lang.Object p1,
                                java.lang.Object p2,
                                java.lang.Object p3)
Specified by:
execute in interface javax.jdo.Query

executeWithArray

public java.lang.Object executeWithArray(java.lang.Object[] params)
Specified by:
executeWithArray in interface javax.jdo.Query

executeWithMap

public java.lang.Object executeWithMap(java.util.Map params)
Specified by:
executeWithMap in interface javax.jdo.Query

closeAll

public void closeAll()
Close all query results.

Specified by:
closeAll in interface javax.jdo.Query

close

public void close(java.lang.Object queryResult)
Close the given query result.

Specified by:
close in interface javax.jdo.Query

registerListener

public void registerListener(com.solarmetric.rd.kodo.query.FilterListener listener)
Register a filter listener for this particular query.


executeQuery

protected abstract com.solarmetric.rd.rop.ResultList executeQuery(com.solarmetric.rd.kodo.meta.ClassMetaData type,
                                                                  boolean subclasses,
                                                                  com.solarmetric.rd.kodo.query.ExpressionFactory factory,
                                                                  com.solarmetric.rd.kodo.query.Expression exp,
                                                                  java.util.Map params)
Execute the given expression against the given candidate extent.

Parameters:
type - the base type the query should match
subclasses - true if subclasses should be included in the results
factory - the expression factory used to compile the expression
exp - the compiled expression for the parsed query
params - map of parameter names to values
Returns:
a list of matching objects

getExpressionFactory

protected abstract com.solarmetric.rd.kodo.query.ExpressionFactory getExpressionFactory(com.solarmetric.rd.kodo.meta.ClassMetaData type)
Return an ExpressionFactory to use to create an expression to be executed against an extent. Each factory will be used to compile one filter only.


getStandardFilterListener

protected abstract com.solarmetric.rd.kodo.query.FilterListener getStandardFilterListener(java.lang.String tag)
Return the standard filter extension for the given tag, or null if none. This method is called only after checking the listeners that have been added to this particular query and the user-defined listeners in the com.solarmetric.kodo.conf.JDOConfiguration.


getSortDirection

public boolean getSortDirection(int orderingIndex)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Resolves the direction of the sort for the ordering declaration at the given index. Returns true if ascending, false otherwise.

Specified by:
getSortDirection in interface com.solarmetric.rd.kodo.query.Resolver

isParameter

public boolean isParameter(java.lang.String name)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Return true if the given name represents a declared parameter.

Specified by:
isParameter in interface com.solarmetric.rd.kodo.query.Resolver

isVariable

public boolean isVariable(java.lang.String name)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Return true if the given name represents a declared variable.

Specified by:
isVariable in interface com.solarmetric.rd.kodo.query.Resolver

getParameterClass

public java.lang.Class getParameterClass(java.lang.String name)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Return the type of the given parameter, or null if the name does not represent a variable declared in this Query.

Specified by:
getParameterClass in interface com.solarmetric.rd.kodo.query.Resolver

getVariableClass

public java.lang.Class getVariableClass(java.lang.String name)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Return the type of the given variable, or null if the name does not represent a variable declared in this Query.

Specified by:
getVariableClass in interface com.solarmetric.rd.kodo.query.Resolver

classForName

public java.lang.Class classForName(java.lang.String name)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Resolve the type represented by the given class name. This will test the type against the namespace of the Query and the declared imports, and will properly handle primitives and java.lang types as well. Returns null if the name does not match a known type.

Specified by:
classForName in interface com.solarmetric.rd.kodo.query.Resolver

getFilterListener

public com.solarmetric.rd.kodo.query.FilterListener getFilterListener(java.lang.String tag)
Description copied from interface: com.solarmetric.rd.kodo.query.Resolver
Return the filter listener for the given tag, or null if none.

Specified by:
getFilterListener in interface com.solarmetric.rd.kodo.query.Resolver

getCandidateExtent

protected javax.jdo.Extent getCandidateExtent()
Make the candidate extent available to subclasses.


getCandidateCollection

protected java.util.Collection getCandidateCollection()
Make the candidate collection available to subclasses.


lock

protected void lock()
Synchronizes on an internal lock if the Multithreaded flat is set in the persistence manager. Make sure to call unlock() in a finally clause of the same method.


unlock

protected void unlock()
Releases the internal lock.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.