db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1584929 - in /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base: fillReferencedObject.vm fillReferencingObjects.vm
Date Fri, 04 Apr 2014 22:22:48 GMT
Author: tfischer
Date: Fri Apr  4 22:22:48 2014
New Revision: 1584929

URL: http://svn.apache.org/r1584929
Log:
TORQUE-314 filler methods do not set isNew and isModified flag correctly

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencedObject.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencingObjects.vm

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencedObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencedObject.vm?rev=1584929&r1=1584928&r2=1584929&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencedObject.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencedObject.vm
Fri Apr  4 22:22:48 2014
@@ -38,6 +38,11 @@
 #set ( $foreignTableElement = $foreignKeyElement.getChild("table") )
 #set ( $foreignTablePeerClassName = $foreignTableElement.getAttribute("peerClassName") )
 #set ( $foreignTableName = $foreignTableElement.getAttribute("name") )
+#set ( $trackModified = $torqueGen.booleanOption("torque.om.trackModified"))
+#set ( $trackNew = $torqueGen.booleanOption("torque.om.trackNew"))
+#set ( $trackSaving = $torqueGen.booleanOption("torque.om.trackSaving"))
+#set ( $trackLoading = $torqueGen.booleanOption("torque.om.trackLoading"))
+#set ( $trackDeleted = $torqueGen.booleanOption("torque.om.trackDeleted"))
     /** 
      * Fills the referenced ${fieldType} objects in the ${field} fields
      * of the objects in <code>toFill</code> by reading the database.
@@ -269,8 +274,24 @@
             // object to remain consistent with the other Torque reference
             // treatment
             ${fieldType} referencedCopy = referenced.copy(false);
-            // copy does not set primary key
+            // copy does not set primary key#if ($trackModified || $trackNew || $trackSaving
|| $trackLoading || $trackDeleted) and the flags#end
+
             referencedCopy.setPrimaryKey(referenced.getPrimaryKey());
+#if ($trackModified)
+            referencedCopy.setModified(referenced.isModified());
+#end
+#if ($trackNew)
+            referencedCopy.setNew(referenced.isNew());
+#end
+#if ($trackSaving)
+            referencedCopy.setSaving(referenced.isSaving());
+#end
+#if ($trackLoading)
+            referencedCopy.setLoading(referenced.isLoading());
+#end
+#if ($trackDeleted)
+            referencedCopy.setDeleted(referenced.isDeleted());
+#end
             objectToFill.${setter}(referencedCopy);
             result.add(referencedCopy);
         }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencingObjects.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencingObjects.vm?rev=1584929&r1=1584928&r2=1584929&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencingObjects.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/fillReferencingObjects.vm
Fri Apr  4 22:22:48 2014
@@ -38,6 +38,11 @@
 #set ( $primaryKeyColumnElements = $localTableElement.getChild("primary-keys").getChildren("column"))
 #set ( $foreignTableElement = $foreignKeyElement.getParent() )
 #set ( $foreignTablePeerClassName = $foreignTableElement.getAttribute("peerClassName") )
+#set ( $trackModified = $torqueGen.booleanOption("torque.om.trackModified"))
+#set ( $trackNew = $torqueGen.booleanOption("torque.om.trackNew"))
+#set ( $trackSaving = $torqueGen.booleanOption("torque.om.trackSaving"))
+#set ( $trackLoading = $torqueGen.booleanOption("torque.om.trackLoading"))
+#set ( $trackDeleted = $torqueGen.booleanOption("torque.om.trackDeleted"))
     /** 
      * Fills the referenced ${fieldContainedType} objects in the ${field} fields
      * of the objects in <code>toFill</code> by reading the database.
@@ -273,8 +278,24 @@
                 // of the referencing object to remain consistent
                 // with other Torque referencing object treatment
                 ${fieldContainedType} referencingCopy = referencing.copy(false);
-                // copy does not set primary key
+                // copy does not set primary key#if ($trackModified || $trackNew || $trackSaving
|| $trackLoading || $trackDeleted) and the flags#end
+
                 referencingCopy.setPrimaryKey(referencing.getPrimaryKey());
+#if ($trackModified)
+                referencingCopy.setModified(referencing.isModified());
+#end
+#if ($trackNew)
+                referencingCopy.setNew(referencing.isNew());
+#end
+#if ($trackSaving)
+                referencingCopy.setSaving(referencing.isSaving());
+#end
+#if ($trackLoading)
+                referencingCopy.setLoading(referencing.isLoading());
+#end
+#if ($trackDeleted)
+                referencingCopy.setDeleted(referencing.isDeleted());
+#end
                 objectToFill.${adder}(referencingCopy);
                 result.add(referencingCopy);
             }



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