db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1377412 - in /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om: outlets/ templates/peer/base/ templates/peer/impl/base/
Date Sun, 26 Aug 2012 10:31:01 GMT
Author: tfischer
Date: Sun Aug 26 10:31:00 2012
New Revision: 1377412

URL: http://svn.apache.org/viewvc?rev=1377412&view=rev
Log:
Torque-220: Make default constructor of PeerImpl work without additional setters

Added:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/constructor.vm
Modified:
    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/om/templates/peer/base/peerImplCreator.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.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=1377412&r1=1377411&r2=1377412&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 Aug 26 10:31:00 2012
@@ -70,6 +70,9 @@
     <mergepoint name="serialVersionUid">
       <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
     </mergepoint>
+    <mergepoint name="constructor">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.constructor"/>
+    </mergepoint>
     <mergepoint name="doInsert">
       <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doInsert"/>
     </mergepoint>
@@ -143,6 +146,9 @@
     <mergepoint name="serialVersionUid">
       <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
     </mergepoint>
+    <mergepoint name="constructor">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.constructor"/>
+    </mergepoint>
     <mergepoint name="doSelect">
       <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doSelect"/>
     </mergepoint>
@@ -179,6 +185,11 @@
       path="peer/impl/base/log.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.impl.base.constructor"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/constructor.vm">
+  </outlet>
+
   <outlet name="torque.om.peer.impl.base.doInsert"
       xsi:type="velocityOutlet"
       path="peer/impl/base/doInsert.vm">

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm?rev=1377412&r1=1377411&r2=1377412&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm
Sun Aug 26 10:31:00 2012
@@ -33,10 +33,6 @@
     protected static ${peerImplClassName} create${peerImplClassName}()
     {
         ${peerImplClassName} instance = new ${peerImplClassName}();
-        instance.setRecordMapper(new $recordMapperClassName());
-        instance.setTableMap(${peerClassName}.TABLE);
-        instance.setDatabaseName(${peerClassName}.DATABASE_NAME);
-        
         return instance;
     }
 

Modified: 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=1377412&r1=1377411&r2=1377412&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerForViewImpl.vm
Sun Aug 26 10:31:00 2012
@@ -41,6 +41,7 @@ $torqueGen.mergepoint("log")
 
 $torqueGen.mergepoint("serialVersionUid")
 
+$torqueGen.mergepoint("constructor")
 $torqueGen.mergepoint("doSelect")
 $torqueGen.mergepoint("getDbObjectInstance")
 $torqueGen.mergepoint("doInsert")

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.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/basePeerImpl.vm?rev=1377412&r1=1377411&r2=1377412&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm
Sun Aug 26 10:31:00 2012
@@ -41,6 +41,7 @@ $torqueGen.mergepoint("log")
 
 $torqueGen.mergepoint("serialVersionUid")
 
+$torqueGen.mergepoint("constructor")
 $torqueGen.mergepoint("doSelect")
 $torqueGen.mergepoint("getDbObjectInstance")
 $torqueGen.mergepoint("doInsert")

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/constructor.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/constructor.vm?rev=1377412&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/constructor.vm
(added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/constructor.vm
Sun Aug 26 10:31:00 2012
@@ -0,0 +1,56 @@
+## 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: imports.vm 1374905 2012-08-20 03:24:18Z tfischer $
+##
+## Generates the constructor for the base peer impl 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.  
+##
+    /**
+     * Constructor.
+     * The recordMapper, tableMap and databaseName fields are correctly
+     * initialized.
+     */
+    public ${basePeerImplClassName}()
+    {
+        setRecordMapper(new $recordMapperClassName());
+        setTableMap(${peerClassName}.TABLE);
+        setDatabaseName(${peerClassName}.DATABASE_NAME);
+    }
+
+    /**
+     * Constructor providing the objects to be injected as parameters.
+     *
+     * @param recordMapper a record mapper to map JDBC result sets to objects
+     * @param tableMap the default table map
+     * @param databaseName the name of the database
+     */
+    public ${basePeerImplClassName}(
+            RecordMapper<${dbObjectClassName}> recordMapper, 
+            TableMap tableMap,
+            String databaseName)
+    {
+        super(recordMapper, tableMap, databaseName);
+    }
+

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.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/imports.vm?rev=1377412&r1=1377411&r2=1377412&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm
Sun Aug 26 10:31:00 2012
@@ -69,6 +69,7 @@ import org.apache.torque.om.StringKey;
 import org.apache.torque.om.ObjectKey;
 import org.apache.torque.om.SimpleKey;
 import org.apache.torque.om.ComboKey;
+import org.apache.torque.map.TableMap;
 import org.apache.torque.util.BasePeer;
 import org.apache.torque.util.Transaction;
 import org.apache.torque.util.ColumnValues;



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