db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1244818 - in /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates: dbObject/base/copyMethods.vm dbObject/base/joinGetterReferencingObject.vm general/setterMethodEnd.vm
Date Thu, 16 Feb 2012 01:44:52 GMT
Author: tfischer
Date: Thu Feb 16 01:44:51 2012
New Revision: 1244818

URL: http://svn.apache.org/viewvc?rev=1244818&view=rev
Log:
fix behaviour of complexObjectModel and objectIsCaching generator options

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/joinGetterReferencingObject.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm?rev=1244818&r1=1244817&r2=1244818&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
Thu Feb 16 01:44:51 2012
@@ -26,14 +26,14 @@
     /**
      * Makes a copy of this object.
      * It creates a new object filling in the simple attributes.
-  #if ($complexObjectModel)
+  #if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
      * It then fills all the association collections and sets the
      * related objects to isNew=true.
   #end
      */
     public $dbObjectClassName copy() throws TorqueException
     {
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
         return copy(true);
 #else
 $torqueGen.mergepoint("createObjectInstance")
@@ -41,7 +41,7 @@ $torqueGen.mergepoint("createObjectInsta
 #end
     }
 
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
     /**
      * Makes a copy of this object using a connection.
      * It creates a new object filling in the simple attributes.
@@ -87,7 +87,7 @@ $torqueGen.mergepoint("createObjectInsta
     }
 #end
   
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
     /**
      * Fills the copyObj with the contents of this object.
      * The associated objects are also copied and treated as new objects.
@@ -114,17 +114,17 @@ $torqueGen.mergepoint("createObjectInsta
   
     /**
      * Fills the copyObj with the contents of this object.
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
      * If deepcopy is true, The associated objects are also copied
      * and treated as new objects.
      *
 #end
      * @param copyObj the object to fill.
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
      * @param deepcopy whether the associated objects should be copied.
 #end
      */
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
     protected $dbObjectClassName copyInto($dbObjectClassName copyObj, boolean deepcopy) throws
TorqueException
 #else
     protected $dbObjectClassName copyInto($dbObjectClassName copyObj) throws TorqueException
@@ -147,7 +147,7 @@ $torqueGen.mergepoint("createObjectInsta
   #end
 #end
 
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
   #set ($foreignKeyElements = $torqueGen.getChild("referencing-foreign-keys").getChildren("foreign-key"))
         if (deepcopy)
         {
@@ -164,7 +164,7 @@ $torqueGen.mergepoint("createObjectInsta
       #set ( $getter = $foreignFieldElement.getAttribute("getter"))
       #set ( $adder = $foreignFieldElement.getAttribute("adder"))
       #if ($foreignTableName != $name)
-        #if ($objectIsCaching)
+        #if (($objectIsCaching == "true"))
           ## field can be null if the generator property
           ## torque.silentDbFetch is set to false
             if ($columnField != null)
@@ -189,7 +189,7 @@ $torqueGen.mergepoint("createObjectInsta
     }
         
     
-#if ($complexObjectModel)
+#if (($complexObjectModel == "true") && ($objectIsCaching == "true"))
     /**
      * Fills the copyObj with the contents of this object using connection.
      * If deepcopy is true, The associated objects are also copied
@@ -233,12 +233,10 @@ $torqueGen.mergepoint("createObjectInsta
       #set ( $getter = $foreignFieldElement.getAttribute("getter"))
       #set ( $adder = $foreignFieldElement.getAttribute("adder"))
       #if ($foreignTableName != $name)
-        #if ($objectIsCaching)
             for (${columnFieldContainedType} obj : $getter(con))
             {
                 copyObj.${adder}(obj.copy());
             }
-        #end
       #end
     #end
   #end

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/joinGetterReferencingObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/joinGetterReferencingObject.vm?rev=1244818&r1=1244817&r2=1244818&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/joinGetterReferencingObject.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/joinGetterReferencingObject.vm
Thu Feb 16 01:44:51 2012
@@ -27,7 +27,6 @@
 ## by the OMTransformer.  
 ##
 #set ( $silentDbFetch = $torqueGen.booleanOption("torque.om.silentDbFetch") )
-#set ( $objectIsCaching = $torqueGen.booleanOption("torque.om.objectIsCaching") )
 #set ( $foreignKeyElement = $torqueGen.getParent() )
 #set ( $otherTable = $foreignKeyElement.getParent() )
 #set ( $otherTablePeerClass = $otherTable.getAttribute("peerClassName") )
@@ -38,13 +37,9 @@
 #set ( $referenceElements = $foreignKeyElement.getChildren("reference") )
 #if ($silentDbFetch)
     /**
-  #if ($objectIsCaching)
      * If this collection has already been initialized with
      * an identical criteria, it returns the collection.
      * Otherwise if this $thisObjectClassName is new, it will return
-  #else
-     * If this $thisObjectClassName is new, this method will return
-  #end
      * an empty collection; or if this thisObjectClassName has previously
      * been saved, it will retrieve the related objects from storage.
      *
@@ -59,13 +54,9 @@
 
 #end
     /**
-#if ($objectIsCaching)
      * If this collection has already been initialized with
      * an identical criteria, it returns the collection.
      * Otherwise if this $thisObjectClassName is new, it will return
-#else
-     * If this $thisObjectClassName is new, this method will return
-#end
      * an empty collection; or if this $thisObjectClassName has previously
      * been saved, it will retrieve the related objects from storage.
      *
@@ -76,7 +67,6 @@
     protected $fieldType ${joinGetter}(Criteria criteria, Connection connection)
         throws TorqueException
     {
-#if ($objectIsCaching)
         if ($field == null)
         {
             if (isNew())
@@ -85,13 +75,13 @@
             }
             else
             {
-  #foreach ($referenceElement in $referenceElements)
-    #set ( $otherTableColumnElement = $referenceElement.getChild("local-column").getChild("column")
)
-    #set ( $thisTableColumnElement = $referenceElement.getChild("foreign-column").getChild("column")
)
-    #set ( $otherTablePeerColumnName = $otherTableColumnElement.getAttribute("peerColumnName")
)
-    #set ( $thisTableColumnGetter = $thisTableColumnElement.getAttribute("getter") )
+#foreach ($referenceElement in $referenceElements)
+  #set ( $otherTableColumnElement = $referenceElement.getChild("local-column").getChild("column")
)
+  #set ( $thisTableColumnElement = $referenceElement.getChild("foreign-column").getChild("column")
)
+  #set ( $otherTablePeerColumnName = $otherTableColumnElement.getAttribute("peerColumnName")
)
+  #set ( $thisTableColumnGetter = $thisTableColumnElement.getAttribute("getter") )
                 criteria.add(${otherTablePeerName}.${otherTablePeerColumnName}, ${thisTableColumnGetter}()
);
-  #end
+#end
                 $field = ${otherTablePeerName}.${peerJoinSelectMethod}(criteria, connection);
             }
         }
@@ -100,7 +90,6 @@
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
-#end
 #foreach ($referenceElement in $referenceElements)
   #set ( $otherTableColumnElement = $referenceElement.getChild("local-column").getChild("column")
)
   #set ( $thisTableColumnElement = $referenceElement.getChild("foreign-column").getChild("column")
)
@@ -108,7 +97,6 @@
   #set ( $thisTableColumnGetter = $thisTableColumnElement.getAttribute("getter") )
             criteria.add(${otherTablePeerName}.${otherTablePeerColumnName}, ${thisTableColumnGetter}()
);
 #end
-#if ($objectIsCaching)
             if (!${criteriaCacheField}.equals(criteria))
             {
                 $field = ${otherTablePeerName}.${peerJoinSelectMethod}(criteria, connection);
@@ -117,7 +105,4 @@
         $criteriaCacheField = criteria;
 
         return $field;
-#else
-        return ${otherTablePeerName}.${peerJoinSelectMethod}(criteria, connection);
-#end
     }

Modified: 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=1244818&r1=1244817&r2=1244818&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/general/setterMethodEnd.vm
Thu Feb 16 01:44:51 2012
@@ -24,7 +24,7 @@
 ## The template expects as input a "column" element from the torque schema, 
 ## which was processed by the OMTransformer.  
 ##
-#if ($torqueGen.option("torque.om.complexObjectModel"))
+#if ($torqueGen.booleanOption("torque.om.complexObjectModel"))
   ##
   ## set referenced object(s) to null if the id has changed
   ## 
@@ -50,7 +50,7 @@
   ##
   ## update the id in referencing object(s)
   ## 
-  #if ($torqueGen.option("torque.om.objectIsCaching"))
+  #if ($torqueGen.booleanOption("torque.om.objectIsCaching"))
     #set ( $referencingColumns = $torqueGen.getChildren("referencing-column") )
     #foreach ($referencingColumnElement in $referencingColumns)
       ## the column on the foreign table



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