Update of 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11429/src/main/java/org/xdoclet/plugin/hibernate

Modified Files:
        AbstractHibernatePlugin.java Column.jelly Component.jelly 
        HibernateConfigPlugin.java HibernateMappingPlugin.java 
        Property.jelly 
Log Message:
(XDP-65) Added support of nested components

Index: Column.jelly
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/Column.jelly,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Column.jelly        6 May 2005 08:09:40 -0000       1.7
--- Column.jelly        1 Jun 2005 14:52:57 -0000       1.8
***************
*** 1,5 ****
  <j:jelly xmlns:j="jelly:core">
      <column
!         name="${plugin.buildComponentColumnName(componentTag.prefix, 
columnTag.name_)}"
          length="${columnTag.length}"
          precision="${columnTag.precision}"
--- 1,5 ----
  <j:jelly xmlns:j="jelly:core">
      <column
!         name="${plugin.buildComponentColumnName(columnTag.name_)}"
          length="${columnTag.length}"
          precision="${columnTag.precision}"

Index: HibernateMappingPlugin.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/HibernateMappingPlugin.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** HibernateMappingPlugin.java 31 May 2005 11:24:36 -0000      1.41
--- HibernateMappingPlugin.java 1 Jun 2005 14:52:57 -0000       1.42
***************
*** 18,21 ****
--- 18,22 ----
  import org.generama.QDoxCapableMetadataProvider;
  import org.generama.WriterMapper;
+ 
  import org.generama.defaults.XMLOutputValidator;
  
***************
*** 83,86 ****
--- 84,88 ----
  
      private boolean force = false;
+     private Stack componentsPrefixies = new Stack();
  
      public HibernateMappingPlugin(JellyTemplateEngine jellyTemplateEngine,
***************
*** 90,101 ****
          setFilereplace("\\.hbm.xml");
          setMultioutput(true);
- 
          Map dtds = new HashMap();
          dtds.put("http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";,
!                 getClass().getResource("dtd/hibernate-mapping-2.0.dtd"));
          dtds.put("http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";,
!                 getClass().getResource("dtd/hibernate-mapping-3.0.dtd"));
          setOutputValidator(new XMLOutputValidator(dtds));
- 
          new TagLibrary(metadataProvider);
      }
--- 92,101 ----
          setFilereplace("\\.hbm.xml");
          setMultioutput(true);
          Map dtds = new HashMap();
          dtds.put("http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";,
!             getClass().getResource("dtd/hibernate-mapping-2.0.dtd"));
          dtds.put("http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";,
!             getClass().getResource("dtd/hibernate-mapping-3.0.dtd"));
          setOutputValidator(new XMLOutputValidator(dtds));
          new TagLibrary(metadataProvider);
      }
***************
*** 276,292 ****
      }
  
-     public String buildComponentColumnName(String prefix, String columnName) {
-         if (prefix == null) {
-             return columnName;
-         }
- 
-         //If columnName is null then we do not need add prefix
-         if (columnName == null) {
-             return null;
-         }
- 
-         return prefix + columnName;
-     }
- 
      /**
       * dispatch qtag to correct jelly script. cache results statically
--- 276,279 ----
***************
*** 449,451 ****
--- 436,470 ----
          }
      }
+ 
+     public void startComponent(String prefix) {
+         componentsPrefixies.push(prefix);
+     }
+ 
+     public void endComponent() {
+         componentsPrefixies.pop();
+     }
+ 
+     public String buildComponentColumnName(String columnName) {
+         //If columnName is null then we do not need add prefix
+         if (columnName == null) {
+             return null;
+         }
+ 
+         if (componentsPrefixies.isEmpty()) {
+             return columnName;
+         }
+ 
+         StringBuffer result = new StringBuffer();
+ 
+         for (Iterator iterator = componentsPrefixies.iterator(); 
iterator.hasNext();) {
+             String pr = (String) iterator.next();
+ 
+             if (pr != null) {
+                 result.append(pr);
+             }
+         }
+ 
+         result.append(columnName);
+         return result.toString();
+     }
  }
\ No newline at end of file

Index: Property.jelly
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/Property.jelly,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Property.jelly      31 May 2005 11:24:36 -0000      1.10
--- Property.jelly      1 Jun 2005 14:52:57 -0000       1.11
***************
*** 7,11 ****
              access="${property.access}"
              type="${propertyTag.type}"
!             column="${plugin.buildComponentColumnName(componentTag.prefix, 
propertyTag.column)}"
              length="${propertyTag.length}"
              precision="${propertyTag.precision}"
--- 7,11 ----
              access="${property.access}"
              type="${propertyTag.type}"
!             column="${plugin.buildComponentColumnName(propertyTag.column)}"
              length="${propertyTag.length}"
              precision="${propertyTag.precision}"

Index: Component.jelly
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/Component.jelly,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Component.jelly     31 May 2005 11:24:36 -0000      1.11
--- Component.jelly     1 Jun 2005 14:52:57 -0000       1.12
***************
*** 2,5 ****
--- 2,6 ----
      <j:set var="componentTag" 
value="${property.entity.getTagByName('hibernate.component')}"/>
      <j:if test="${componentTag != null}">
+         <j:expr value="${plugin.startComponent(componentTag.prefix)}"/>
          <component
              class="${componentTag.class_}"
***************
*** 20,24 ****
              </j:forEach>
          </component>
      </j:if>
-     <j:set var="componentTag" value="null"/>
  </j:jelly>
--- 21,25 ----
              </j:forEach>
          </component>
+         <j:expr value="${plugin.endComponent()}"/>
      </j:if>
  </j:jelly>

Index: AbstractHibernatePlugin.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/AbstractHibernatePlugin.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AbstractHibernatePlugin.java        31 May 2005 11:24:35 -0000      1.2
--- AbstractHibernatePlugin.java        1 Jun 2005 14:52:56 -0000       1.3
***************
*** 7,10 ****
--- 7,11 ----
  
  import java.io.File;
+ 
  import java.net.URL;
  

Index: HibernateConfigPlugin.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/HibernateConfigPlugin.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** HibernateConfigPlugin.java  31 May 2005 11:24:36 -0000      1.11
--- HibernateConfigPlugin.java  1 Jun 2005 14:52:57 -0000       1.12
***************
*** 10,16 ****
  
  import java.util.Collection;
  import java.util.Map;
  import java.util.Properties;
- import java.util.HashMap;
  
  import org.apache.commons.collections.CollectionUtils;
--- 10,16 ----
  
  import java.util.Collection;
+ import java.util.HashMap;
  import java.util.Map;
  import java.util.Properties;
  
  import org.apache.commons.collections.CollectionUtils;
***************
*** 19,22 ****
--- 19,23 ----
  import org.generama.QDoxCapableMetadataProvider;
  import org.generama.WriterMapper;
+ 
  import org.generama.defaults.XMLOutputValidator;
  
***************
*** 88,99 ****
          setMultioutput(false);
          setMappingextension(".hbm.xml");
- 
          Map dtds = new HashMap();
          
dtds.put("http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd";,
!                 
getClass().getResource("dtd/hibernate-configuration-2.0.dtd"));
          
dtds.put("http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";,
!                 
getClass().getResource("dtd/hibernate-configuration-3.0.dtd"));
          setOutputValidator(new XMLOutputValidator(dtds));
- 
          new TagLibrary(metadataProvider);
          this.props = new Properties();
--- 89,98 ----
          setMultioutput(false);
          setMappingextension(".hbm.xml");
          Map dtds = new HashMap();
          
dtds.put("http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd";,
!             getClass().getResource("dtd/hibernate-configuration-2.0.dtd"));
          
dtds.put("http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";,
!             getClass().getResource("dtd/hibernate-configuration-3.0.dtd"));
          setOutputValidator(new XMLOutputValidator(dtds));
          new TagLibrary(metadataProvider);
          this.props = new Properties();



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits

Reply via email to