Author: max.andersen(a)jboss.com
Date: 2006-10-31 09:24:31 -0500 (Tue, 31 Oct 2006)
New Revision: 10667
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl
Log:
HBX-795 Entity docmentation is missing hiearchy information
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java 2006-10-31
14:21:49 UTC (rev 10666)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java 2006-10-31
14:24:31 UTC (rev 10667)
@@ -40,6 +40,11 @@
private static final String FILE_HIBERNATE_IMAGE =
"doc/hibernate_logo.gif";
/**
+ * Extends Image.
+ */
+ private static final String FILE_EXTENDS_IMAGE = "doc/inherit.gif";
+
+ /**
* Main index page.
*/
private static final String FILE_INDEX = "doc/index.html";
@@ -289,6 +294,10 @@
DocFileManager.copy(FILE_HIBERNATE_IMAGE,
hibernateLogoDocFile.getFile() );
+ DocFile extendsImageDocFile = docFileManager.getExtendsImageDocFile();
+
+ DocFileManager.copy(FILE_EXTENDS_IMAGE, extendsImageDocFile.getFile());
+
DocFile mainIndexDocFile = docFileManager.getMainIndexDocFile();
DocFileManager.copy(FILE_INDEX, mainIndexDocFile.getFile() );
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java 2006-10-31
14:21:49 UTC (rev 10666)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java 2006-10-31
14:24:31 UTC (rev 10667)
@@ -45,6 +45,11 @@
* The Hibernate image.
*/
private DocFile hibernateImageDocFile;
+
+ /**
+ * The extends image.
+ */
+ private DocFile extendsImageDocFile;
/**
* The CSS stylesheet file.
@@ -159,6 +164,8 @@
hibernateImageDocFile = new DocFile("hibernate_logo.gif",
assetsDocFolder);
+
+ extendsImageDocFile = new DocFile("inherit.gif", assetsDocFolder);
cssStylesDocFile = new DocFile("doc-style.css", assetsDocFolder);
@@ -281,7 +288,17 @@
return hibernateImageDocFile;
}
+
+ /**
+ * Returns the DocFile for the extends Image.
+ *
+ * @return the value.
+ */
+ public DocFile getExtendsImageDocFile() {
+ return extendsImageDocFile;
+ }
+
/**
* Returns the DocFile for the main index.
*
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java 2006-10-31
14:21:49 UTC (rev 10666)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java 2006-10-31
14:24:31 UTC (rev 10667)
@@ -4,11 +4,9 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
@@ -489,5 +487,22 @@
return null;
}
}
+
+ public List getInheritanceHiearchy(POJOClass pc) {
+ if(pc.isSubclass()) {
+ List superClasses = new ArrayList();
+ POJOClass superClass = pc.getSuperClass();
+ while (superClass != null)
+ {
+ superClasses.add(superClass);
+ superClass = superClass.getSuperClass();
+ }
+
+ return superClasses;
+ } else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
}
\ No newline at end of file
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-10-31
14:21:49 UTC (rev 10666)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-10-31
14:24:31 UTC (rev 10667)
@@ -3,36 +3,36 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
+import java.util.Set;
import java.util.StringTokenizer;
-import java.util.Set;
-import java.util.HashSet;
+import org.hibernate.cfg.Configuration;
import org.hibernate.id.MultipleHiLoPerTableGenerator;
import org.hibernate.id.PersistentIdentifierGenerator;
+import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Formula;
import org.hibernate.mapping.KeyValue;
+import org.hibernate.mapping.ManyToOne;
+import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Subclass;
+import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.UniqueKey;
import org.hibernate.mapping.Value;
-import org.hibernate.mapping.Collection;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mapping.ManyToOne;
-import org.hibernate.mapping.Table;
import org.hibernate.tool.hbm2x.Cfg2JavaTool;
import org.hibernate.util.JoinedIterator;
import org.hibernate.util.StringHelper;
-import org.hibernate.cfg.Configuration;
public class EntityPOJOClass extends BasicPOJOClass {
@@ -786,8 +786,11 @@
}
public POJOClass getSuperClass(){
+ if (!isSubclass())
+ return null;
return new EntityPOJOClass(clazz.getSuperclass(),c2j);
}
+
public String toString() {
return getClass().getName() + "(" +
(clazz==null?"<none>":clazz.getEntityName()) + ")";
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css 2006-10-31
14:21:49 UTC (rev 10666)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css 2006-10-31
14:24:31 UTC (rev 10667)
@@ -67,3 +67,39 @@
.HeaderLink {
text-decoration: none;
}
+
+/* entity hierarchy */
+
+.EntityHierarchy
+{
+ border: solid 1px #CCCCCC;
+ background: #F4F4F4;
+ padding: 5px;
+ font: bold 90% monospace;
+}
+
+.EntityHierarchy a
+{
+ font-weight: normal;
+}
+
+.EntityHierarchy ul
+{
+ margin: 0;
+ list-style: none;
+ padding-left: 0;
+}
+* html .EntityHierarchy ul /* ie6 only */
+{
+ margin-left: 0;
+}
+
+.EntityHierarchy ul.first
+{
+ padding-left: 15px;
+}
+
+.EntityHierarchy ul ul
+{
+ padding-left: 30px;
+}
\ No newline at end of file
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl 2006-10-31
14:21:49 UTC (rev 10666)
+++
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl 2006-10-31
14:24:31 UTC (rev 10667)
@@ -8,14 +8,28 @@
<BODY>
<H4>${class.packageName}</H4>
- <H3>Entity : ${class.getShortName()}</H3>
- <#if class.isInterface()>
- Interface Name :
- <#else>
- Class Name :
- </#if>
- ${class.qualifiedDeclarationName}
- <BR>
+ <H3>Entity ${class.getShortName()}</H3>
+
+ <div class="EntityHierarchy">
+ <ul>
+ <li>
+ <#assign superClasses=dochelper.getInheritanceHiearchy(class)>
+ <#list superClasses?reverse as superClass>
+ <#-- whitespace is significant here -->
+ <#if superClass_index gt 0><img src="${docFileManager.getRef(docFile,
docFileManager.getExtendsImageDocFile())}" alt="extended
by"/></#if><a href="${docFileManager.getRef(docFile,
docFileManager.getEntityDocFileByDeclarationName(superClass))}">${superClass.qualifiedDeclarationName}</a>
+ <ul <#if superClass_index == 0>class="first"</#if>>
+ <li>
+ </#list>
+ <#-- whitespace is significant here -->
+ <#if class.subclass><img src="${docFileManager.getRef(docFile,
docFileManager.getExtendsImageDocFile())}" alt="extended
by"/></#if>${class.qualifiedDeclarationName}
+ <#list superClasses as superClass>
+ </li>
+ </ul>
+ </#list>
+ </li>
+ </ul>
+ </div>
+
<#if class.getMetaAsString("class-description")?has_content>
<HR>
<BR>
Show replies by date