db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r910600 [26/29] - in /db/torque/torque4/trunk: maven-torque-gf-plugin/ maven-torque-gf-plugin/src/ maven-torque-gf-plugin/src/main/ maven-torque-gf-plugin/src/main/java/ maven-torque-gf-plugin/src/main/java/org/ maven-torque-gf-plugin/src/m...
Date Tue, 16 Feb 2010 17:16:02 GMT
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/dbObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/dbObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/dbObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/dbObject.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,49 @@
+## 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 Database object. 
+## The generated code is intended to be modified by the user. 
+## The template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+#if ($interface)
+  #set ($interface = ", $interface")
+#else
+  #set ($interface = "")
+#end
+package $dbObjectPackage;
+
+#if ($abstract == "true")
+  #set ($abstract = "abstract")
+#else
+  #set ($abstract = "")
+#end
+
+import org.apache.torque.om.Persistent;
+
+$torqueGf.mergepoint("classJavadoc")
+public $abstract class $dbObjectClassName
+    extends ${baseDbObjectPackage}.${baseDbObjectClassName}
+    implements Persistent$interface
+{
+$torqueGf.mergepoint("serialVersionUid")
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/classJavadoc.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,36 @@
+## 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 class javadoc for a inheritance db object. 
+## This template expects as input a "/table/column/inheritance" element
+## from the torque schema which was processed by the OMTransformer.  
+##
+/**
+#if ($torqueGf.booleanOption("torque.om.addTimeStamp"))
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [${torqueGf.now()}]
+ *
+#end
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/inheritanceDbObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/inheritanceDbObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/inheritanceDbObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/inheritance/inheritanceDbObject.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,42 @@
+## 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 a inheritance db object. 
+## This template expects as input a "/table/column/inheritance" element
+## from the torque schema which was processed by the OMTransformer.  
+##
+package $package;
+
+$torqueGf.mergepoint("classJavadoc")
+public class $className extends $extends
+{
+$torqueGf.mergepoint("serialVersionUid")
+    public ${className}()
+    {
+#set ( $columnElement = $torqueGf.getParent() )
+#set ( $tableElement = $columnElement.getParent() )
+#set ( $setter = $columnElement.getAttribute("setter") )
+#set ( $peerClassName = $tableElement.getAttribute("peerClassName") )
+#set ( $peerPackage = $tableElement.getAttribute("peerPackage") )
+        ${setter}(${peerPackage}.${peerClassName}.${classkeyConstant});
+    }
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/fieldDefinition.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/fieldDefinition.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/fieldDefinition.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/fieldDefinition.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,35 @@
+## 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 generates the definition for a field (= member variable) of 
+## a java class. It expects to be executed on a source element with the 
+## field attributes set (as defined in the JavaFieldAttributeName enum). 
+##
+#if ($description)
+    /** $description */
+#else
+    /** Defines the $field field. */
+#end
+#if (!$fieldAccessModifier)
+  #set ( $fieldAccessModifier = "private" )
+#end
+    $fieldAccessModifier $fieldType $field#if($defaultValue) = $defaultValue#end;
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getter.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getter.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,44 @@
+## 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 generates a getter method for a member field.
+## It expects to be executed on a source element with the 
+## field attributes set (as defined in the JavaFieldAttributeName enum). 
+##
+#if (!$getterThrows)
+  #set ( $getterThrows = "" )
+#else
+  #set ( $getterThrows = " throws $getterThrows" )
+#end
+    /**
+     * Get the value of ${field}.
+#if ($description)
+     * The field is described as follows: 
+     * $description
+#end
+     *
+     * @return $fieldType
+     */
+    $getterAccessModifer $fieldType ${getter}()$getterThrows 
+    {
+        $torqueGf.mergepoint("methodStart")
+        return $field;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getterSetter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getterSetter.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getterSetter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/getterSetter.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,27 @@
+## 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 generates a getter and a setter for a member field.
+## It expects to be executed on a source element with the 
+## field attributes set (as defined in the JavaFieldAttributeName enum). 
+##
+$torqueGf.mergepoint("getter")
+$torqueGf.mergepoint("setter")

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/serialVersionUid.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/serialVersionUid.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/serialVersionUid.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/serialVersionUid.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,30 @@
+## 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 generates a serialVersionUID field from the
+## time stamp at generation time, if the option torque.om:addTimeStamp
+## is set to true.
+##
+#if ($torqueGf.booleanOption("torque.om.addTimeStamp"))
+    /** Serial version */
+    private static final long serialVersionUID = ${torqueGf.now().Time}L;
+
+#end
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setter.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setter.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,49 @@
+## 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 generates a setter method for a field.
+## It expects to be executed on a source element with the 
+## field attributes set (as defined in the JavaFieldAttributeName enum). 
+##
+#if (!$setterThrows)
+  #set ( $setterThrows = "" )
+#else
+  #set ( $setterThrows = " throws $setterThrows" )
+#end
+    /**
+     * Set the value of ${field}.
+#if ($description)
+     * The field is described as follows: 
+     * $description
+#end
+     *
+     * @param v new value
+#if ($setterThrows != "")
+     * @${setterThrows.substring(1)}
+#end
+     */
+    $setterAccessModifer void ${setter}($fieldType v)$setterThrows
+    {
+$torqueGf.mergepoint("methodStart")
+        this.$field = v;
+$torqueGf.mergepoint("methodEnd")
+    }
+    
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm Tue Feb 16 17:15:43 2010
@@ -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 $
+##
+## This template creates additional code for updating referenced or referencing
+## objects in the setter method for a field representing a table column.
+## The template expects as input a "column" element from the torque schema, 
+## which was processed by the OMTransformer.  
+##
+#if ($torqueGf.option("torque.om.complexObjectModel"))
+  ##
+  ## set referenced object(s) to null if the id has changed
+  ## 
+  #set ( $referencedColumns = $torqueGf.getChildren("referenced-column") )
+  #foreach ($referencedColumnElement in $referencedColumns)
+    #set ( $foreignKeyElement = $referencedColumnElement.getChild("foreign-key") )
+    #set ( $foreignColumnElement = $referencedColumnElement.getChild("column") )
+    #set ( $foreignColumnGetter = $foreignColumnElement.getAttribute("getter") )
+    #set ( $localFieldElement = $foreignKeyElement.getChild("local-field") )
+    #set ( $localReferenceFieldName = $localFieldElement.getAttribute("field") )
+    #if ($foreignColumnElement.getAttribute("primitive") == "true")
+        if ($localReferenceFieldName != null && ${localReferenceFieldName}.${foreignColumnGetter}() != v)
+    #else
+        if ($localReferenceFieldName != null && !org.apache.commons.lang.ObjectUtils.equals(${localReferenceFieldName}.${foreignColumnGetter}(), v))
+    #end
+        {
+            $localReferenceFieldName = null;
+        }
+  #end
+
+  ##
+  ## update the id in referencing object(s)
+  ## 
+  #if ($torqueGf.option("torque.om.objectIsCaching"))
+    #set ( $referencingColumns = $torqueGf.getChildren("referencing-column") )
+    #foreach ($referencingColumnElement in $referencingColumns)
+      ## the column on the foreign table
+      #set ( $foreignColumnElement = $referencingColumnElement.getChild("column") )
+      #set ( $foreignSetterName = $foreignColumnElement.getAttribute("setter") )
+      ## the foreign key defining the relation (the "foreign" side of the relation points to the current table)
+      #set ( $foreignKeyElement = $referencingColumnElement.getChild("foreign-key") )
+      ## the field representing the foreign table objects in the current object
+      #set ( $fieldElement = $foreignKeyElement.getChild("foreign-field") )
+      #set ( $fieldName = $fieldElement.getAttribute("field") )
+      #set ( $fieldContainedType = $fieldElement.getAttribute("fieldContainedType") )
+        // update associated objects in $fieldName 
+        if ($fieldName != null)
+        {
+            for (int i = 0; i < ${fieldName}.size(); i++)
+            {
+                ((${fieldContainedType}) ${fieldName}.get(i))
+                        .${foreignSetterName}(v);
+            }
+        }
+    #end
+  #end
+#end

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodStart.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodStart.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodStart.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodStart.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,36 @@
+## 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 additional code for tracking whether the object was
+## modified in the setter method for a field representing a table column.
+## The template expects as input a "column" element from the torque schema, 
+## which was processed by the OMTransformer.  
+##
+#if ($torqueGf.booleanOption("torque.om.trackModified"))
+  #if ($primitive)
+        if (this.$field != v)
+  #else
+        if (!ObjectUtils.equals(this.$field, v))
+  #end
+        {
+            setModified(true);
+        }
+#end

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterReferencedObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterReferencedObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterReferencedObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterReferencedObject.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,62 @@
+## 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 the setter method in the object for the "local" part
+## of a foreign key. The object in the field represents the "foreign" part
+## of the foreign key.  
+## The template expects as input a "local-field" element inside a 
+## "foreign-key" element from the torque schema, which was generated 
+## by the OMTransformer.  
+##
+#if (!$setterThrows)
+  #set ( $setterThrows = "" )
+#else
+  #set ( $setterThrows = " throws $setterThrows" )
+#end
+    /**
+     * Declares an association between this object and a $fieldType object
+     *
+     * @param v $fieldType
+#if ($setterThrows != "")
+     * @${setterThrows.substring(1)}
+#end
+     */
+    public void ${setter}($fieldType v)$setterThrows
+    {
+#set ( $foreignKeyElement = $torqueGf.getParent() )
+#set ( $referenceElements = $foreignKeyElement.getChildren("reference") )
+#foreach ( $referenceElement in $referenceElements )
+  #set ( $localColumnElement = $referenceElement.getChild("local-column").getChild("column") )
+  #set ( $localColumnSetter = $localColumnElement.getAttribute("setter") )
+  #set ( $localColumnDefaultValue = $localColumnElement.getAttribute("defaultValue") )
+  #set ( $foreignColumnElement = $referenceElement.getChild("foreign-column").getChild("column") )
+  #set ( $foreignColumnGetter = $foreignColumnElement.getAttribute("getter") )
+        if (v == null)
+        {
+            ${localColumnSetter}(${localColumnDefaultValue});
+        }
+        else
+        {
+            ${localColumnSetter}(v.${foreignColumnGetter}());
+        }
+    #end
+        $field = v;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/interface/interface.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/interface/interface.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/interface/interface.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/interface/interface.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,47 @@
+## 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 Interface for a Database object. 
+## The generated code is intended to be modified by the user. 
+## The template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+
+package ${dbObjectPackage};
+
+/**
+#if ($description)
+ * $description
+ *
+#end
+ * This is an interface that should be filled with the public api of the
+ * $dbObjectClassName objects.
+ * The skeleton for this class was autogenerated by Torque #if ($torqueGf.booleanOption("torque.om.addTimeStamp"))on:
+ *
+ * [${torqueGf.now()}]
+ * #end
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+public interface ${interface}
+{
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,344 @@
+## 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 manager class. 
+## This template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+package ${baseManagerPackage};
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.torque.Torque;
+import org.apache.torque.TorqueException;
+import org.apache.torque.manager.AbstractBaseManager;
+import org.apache.torque.manager.CacheListener;
+import org.apache.torque.manager.MethodResultCache;
+import org.apache.torque.om.ObjectKey;
+import org.apache.torque.om.SimpleKey;
+import org.apache.torque.om.Persistent;
+import org.apache.torque.util.Criteria;
+
+#if ($baseManagerPackage != $managerPackage)
+import ${managerPackage}.${managerClassName};
+#end
+#if ($baseManagerPackage != $peerPackage)
+import ${peerPackage}.${peerClassName};
+#end
+#if ($baseManagerPackage != $dbObjectPackage)
+import ${dbObjectPackage}.${dbObjectClassName};
+#end
+
+$torqueGf.mergepoint("classJavadoc")
+public abstract class ${baseManagerClassName}
+    extends AbstractBaseManager
+{
+$torqueGf.mergepoint("serialVersionUid")
+    /** The name of the manager */
+    protected static final String MANAGED_CLASS = "${dbObjectPackage}.${dbObjectClassName}";
+   
+    /** The name of our class to pass to Torque as the default manager. */
+    protected static final String DEFAULT_MANAGER_CLASS
+        = "${managerPackage}.${managerClassName}";
+
+    /**
+     * Retrieves an implementation of the manager, based on the settings in
+     * the configuration.
+     *
+     * @return an implementation of ${managerClassName}.
+     */
+    public static ${managerClassName} getManager()
+    {
+        return (${managerClassName})
+            Torque.getManager(${baseManagerClassName}.MANAGED_CLASS,
+                ${baseManagerClassName}.DEFAULT_MANAGER_CLASS);
+    }
+
+    /**
+     * Static accessor for the @see #getInstanceImpl().
+     *
+     * @return a <code>${dbObjectClassName}</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static ${dbObjectClassName} getInstance()
+        throws TorqueException
+    {
+        return getManager().getInstanceImpl();
+    }
+
+    /**
+     * Static accessor for the @see #getInstanceImpl(ObjectKey).
+     *
+     * @param id an <code>ObjectKey</code> value
+     * @return a <code>${dbObjectClassName}</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static ${dbObjectClassName} getInstance(ObjectKey id)
+        throws TorqueException
+    {
+        return getManager().getInstanceImpl(id);
+    }
+
+    /**
+     * Static accessor for the @see #getCachedInstanceImpl(ObjectKey).
+     * Loads <code>${dbObjectClassName}</code> from cache, returns
+     * <code>null</code>, if instance is not in cache
+     *
+     * @param id an <code>ObjectKey</code> value
+     * @return a <code>${dbObjectClassName}</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static ${dbObjectClassName} getCachedInstance(ObjectKey id)
+        throws TorqueException
+    {
+        return getManager().getCachedInstanceImpl(id);
+    }
+
+    /**
+     * Static accessor for the @see #getInstanceImpl(ObjectKey, boolean).
+     *
+     * @param id an <code>ObjectKey</code> value
+     * @param fromCache if true, look for cached ${dbObjectClassName}s before loading
+     * from storage.
+     * @return a <code>${interfaceName}</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static ${dbObjectClassName} getInstance(ObjectKey id, boolean fromCache)
+        throws TorqueException
+    {
+        return getManager().getInstanceImpl(id, fromCache);
+    }
+
+#set ($primaryKeyColumnElements = $torqueGf.getChild("primary-keys").getChildren("column"))
+#if ($primaryKeyColumnElements.size() == 1)
+  #set ($primaryKeyColumnElement = $primaryKeyColumnElements.get(0))
+  #set ($fieldType = $primaryKeyColumnElement.getAttribute("fieldType"))
+    /**
+     * Static accessor for the @see #getInstanceImpl(ObjectKey).
+     *
+     * @param id an <code>ObjectKey</code> value
+     * @return a <code>${dbObjectClassName}</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static ${dbObjectClassName} getInstance($fieldType id)
+        throws TorqueException
+    {
+        return getManager().getInstanceImpl(SimpleKey.keyFor(id));
+    }
+
+    /**
+     * Static accessor for the @see #getInstanceImpl(ObjectKey).
+     *
+     * @param id an <code>ObjectKey</code> value
+     * @param fromCache if true, look for cached ${dbObjectClassName}s before loading
+     * from storage.
+     * @return a <code>${dbObjectClassName}</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static ${dbObjectClassName} getInstance($fieldType id, boolean fromCache)
+        throws TorqueException
+    {
+        return getManager().getInstanceImpl(SimpleKey.keyFor(id), fromCache);
+    }
+#end
+
+    /**
+     * Static accessor for the @see #getInstancesImpl(List).
+     *
+     * @param ids a <code>List</code> value
+     * @return a <code>List</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static List#if($java5 == "true")<$dbObjectClassName>#end getInstances(List#if($java5 == "true")<ObjectKey>#end ids)
+        throws TorqueException
+    {
+        return getManager().getInstancesImpl(ids);
+    }
+
+    /**
+     * Static accessor for the @see #getInstancesImpl(List, boolean).
+     *
+     * @param ids a <code>List</code> value
+     * @param fromCache if true, look for cached ${dbObjectClassName}s before loading
+     * from storage.
+     * @return a <code>List</code> value
+     * @exception TorqueException if an error occurs
+     */
+    public static List#if($java5 == "true")<$dbObjectClassName>#end getInstances(List#if($java5 == "true")<ObjectKey>#end ids, boolean fromCache)
+        throws TorqueException
+    {
+        return getManager().getInstancesImpl(ids, fromCache);
+    }
+
+    public static void putInstance(Persistent om)
+        throws TorqueException
+    {
+        getManager().putInstanceImpl(om);
+    }
+
+    public static void clear()
+        throws TorqueException
+    {
+        getManager().clearImpl();
+    }
+
+    public static boolean exists(${dbObjectClassName} obj)
+        throws TorqueException
+    {
+        return getManager().existsImpl(obj);
+    }
+
+    public static MethodResultCache getMethodResult()
+    {
+        return getManager().getMethodResultCache();
+    }
+
+    public static void addCacheListener(CacheListener listener)
+    {
+        getManager().addCacheListenerImpl(listener);
+    }
+
+    /**
+     * Creates a new <code>${baseManagerClassName}</code> instance.
+     *
+     * @exception TorqueException if an error occurs
+     */
+    public $baseManagerClassName()
+        throws TorqueException
+    {
+        setClassName(${baseManagerClassName}.MANAGED_CLASS);
+    }
+
+    /**
+     * Get a fresh instance of a ${dbObjectClassName}Manager
+     */
+    protected ${dbObjectClassName} getInstanceImpl()
+        throws TorqueException
+    {
+        ${dbObjectClassName} obj = null;
+        try
+        {
+            obj = (${dbObjectClassName}) getOMInstance();
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+        return obj;
+    }
+
+    /**
+     * Get a ${dbObjectClassName} with the given id.
+     *
+     * @param id <code>ObjectKey</code> value
+     */
+    protected ${dbObjectClassName} getInstanceImpl(ObjectKey id)
+        throws TorqueException
+    {
+        return (${dbObjectClassName}) getOMInstance(id);
+    }
+
+    /**
+     * Get a ${interfaceName} with the given id from the cache. Returns
+     * <code>null</code> if instance is not in cache
+     *
+     * @param id <code>ObjectKey</code> value
+     */
+    protected ${dbObjectClassName} getCachedInstanceImpl(ObjectKey id)
+        throws TorqueException
+    {
+        return (${dbObjectClassName}) cacheGet(id);
+    }
+
+    /**
+     * Get a ${dbObjectClassName} with the given id.
+     *
+     * @param id <code>ObjectKey</code> value
+     * @param fromCache if true, look for cached ${dbObjectClassName}s before loading
+     * from storage.
+     */
+    protected ${dbObjectClassName} getInstanceImpl(ObjectKey id, boolean fromCache)
+        throws TorqueException
+    {
+        return (${dbObjectClassName}) getOMInstance(id, fromCache);
+    }
+
+    /**
+     * Gets a list of ${dbObjectClassName}s based on id's.
+     *
+     * @param ids a List of <code>ObjectKeys</code> value
+     * @return a <code>List</code> of ${dbObjectClassName}s
+     * @exception TorqueException if an error occurs
+     */
+    protected List#if($java5 == "true")<$dbObjectClassName>#end getInstancesImpl(List#if($java5 == "true")<ObjectKey>#end ids)
+        throws TorqueException
+    {
+        return getOMs(ids);
+    }
+
+    /**
+     * Gets a list of ${dbObjectClassName}s based on id's.
+     *
+     * @param ids a List of <code>ObjectKeys</code> value
+     * @param fromCache if true, look for cached ${dbObjectClassName}s before loading
+     * from storage.
+     * @return a <code>List</code> of ${dbObjectClassName}s
+     * @exception TorqueException if an error occurs
+     */
+    protected List#if($java5 == "true")<$dbObjectClassName>#end getInstancesImpl(List#if($java5 == "true")<ObjectKey>#end ids, boolean fromCache)
+        throws TorqueException
+    {
+        return getOMs(ids, fromCache);
+    }
+
+    /**
+     * check for a duplicate project name
+     */
+    protected boolean existsImpl(${dbObjectClassName} om)
+        throws TorqueException
+    {
+        Criteria crit = ${peerClassName}
+            .buildCriteria((${dbObjectClassName})om);
+        return ${peerClassName}.doSelect(crit).size() > 0;
+    }
+
+    protected Persistent retrieveStoredOM(ObjectKey id)
+        throws TorqueException
+    {
+        return ${peerClassName}.retrieveByPK(id);
+    }
+
+    /**
+     * Gets a list of ModuleEntities based on id's.
+     *
+     * @param ids a <code>NumberKey[]</code> value
+     * @return a <code>List</code> value
+     * @exception TorqueException if an error occurs
+     */
+    protected List#if($java5 == "true")<$dbObjectClassName>#end retrieveStoredOMs(List ids)
+        throws TorqueException
+    {
+        return ${peerClassName}.retrieveByPKs(ids);
+    }
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/classJavadoc.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,41 @@
+## 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 class javadoc for a base manager. 
+## This template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+/**
+ * This class manages $dbObjectClassName objects.
+ *
+#if ($description)
+ * $description
+ *
+#end
+ * This class was autogenerated by Torque#if ($torqueGf.booleanOption("torque.om.addTimeStamp")) on:
+ *
+ * [${torqueGf.now()}]
+#end
+ *
+ * You should not use this class directly.  It should not even be
+ * extended; all references should be to ${beanClassName}
+ */
+ 
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/classJavadoc.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,41 @@
+## 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 class javadoc for a manager. 
+## This template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+/**
+ * This class manages $dbObjectClassName objects.
+ *
+#if ($description)
+ * $description
+ *
+#end
+ * This class was autogenerated by Torque#if ($torqueGf.booleanOption("torque.om.addTimeStamp")) on:
+ *
+ * [${torqueGf.now()}]
+#end
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/manager.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/manager.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/manager.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/manager.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,37 @@
+## 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.
+package $managerPackage;
+
+import org.apache.torque.TorqueException;
+
+$torqueGf.mergepoint("classJavadoc")
+public class ${managerClassName}
+    extends ${baseManagerPackage}.${baseManagerClassName}
+{
+$torqueGf.mergepoint("serialVersionUid")
+    /**
+     * Creates a new <code>${managerClassName}</code> instance.
+     *
+     * @exception TorqueException if an error occurs
+     */
+    public ${managerClassName}()
+        throws TorqueException
+    {
+        super();
+    }
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classJavadoc.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,40 @@
+## 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 class javadoc for a mapBuilder object. 
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The attributes of the current source element must be set
+## as velocity variables.  
+##
+/**
+#if ($description)
+ * $description
+ *
+#end
+#if ($torqueGf.booleanOption("torque.om.addTimeStamp"))
+ * This class was autogenerated by Torque on:
+ *
+ * [${torqueGf.now()}]
+ *
+#end
+ */

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classNameConstant.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classNameConstant.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classNameConstant.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/classNameConstant.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,34 @@
+## 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 class name constant for a MapBuilder.
+## 
+## 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 attributes of the current source element must be set
+## as velocity variables.  
+##
+    /**
+     * The name of this class
+     */
+    public static final String CLASS_NAME =
+        "${mapBuilderPackage}.${mapBuilderClassName}";

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/dbMapField.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/dbMapField.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/dbMapField.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/dbMapField.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,27 @@
+## 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 dbMap field for a MapBuilder.
+## 
+    /**
+     * The database map.
+     */
+    private DatabaseMap dbMap = null;

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,164 @@
+## 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 doBuild method for a MapBuilder.
+## 
+## 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.  
+##
+#set ( $tableElement = $torqueGf.getSourceElement() )
+#set ( $databaseName = $tableElement.getParent().getAttribute("name") )
+    /**
+     * The doBuild() method builds the DatabaseMap
+     *
+     * @throws TorqueException
+     */
+    public synchronized void doBuild() throws TorqueException
+    {
+        if ( isBuilt() )
+        {
+            return;
+        }
+        dbMap = Torque.getDatabaseMap("$databaseName");
+
+        dbMap.addTable("$name");
+        TableMap tMap = dbMap.getTable("$name");
+        tMap.setJavaName("$javaName");
+        tMap.setOMClass(${dbObjectPackage}.${dbObjectClassName}.class);
+        tMap.setPeerClass(${peerPackage}.${peerClassName}.class);
+#if ( $description )
+        tMap.setDescription("$description");
+#end
+#if ($idMethod == "native")
+        tMap.setPrimaryKeyMethod(TableMap.NATIVE);
+#elseif ($idMethod == "idbroker")
+        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
+#else
+        tMap.setPrimaryKeyMethod("$idMethod");
+#end
+#set ( $idMethodParameterElements = $tableElement.getChildren("id-method-parameter"))
+#if (!$idMethodParameterElements.isEmpty())
+        // this might need upgrading based on what all the databases
+        // need, but for now assume one parameter.
+  #set ( $idMethodParameterElement = $idMethodParameterElements.get(0) )
+  #set ( $value = $idMethodParameterElement.getAttribute("value") )
+        tMap.setPrimaryKeyMethodInfo("$value");
+#elseif ($idMethod == "idbroker")
+        tMap.setPrimaryKeyMethodInfo(tMap.getName());
+#elseif ($idMethod == "native")
+        org.apache.torque.adapter.DB dbAdapter = Torque.getDB("$databaseName");
+        if (dbAdapter.getIDMethodType().equals(org.apache.torque.adapter.DB.SEQUENCE))
+        {
+            tMap.setPrimaryKeyMethodInfo("$sequence");
+        }
+        else if (dbAdapter.getIDMethodType().equals(org.apache.torque.adapter.DB.AUTO_INCREMENT))
+        {
+            tMap.setPrimaryKeyMethodInfo("$name");
+        }
+#end
+#set ( $primaryKeyColumnElements = $tableElement.getChild("primary-keys").getChildren("column") )
+#if ($useManagers == "true" && $primaryKeyColumnElements.size() > 0)
+        tMap.setUseManager(true);
+        tMap.setManagerClass(${managerPackage}.${managerClassName}.class);
+#end
+
+        ColumnMap cMap = null;
+
+#set ($tableUseInheritance = "false")
+#set ($position = 1)
+#set ( $columnElements = $tableElement.getChildren("column") )
+#foreach ($columnElement in $columnElements)
+  #set ( $columnName = $columnElement.getAttribute("name") )
+  #set ( $javaName = $columnElement.getAttribute("javaName") )
+  #set ( $type = $columnElement.getAttribute("type") )
+  #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+  #set ( $sampleObject = $columnElement.getAttribute("sampleObject") )
+  #set ( $primitive = $columnElement.getAttribute("primitive") )
+  #set ( $primaryKey = $columnElement.getAttribute("primaryKey") )
+  #set ( $required = $columnElement.getAttribute("required") )
+  #set ( $autoIncrement = $columnElement.getAttribute("autoIncrement") )
+  #set ( $protected = $columnElement.getAttribute("protected") )
+  #set ( $columnDescription = $columnElement.getAttribute("description") )
+  #set ( $default = $columnElement.getAttribute("default") )
+  #set ( $inheritance = $columnElement.getAttribute("inheritance") )
+  #set ( $inputValidator = $columnElement.getAttribute("inputValidator") )
+  #set ( $size = $columnElement.getAttribute("size") )
+  #set ( $scale = $columnElement.getAttribute("scale") )
+  #set ( $referencedColumnElements = $columnElement.getChildren("referenced-column"))
+    // ------------- Column: $columnName --------------------
+        cMap = new ColumnMap("$columnName", tMap);
+        cMap.setType($sampleObject);
+        cMap.setTorqueType("$type");
+        cMap.setUsePrimitive($primitive);
+        cMap.setPrimaryKey($primaryKey);
+        cMap.setNotNull($required);
+        cMap.setJavaName("$javaName");
+        cMap.setAutoIncrement($autoIncrement);
+        cMap.setProtected($protected);
+  #if ($fieldType)
+        cMap.setJavaType( "${fieldType}" );
+  #end
+  #if ($columnDescription)
+        cMap.setDescription("${columnDescription}");
+  #end
+  #if ($default)
+        cMap.setDefault("$default");
+  #end
+  #if ($inheritance != "false")
+        cMap.setInheritance("$inheritance");
+  #end
+  #if ($inputValidator)
+        cMap.setInputValidator("$inputValidator");
+  #end
+  #if ($size)
+        cMap.setSize($size);
+    #if ($scale)
+        cMap.setScale($scale);
+    #end
+  #end
+  #if (!$referencedColumnElements.isEmpty())
+    #set ( $referencedColumnElement = $referencedColumnElements.get(0).getChild("column"))
+        cMap.setForeignKey(
+            "$referencedColumnElement.getParent().getAttribute("name")",
+            "$referencedColumnElement.getAttribute("name")");
+  #end
+  #if ($inheritance != "false")
+    #set ( $tableUseInheritance = "true" );
+        cMap.setUseInheritance(true);
+        InheritanceMap iMap = null;
+    #set ( $inheritanceElements = $columnElement.getChildren("inheritance"))
+    #foreach ($inheritanceElement in $inheritanceElements)
+      #set ( $key = $inheritanceElement.getAttribute("key") )
+      #set ( $class = $inheritanceElement.getAttribute("class") )
+      #set ( $extends = $inheritanceElement.getAttribute("extends") )
+        iMap = new InheritanceMap(cMap,"$key","$class","$extends");
+        cMap.addInheritanceMap(iMap);
+    #end
+  #end
+        cMap.setPosition($position);
+  #set ($position = $position + 1)
+        tMap.addColumn(cMap);
+#end
+        tMap.setUseInheritance($tableUseInheritance);
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/getDatabaseMap.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/getDatabaseMap.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/getDatabaseMap.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/getDatabaseMap.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,32 @@
+## 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 getDatabaseMap method for a MapBuilder.
+## 
+    /**
+     * Gets the databasemap this map builder built.
+     *
+     * @return the databasemap
+     */
+    public DatabaseMap getDatabaseMap()
+    {
+        return this.dbMap;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/imports.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/imports.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/imports.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/imports.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,42 @@
+## 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 imports for a MapBuilder.
+## 
+## 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.  
+##
+import java.util.Date;
+
+import org.apache.torque.Torque;
+import org.apache.torque.TorqueException;
+#if ($table.IdMethod == "native")
+import org.apache.torque.adapter.DB;
+#end
+import org.apache.torque.map.MapBuilder;
+import org.apache.torque.map.DatabaseMap;
+import org.apache.torque.map.TableMap;
+import org.apache.torque.map.ColumnMap;
+import org.apache.torque.map.InheritanceMap;
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/isBuilt.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/isBuilt.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/isBuilt.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/isBuilt.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,33 @@
+## 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 isBuilt method for a MapBuilder.
+## 
+    /**
+     * Tells us if this DatabaseMapBuilder is built so that we
+     * don't have to re-build it every time.
+     *
+     * @return true if this DatabaseMapBuilder is built
+     */
+    public boolean isBuilt()
+    {
+        return (dbMap != null);
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/mapBuilder.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/mapBuilder.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/mapBuilder.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/mapBuilder.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,41 @@
+## 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 map builder class for a table.
+## 
+## 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 ${mapBuilderPackage};
+$torqueGf.mergepoint("imports")
+$torqueGf.mergepoint("classJavadoc")
+public class ${mapBuilderClassName} implements MapBuilder
+{
+$torqueGf.mergepoint("classNameConstant")
+$torqueGf.mergepoint("dbMapField")
+$torqueGf.mergepoint("isBuilt")
+$torqueGf.mergepoint("getDatabaseMap")
+$torqueGf.mergepoint("doBuild")
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,52 @@
+## 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 class for initializing all database maps in a database. 
+## 
+## This template expects the current source element to be a "database" element 
+## from the torque schema.
+##
+package ${mapBuilderPackage};
+
+import org.apache.torque.Torque;
+import org.apache.torque.TorqueException;
+
+/**
+ * This is a Torque Generated class that is used to load all database map 
+ * information at once.  This is useful because Torque's default behaviour
+ * is to do a "lazy" load of mapping information, e.g. loading it only
+ * when it is needed.<p>
+ *
+ * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize() 
+ */
+public class ${mapInitClassName}
+{
+    public static final void init()
+        throws TorqueException
+    {
+#set ( $tableElements = $torqueGf.getChildren("table") )
+#foreach ( $tableElement in $tableElements )
+  #set ( $mapBuilderClassName = $tableElement.getAttribute("mapBuilderClassName") )
+  #set ( $mapBuilderPackage = $tableElement.getAttribute("mapBuilderPackage") )
+        Torque.getMapBuilder(${mapBuilderPackage}.${mapBuilderClassName}.CLASS_NAME);
+#end
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,42 @@
+## 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 a class extending the class for initializing all database maps
+## in a database. 
+## 
+## This template expects the current source element to be a "database" element 
+## from the torque schema.
+##
+package ${mapInitPackage};
+
+/**
+ * This Torque generated class is used to link the runtime code 
+ * in org.apache.torque.* packages to the Database specific MapInit 
+ * classes generated in the user defined packages.  It resided in 
+ * the ${packageLinkage} so that the runtime code can 
+ * locate it regardless of the user build properties.
+ *
+ * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize() 
+ */
+public class ${mapInitClassName}
+		extends ${mapBuilderPackage}.${mapInitClassName}
+{
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,44 @@
+## 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 addSelectColumns method for the base peer.
+## 
+## 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.  
+##
+    /**
+     * Add all the columns needed to create a new object.
+     *
+     * @param criteria object containing the columns to add.
+     * @throws TorqueException Any exceptions caught during processing will be
+     *         rethrown wrapped into a TorqueException.
+     */
+    public static void addSelectColumns(Criteria criteria)
+            throws TorqueException
+    {
+#foreach ($columnElement in $torqueGf.getChildren("column"))
+  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName"))
+        criteria.addSelectColumn(${peerClassName}.$peerColumnName);
+#end
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,79 @@
+## 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};
+
+$torqueGf.mergepoint("imports")
+
+$torqueGf.mergepoint("classJavadoc")
+public abstract class $basePeerClassName
+    extends ${basePeerBaseClass}
+{
+$torqueGf.mergepoint("serialVersionUid")
+
+$torqueGf.mergepoint("tableDatabaseNameConstants")
+
+$torqueGf.mergepoint("columnConstants")
+
+$torqueGf.mergepoint("staticInit")
+
+$torqueGf.mergepoint("mapBuilderGetter")
+
+$torqueGf.mergepoint("numColumnConstant")
+
+$torqueGf.mergepoint("dbObjectClassConstants")
+
+$torqueGf.mergepoint("classMethods")
+$torqueGf.mergepoint("resultSet2Objects")
+$torqueGf.mergepoint("addSelectColumns")
+$torqueGf.mergepoint("correctBooleans")
+$torqueGf.mergepoint("row2Object")
+$torqueGf.mergepoint("populateObject")
+$torqueGf.mergepoint("doSelect")
+$torqueGf.mergepoint("doSelectVillageRecords")
+$torqueGf.mergepoint("populateObjects")
+$torqueGf.mergepoint("getOMClass")
+$torqueGf.mergepoint("doInsert")
+$torqueGf.mergepoint("doUpdate")
+$torqueGf.mergepoint("doDelete")
+$torqueGf.mergepoint("buildCriteria")
+$torqueGf.mergepoint("buildSelectCriteria")
+$torqueGf.mergepoint("retrieveByPK")
+$torqueGf.mergepoint("retrieveByPKs")
+#if ($complexObjectModel == "true")
+$torqueGf.mergepoint("doSelectJoin")
+$torqueGf.mergepoint("doSelectJoinAllExcept")
+#end
+$torqueGf.mergepoint("getTableMap")
+$torqueGf.mergepoint("setDbName")
+#if ($java5 == "true")
+$torqueGf.mergepoint("java5Wrappers")
+#end
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,69 @@
+## 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 buildCriteria methods in 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.  
+##
+    /** Build a Criteria object from an ObjectKey */
+    public static Criteria buildCriteria(ObjectKey pk)
+    {
+        Criteria criteria = new Criteria();
+#set ( $primaryKeyColumnElements = $torqueGf.getChild("primary-keys").getChildren("column") )
+#if ($primaryKeyColumnElements.size() == 1)
+  #set ( $primaryKeyColumnElement = $primaryKeyColumnElements.get(0) )
+  #set ( $peerColumnName = $primaryKeyColumnElement.getAttribute("peerColumnName") )
+        criteria.add(${peerClassName}.$peerColumnName, pk);
+#else
+        SimpleKey[] keys = (SimpleKey[])pk.getValue();
+  #set ( $i = 0 )
+  #foreach ($primaryKeyColumnElement in $primaryKeyColumnElements)
+    #set ( $peerColumnName = $primaryKeyColumnElement.getAttribute("peerColumnName") )
+        criteria.add(${peerClassName}.$peerColumnName, keys[$i]);
+    #set ( $i = $i + 1 )
+  #end
+#end
+        return criteria;
+     }
+
+    /** Build a Criteria object from the data object for this peer */
+    public static Criteria buildCriteria($dbObjectClassName obj)
+    {
+        Criteria criteria = new Criteria(DATABASE_NAME);
+#foreach ($columnElement in $torqueGf.getChildren("column"))
+  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
+  #set ( $getter = $columnElement.getAttribute("getter") )
+  #set ( $primaryKey = ($columnElement.getAttribute("primaryKey") == "true") )
+  #if ($primaryKey && !$idMethod.equals("none"))
+        if (!obj.isNew())
+        {
+            criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
+        }
+  #else
+        criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
+  #end
+  #end
+        return criteria;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,51 @@
+## 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 buildSelectCriteria methods in 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.  
+##
+    /** Build a Criteria object from the data object for this peer, skipping all binary columns */
+    public static Criteria buildSelectCriteria($dbObjectClassName obj)
+    {
+        Criteria criteria = new Criteria(DATABASE_NAME);
+#foreach ($columnElement in $torqueGf.getChildren("column"))
+  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") ) 
+  #set ( $fieldType = $columnElement.getAttribute("fieldType") ) 
+  #set ( $getter = $columnElement.getAttribute("getter") ) 
+  #set ( $primaryKey = ($columnElement.getAttribute("primaryKey") == "true") )
+  #if ( $fieldType != "byte[]" )
+    #if ($primaryKey && !$idMethod.equals("none"))
+        if (!obj.isNew())
+        {
+            criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
+        }
+    #else
+        criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
+    #end
+  #end
+#end
+        return criteria;
+    }



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