org.objectweb.speedo.query.lib
Class QueryDefinitionImpl

java.lang.Object
  extended byorg.objectweb.speedo.query.lib.QueryDefinitionImpl
All Implemented Interfaces:
QueryDefinition
Direct Known Subclasses:
SpeedoQuery

public class QueryDefinitionImpl
extends java.lang.Object
implements QueryDefinition

is a basic implementation of the QueryDefinition interface.

Author:
S.Chassande-Barrioz

Field Summary
protected  java.lang.Class candidateClass
          Class of candadate classes.
protected  java.util.Collection candidateInstances
          Candidate classes or extent for the query.
protected  javax.jdo.Extent extentClass
           
protected  java.lang.String filter
          Query filter.
protected  java.lang.String grouping
           
protected  boolean ignoreCache
          IgnoreCache option.
protected  java.util.List importStatements
          the import statements is transformed into a simple vector
protected  long indexFirst
           
protected  long indexLast
           
protected  java.util.List order
           
protected  java.lang.String parameters
          Query parameters and variables declaration
protected  java.lang.String result
           
protected  java.lang.Class resultClass
           
protected  boolean unique
           
protected  java.lang.String variables
           
protected  boolean withPrefetch
           
 
Constructor Summary
QueryDefinitionImpl()
           
QueryDefinitionImpl(QueryDefinition qd)
           
 
Method Summary
 void defineWith(QueryDefinition qd)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Class getCandidateClass()
           
 java.util.Collection getCollection()
           
 javax.jdo.Extent getExtent()
           
 java.lang.String getFilter()
           
 java.lang.String getGrouping()
          List of grouped fields
 java.util.List getImportStatements()
           
 boolean getIncludeSubClasses()
          indicates if subclasses must be returned too
 long getIndexFirst()
          The application may want to skip some number of results that may have been previously returned, and additionally may want to limit the number of instances returned from a query.
 long getIndexLast()
          The application may want to skip some number of results that may have been previously returned, and additionally may want to limit the number of instances returned from a query.
 java.util.List getOrder()
           
 java.lang.String getParameters()
           
 java.lang.String getResult()
          The application wmight want to get results from a query that are not instance of the candidate class.
 java.lang.Class getResultClass()
          The application may have a user-defined class that best represents the results of a query.
 boolean getUnique()
          If the application knows that there can be exactly zero or one instance returned from a query, the result of the query is most conveniently returned as an instance (possibily null) instead of a Collection.
 java.lang.String getVariables()
           
 int hashCode()
           
 boolean isCollection()
           
 boolean isIgnoreCache()
           
 java.lang.String qdToString(boolean oneLine)
           
 java.lang.String toString()
           
 boolean withPrefetch()
           
 void withPrefetch(boolean withPrefetch)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ignoreCache

protected boolean ignoreCache
IgnoreCache option. The ignoreCache option setting specifies whether the query should execute entirely in the back end, instead of in the cache. If this flag is set to true, an implementation might be able to optimize the query execution by ignoring changed values in the cache. For optimistic transactions, this can dramatically improve query response times.


candidateInstances

protected java.util.Collection candidateInstances
Candidate classes or extent for the query.


extentClass

protected javax.jdo.Extent extentClass

candidateClass

protected java.lang.Class candidateClass
Class of candadate classes.


filter

protected java.lang.String filter
Query filter.


parameters

protected java.lang.String parameters
Query parameters and variables declaration


variables

protected java.lang.String variables

importStatements

protected java.util.List importStatements
the import statements is transformed into a simple vector


order

protected java.util.List order

indexFirst

protected transient long indexFirst

indexLast

protected transient long indexLast

unique

protected boolean unique

result

protected java.lang.String result

resultClass

protected java.lang.Class resultClass

withPrefetch

protected boolean withPrefetch

grouping

protected java.lang.String grouping
Constructor Detail

QueryDefinitionImpl

public QueryDefinitionImpl()

QueryDefinitionImpl

public QueryDefinitionImpl(QueryDefinition qd)
Method Detail

defineWith

public void defineWith(QueryDefinition qd)

getCandidateClass

public java.lang.Class getCandidateClass()
Specified by:
getCandidateClass in interface QueryDefinition

isCollection

public boolean isCollection()
Specified by:
isCollection in interface QueryDefinition

getCollection

public java.util.Collection getCollection()
Specified by:
getCollection in interface QueryDefinition

getParameters

public java.lang.String getParameters()
Specified by:
getParameters in interface QueryDefinition

getVariables

public java.lang.String getVariables()
Specified by:
getVariables in interface QueryDefinition

getFilter

public java.lang.String getFilter()
Specified by:
getFilter in interface QueryDefinition

getExtent

public javax.jdo.Extent getExtent()
Specified by:
getExtent in interface QueryDefinition

getImportStatements

public java.util.List getImportStatements()
Specified by:
getImportStatements in interface QueryDefinition

isIgnoreCache

public boolean isIgnoreCache()
Specified by:
isIgnoreCache in interface QueryDefinition

getOrder

public java.util.List getOrder()
Specified by:
getOrder in interface QueryDefinition

getIndexFirst

public long getIndexFirst()
Description copied from interface: QueryDefinition
The application may want to skip some number of results that may have been previously returned, and additionally may want to limit the number of instances returned from a query. The default range for query execution if this method is not called are (0, Long.MAX_VALUE).

Specified by:
getIndexFirst in interface QueryDefinition

getIndexLast

public long getIndexLast()
Description copied from interface: QueryDefinition
The application may want to skip some number of results that may have been previously returned, and additionally may want to limit the number of instances returned from a query. The default range for query execution if this method is not called are (0, Long.MAX_VALUE).

Specified by:
getIndexLast in interface QueryDefinition

getUnique

public boolean getUnique()
Description copied from interface: QueryDefinition
If the application knows that there can be exactly zero or one instance returned from a query, the result of the query is most conveniently returned as an instance (possibily null) instead of a Collection.

Specified by:
getUnique in interface QueryDefinition

getResult

public java.lang.String getResult()
Description copied from interface: QueryDefinition
The application wmight want to get results from a query that are not instance of the candidate class. The results might be fields of persistent instances, instances of classes other than the candidate class, or aggregates of fields.

Specified by:
getResult in interface QueryDefinition

getResultClass

public java.lang.Class getResultClass()
Description copied from interface: QueryDefinition
The application may have a user-defined class that best represents the results of a query. In this case, the application can specify that instances of this class should be returned.

Specified by:
getResultClass in interface QueryDefinition

getIncludeSubClasses

public boolean getIncludeSubClasses()
Description copied from interface: QueryDefinition
indicates if subclasses must be returned too

Specified by:
getIncludeSubClasses in interface QueryDefinition

getGrouping

public java.lang.String getGrouping()
Description copied from interface: QueryDefinition
List of grouped fields

Specified by:
getGrouping in interface QueryDefinition

withPrefetch

public boolean withPrefetch()
Specified by:
withPrefetch in interface QueryDefinition

withPrefetch

public void withPrefetch(boolean withPrefetch)
Specified by:
withPrefetch in interface QueryDefinition

toString

public java.lang.String toString()

qdToString

public java.lang.String qdToString(boolean oneLine)
Specified by:
qdToString in interface QueryDefinition

hashCode

public int hashCode()
Specified by:
hashCode in interface QueryDefinition

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface QueryDefinition