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/accesslayer MtoNCollectionPrefetcher.java BasePrefetcher.java CollectionPrefetcher.java
Date Thu, 15 Jan 2004 20:58:47 GMT
brj         2004/01/15 12:58:47

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        MtoNCollectionPrefetcher.java BasePrefetcher.java
                        CollectionPrefetcher.java
  Log:
  cleaned up prefetchRelationship (collectionClass not relevant)
  
  Revision  Changes    Path
  1.2       +12 -18    db-ojb/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
  
  Index: MtoNCollectionPrefetcher.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MtoNCollectionPrefetcher.java	22 Dec 2003 15:34:54 -0000	1.1
  +++ MtoNCollectionPrefetcher.java	15 Jan 2004 20:58:46 -0000	1.2
  @@ -101,35 +101,29 @@
       public void prefetchRelationship(Collection owners)
       {
           Query queries[];
  -        Query mToNQueries[];
  +        Query mnQueries[];
           Collection children = new ArrayList();
  -        Collection mToNImplementors = new ArrayList();
  -        Class collectionClass = getCollectionClass();
  +        Collection mnImplementors = new ArrayList();
   
           queries = buildPrefetchQueries(owners, children);
  -        mToNQueries = buildMtoNImplementorQueries(owners, children);
  +        mnQueries = buildMtoNImplementorQueries(owners, children);
   
           for (int i = 0; i < queries.length; i++)
           {
  -            Collection newChildren;
  -
  -            if (collectionClass != null)
  -            {
  -                newChildren = (Collection) getBroker().getCollectionByQuery(collectionClass,
queries[i]);
  -            }
  -            else
  +            Iterator iter = getBroker().getIteratorByQuery(queries[i]);
  +            while (iter.hasNext())
               {
  -                newChildren = getBroker().getCollectionByQuery(queries[i]);
  +                children.add(iter.next());
               }
  -            children.addAll(newChildren);
               
  -            Iterator iter = getBroker().getReportQueryIteratorByQuery(mToNQueries[i]);
  -            while (iter.hasNext())
  +            Iterator mnIter = getBroker().getReportQueryIteratorByQuery(mnQueries[i]);
  +            while (mnIter.hasNext())
               {
  -                mToNImplementors.add(iter.next());
  +                mnImplementors.add(mnIter.next());
               }
           }
  -        associateBatched(owners, children, mToNImplementors);
  +        
  +        associateBatched(owners, children, mnImplementors);
       }
       
       /**
  
  
  
  1.5       +6 -23     db-ojb/src/java/org/apache/ojb/broker/accesslayer/BasePrefetcher.java
  
  Index: BasePrefetcher.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/BasePrefetcher.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BasePrefetcher.java	12 Jan 2004 19:41:19 -0000	1.4
  +++ BasePrefetcher.java	15 Jan 2004 20:58:46 -0000	1.5
  @@ -58,9 +58,7 @@
   import java.util.Collection;
   import java.util.Iterator;
   
  -
   import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.ManageableCollection;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.core.PersistenceBrokerConfiguration;
  @@ -137,32 +135,22 @@
       {
           Query queries[];
           Collection children = new ArrayList();
  -        Class collectionClass = getCollectionClass();
   
           queries = buildPrefetchQueries(owners, children);
   
           for (int i = 0; i < queries.length; i++)
           {
  -            if (collectionClass != null)
  +            Iterator iter = getBroker().getIteratorByQuery(queries[i]);
  +            while (iter.hasNext())
               {
  -                ManageableCollection newChildren = broker.getCollectionByQuery(collectionClass,
queries[i]);
  -                Iterator iter = newChildren.ojbIterator();
  -                
  -                while (iter.hasNext())
  -                {
  -                    children.add(iter.next()); 
  -                }
  +                children.add(iter.next());
               }
  -            else
  -            {
  -                Collection newChildren = broker.getCollectionByQuery(queries[i]);
  -                children.addAll(newChildren);
  -            }           
           }
  -        
  +
           associateBatched(owners, children);
       }
   
  +    
       protected QueryByCriteria buildPrefetchQuery(Collection ids, FieldDescriptor[] fields)
       {
           return buildPrefetchQuery(getItemClassDescriptor().getClassOfObject(), ids, fields);
  @@ -305,10 +293,5 @@
       protected Logger getLogger()
       {
           return logger;
  -    }
  -
  -    protected Class getCollectionClass()
  -    {
  -        return null;
       }
   }
  
  
  
  1.22      +1 -6      db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
  
  Index: CollectionPrefetcher.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- CollectionPrefetcher.java	22 Dec 2003 15:34:54 -0000	1.21
  +++ CollectionPrefetcher.java	15 Jan 2004 20:58:46 -0000	1.22
  @@ -262,9 +262,4 @@
       {
           return (CollectionDescriptor) getObjectReferenceDescriptor();
       }
  -
  -    protected Class getCollectionClass()
  -    {
  -        return getCollectionDescriptor().getCollectionClass();
  -    }
   }
  
  
  

---------------------------------------------------------------------
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