Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.access.util
Class SelectObserver  view SelectObserver download SelectObserver.java

java.lang.Object
  extended byorg.objectstyle.cayenne.access.util.DefaultOperationObserver
      extended byorg.objectstyle.cayenne.access.util.SelectObserver
All Implemented Interfaces:
org.objectstyle.cayenne.access.OperationHints, org.objectstyle.cayenne.access.OperationObserver
Direct Known Subclasses:
ContextSelectObserver

public class SelectObserver
extends DefaultOperationObserver

OperationObserver that accumulates select query results provided by callback methods. Later the results can be retrieved via different getResults methods.

This class can serve as a helper for classes that work with DataNode directly, bypassing DataContext. Also it is used by DataContext to implement "data rows" functionality - retrieving data without instantiating and registering DataObjects.

If exceptions happen during the execution, they are immediately rethrown.

For more information see Cayenne User Guide.


Field Summary
protected  java.util.Map results
           
protected  int selectCount
           
 
Fields inherited from class org.objectstyle.cayenne.access.util.DefaultOperationObserver
DEFAULT_LOG_LEVEL, globalExceptions, loggingLevel, queryExceptions, transactionCommitted, transactionRolledback
 
Constructor Summary
SelectObserver()
           
SelectObserver(org.apache.log4j.Level logLevel)
           
 
Method Summary
 void clear()
          Clears fetched objects stored in an internal list.
 java.util.Map getResults()
          Returns query results accumulated during query execution with this object as an operation observer.
 java.util.List getResults(org.objectstyle.cayenne.query.Query q)
          Returns a list of result snapshots for the specified query, or null if this query has never produced any results.
 int getSelectCount()
          Returns a count of select queries that returned results since the last time "clear" was called, or since this object was created.
 void nextDataRows(org.objectstyle.cayenne.query.Query query, java.util.List dataRows)
          Stores all objects in dataRows in an internal result list.
 void nextGlobalException(java.lang.Exception ex)
          Overrides superclass implementation to rethrow an exception immediately.
 void nextQueryException(org.objectstyle.cayenne.query.Query query, java.lang.Exception ex)
          Overrides superclass implementation to rethrow an exception immediately.
 
Methods inherited from class org.objectstyle.cayenne.access.util.DefaultOperationObserver
getGlobalExceptions, getLoggingLevel, getQueryExceptions, hasExceptions, isIteratedResult, isTransactionCommitted, isTransactionRolledback, nextBatchCount, nextCount, nextDataRows, printExceptions, setLoggingLevel, transactionCommitted, transactionRolledback, useAutoCommit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

results

protected java.util.Map results

selectCount

protected int selectCount
Constructor Detail

SelectObserver

public SelectObserver()

SelectObserver

public SelectObserver(org.apache.log4j.Level logLevel)
Method Detail

getSelectCount

public int getSelectCount()
Returns a count of select queries that returned results since the last time "clear" was called, or since this object was created.


getResults

public java.util.List getResults(org.objectstyle.cayenne.query.Query q)
Returns a list of result snapshots for the specified query, or null if this query has never produced any results.


getResults

public java.util.Map getResults()
Returns query results accumulated during query execution with this object as an operation observer.


clear

public void clear()
Clears fetched objects stored in an internal list.


nextDataRows

public void nextDataRows(org.objectstyle.cayenne.query.Query query,
                         java.util.List dataRows)
Stores all objects in dataRows in an internal result list.

Specified by:
nextDataRows in interface org.objectstyle.cayenne.access.OperationObserver
Overrides:
nextDataRows in class DefaultOperationObserver

nextQueryException

public void nextQueryException(org.objectstyle.cayenne.query.Query query,
                               java.lang.Exception ex)
Overrides superclass implementation to rethrow an exception immediately.

Specified by:
nextQueryException in interface org.objectstyle.cayenne.access.OperationObserver
Overrides:
nextQueryException in class DefaultOperationObserver

nextGlobalException

public void nextGlobalException(java.lang.Exception ex)
Overrides superclass implementation to rethrow an exception immediately.

Specified by:
nextGlobalException in interface org.objectstyle.cayenne.access.OperationObserver
Overrides:
nextGlobalException in class DefaultOperationObserver