You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2010/02/16 18:16:02 UTC

svn commit: r910600 [23/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...

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

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getter.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getter.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 $
+##
+## 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).
+##
+## The difference to om/general/getter.vm is that this template ignores the
+## access modifier and generates a method which is always public.
+## If it were otherwise, the dbObject could not access the getter. 
+##
+#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
+#if ($getterThrows != "")
+     * @${getterThrows.substring(1)}
+#end
+     */
+    public $fieldType ${getter}()$getterThrows 
+    {
+        $torqueGf.mergepoint("methodStart")
+        return $field;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencedObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencedObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencedObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencedObject.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.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## This template creates the getter 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.  
+##
+    /**
+     * Returns the associated $fieldType object.
+     *
+     * @return the associated $fieldType object
+     */
+    public $fieldType ${getter}()
+    {
+        return $field;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencingObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencingObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencingObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/getterReferencingObject.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 the getter method in the object for the "foreign" part
+## of a foreign key. The objects in the field represent the "local" part
+## of the foreign key.  
+## The template expects as input a "foreign-field" element inside a 
+## "referencing-foreign-keys/foreign-key" element
+##
+    /**
+     * Returns the Collection of ${fieldContainedType}s.
+     *
+     * @return the collection of associated objects
+     */
+    public $fieldType ${getter}()
+    {
+        return $field;
+    }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setter.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setter.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 $
+##
+## This template expects to be executed on a source element with the 
+## field attributes set (as defined in the JavaFieldAttributeName enum). 
+##
+## The difference to om/general/setter.vm is that this template ignores the
+## access modifier and generates a method which is always public.
+## If it were otherwise, the dbObject could not access the setter. 
+##
+#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
+     */
+    public 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/bean/base/setterMethodEnd.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setterMethodEnd.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setterMethodEnd.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/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 adjusting referenced 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-in-bean") )
+    #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-in-bean") )
+      #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/bean/base/setterReferencingObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setterReferencingObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setterReferencingObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/base/setterReferencingObject.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,48 @@
+## 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 for a collection of referencing objects in a 
+## base bean.
+## It expects to be executed on a
+## referencing-foreign-keys/foreign-key/foreign-field-in-bean
+## source element.
+##
+    /**
+     * Set the collection of ${fieldContainedType}s. 
+#if ($description)
+     * The field is described as follows: 
+     * $description
+#end
+     *
+     * @param v new value
+     */
+    public void ${setter}($fieldType list)
+    {
+        if (list == null)
+        {
+            this.$field = null;
+        }
+        else
+        {
+            this.$field = new ${initializerType}(list);
+        }
+    }
+    
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/bean.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/bean.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/bean.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/bean.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 $
+##
+## This template creates source code for a bean. 
+## The template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+package ${beanPackage};
+
+$torqueGf.mergepoint("classJavadoc")
+public class $beanClassName
+    extends ${baseBeanPackage}.${baseBeanClassName}
+{
+$torqueGf.mergepoint("serialVersionUid")
+$torqueGf.mergepoint("extensions")
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/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 bean. 
+## This template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.  
+##
+/**
+#if ($description)
+ * $description
+ *
+#end
+#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/bean/inheritance/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/inheritance/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/inheritance/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/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 bean. 
+## 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/bean/inheritance/inheritanceBean.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/inheritance/inheritanceBean.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/inheritance/inheritanceBean.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/bean/inheritance/inheritanceBean.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 a inheritance bean. 
+## This template expects as input a "/table/column/inheritance" element
+## from the torque schema which was processed by the OMTransformer.  
+##
+package $beanPackage;
+
+import java.io.Serializable;
+#set ( $columnElement = $torqueGf.getParent() )
+#set ( $tableElement = $columnElement.getParent() )
+#if (!$beanExtends)
+  #set ( $beanExtends = $tableElement.getAttribute("beanClassName") )
+#end
+
+$torqueGf.mergepoint("classJavadoc")
+public class $beanClassName
+    extends $beanExtends
+    implements Serializable
+{
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,59 @@
+## 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 adder method in the object for the "foreign" part
+## of a foreign key. The addable objects represent the "local" part
+## of the foreign key.  
+## The template expects as input a "foreign-field" element inside a 
+## "foreign-key" element from the torque schema, which was generated 
+## by the OMTransformer.  
+##
+#set ( $foreignKeyElement = $torqueGf.getParent() )
+#set ( $localTableElement = $foreignKeyElement.getChild("table") )
+#set ( $localClassName = $localTableElement.getAttribute("dbObjectClassName") )
+#set ( $foreignKeyLocalFieldElement = $foreignKeyElement.getChild("local-field") )
+#set ( $foreignKeyLocalColumnSetter = $foreignKeyLocalFieldElement.getAttribute("setter"))
+    /**
+     * Method called to associate a $fieldContainedType object to this object
+     * through the $field foreign key attribute
+     *
+     * @param l $fieldContainedType
+     * @throws TorqueException
+     */
+    public void ${adder}($fieldContainedType l) throws TorqueException
+    {
+        ${getter}().add(l);
+        l.${foreignKeyLocalColumnSetter}(($localClassName) this);
+    }
+
+    /**
+     * Method called to associate a $fieldContainedType object to this object
+     * through the $field foreign key attribute using connection.
+     *
+     * @param l $fieldContainedType
+     * @throws TorqueException
+     */
+    public void ${adder}($fieldContainedType l, Connection con) throws TorqueException
+    {
+        ${getter}(con).add(l);
+        l.${foreignKeyLocalColumnSetter}(($localClassName) this);
+    }
+    
\ No newline at end of file

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



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org