db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1057791 - in /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates: TorqueSchemaAttributeName.java transformer/om/OMColumnTransformer.java
Date Tue, 11 Jan 2011 18:38:08 GMT
Author: tfischer
Date: Tue Jan 11 18:38:07 2011
New Revision: 1057791

URL: http://svn.apache.org/viewvc?rev=1057791&view=rev
Log:
honor the defaultJavaType attribute of the database element

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaAttributeName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaAttributeName.java?rev=1057791&r1=1057790&r2=1057791&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaAttributeName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaAttributeName.java
Tue Jan 11 18:38:07 2011
@@ -50,6 +50,8 @@ public enum TorqueSchemaAttributeName im
     ID_METHOD("idMethod"),
     /** attribute defaultIdMethod. */
     DEFAULT_ID_METHOD("defaultIdMethod"),
+    /** attribute defaultJavaType. */
+    DEFAULT_JAVA_TYPE("defaultJavaType"),
     /** attribute value. */
     VALUE("value"),
     /** attribute required. */

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java?rev=1057791&r1=1057790&r2=1057791&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
Tue Jan 11 18:38:07 2011
@@ -74,6 +74,7 @@ public class OMColumnTransformer
     {
         checkElementName(columnElement);
         checkColumnNameExists(columnElement);
+        setJavaTypeAttribute(columnElement);
 
         columnElement.setAttribute(
                 ColumnAttributeName.POSITION,
@@ -114,6 +115,30 @@ public class OMColumnTransformer
     }
 
     /**
+     * Sets the javaType attribute of the column element
+     * if it is not already set and a default value is set.
+     *
+     * @param columnElement the column element, not null.
+     */
+    protected void setJavaTypeAttribute(SourceElement columnElement)
+    {
+        if (columnElement.getAttribute(TorqueSchemaAttributeName.JAVA_TYPE)
+                != null)
+        {
+            return;
+        }
+        SourceElement databaseElement = columnElement.getParent().getParent();
+        String defaultJavaType = (String) databaseElement.getAttribute(
+                TorqueSchemaAttributeName.DEFAULT_JAVA_TYPE);
+        if (defaultJavaType != null)
+        {
+            columnElement.setAttribute(
+                    TorqueSchemaAttributeName.JAVA_TYPE,
+                    defaultJavaType);
+        }
+    }
+
+    /**
      * Sets default values for attributes of the column element
      * if the attribute is not set.
      * The following attributes are checked:



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