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 BasePrefetcher.java MtoNCollectionPrefetcher.java CollectionPrefetcher.java
Date Thu, 15 Jan 2004 21:01:54 GMT
brj         2004/01/15 13:01:54

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_BRANCH_1_0 BasePrefetcher.java
                        MtoNCollectionPrefetcher.java
                        CollectionPrefetcher.java
  Log:
  cleaned up prefetchRelationship (collectionClass not relevant)
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.2   +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.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- BasePrefetcher.java	12 Jan 2004 19:43:57 -0000	1.3.2.1
  +++ BasePrefetcher.java	15 Jan 2004 21:01:54 -0000	1.3.2.2
  @@ -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.1.2.3   +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.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- MtoNCollectionPrefetcher.java	7 Jan 2004 14:13:22 -0000	1.1.2.2
  +++ MtoNCollectionPrefetcher.java	15 Jan 2004 21:01:54 -0000	1.1.2.3
  @@ -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.20.2.3  +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.20.2.2
  retrieving revision 1.20.2.3
  diff -u -r1.20.2.2 -r1.20.2.3
  --- CollectionPrefetcher.java	7 Jan 2004 13:02:04 -0000	1.20.2.2
  +++ CollectionPrefetcher.java	15 Jan 2004 21:01:54 -0000	1.20.2.3
  @@ -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