Author: arminw
Date: Fri Dec 22 17:32:28 2006
New Revision: 489818

URL: http://svn.apache.org/viewvc?view=rev&rev=489818
Log:
minor improvement, add method to lookup top-level ClassDescriptor

Modified:
    
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java

Modified: 
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
URL: 
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java?view=diff&rev=489818&r1=489817&r2=489818
==============================================================================
--- 
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
 (original)
+++ 
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
 Fri Dec 22 17:32:28 2006
@@ -199,6 +199,20 @@
     }
 
     /**
+     * Returns the top level (extent) [EMAIL PROTECTED] ClassDescriptor} to 
which the given class belongs.
+     * This may be a (abstract) base-class, an interface or the given class
+     * itself if given class is not defined as an extent in other class
+     * descriptors.
+     *
+     * @throws ClassNotPersistenceCapableException if clazz is not persistence 
capable,
+     * i.e. if clazz is not defined in the DescriptorRepository.
+     */
+    public ClassDescriptor getTopLevelDescriptor(Class clazz) throws 
ClassNotPersistenceCapableException
+    {
+        return getDescriptorFor(getTopLevelClass(clazz));
+    }
+
+    /**
      * @return all field descriptors for a class that belongs to a set of 
classes mapped
      * to the same table, otherwise the select queries produced won't contain 
the necessary
      * information to materialize extents mapped to the same class.
@@ -830,7 +844,7 @@
                     for (Iterator it2 = ordList.iterator(); it2.hasNext();)
                     {
                         ObjectReferenceDescriptor ord = 
(ObjectReferenceDescriptor) it2.next();
-                        ClassDescriptor oneDesc = 
getDescriptorFor(ord.getItemClass());
+                        ClassDescriptor oneDesc = ord.getItemClassDescriptor();
                         fkTables.addAll(getFullTableNames(oneDesc));
                     }
                 }
@@ -839,7 +853,7 @@
                 for (Iterator it2 = codList.iterator(); it2.hasNext();)
                 {
                     CollectionDescriptor cod = (CollectionDescriptor) 
it2.next();
-                    ClassDescriptor manyDesc = 
getDescriptorFor(cod.getItemClass());
+                    ClassDescriptor manyDesc = cod.getItemClassDescriptor();
                     if (cod.isMtoNRelation())
                     {
                         HashSet fkTables = 
getFKTablesFor(cod.getIndirectionTable(), fkInfo);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to