db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmon...@apache.org
Subject svn commit: r524492 - in /db/torque: generator/trunk/xdocs/properties-reference.xml maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/OMMojo.java site/trunk/xdocs/changes.xml templates/trunk/src/templates/om/bean/Bean.vm
Date Sat, 31 Mar 2007 23:25:53 GMT
Author: gmonroe
Date: Sat Mar 31 16:25:52 2007
New Revision: 524492

URL: http://svn.apache.org/viewvc?view=rev&rev=524492
Log:
Add in support for a torque.beanExtendsClass property.  This
allows for the generated base bean class to be an created
as the extension of the specified class (e.g. Struts'
ActionForm, etc)

Modified:
    db/torque/generator/trunk/xdocs/properties-reference.xml
    db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/OMMojo.java
    db/torque/site/trunk/xdocs/changes.xml
    db/torque/templates/trunk/src/templates/om/bean/Bean.vm

Modified: db/torque/generator/trunk/xdocs/properties-reference.xml
URL: http://svn.apache.org/viewvc/db/torque/generator/trunk/xdocs/properties-reference.xml?view=diff&rev=524492&r1=524491&r2=524492
==============================================================================
--- db/torque/generator/trunk/xdocs/properties-reference.xml (original)
+++ db/torque/generator/trunk/xdocs/properties-reference.xml Sat Mar 31 16:25:52 2007
@@ -416,6 +416,14 @@
       </td>
     </tr>
     <tr>
+      <td><code>torque.beanExtendsClass</code></td>
+      <td><code>Not set</code></td>
+      <td>
+        A fully qualified class name (e.g. org.apache.struts.action.ActionForm)
+        that the generated base bean classes will extend.
+      </td>
+    </tr>
+    <tr>
       <td><code>torque.enableJava5Features</code></td>
       <td><code>false</code></td>
       <td>

Modified: db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/OMMojo.java
URL: http://svn.apache.org/viewvc/db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/OMMojo.java?view=diff&rev=524492&r1=524491&r2=524492
==============================================================================
--- db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/OMMojo.java (original)
+++ db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/OMMojo.java Sat Mar
31 16:25:52 2007
@@ -105,6 +105,13 @@
             = "beanSuffix";
 
     /**
+     * The context property which determines the fully qualifed
+     * class name that the base beans will extend.
+     */
+    public static final String BEAN_EXTENDS_CLASS_PROPERTY
+            = "beanExtendsClass";
+
+    /**
      * The context property for the subpackage of the generated
      * database Map classes.
      */
@@ -259,6 +266,14 @@
     private String beanSuffix;
 
     /**
+     * A fully qualified class name that the generated base bean class will
+     * extend.
+     *
+     * @parameter expression="Bean"
+     */
+    private String beanExtendsClass;
+
+    /**
      * The subpackage (relative to <code>targetPackage</code>
      * where Torque will put the generated Java classes for the database map.
      *
@@ -586,6 +601,10 @@
                 beanSuffix);
 
         configuration.addProperty(
+                BEAN_EXTENDS_CLASS_PROPERTY,
+                beanExtendsClass);
+
+        configuration.addProperty(
                 GENERATE_BEANS_CONTEXT_PROPERTY,
                 Boolean.toString(generateBeans));
 
@@ -648,6 +667,29 @@
     public String getBeanSuffix()
     {
         return beanSuffix;
+    }
+
+    /**
+     * Sets the optional fully qualified class name that the
+     * generated base bean classes will extend.
+     *
+     * @param beanExtendsClass the fully qualified class or 
+     *          null/"" if none is used.
+     */
+    public void setBeanExtendsClass(String beanExtendsClass)
+    {
+        this.beanExtendsClass = beanExtendsClass;
+    }
+
+    /**
+     * Returns the fully qualified class that the generated base bean
+     * classes will extend.
+     *
+     * @return the fully qualified class or null/"" if none is used.
+     */
+    public String getBeanExtendsClass()
+    {
+        return beanExtendsClass;
     }
 
     /**

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?view=diff&rev=524492&r1=524491&r2=524492
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Sat Mar 31 16:25:52 2007
@@ -31,6 +31,11 @@
 
   <body>
   <release version="3.3-RC3" date="in SVN">
+    <action type="add" dev="gmonroe">
+      Added torque.beanExtendsClass property that defines a fully qualified
+      class name (e.g. org.apache.struts.action.ActionForm) that the base 
+      bean classes will extend.
+    </action>
     <action type="fix" dev="tfischer" issue="TORQUE-88">
       Fixed handling of the enableJava5Features config parameter in the
       maven 2 plugin.

Modified: db/torque/templates/trunk/src/templates/om/bean/Bean.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/bean/Bean.vm?view=diff&rev=524492&r1=524491&r2=524492
==============================================================================
--- db/torque/templates/trunk/src/templates/om/bean/Bean.vm (original)
+++ db/torque/templates/trunk/src/templates/om/bean/Bean.vm Sat Mar 31 16:25:52 2007
@@ -61,6 +61,9 @@
  * extended; all references should be to ${table.JavaName}${beanSuffix}
  */
 public abstract class ${basePrefix}${table.JavaName}${beanSuffix}
+#if ( ${beanExtendsClass} ) 
+    extends ${beanExtendsClass}
+#end
     implements Serializable
 {
 



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message