org.objectweb.speedo.query.lib
Class QueryResultCommon

java.lang.Object
  extended byorg.objectweb.speedo.query.lib.QueryResultCommon
Direct Known Subclasses:
QueryResultList, QueryResultUnique

public class QueryResultCommon
extends java.lang.Object

Is a common classes used for compute the query result. This implementation supports user class or persistent class as query result.

Author:
S.Chassande-Barrioz

Field Summary
protected  java.lang.Object[] conns
          The underlying connection used to evalue the query.
protected  boolean debug
           
protected  org.objectweb.util.monolog.api.Logger logger
           
protected  javax.jdo.PersistenceManager pm
          The proxy manager representing the current execution context.
protected  org.objectweb.medor.tuple.api.TupleCollection tc
          The inner medor TupleCollection
 
Constructor Summary
QueryResultCommon(org.objectweb.medor.tuple.api.TupleCollection _tc, javax.jdo.PersistenceManager _pm, java.lang.Object[] _conns, java.lang.Class _resultClazz, java.lang.Class[] _selectedFieldTypes, boolean staticFirstElementIndex, org.objectweb.util.monolog.api.Logger _logger)
          Builds a QueryResultList.
 
Method Summary
 void close()
          Close the connection to the data store.
static void closeConnection(java.lang.Object conn)
           
protected  java.lang.Object getValue(org.objectweb.medor.tuple.api.Tuple tuple)
          When the array #selectedFieldTypes contains a single element, the result of the query can or cannot be encapsulated into a user class.
protected  java.lang.Object pname2Object(org.objectweb.jorm.naming.api.PName pn)
          Fetch the persistent instance corresponding to an identifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tc

protected org.objectweb.medor.tuple.api.TupleCollection tc
The inner medor TupleCollection


conns

protected java.lang.Object[] conns
The underlying connection used to evalue the query. These connections will be closed when the result will be no more used.


pm

protected javax.jdo.PersistenceManager pm
The proxy manager representing the current execution context. The persistenceManager is used to fetch the real object from the identifier.


logger

protected org.objectweb.util.monolog.api.Logger logger

debug

protected boolean debug
Constructor Detail

QueryResultCommon

public QueryResultCommon(org.objectweb.medor.tuple.api.TupleCollection _tc,
                         javax.jdo.PersistenceManager _pm,
                         java.lang.Object[] _conns,
                         java.lang.Class _resultClazz,
                         java.lang.Class[] _selectedFieldTypes,
                         boolean staticFirstElementIndex,
                         org.objectweb.util.monolog.api.Logger _logger)
                  throws org.objectweb.medor.api.MedorException,
                         SpeedoException
Builds a QueryResultList.

Parameters:
_tc - the tuple collection representing the query result
_pm - is the peristence manager linked to the query
_conns - is the connection to the underlying support to close in same time than the query.
_resultClazz - is the class encapsulated the result
Method Detail

close

public void close()
Close the connection to the data store. The query result will be no more usable after.


closeConnection

public static void closeConnection(java.lang.Object conn)

pname2Object

protected java.lang.Object pname2Object(org.objectweb.jorm.naming.api.PName pn)
Fetch the persistent instance corresponding to an identifier

Parameters:
pn - is the persistent object identifier
Returns:
a persistent instance if it has been found, otherwise a null value.

getValue

protected java.lang.Object getValue(org.objectweb.medor.tuple.api.Tuple tuple)
                             throws org.objectweb.medor.api.MedorException
When the array #selectedFieldTypes contains a single element, the result of the query can or cannot be encapsulated into a user class. When this array contains several element and the #resultClass field is not definied, the

Parameters:
tuple - contains the result
Returns:
the query result
Throws:
org.objectweb.medor.api.MedorException