svn commit: r489818 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java

[email protected]
Newsgroups gmane.comp.jakarta.ojb.devel
Message-ID <[email protected]>
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) {@link 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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.