db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1435917 - in /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer: ./ om/ om/mapInit/ sql/
Date Sun, 20 Jan 2013 19:15:48 GMT
Author: tfischer
Date: Sun Jan 20 19:15:48 2013
New Revision: 1435917

URL: http://svn.apache.org/viewvc?rev=1435917&view=rev
Log:
TORQUE-253: included and external schema files should be used in sql generation

Added:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/IncludeSchemaTransformer.java
      - copied, changed from r1423132, db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/IncludeSchemaTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/LoadExternalSchemaTransformer.java
      - copied, changed from r1423132, db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
Removed:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/IncludeSchemaTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java

Copied: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/IncludeSchemaTransformer.java
(from r1423132, db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/IncludeSchemaTransformer.java)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/IncludeSchemaTransformer.java?p2=db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/IncludeSchemaTransformer.java&p1=db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/IncludeSchemaTransformer.java&r1=1423132&r2=1435917&rev=1435917&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/IncludeSchemaTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/IncludeSchemaTransformer.java
Sun Jan 20 19:15:48 2013
@@ -1,4 +1,4 @@
-package org.apache.torque.templates.transformer.om;
+package org.apache.torque.templates.transformer;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Copied: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/LoadExternalSchemaTransformer.java
(from r1423132, db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/LoadExternalSchemaTransformer.java?p2=db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/LoadExternalSchemaTransformer.java&p1=db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java&r1=1423132&r2=1435917&rev=1435917&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/LoadExternalSchemaTransformer.java
Sun Jan 20 19:15:48 2013
@@ -1,4 +1,4 @@
-package org.apache.torque.templates.transformer.om;
+package org.apache.torque.templates.transformer;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -33,6 +33,8 @@ import org.apache.torque.generator.sourc
 import org.apache.torque.generator.source.transform.SourceTransformerException;
 import org.apache.torque.templates.TorqueSchemaAttributeName;
 import org.apache.torque.templates.TorqueSchemaElementName;
+import org.apache.torque.templates.transformer.om.DatabaseAttributeName;
+import org.apache.torque.templates.transformer.om.DatabaseChildElementName;
 import org.apache.torque.templates.transformer.om.mapInit.DatabaseMapInitTransformer;
 
 /**

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java?rev=1435917&r1=1435916&r2=1435917&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
Sun Jan 20 19:15:48 2013
@@ -29,6 +29,8 @@ import org.apache.torque.generator.sourc
 import org.apache.torque.templates.TemplateOptionName;
 import org.apache.torque.templates.TorqueSchemaAttributeName;
 import org.apache.torque.templates.TorqueSchemaElementName;
+import org.apache.torque.templates.transformer.IncludeSchemaTransformer;
+import org.apache.torque.templates.transformer.LoadExternalSchemaTransformer;
 import org.apache.torque.templates.transformer.om.mapInit.DatabaseMapInitTransformer;
 
 /**

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java?rev=1435917&r1=1435916&r2=1435917&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
Sun Jan 20 19:15:48 2013
@@ -34,9 +34,9 @@ import org.apache.torque.generator.sourc
 import org.apache.torque.templates.TemplateOptionName;
 import org.apache.torque.templates.TorqueSchemaAttributeName;
 import org.apache.torque.templates.TorqueSchemaElementName;
+import org.apache.torque.templates.transformer.LoadExternalSchemaTransformer;
 import org.apache.torque.templates.transformer.om.DatabaseAttributeName;
 import org.apache.torque.templates.transformer.om.DatabaseChildElementName;
-import org.apache.torque.templates.transformer.om.LoadExternalSchemaTransformer;
 import org.apache.torque.templates.transformer.om.OMTransformer;
 
 /**

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java?rev=1435917&r1=1435916&r2=1435917&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
Sun Jan 20 19:15:48 2013
@@ -37,8 +37,12 @@ import org.apache.torque.templates.Torqu
 import org.apache.torque.templates.platform.Platform;
 import org.apache.torque.templates.platform.PlatformFactory;
 import org.apache.torque.templates.transformer.CollectAttributeSetTrueTransformer;
+import org.apache.torque.templates.transformer.IncludeSchemaTransformer;
+import org.apache.torque.templates.transformer.LoadExternalSchemaTransformer;
 import org.apache.torque.templates.transformer.SchemaTypeHelper;
+import org.apache.torque.templates.transformer.om.DatabaseChildElementName;
 import org.apache.torque.templates.transformer.om.OMColumnTransformer;
+import org.apache.torque.templates.transformer.om.OMTransformer;
 import org.apache.torque.templates.transformer.om.TableChildElementName;
 import org.apache.torque.templates.typemapping.SchemaType;
 import org.apache.torque.templates.typemapping.SqlType;
@@ -50,21 +54,44 @@ import org.apache.torque.templates.typem
 public class SQLTransformer implements SourceTransformer
 {
     /** A CollectAttributeSetTrueTransformer instance. */
-    private final CollectAttributeSetTrueTransformer collectAttributeSetTrueTransformer
+    private static final CollectAttributeSetTrueTransformer collectAttributeSetTrueTransformer
             = new CollectAttributeSetTrueTransformer();
 
-    public SourceElement transform(
+    /**
+     * The transformer which loads the external schemata.
+     *
+     * @see LoadExternalSchemaTransformer
+     */
+    private static final SourceTransformer loadExternalSchemaTransformer
+            = new LoadExternalSchemaTransformer();
+
+    /**
+     * The transformer which includes the included schemata.
+     *
+     * @see LoadExternalSchemaTransformer
+     */
+    private static final SourceTransformer includeSchemaTransformer
+            = new IncludeSchemaTransformer();
+
+   public SourceElement transform(
             SourceElement databaseElement,
             ControllerState controllerState)
         throws SourceTransformerException
     {
-        TemplateOptionName.checkRequiredOptions(
+       OMTransformer.setRootDatabaseNameAttribute(databaseElement);
+       // include included schemata
+       includeSchemaTransformer.transform(databaseElement, controllerState);
+       // load referenced external schemata
+       loadExternalSchemaTransformer.transform(databaseElement, controllerState);
+
+       TemplateOptionName.checkRequiredOptions(
                 controllerState,
                 TemplateOptionName.DATABASE);
 
-        List<SourceElement> tableElements = databaseElement.getChildren(
-                TorqueSchemaElementName.TABLE.getName());
-        for (SourceElement tableElement : tableElements)
+       List<SourceElement> allTables
+               = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES)
+                   .getChildren(TorqueSchemaElementName.TABLE);
+        for (SourceElement tableElement : allTables)
         {
             transformTable(tableElement, controllerState);
         }
@@ -446,8 +473,10 @@ public class SQLTransformer implements S
             return;
         }
         List<String> databaseSchemaNames = new ArrayList<String>();
-        for (SourceElement tableElement
-                : databaseElement.getChildren(TorqueSchemaElementName.TABLE))
+        List<SourceElement> allTables
+                = databaseElement.getChild(DatabaseChildElementName.ALL_TABLES)
+                    .getChildren(TorqueSchemaElementName.TABLE);
+        for (SourceElement tableElement : allTables)
         {
             String name = (String)
                     tableElement.getAttribute(TorqueSchemaAttributeName.NAME);



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