db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r997970 - in /db/torque/torque4/trunk/torque-templates/src/main: java/org/apache/torque/templates/transformer/om/ java/org/apache/torque/templates/transformer/om/dbobject/base/ resources/org/apache/torque/templates/transformer/om/dbobject/b...
Date Fri, 17 Sep 2010 04:10:34 GMT
Author: tfischer
Date: Fri Sep 17 04:10:33 2010
New Revision: 997970

URL: http://svn.apache.org/viewvc?rev=997970&view=rev
Log:
Moved functionality from BaseDbObject...Transformers to OmTableTransformer

Removed:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/dbobject/base/
Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java?rev=997970&r1=997969&r2=997970&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
Fri Sep 17 04:10:33 2010
@@ -73,6 +73,7 @@ public class OMTableTransformer extends 
         setJavaNameAttribute(tableElement);
         setIdMethodAttribute(tableElement);
         setSequenceAttributeIfNecessary(tableElement);
+        setBaseClass(tableElement, controllerState);
 
         // sets all the attributes defined in OMTableTransformer.properties
         super.transform(tableElement, controllerState);
@@ -316,4 +317,36 @@ public class OMTableTransformer extends 
             }
         }
     }
+
+    /**
+     * Sets the base class attribute on the table element if it is not
+     * already set.
+     *
+     * @param tableElement the table attribute to process, not null.
+     * @param controllerState the controller state, not null.
+     */
+    private void setBaseClass(
+            SourceElement tableElement,
+            ControllerState controllerState)
+    {
+        Object baseClass = tableElement.getAttribute(
+                TorqueSchemaAttributeName.BASE_CLASS);
+        if (baseClass == null)
+        {
+            baseClass = tableElement.getParent().getAttribute(
+                    TorqueSchemaAttributeName.BASE_CLASS);
+        }
+        if (baseClass == null)
+        {
+            baseClass = controllerState.getOption(
+                    TemplateOptionName.OM_DB_OBJECT_DEFAULT_BASE_CLASS);
+        }
+        if (baseClass == null)
+        {
+            baseClass = "";
+        }
+        tableElement.setAttribute(
+                TorqueSchemaAttributeName.BASE_CLASS,
+                baseClass);
+    }
 }



---------------------------------------------------------------------
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