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/sql SqlQueryStatement.java
Date Fri, 10 Dec 2004 22:40:43 GMT
brj         2004/12/10 14:40:43

  Modified:    src/java/org/apache/ojb/broker/metadata
                        AttributeDescriptorBase.java ClassDescriptor.java
                        ObjectReferenceDescriptor.java
                        CollectionDescriptor.java
               src/java/org/apache/ojb/broker/accesslayer
                        RelationshipPrefetcherImpl.java BasePrefetcher.java
               src/java/org/apache/ojb/broker/core MtoNBroker.java
                        QueryReferenceBroker.java
               src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
               src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlQueryStatement.java
  Log:
  new method getItemClassDescriptor in ObjectReferenceDescriptor
  
  Revision  Changes    Path
  1.19      +6 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/AttributeDescriptorBase.java
  
  Index: AttributeDescriptorBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/AttributeDescriptorBase.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AttributeDescriptorBase.java	14 Nov 2004 09:36:10 -0000	1.18
  +++ AttributeDescriptorBase.java	10 Dec 2004 22:40:41 -0000	1.19
  @@ -71,6 +71,11 @@
           return m_ClassDescriptor;
       }
   
  +    protected ClassDescriptor getDescriptorFor(Class aClass)
  +    {
  +        return getClassDescriptor().getRepository().getDescriptorFor(aClass);
  +    }
  +    
       /**
        * Sets the classDescriptor.
        * @param classDescriptor The classDescriptor to set
  
  
  
  1.97      +2 -2      db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
  
  Index: ClassDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- ClassDescriptor.java	28 Nov 2004 03:14:43 -0000	1.96
  +++ ClassDescriptor.java	10 Dec 2004 22:40:41 -0000	1.97
  @@ -472,7 +472,7 @@
               
               if (superOrd != null)
               {
  -                ClassDescriptor superCld = getRepository().getDescriptorFor(superOrd.getItemClass());
  +                ClassDescriptor superCld = superOrd.getItemClassDescriptor();
                   ord = superCld.getObjectReferenceDescriptorByName(name);
               }
           }
  
  
  
  1.41      +15 -2     db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
  
  Index: ObjectReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ObjectReferenceDescriptor.java	14 Nov 2004 09:36:10 -0000	1.40
  +++ ObjectReferenceDescriptor.java	10 Dec 2004 22:40:41 -0000	1.41
  @@ -43,6 +43,7 @@
       public static final int CASCADE_OBJECT = 23;
   
       private Class m_ClassOfItems = null;
  +    private ClassDescriptor m_ClassDescriptorOfItems;
       private Vector m_ForeignKeyFields = new Vector();
       private boolean m_CascadeRetrieve = true;
       private int m_CascadeStore = CASCADE_NONE;
  @@ -170,19 +171,31 @@
       }
   
       /**
  -     *
  +     * Answer the ItemClass.
        */
       public Class getItemClass()
       {
           return m_ClassOfItems;
       }
   
  +   /**
  +    * Answer the ClassDescriptor of the ItemClass.
  +    */
  +   public ClassDescriptor getItemClassDescriptor()
  +   {
  +       if (m_ClassDescriptorOfItems == null)
  +       {
  +           m_ClassDescriptorOfItems = getDescriptorFor(getItemClass());
  +       }
  +       return m_ClassDescriptorOfItems;
  +   }
  +
       /**
        * @return the fully qualified name of the item class for this descriptor.
        */
       public String getItemClassName()
       {
  -        return this.m_ClassOfItems != null ? this.m_ClassOfItems.getName() : null;
  +        return m_ClassOfItems != null ? m_ClassOfItems.getName() : null;
       }
   
       /**
  
  
  
  1.32      +2 -2      db-ojb/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java
  
  Index: CollectionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- CollectionDescriptor.java	11 Aug 2004 00:41:46 -0000	1.31
  +++ CollectionDescriptor.java	10 Dec 2004 22:40:42 -0000	1.32
  @@ -325,7 +325,7 @@
           if (m_hasProxyItems == null)
           {
               DescriptorRepository repo = getClassDescriptor().getRepository();
  -            ClassDescriptor cld = repo.getDescriptorFor(getItemClass());
  +            ClassDescriptor cld = getItemClassDescriptor();
               if (cld.getProxyClass() != null)
               {
                   m_hasProxyItems = Boolean.TRUE;
  
  
  
  1.14      +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/RelationshipPrefetcherImpl.java
  
  Index: RelationshipPrefetcherImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RelationshipPrefetcherImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RelationshipPrefetcherImpl.java	12 May 2004 19:25:54 -0000	1.13
  +++ RelationshipPrefetcherImpl.java	10 Dec 2004 22:40:42 -0000	1.14
  @@ -36,7 +36,7 @@
        */
       public RelationshipPrefetcherImpl(PersistenceBrokerImpl aBroker, ObjectReferenceDescriptor
anOrd)
       {
  -        super(aBroker, anOrd.getItemClass());
  +        super(aBroker, anOrd.getItemClassDescriptor());
           objectReferenceDescriptor = anOrd;
       }
   
  
  
  
  1.12      +10 -2     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- BasePrefetcher.java	14 Nov 2004 09:33:38 -0000	1.11
  +++ BasePrefetcher.java	10 Dec 2004 22:40:42 -0000	1.12
  @@ -48,9 +48,17 @@
        */
       public BasePrefetcher(PersistenceBrokerImpl aBroker, Class anItemClass)
       {
  +        this(aBroker, aBroker.getDescriptorRepository().getDescriptorFor(anItemClass));
  +    }
  +
  +    /**
  +     * Constructor for BasePrefetcher.
  +     */
  +    public BasePrefetcher(PersistenceBrokerImpl aBroker, ClassDescriptor anItemCld)
  +    {
           super();
           broker = aBroker;
  -        itemClassDesc = aBroker.getDescriptorRepository().getDescriptorFor(anItemClass);
  +        itemClassDesc = anItemCld;
           logger = LoggerFactory.getLogger(this.getClass());
           pkLimit = broker.getSqlInLimit() / getItemClassDescriptor().getPkFields().length;
       }
  
  
  
  1.15      +3 -3      db-ojb/src/java/org/apache/ojb/broker/core/MtoNBroker.java
  
  Index: MtoNBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/MtoNBroker.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MtoNBroker.java	26 Oct 2004 13:22:19 -0000	1.14
  +++ MtoNBroker.java	10 Dec 2004 22:40:42 -0000	1.15
  @@ -131,7 +131,7 @@
           String selectStmt = pb.serviceSqlGenerator()
                   .getGenericPreparedStatement(SqlGenerator.TYPE_GENERIC_SELECT, table, fkColumns,
pkColumns);
   
  -        ClassDescriptor itemCLD = pb.getDescriptorRepository().getDescriptorFor(cod.getItemClass());
  +        ClassDescriptor itemCLD = cod.getItemClassDescriptor();
           Collection extents = pb.getDescriptorRepository().getAllConcreteSubclassDescriptors(itemCLD);
           if(extents.size() > 0)
           {
  @@ -203,7 +203,7 @@
           }
           List workList = new ArrayList(mnKeys);
           MtoNBroker.Key relatedObjKeys;
  -        ClassDescriptor relatedCld = pb.getDescriptorRepository().getDescriptorFor(cod.getItemClass());
  +        ClassDescriptor relatedCld = cod.getItemClassDescriptor();
           Object relatedObj;
   
           // remove keys of relatedObject from the existing m:n rows in workList
  
  
  
  1.27      +4 -4      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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- QueryReferenceBroker.java	5 Dec 2004 14:54:40 -0000	1.26
  +++ QueryReferenceBroker.java	10 Dec 2004 22:40:42 -0000	1.27
  @@ -526,7 +526,7 @@
               not only the top-level class - right?
               */
               // referencedProxy = getClassDescriptor(referencedClass).getDynamicProxyClass();
  -            referencedProxy = pb.getClassDescriptor(rds.getItemClass()).getDynamicProxyClass();
  +            referencedProxy = rds.getItemClassDescriptor().getDynamicProxyClass();
           }
           else
           {
  @@ -698,7 +698,7 @@
           ValueContainer[] values = pb.serviceBrokerHelper().getKeyValues(cld, obj);
           Object[] thisClassFks = cod.getFksToThisClass();
           Object[] itemClassFks = cod.getFksToItemClass();
  -        ClassDescriptor refCld = pb.getClassDescriptor(cod.getItemClass());
  +        ClassDescriptor refCld = cod.getItemClassDescriptor();
           Criteria criteria = new Criteria();
   
           for (int i = 0; i < thisClassFks.length; i++)
  @@ -725,7 +725,7 @@
       private QueryByCriteria getFKQuery1toN(Object obj, ClassDescriptor cld, CollectionDescriptor
cod)
       {
           ValueContainer[] container = pb.serviceBrokerHelper().getKeyValues(cld, obj);
  -        ClassDescriptor refCld = pb.getClassDescriptor(cod.getItemClass());
  +        ClassDescriptor refCld = cod.getItemClassDescriptor();
           FieldDescriptor[] fields = cod.getForeignKeyFieldDescriptors(refCld);
           Criteria criteria = new Criteria();
   
  
  
  
  1.54      +1 -1      db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java
  
  Index: ConcreteEditingContext.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- ConcreteEditingContext.java	29 Nov 2004 22:11:59 -0000	1.53
  +++ ConcreteEditingContext.java	10 Dec 2004 22:40:42 -0000	1.54
  @@ -1227,7 +1227,7 @@
               Collection relRefs;
   
               ord = (ObjectReferenceDescriptor) it.next();
  -            relCDesc = _pb.getClassDescriptor(ord.getItemClass());
  +            relCDesc = ord.getItemClassDescriptor();
               relRefs = relCDesc.getObjectReferenceDescriptors();
               for (Iterator relIt = relRefs.iterator(); relIt.hasNext(); )
               {
  
  
  
  1.93      +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
  
  Index: SqlQueryStatement.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- SqlQueryStatement.java	2 Dec 2004 21:37:46 -0000	1.92
  +++ SqlQueryStatement.java	10 Dec 2004 22:40:43 -0000	1.93
  @@ -384,7 +384,7 @@
                * and then we need to take the primary key attribute of the referenced object

                * to help them out.
                */
  -            ClassDescriptor cld = aTableAlias.cld.getRepository().getDescriptorFor(anOrd.getItemClass());
  +            ClassDescriptor cld = anOrd.getItemClassDescriptor();
               if (cld != null)
               {
                   fld = aTableAlias.cld.getFieldDescriptorByName(cld.getPkFields()[0].getPersistentField().getName());
  
  
  

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