db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1305157 - in /db/torque/torque4/trunk/torque-templates/src: main/java/org/apache/torque/templates/ main/java/org/apache/torque/templates/transformer/om/ main/java/org/apache/torque/templates/transformer/om/mapInit/ main/resources/org/apach...
Date Sun, 25 Mar 2012 21:44:52 GMT
Author: tfischer
Date: Sun Mar 25 21:44:51 2012
New Revision: 1305157

URL: http://svn.apache.org/viewvc?rev=1305157&view=rev
Log:
TORQUE-175: Implement generation of objects for views.
The multiplicity of tables in the schema was set to 0..unbounded because a schema can in principle only contain views.

Added:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java
      - copied, changed from r1296047, db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm
Removed:
    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/TorqueSchemaElementName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseChildElementName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
    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/DatabaseMapInitTableTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0-strict.xsd
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0.xsd
    db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaElementName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaElementName.java?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaElementName.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TorqueSchemaElementName.java Sun Mar 25 21:44:51 2012
@@ -34,6 +34,8 @@ public enum TorqueSchemaElementName impl
     EXTERNAL_SCHEMA("external-schema"),
     /** element table. */
     TABLE("table"),
+    /** element view. */
+    VIEW("view"),
     /** element column. */
     COLUMN("column"),
     /** element foreign-key. */

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseChildElementName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseChildElementName.java?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseChildElementName.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseChildElementName.java Sun Mar 25 21:44:51 2012
@@ -32,7 +32,13 @@ public enum DatabaseChildElementName imp
      * The element containing all known tables including those
      * loaded from an external schema.
      */
-    ALL_TABLES("all-tables");
+    ALL_TABLES("all-tables"),
+
+    /**
+     * The element containing all known views including those
+     * loaded from an external schema.
+     */
+    ALL_VIEWS("all-views");
 
     /** The name of the source element, not null. */
     private String name;

Modified: 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/om/LoadExternalSchemaTransformer.java?rev=1305157&r1=1305156&r2=1305157&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/om/LoadExternalSchemaTransformer.java Sun Mar 25 21:44:51 2012
@@ -97,6 +97,13 @@ public class LoadExternalSchemaTransform
             allTables = new SourceElement(DatabaseChildElementName.ALL_TABLES);
             root.getChildren().add(allTables);
         }
+        SourceElement allViews = root.getChild(
+                DatabaseChildElementName.ALL_VIEWS);
+        if (allViews == null)
+        {
+            allViews = new SourceElement(DatabaseChildElementName.ALL_VIEWS);
+            root.getChildren().add(allViews);
+        }
 
         String rootDatabaseName = (String) root.getAttribute(
                 DatabaseAttributeName.ROOT_DATABASE_NAME);
@@ -149,6 +156,13 @@ public class LoadExternalSchemaTransform
                 {
                     allTables.getChildren().add(externalTable);
                 }
+                // fill root's all-views with all external views
+                for (SourceElement externalView
+                        : externalAllTables.getChildren(
+                            TorqueSchemaElementName.VIEW))
+                {
+                    allViews.getChildren().add(externalView);
+                }
             }
             catch (SourceException e)
             {
@@ -164,6 +178,12 @@ public class LoadExternalSchemaTransform
         {
             allTables.getChildren().add(table);
         }
+        // add own views to root's all-views
+        for (SourceElement view
+                : root.getChildren(TorqueSchemaElementName.VIEW))
+        {
+            allViews.getChildren().add(view);
+        }
         return root;
     }
 }

Copied: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java (from r1296047, 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/OMTableAndViewTransformer.java?p2=db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java&p1=db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java&r1=1296047&r2=1305157&rev=1305157&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/OMTableAndViewTransformer.java Sun Mar 25 21:44:51 2012
@@ -37,9 +37,9 @@ import org.apache.torque.templates.Torqu
 import org.apache.torque.templates.transformer.CollectAttributeSetTrueTransformer;
 
 /**
- * Transforms the tables in the OM model.
+ * Transforms the tables and views in the OM model.
  */
-public class OMTableTransformer extends AttributeTransformer
+public class OMTableAndViewTransformer extends AttributeTransformer
 {
     /** The transformer for the column child elements. */
     private static OMColumnTransformer columnTransformer
@@ -61,10 +61,10 @@ public class OMTableTransformer extends 
     private static WrapReservedJavaWords reservedJavaWordsWrapper
             = new WrapReservedJavaWords();
 
-    public OMTableTransformer() throws SourceTransformerException
+    public OMTableAndViewTransformer() throws SourceTransformerException
     {
         super(new InputStreamReader(
-                OMTableTransformer.class.getResourceAsStream(
+                OMTableAndViewTransformer.class.getResourceAsStream(
                         "OMTableTransformer.properties")));
     }
 
@@ -125,7 +125,9 @@ public class OMTableTransformer extends 
     private void checkElementName(SourceElement tableElement)
     {
         if (!TorqueSchemaElementName.TABLE.getName().equals(
-                tableElement.getName()))
+                tableElement.getName())
+            && !TorqueSchemaElementName.VIEW.getName().equals(
+                    tableElement.getName()))
         {
             throw new IllegalArgumentException("Illegal element Name "
                     + tableElement.getName());

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=1305157&r1=1305156&r2=1305157&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 Mar 25 21:44:51 2012
@@ -19,6 +19,9 @@ package org.apache.torque.templates.tran
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.source.SourceElement;
 import org.apache.torque.generator.source.transform.SourceTransformer;
@@ -64,12 +67,12 @@ public class OMTransformer implements So
         = new OMForeignKeyTransformer();
 
     /**
-     * The transformer which adds transforms the table and column elements
+     * The transformer which adds transforms the table/view and column elements
      * of the schema.
      *
-     * @see OMTableTransformer
+     * @see OMTableAndViewTransformer
      */
-    private static final OMTableTransformer tableTransformer;
+    private static final OMTableAndViewTransformer tableOrViewTransformer;
 
     /**
      * The transformer which loads the external schemata.
@@ -83,7 +86,7 @@ public class OMTransformer implements So
     {
         try
         {
-            tableTransformer = new OMTableTransformer();
+            tableOrViewTransformer = new OMTableAndViewTransformer();
         }
         catch (SourceTransformerException e)
         {
@@ -114,28 +117,33 @@ public class OMTransformer implements So
         // load referenced external schemata
         loadExternalSchemaTransformer.transform(root, controllerState);
 
-        SourceElement allTablesRoot
-                = root.getChild(DatabaseChildElementName.ALL_TABLES);
-        for (SourceElement tableElement : allTablesRoot.getChildren(
-                TorqueSchemaElementName.TABLE))
+        List<SourceElement> allTablesAndViews = new ArrayList<SourceElement>();
+        allTablesAndViews.addAll(
+                root.getChild(DatabaseChildElementName.ALL_TABLES)
+                    .getChildren(TorqueSchemaElementName.TABLE));
+        allTablesAndViews.addAll(
+                root.getChild(DatabaseChildElementName.ALL_VIEWS)
+                    .getChildren(TorqueSchemaElementName.VIEW));
+
+        for (SourceElement tableOrViewElement : allTablesAndViews)
         {
-            tableTransformer.transform(
-                    tableElement,
+            tableOrViewTransformer.transform(
+                    tableOrViewElement,
                     controllerState);
         }
 
-        for (SourceElement tableElement : allTablesRoot.getChildren(
-                TorqueSchemaElementName.TABLE))
+        for (SourceElement tableOrViewElement : allTablesAndViews)
         {
-            for (SourceElement columnElement : tableElement.getChildren(
+            for (SourceElement columnElement : tableOrViewElement.getChildren(
                     TorqueSchemaElementName.COLUMN))
             {
                 foreignKeyColumnTransformer.transform(
                         columnElement,
                         controllerState);
             }
-            for (SourceElement foreignKeyElement : tableElement.getChildren(
-                    TorqueSchemaElementName.FOREIGN_KEY))
+            for (SourceElement foreignKeyElement
+                    : tableOrViewElement.getChildren(
+                        TorqueSchemaElementName.FOREIGN_KEY))
             {
                 foreignKeyTransformer.transform(
                         foreignKeyElement,
@@ -143,11 +151,11 @@ public class OMTransformer implements So
             }
         }
 
-        for (SourceElement tableElement : allTablesRoot.getChildren(
-                TorqueSchemaElementName.TABLE))
+        for (SourceElement tableOrViewElement : allTablesAndViews)
         {
-            for (SourceElement foreignKeyElement : tableElement.getChildren(
-                    TorqueSchemaElementName.FOREIGN_KEY))
+            for (SourceElement foreignKeyElement
+                    : tableOrViewElement.getChildren(
+                        TorqueSchemaElementName.FOREIGN_KEY))
             {
                 foreignKeyTransformer.transformSecondPass(
                         foreignKeyElement,

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java Sun Mar 25 21:44:51 2012
@@ -26,7 +26,7 @@ import org.apache.torque.generator.sourc
 import org.apache.torque.generator.source.transform.AttributeTransformer;
 import org.apache.torque.generator.source.transform.SourceTransformerException;
 import org.apache.torque.templates.TorqueSchemaElementName;
-import org.apache.torque.templates.transformer.om.OMTableTransformer;
+import org.apache.torque.templates.transformer.om.OMTableAndViewTransformer;
 
 /**
  * A transformer which sets attributes for the table elements
@@ -60,7 +60,7 @@ public class DatabaseMapInitTableTransfo
             throw new IllegalArgumentException("Illegal element Name "
                     + rootElement.getName());
         }
-        OMTableTransformer.setJavaNameAttribute(rootElement);
+        OMTableAndViewTransformer.setJavaNameAttribute(rootElement);
         super.transform(rootElement, controllerState);
         return rootElement;
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml Sun Mar 25 21:44:51 2012
@@ -59,6 +59,33 @@
     <outlet name="torque.om.dbObject"/>
   </output>
 
+  <output name="torque.om.dbObjectForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+           xsi:type="sourceElementAttributeAction"
+           element="."
+           attribute="dbObjectPackage"
+           acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action 
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="dbObjectClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.dbObject"/>
+  </output>
+
   <output name="torque.om.baseDbObject">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -85,6 +112,32 @@
     <outlet name="torque.om.baseDbObject"/>
   </output>
   
+  <output name="torque.om.baseDbObjectForView">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action 
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseDbObjectPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseDbObjectClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.baseDbObjectForView"/>
+  </output>
+  
   <output name="torque.om.inheritanceDbObject" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -112,6 +165,33 @@
     <outlet name="torque.om.inheritanceDbObject"/>
   </output>
   
+  <output name="torque.om.inheritanceDbObjectForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="package"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="className"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view/column/inheritance">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.inheritanceDbObject"/>
+  </output>
+  
   <output name="torque.om.interface" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -167,6 +247,33 @@
     <outlet name="torque.om.peer"/>
   </output>
 
+  <output name="torque.om.peerForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="peerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="peerClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.peer"/>
+  </output>
+
   <output name="torque.om.peer.impl" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -194,6 +301,33 @@
     <outlet name="torque.om.peer.impl"/>
   </output>
 
+  <output name="torque.om.peerForView.impl" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="peerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="peerImplClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.peer.impl"/>
+  </output>
+
   <output name="torque.om.basePeer">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -221,6 +355,33 @@
     <outlet name="torque.om.basePeer"/>
   </output>
 
+  <output name="torque.om.basePeerForView">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="basePeerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="basePeerClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.basePeerForView"/>
+  </output>
+
   <output name="torque.om.basePeer.impl">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -248,6 +409,33 @@
     <outlet name="torque.om.basePeer.impl"/>
   </output>
 
+  <output name="torque.om.basePeerForView.impl">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="basePeerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="basePeerImplClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.basePeerForView.impl"/>
+  </output>
+
   <output name="torque.om.mapBuilder">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -275,6 +463,33 @@
     <outlet name="torque.om.mapBuilder"/>
   </output>
 
+  <output name="torque.om.mapBuilderForView">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="mapBuilderPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="mapBuilderClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.mapBuilder"/>
+  </output>
+
   <output name="torque.om.recordMapper" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -302,6 +517,33 @@
     <outlet name="torque.om.recordmapper.recordMapper"/>
   </output>
 
+  <output name="torque.om.recordMapperForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="recordMapperPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="recordMapperClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.recordmapper.recordMapper"/>
+  </output>
+
   <output name="torque.om.baseRecordMapper">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -329,6 +571,33 @@
     <outlet name="torque.om.recordmapper.base.recordMapperBase"/>
   </output>
 
+  <output name="torque.om.baseRecordMapperForView">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseRecordMapperPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseRecordMapperClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.recordmapper.base.recordMapperBase"/>
+  </output>
+
   <output name="torque.om.bean" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -357,6 +626,34 @@
     <outlet name="torque.om.bean.bean"/>
   </output>
 
+  <output name="torque.om.beanForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="beanPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="beanClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view"
+        skipDecider="org.apache.torque.templates.skipdecider.BeanSkipDecider">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.bean.bean"/>
+  </output>
+
   <output name="torque.om.baseBean">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -385,6 +682,34 @@
     <outlet name="torque.om.bean.baseBean"/>
   </output>
   
+  <output name="torque.om.baseBeanForView">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseBeanPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseBeanClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view"
+        skipDecider="org.apache.torque.templates.skipdecider.BeanSkipDecider">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.bean.baseBean"/>
+  </output>
+  
   <output name="torque.om.inheritanceBean" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -413,6 +738,34 @@
     <outlet name="torque.om.inheritanceBean"/>
   </output>
   
+  <output name="torque.om.inheritanceBeanForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="beanPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="beanClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view/column/inheritance"
+        skipDecider="org.apache.torque.templates.skipdecider.BeanSkipDecider">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.inheritanceBean"/>
+  </output>
+  
   <output name="torque.om.mapInit" existingTargetStrategy="skip" outputDirKey="modifiable">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -496,6 +849,34 @@
     <outlet name="torque.om.manager.manager"/>
   </output>
 
+  <output name="torque.om.managerForView" existingTargetStrategy="skip" outputDirKey="modifiable">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="managerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="managerClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view" 
+        skipDecider="org.apache.torque.templates.skipdecider.ManagerSkipDecider">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.manager.manager"/>
+  </output>
+
   <!-- Base Manager class -->
   <output name="torque.om.baseManager">
     <filenameOutlet
@@ -524,5 +905,33 @@
     </source>
     <outlet name="torque.om.manager.baseManager"/>
   </output>
+
+  <output name="torque.om.baseManagerForView">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseManagerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseManagerClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <source xsi:type="fileSource" elements="database/all-views/view"
+        skipDecider="org.apache.torque.templates.skipdecider.ManagerSkipDecider">
+      <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
+      <include>*schema.xml</include>
+      <exclude>id-table-schema.xml</exclude>
+    </source>
+    <outlet name="torque.om.manager.baseManager"/>
+  </output>
 </control>
   
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml Sun Mar 25 21:44:51 2012
@@ -149,6 +149,80 @@
     <mergepoint name="extensions"/>
   </outlet>
 
+  <outlet name="torque.om.baseDbObjectForView"
+      xsi:type="velocityOutlet"
+      path="dbObject/base/baseDbObjectForView.vm">
+    <mergepoint name="imports" /><!-- extension -->
+    <mergepoint name="objectBeanImports">
+      <action xsi:type="applyAction" outlet="torque.om.dbObject.base.objectBeanImports"/>
+    </mergepoint>
+    <mergepoint name="classJavadoc">
+      <action xsi:type="applyAction" outlet="torque.om.dbObject.base.classJavadoc"/>
+    </mergepoint>
+    <mergepoint name="serialVersionUid">
+      <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
+    </mergepoint>
+    <mergepoint name="fieldDefinitions">
+      <action xsi:type="traverseAllAction"
+          element="column"
+          outlet="torque.om.fieldDefinition"/>
+    </mergepoint>
+    <mergepoint name="newModifiedFields">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.newModifiedFields"/>
+    </mergepoint>
+    <mergepoint name="loadingField">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.loadingField"/>
+    </mergepoint>
+    <mergepoint name="gettersSetters">
+      <action xsi:type="traverseAllAction"
+          element="column"
+          outlet="torque.om.getterSetter"/>
+    </mergepoint>
+    <mergepoint name="newModifiedMethods">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.newModifiedMethods"/>
+    </mergepoint>
+    <mergepoint name="loadingMethods">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.loadingMethods"/>
+    </mergepoint>
+    <mergepoint name="getByNameMethods">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.getByNameMethods"/>
+    </mergepoint>
+    <mergepoint name="primaryKeyMethods">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.primaryKeyMethods"/>
+    </mergepoint>
+     <mergepoint name="copyMethods">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.copyMethods"/>
+    </mergepoint>
+    <mergepoint name="peerGetter">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.peerGetter"/>
+    </mergepoint>
+    <mergepoint name="tableMapGetter">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.tableMapGetter"/>
+    </mergepoint>
+    <mergepoint name="objectBeanMethods">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.objectBeanMethods"/>
+    </mergepoint>
+    <mergepoint name="equalsHashCode">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.equalsHashCode"/>
+    </mergepoint>
+    <mergepoint name="toString">
+      <action xsi:type="applyAction"
+          outlet="torque.om.dbObject.base.toString"/>
+    </mergepoint>
+    <mergepoint name="extensions"/>
+  </outlet>
+
   <outlet name="torque.om.dbObject.base.objectBeanImports"
       xsi:type="velocityOutlet"
       path="dbObject/base/bean/objectBeanImports.vm">

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml Sun Mar 25 21:44:51 2012
@@ -143,6 +143,57 @@
     <mergepoint name="extensions" />
   </outlet>
 
+  <outlet name="torque.om.basePeerForView.impl"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/basePeerForViewImpl.vm">
+    <mergepoint name="imports">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.imports"/>
+    </mergepoint>
+    <mergepoint name="classJavadoc">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.classJavadoc"/>
+    </mergepoint>
+    <mergepoint name="log">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.log"/>
+    </mergepoint>
+    <mergepoint name="serialVersionUid">
+      <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
+    </mergepoint>
+    <mergepoint name="resultSet2Objects">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.resultSet2Objects"/>
+    </mergepoint>
+    <mergepoint name="addSelectColumns">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.addSelectColumns"/>
+    </mergepoint>
+    <mergepoint name="correctBooleans">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.correctBooleans"/>
+    </mergepoint>
+    <mergepoint name="doSelect">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doSelect"/>
+    </mergepoint>
+    <mergepoint name="getDbObjectInstance">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.getDbObjectInstance"/>
+    </mergepoint>
+    <mergepoint name="buildCriteria">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.buildCriteria"/>
+    </mergepoint>
+    <mergepoint name="buildSelectCriteria">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.buildSelectCriteria"/>
+    </mergepoint>
+    <mergepoint name="retrieveByPK">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.retrieveByPK"/>
+    </mergepoint>
+    <mergepoint name="retrieveByPKs">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.retrieveByPKs"/>
+    </mergepoint>
+    <mergepoint name="getTableMap">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.getTableMap"/>
+    </mergepoint>
+    <mergepoint name="setDbName">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.setDbName"/>
+    </mergepoint>
+    <mergepoint name="extensions" />
+  </outlet>
+
   <outlet name="torque.om.peer.impl.base.imports"
       xsi:type="velocityOutlet"
       path="peer/impl/base/imports.vm">
@@ -372,6 +423,83 @@
     <mergepoint name="extensions" />
   </outlet>
 
+  <outlet name="torque.om.basePeerForView"
+      xsi:type="velocityOutlet"
+      path="peer/base/basePeerForView.vm">
+    <mergepoint name="imports">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.imports"/>
+    </mergepoint>
+    <mergepoint name="classJavadoc">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.classJavadoc"/>
+    </mergepoint>
+    <mergepoint name="log">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.log"/>
+    </mergepoint>
+    <mergepoint name="serialVersionUid">
+      <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
+    </mergepoint>
+    <mergepoint name="tableDatabaseNameConstants">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.tableDatabaseNameConstants"/>
+    </mergepoint>
+    <mergepoint name="columnConstants">
+      <action xsi:type="traverseAllAction"
+          element="column"
+          outlet="torque.om.peer.base.columnConstant"/>
+    </mergepoint>
+    <mergepoint name="peerImplField">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplField"/>
+    </mergepoint>
+    <mergepoint name="staticInit">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.staticInit"/>
+    </mergepoint>
+    <mergepoint name="peerImplCreator">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplCreator"/>
+    </mergepoint>
+    <mergepoint name="peerImplGetter">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplGetter"/>
+    </mergepoint>
+    <mergepoint name="peerImplSetter">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplSetter"/>
+    </mergepoint>
+    <mergepoint name="numColumnConstant">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.numColumnConstant"/>
+    </mergepoint>
+    <mergepoint name="inheritanceClasskeyConstants">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.inheritanceClasskeyConstants"/>
+    </mergepoint>
+    <mergepoint name="resultSet2Objects">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.resultSet2Objects"/>
+    </mergepoint>
+    <mergepoint name="addSelectColumns">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.addSelectColumns"/>
+    </mergepoint>
+    <mergepoint name="correctBooleans">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.correctBooleans"/>
+    </mergepoint>
+    <mergepoint name="doSelect">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.doSelect"/>
+    </mergepoint>
+    <mergepoint name="getDbObjectInstance">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.getDbObjectInstance"/>
+    </mergepoint>
+    <mergepoint name="buildCriteria">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.buildCriteria"/>
+    </mergepoint>
+    <mergepoint name="buildSelectCriteria">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.buildSelectCriteria"/>
+    </mergepoint>
+    <mergepoint name="retrieveByPK">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.retrieveByPK"/>
+    </mergepoint>
+    <mergepoint name="retrieveByPKs">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.retrieveByPKs"/>
+    </mergepoint>
+    <mergepoint name="getTableMap">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.getTableMap"/>
+    </mergepoint>
+    <mergepoint name="extensions" />
+  </outlet>
+
   <outlet name="torque.om.peer.base.imports"
       xsi:type="velocityOutlet"
       path="peer/base/imports.vm">

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm?rev=1305157&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/baseDbObjectForView.vm Sun Mar 25 21:44:51 2012
@@ -0,0 +1,130 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## This template creates source code for a base Database object.
+## The generated code contains the table-specific functionality of a database 
+## object. 
+## The template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+package $baseDbObjectPackage;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+#if ($torqueGen.booleanOption("torque.addIntakeRetrievable"))
+import $torqueGen.option("torque.retrievableInterface");
+#end
+#if (!$torqueGen.booleanOption("torque.om.complexObjectModel"))
+import org.apache.torque.Torque;
+#end
+import org.apache.torque.TorqueException;
+import org.apache.torque.map.TableMap;
+import org.apache.torque.om.ComboKey;
+import org.apache.torque.om.DateKey;
+import org.apache.torque.om.NumberKey;
+import org.apache.torque.om.ObjectKey;
+import org.apache.torque.om.SimpleKey;
+import org.apache.torque.om.StringKey;
+import org.apache.torque.om.BooleanKey;
+#if ($addSaveMethods == true && $saveMethodsInDbObjects == "true")
+import org.apache.torque.om.Persistent;
+#end
+#if ($torqueGen.booleanOption("torque.om.addGetByNameMethods"))
+import org.apache.torque.om.ColumnAccessByName;
+#end##
+import $torqueGen.option("torque.om.criteriaClass");
+#if ($addSaveMethods == true && $saveMethodsInDbObjects == "true")
+import org.apache.torque.util.Transaction;
+#end
+import org.apache.commons.lang.ObjectUtils;
+
+
+#if ($complexObjectModel)
+#foreach ($col in $table.Columns)
+ #if ($col.isForeignKey())
+  #set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
+  #if ($tblFK.Interface && $tblFK.Interface.indexOf('.') != -1)
+import $tblFK.Interface;
+  #end
+ #end
+#end
+#end
+$torqueGen.mergepoint("imports")##
+#if ($torqueGen.booleanOption("torque.om.generateBeans"))
+$torqueGen.mergepoint("objectBeanImports")
+#end
+#if ($peerPackage != $dbObjectPackage)
+import ${peerPackage}.${peerClassName};
+#end
+$torqueGen.mergepoint("classJavadoc")
+#if ($baseClass == "")
+  #set ($extendsBaseClass = "" )
+#else
+  #set ($extendsBaseClass = "extends $baseClass" )
+#end
+public abstract class $baseDbObjectClassName $extendsBaseClass
+    implements ##
+#if ($torqueGen.booleanOption("torque.om.save.addSaveMethodsInDbObjects"))
+Persistent, ##
+#end
+Serializable##
+#if ($torqueGen.booleanOption("torque.om.addIntakeRetrievable")), $torqueGen.option("torque.om.retrievableInterface")#end##
+#if ($torqueGen.booleanOption("torque.om.addGetByNameMethods")), ColumnAccessByName#end##
+
+{
+$torqueGen.mergepoint("serialVersionUid")
+
+## field definitions for columns
+$torqueGen.mergepoint("fieldDefinitions")##
+$torqueGen.mergepoint("newModifiedFields")##
+#if ($torqueGen.booleanOption("torque.om.trackLoading"))
+$torqueGen.mergepoint("loadingField")##
+#end
+
+## getters and setters for member variables for columns 
+$torqueGen.mergepoint("gettersSetters")
+$torqueGen.mergepoint("newModifiedMethods")
+#if ($trackLoading == "true")
+$torqueGen.mergepoint("loadingMethods")
+#end
+#if ($addGetByNameMethods == "true")
+$torqueGen.mergepoint("getByNameMethods")
+#end
+
+$torqueGen.mergepoint("primaryKeyMethods")
+$torqueGen.mergepoint("foreignKeyGetters")
+$torqueGen.mergepoint("copyMethods")
+$torqueGen.mergepoint("peerGetter")
+$torqueGen.mergepoint("tableMapGetter")
+
+#if ($torqueGen.booleanOption("torque.om.generateBeans"))
+$torqueGen.mergepoint("objectBeanMethods")
+#end
+
+$torqueGen.mergepoint("toString")
+$torqueGen.mergepoint("equalsHashCode")
+$torqueGen.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm?rev=1305157&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm Sun Mar 25 21:44:51 2012
@@ -0,0 +1,63 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the base peer class.
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.  
+##
+package ${basePeerPackage};
+
+$torqueGen.mergepoint("imports")
+
+$torqueGen.mergepoint("classJavadoc")
+public abstract class $basePeerClassName
+#if ( ${basePeerBaseClass} && (${basePeerBaseClass} != "") )
+    extends ${basePeerBaseClass}
+#end
+{
+$torqueGen.mergepoint("log")
+$torqueGen.mergepoint("serialVersionUid")
+$torqueGen.mergepoint("tableDatabaseNameConstants")
+$torqueGen.mergepoint("columnConstants")
+$torqueGen.mergepoint("numColumnConstant")
+$torqueGen.mergepoint("inheritanceClasskeyConstants")
+$torqueGen.mergepoint("peerImplField")
+$torqueGen.mergepoint("staticInit")
+$torqueGen.mergepoint("peerImplCreator")
+$torqueGen.mergepoint("peerImplGetter")
+$torqueGen.mergepoint("peerImplSetter")
+$torqueGen.mergepoint("resultSet2Objects")
+$torqueGen.mergepoint("addSelectColumns")
+$torqueGen.mergepoint("correctBooleans")
+$torqueGen.mergepoint("doSelect")
+$torqueGen.mergepoint("getDbObjectInstance")
+$torqueGen.mergepoint("buildCriteria")
+$torqueGen.mergepoint("buildSelectCriteria")
+$torqueGen.mergepoint("buildColumnValues")
+$torqueGen.mergepoint("retrieveByPK")
+$torqueGen.mergepoint("retrieveByPKs")
+$torqueGen.mergepoint("getTableMap")
+$torqueGen.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm?rev=1305157&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm Sun Mar 25 21:44:51 2012
@@ -0,0 +1,74 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the base peer class.
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.  
+##
+package ${basePeerPackage};
+
+$torqueGen.mergepoint("imports")
+
+$torqueGen.mergepoint("classJavadoc")
+public abstract class $basePeerImplClassName
+#if (${basePeerImplBaseClass} && ${basePeerImplBaseClass} !="")
+    extends ${basePeerImplBaseClass}
+#end
+{
+$torqueGen.mergepoint("log")
+
+$torqueGen.mergepoint("serialVersionUid")
+
+$torqueGen.mergepoint("resultSet2Objects")
+$torqueGen.mergepoint("addSelectColumns")
+$torqueGen.mergepoint("correctBooleans")
+$torqueGen.mergepoint("doSelect")
+$torqueGen.mergepoint("getDbObjectInstance")
+$torqueGen.mergepoint("doInsert")
+$torqueGen.mergepoint("doUpdate")
+#if ($addSaveMethods == "true" && $saveMethodsInDbObjects != "true")
+$torqueGen.mergepoint("saveMethods")
+#end
+$torqueGen.mergepoint("doDelete")
+$torqueGen.mergepoint("buildCriteria")
+$torqueGen.mergepoint("buildSelectCriteria")
+$torqueGen.mergepoint("buildColumnValues")
+$torqueGen.mergepoint("retrieveByPK")
+$torqueGen.mergepoint("retrieveByPKs")
+#if ($complexObjectModel == "true")
+  #if (($objectIsCaching == "true") && $torqueGen.booleanOption("torque.om.complexObjectModel.generateDoSelectJoin"))
+$torqueGen.mergepoint("doSelectJoin")
+$torqueGen.mergepoint("doSelectJoinAllExcept")
+  #end
+  #if (($objectIsCaching == "true") && $torqueGen.booleanOption("torque.om.complexObjectModel.generateFillers"))
+$torqueGen.mergepoint("fillReferencedObjects")
+$torqueGen.mergepoint("fillReferencingObjects")
+$torqueGen.mergepoint("fillerChunkSizeGetter")
+  #end
+#end
+$torqueGen.mergepoint("getTableMap")
+$torqueGen.mergepoint("setDbName")
+$torqueGen.mergepoint("extensions")
+}

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0-strict.xsd
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0-strict.xsd?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0-strict.xsd (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0-strict.xsd Sun Mar 25 21:44:51 2012
@@ -74,6 +74,17 @@ as compared to the standard database.xsd
         <xs:pattern value="[A-Za-z$#][A-Za-z_$#0-9]*" />
       </xs:restriction>
     </xs:simpleType>
+
+    <xs:simpleType name="sqlQualifiedNameType">
+      <xs:annotation>
+        <xs:documentation xml:lang="en">
+  SQL Standard non-delimited identifiers.
+        </xs:documentation>
+      </xs:annotation>
+      <xs:restriction base="sqlQualifiedNameType">
+        <xs:pattern value="[A-Za-z$#][A-Za-z_$#0-9]*\.?[A-Za-z$#][A-Za-z_$#0-9]*" />
+      </xs:restriction>
+    </xs:simpleType>
   </xs:redefine>
 
 </xs:schema>
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0.xsd
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0.xsd?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0.xsd (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/xsd/database-4-0.xsd Sun Mar 25 21:44:51 2012
@@ -88,11 +88,11 @@ Domains are used to define common attrib
           </xs:documentation>
         </xs:annotation>
       </xs:element>
-      <xs:element name="table" type="tableType" minOccurs="1"
+      <xs:element name="table" type="tableType" minOccurs="0"
                   maxOccurs="unbounded" >
         <xs:annotation>
           <xs:documentation xml:lang="en">
-Define table with its relevant attributes.
+Defines a database table.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
@@ -100,7 +100,7 @@ Define table with its relevant attribute
                   maxOccurs="unbounded" >
         <xs:annotation>
           <xs:documentation xml:lang="en">
-Define table with its relevant attributes.
+Defines a database view.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
@@ -919,7 +919,7 @@ The domain reference name to set common 
         </xs:documentation>
       </xs:annotation>
     </xs:attribute>
-    <xs:attribute name="select" type="sqlNameType" use="required" >
+    <xs:attribute name="select" type="sqlQualifiedNameType" use="required" >
       <xs:annotation>
         <xs:documentation xml:lang="en">
 The sql snippet which contains the value to select.
@@ -1054,4 +1054,13 @@ SQL Standard non-delimited identifiers.
     <xs:restriction base="xs:string" />
   </xs:simpleType>
 
+  <xs:simpleType name="sqlQualifiedNameType">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+SQL Standard non-delimited identifiers.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:restriction base="xs:string" />
+  </xs:simpleType>
+
 </xs:schema>
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml?rev=1305157&r1=1305156&r2=1305157&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml Sun Mar 25 21:44:51 2012
@@ -30,7 +30,7 @@
   <!-- A  T A B L E                                        -->
   <!-- =================================================== -->
 
-  <!-- table name="a" description="A table">
+  <table name="a" description="A table">
     <column
       name="a_id"
       required="true"
@@ -44,13 +44,13 @@
       size="50"
     />
 
-  </table-->
+  </table>
 
   <!-- =================================================== -->
   <!-- B  T A B L E                                        -->
   <!-- =================================================== -->
 
-  <!-- table name="b" description="B table">
+  <table name="b" description="B table">
     <column
       name="b_id"
       required="true"
@@ -64,14 +64,14 @@
       size="50"
     />
 
-  </table-->
+  </table>
 
 
   <!-- =================================================== -->
   <!-- AB  T A B L E                                       -->
   <!-- =================================================== -->
 
-  <!-- table name="r_ab" description="r_ab table" idMethod="none">
+  <table name="r_ab" description="r_ab table" idMethod="none">
     <column
       name="a_id"
       required="true"
@@ -99,13 +99,13 @@
       <reference local="b_id" foreign="b_id"/>
     </foreign-key>
 
-  </table-->
+  </table>
 
   <!-- =================================================== -->
   <!-- C  T A B L E                                       -->
   <!-- =================================================== -->
 
-  <!-- table name="c" description="c table contains fk to ar_ab, a and b">
+  <table name="c" description="c table contains fk to ar_ab, a and b">
     <column
       name="c_id"
       required="true"
@@ -158,14 +158,14 @@
         <reference local="a_id" foreign="a_id"/>
         <reference local="b_id" foreign="b_id"/>
     </foreign-key>
-  </table-->
+  </table>
 
 
   <!-- =================================================== -->
   <!-- N O P K  T A B L E                                  -->
   <!-- =================================================== -->
 
-  <!-- table name="nopk" idMethod="none" description="this table has no pk">
+  <table name="nopk" idMethod="none" description="this table has no pk">
     <column
       name="intcol"
       type="INTEGER"
@@ -188,13 +188,13 @@
       <reference foreign="COL1" local="PARENT_COL1"/>
       <reference foreign="COL2" local="PARENT_COL2"/>
     </foreign-key>
-  </table-->
+  </table>
 
   <!-- =================================================== -->
   <!-- T A B L E  W I T H  I N T E R F A C E               -->
   <!-- =================================================== -->
 
-  <!-- table name="ifc_table" idMethod="none"
+  <table name="ifc_table" idMethod="none"
   	interface="org.apache.torque.TestInterface"
   	description="this table implements an interface">
     <column
@@ -222,13 +222,13 @@
       type="VARCHAR"
       size="50"
     />
-  </table-->
+  </table>
   
   <!-- =================================================== -->
   <!-- T A B L E  W I T H  I N H E R I T A N C E           -->
   <!-- =================================================== -->
 
-  <!-- table name="INHERITANCE_TEST" description="Table to test inheritance">
+  <table name="INHERITANCE_TEST" description="Table to test inheritance">
     <column
       name="INHERITANCE_TEST"
       required="true"
@@ -278,7 +278,7 @@
       type="VARCHAR"
       size="100"
     />
-  </table-->
+  </table>
   
   <!-- =================================================== -->
   <!-- E X T E R N A L   S C H E M A                       -->
@@ -307,5 +307,15 @@
     </foreign-key>
   </table>
   
+  <!-- =================================================== -->
+  <!-- V I E W                                             -->
+  <!-- =================================================== -->
+
+  <view name="a_b" sqlSuffix="from a join r_ab on a.a_id=r_ab.a_id join b on r_ab.b_id=b.b_id">
+    <column name="a_id" type="INTEGER" select="a.a_id"/>
+    <column name="a_name" type="VARCHAR" select="a.name"/>
+    <column name="b_id" type="INTEGER" select="b.b_id"/>
+    <column name="b_name" type="VARCHAR" select="b.name"/>
+  </view>
 
 </database>



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