db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core QueryReferenceBroker.java
Date Fri, 25 Nov 2005 16:27:51 GMT
arminw      2005/11/25 08:27:50

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE CollectionPrefetcher.java
                        MtoNCollectionPrefetcher.java PkEnumeration.java
                        PlainPrefetcher.java ReferencePrefetcher.java
                        RsIterator.java
               src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        QueryReferenceBroker.java
  Log:
  use IdentityFactory to create Identity instances
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.29.2.4  +2 -2      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.29.2.3
  retrieving revision 1.29.2.4
  diff -u -r1.29.2.3 -r1.29.2.4
  --- CollectionPrefetcher.java	11 Apr 2005 18:39:02 -0000	1.29.2.3
  +++ CollectionPrefetcher.java	25 Nov 2005 16:27:50 -0000	1.29.2.4
  @@ -85,7 +85,7 @@
           {
               owner = iter.next();
               fkValues = helper.extractValueArray(helper.getKeyValues(cld, owner));
  -            id = new Identity(null, topLevelClass, fkValues);
  +            id = getBroker().serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
               idsSubset.add(id);
               if (idsSubset.size() == pkLimit)
               {
  
  
  
  1.12.2.6  +13 -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.12.2.5
  retrieving revision 1.12.2.6
  diff -u -r1.12.2.5 -r1.12.2.6
  --- MtoNCollectionPrefetcher.java	26 Oct 2005 19:35:35 -0000	1.12.2.5
  +++ MtoNCollectionPrefetcher.java	25 Nov 2005 16:27:50 -0000	1.12.2.6
  @@ -39,7 +39,6 @@
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByMtoNCriteria;
   import org.apache.ojb.broker.query.ReportQueryByMtoNCriteria;
  -import org.apache.ojb.broker.util.BrokerHelper;
   
   /**
    * Relationship Prefetcher for MtoN-Collections.
  @@ -133,7 +132,6 @@
       /**
        * Build a query to read the mn-implementors
        * @param ids
  -     * @return
        */
       protected Query buildMtoNImplementorQuery(Collection ids)
       {
  @@ -181,7 +179,6 @@
   
       /**
        * prefix the this class fk columns with the indirection table
  -     * @return
        */
       private String[] getFksToThisClass()
       {
  @@ -199,7 +196,6 @@
   
       /**
        * prefix the item class fk columns with the indirection table
  -     * @return
        */
       private String[] getFksToItemClass()
       {
  @@ -223,11 +219,12 @@
       protected Query[] buildMtoNImplementorQueries(Collection owners, Collection children)
       {
           ClassDescriptor cld = getOwnerClassDescriptor();
  -        Class topLevelClass = getBroker().getTopLevelClass(cld.getClassOfObject());
  -        BrokerHelper helper = getBroker().serviceBrokerHelper();
  +        PersistenceBroker pb = getBroker();
  +        //Class topLevelClass = pb.getTopLevelClass(cld.getClassOfObject());
  +        //BrokerHelper helper = pb.serviceBrokerHelper();
           Collection queries = new ArrayList(owners.size());
           Collection idsSubset = new HashSet(owners.size());
  -        Object[] fkValues;
  +        //Object[] fkValues;
           Object owner;
           Identity id;
   
  @@ -235,8 +232,7 @@
           while (iter.hasNext())
           {
               owner = iter.next();
  -            fkValues = helper.extractValueArray(helper.getKeyValues(cld, owner));
  -            id = new Identity(null, topLevelClass, fkValues);
  +            id = pb.serviceIdentity().buildIdentity(cld, owner);
               idsSubset.add(id);
               if (idsSubset.size() == pkLimit)
               {
  @@ -260,7 +256,6 @@
        * @param fkCols indirection table fks to this class
        * @param itemFkCols indirection table fks to item class
        * @param itemPkFields
  -     * @return
        */
       private Criteria buildPrefetchCriteria(Collection ids, String[] fkCols, String[] itemFkCols,
               FieldDescriptor[] itemPkFields)
  @@ -387,7 +382,6 @@
        * Convert the Values using the FieldConversion.sqlToJava
        * @param fcs
        * @param values
  -     * @return
        */
       private Object[] convert(FieldConversion[] fcs, Object[] values)
       {
  @@ -431,14 +425,16 @@
           for (Iterator it = owners.iterator(); it.hasNext();)
           {
               Object owner = it.next();
  -            ownerIdsToLists.put(new Identity(owner, pb), new ArrayList());
  +            Identity oid = pb.serviceIdentity().buildIdentity(owner);
  +            ownerIdsToLists.put(oid, new ArrayList());
           }
   
           // build the children map
           for (Iterator it = children.iterator(); it.hasNext();)
           {
               Object child = it.next();
  -            childMap.put(new Identity(child, pb), child);
  +            Identity oid = pb.serviceIdentity().buildIdentity(child);
  +            childMap.put(oid, child);
           }
   
           int ownerPkLen = getOwnerClassDescriptor().getPkFields().length;
  @@ -457,8 +453,8 @@
               ownerPk = convert(ownerFc, ownerPk);
               childPk = convert(childFc, childPk);
   
  -            Identity ownerId = new Identity(null, ownerTopLevelClass, ownerPk);
  -            Identity childId = new Identity(null, childTopLevelClass, childPk);
  +            Identity ownerId = pb.serviceIdentity().buildIdentity(null, ownerTopLevelClass,
ownerPk);
  +            Identity childId = pb.serviceIdentity().buildIdentity(null, childTopLevelClass,
childPk);
   
               // Identities may not be equal due to type-mismatch
               Collection list = (Collection) ownerIdsToLists.get(ownerId);
  @@ -471,7 +467,7 @@
           {
               Object result;
               Object owner = it.next();
  -            Identity ownerId = new Identity(owner, pb);
  +            Identity ownerId = pb.serviceIdentity().buildIdentity(owner);
   
               List list = (List) ownerIdsToLists.get(ownerId);
   
  @@ -510,5 +506,4 @@
           }
   
       }
  -
   }
  
  
  
  1.17.2.2  +2 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/Attic/PkEnumeration.java
  
  Index: PkEnumeration.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/Attic/PkEnumeration.java,v
  retrieving revision 1.17.2.1
  retrieving revision 1.17.2.2
  diff -u -r1.17.2.1 -r1.17.2.2
  --- PkEnumeration.java	22 Jan 2005 20:51:14 -0000	1.17.2.1
  +++ PkEnumeration.java	25 Nov 2005 16:27:50 -0000	1.17.2.2
  @@ -114,8 +114,7 @@
                   fld.getPersistentField().set(obj, colValue);
               }
               // 3. return the representing identity object
  -            Identity result = new Identity(obj, broker, classDescriptor);
  -            return result;
  +            return broker.serviceIdentity().buildIdentity(classDescriptor, obj);
           }
           catch (SQLException e)
           {
  
  
  
  1.9.2.1   +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/PlainPrefetcher.java
  
  Index: PlainPrefetcher.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/PlainPrefetcher.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- PlainPrefetcher.java	11 Jun 2004 18:49:09 -0000	1.9
  +++ PlainPrefetcher.java	25 Nov 2005 16:27:50 -0000	1.9.2.1
  @@ -66,7 +66,7 @@
           for (Iterator it = realSubjects.iterator(); it.hasNext(); )
           {
               realSubject = it.next();
  -            realSubjectsMap.put(new Identity(realSubject, pb), realSubject);
  +            realSubjectsMap.put(pb.serviceIdentity().buildIdentity(realSubject), realSubject);
           }
   
           for (Iterator it = proxies.iterator(); it.hasNext(); )
  
  
  
  1.20.2.2  +4 -4      db-ojb/src/java/org/apache/ojb/broker/accesslayer/ReferencePrefetcher.java
  
  Index: ReferencePrefetcher.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ReferencePrefetcher.java,v
  retrieving revision 1.20.2.1
  retrieving revision 1.20.2.2
  diff -u -r1.20.2.1 -r1.20.2.2
  --- ReferencePrefetcher.java	7 Jul 2005 16:58:48 -0000	1.20.2.1
  +++ ReferencePrefetcher.java	25 Nov 2005 16:27:50 -0000	1.20.2.2
  @@ -70,7 +70,7 @@
           for (Iterator it = children.iterator(); it.hasNext(); )
           {
               relatedObject = it.next();
  -            childrenMap.put(new Identity(relatedObject, pb), relatedObject);
  +            childrenMap.put(pb.serviceIdentity().buildIdentity(relatedObject), relatedObject);
           }
   
           for (Iterator it = owners.iterator(); it.hasNext(); )
  @@ -82,7 +82,7 @@
                   field.set(owner, null);
                   continue;
               }
  -            id = new Identity(null, topLevelClass, fkValues);
  +            id = pb.serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
               relatedObject = childrenMap.get(id);
               field.set(owner, relatedObject);
           }
  @@ -127,7 +127,7 @@
               {
                   continue;
               }
  -            id = new Identity(null, topLevelClass, fkValues);
  +            id = pb.serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
               if (cache.lookup(id) != null)
               {
                   children.add(pb.getObjectByIdentity(id));
  
  
  
  1.63.2.18 +4 -5      db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
  
  Index: RsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java,v
  retrieving revision 1.63.2.17
  retrieving revision 1.63.2.18
  diff -u -r1.63.2.17 -r1.63.2.18
  --- RsIterator.java	13 Nov 2005 16:14:04 -0000	1.63.2.17
  +++ RsIterator.java	25 Nov 2005 16:27:50 -0000	1.63.2.18
  @@ -409,7 +409,8 @@
           }
   
           // return identity object build up from primary keys
  -        return new Identity(getQueryObject().getClassDescriptor().getClassOfObject(), getTopLevelClass(),
pkValues);
  +        return getBroker().serviceIdentity().buildIdentity(
  +                getQueryObject().getClassDescriptor().getClassOfObject(), getTopLevelClass(),
pkValues);
       }
   
       /**
  @@ -678,7 +679,7 @@
        */
       public boolean absolute(int row) throws PersistenceBrokerException
       {
  -        boolean retval = false;
  +        boolean retval;
           if (supportsAdvancedJDBCCursorControl())
           {
               retval = absoluteAdvanced(row);
  @@ -693,7 +694,6 @@
       /**
        * absolute for basicJDBCSupport
        * @param row
  -     * @return
        */
       private boolean absoluteBasic(int row)
       {
  @@ -737,7 +737,6 @@
       /**
        * absolute for advancedJDBCSupport
        * @param row
  -     * @return
        */
       private boolean absoluteAdvanced(int row)
       {
  
  
  
  No                   revision
  No                   revision
  1.17.2.15 +3 -3      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.17.2.14
  retrieving revision 1.17.2.15
  diff -u -r1.17.2.14 -r1.17.2.15
  --- QueryReferenceBroker.java	28 Oct 2005 19:48:06 -0000	1.17.2.14
  +++ QueryReferenceBroker.java	25 Nov 2005 16:27:50 -0000	1.17.2.15
  @@ -608,14 +608,14 @@
                   Object referencedObject = rds.getPersistentField().get(obj);
                   if(referencedObject != null)
                   {
  -                    return new Identity(referencedObject, pb);
  +                    return pb.serviceIdentity().buildIdentity(referencedObject);
                   }
               }
           }
           else
           {
               // ensure that top-level extents are used for Identities
  -            return new Identity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()),
fkValues);
  +            return pb.serviceIdentity().buildIdentity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()),
fkValues);
           }
           return null;
       }
  
  
  

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