db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core QueryReferenceBroker.java
Date Thu, 01 Apr 2004 09:43:08 GMT
brj         2004/04/01 01:43:08

  Modified:    src/java/org/apache/ojb/broker/core
                        QueryReferenceBroker.java
  Log:
  re-enable deprecated Query#fullSize
  
  Revision  Changes    Path
  1.11      +28 -1     db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
  
  Index: QueryReferenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- QueryReferenceBroker.java	11 Mar 2004 18:16:10 -0000	1.10
  +++ QueryReferenceBroker.java	1 Apr 2004 09:43:08 -0000	1.11
  @@ -32,6 +32,7 @@
   import org.apache.ojb.broker.accesslayer.IndirectionHandler;
   import org.apache.ojb.broker.accesslayer.MaterializationListener;
   import org.apache.ojb.broker.accesslayer.OJBIterator;
  +import org.apache.ojb.broker.accesslayer.PagingIterator;
   import org.apache.ojb.broker.accesslayer.PlainPrefetcher;
   import org.apache.ojb.broker.accesslayer.RelationshipPrefetcher;
   import org.apache.ojb.broker.accesslayer.RelationshipPrefetcherFactory;
  @@ -91,6 +92,9 @@
           ManageableCollection result = null;
           OJBIterator iter = null;
           boolean isRetrievalTasksCreated = (batchRetrieval && (m_retrievalTasks
== null));
  +        int fullSize = -1;
  +        int size = 0;
  +        
           if (isRetrievalTasksCreated)
           {
               // Maps ReferenceDescriptors to HashSets of owners
  @@ -102,9 +106,18 @@
               result = (ManageableCollection) collectionClass.newInstance();
               // now iterate over all elements and add them to the new collection
               iter = pb.getIteratorFromQuery(query, cld);
  +
  +            // BRJ : get fullSizefor Query
  +            // to be removed when Query.fullSize is removed
  +            if (iter instanceof PagingIterator)
  +            {
  +                fullSize = iter.fullSize();           
  +            }
  +
               while (iter.hasNext())
               {
                   Object candidate = iter.next();
  +                 
                   /**
                    * MBAIRD
                    * candidate CAN be null in the case of materializing from an iterator
based
  @@ -119,6 +132,10 @@
                               || itemClass.isAssignableFrom(candidate.getClass()))
                       {
                           result.ojbAdd(candidate);
  +                        
  +                        // BRJ: count added objects
  +                        // to be removed when Query.fullSize is removed
  +                        size++;
                       }
                       else
                       {
  @@ -138,6 +155,7 @@
                   }
               }
   
  +            
               if (isRetrievalTasksCreated)
               {
                   // turn off auto prefetching for related proxies
  @@ -168,6 +186,15 @@
                   m_retrievalTasks = null;
               }
           }
  +        
  +        // BRJ: store fullSize in Query to re-enable deprecated functionality
  +        // to be removed when Query.fullSize is removed
  +        if (fullSize < 0)
  +        {
  +            fullSize = size;	// use size of result
  +        }
  +        query.fullSize(fullSize);
  +        
           return result;
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message