db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmon...@apache.org
Subject svn commit: r482872 - in /db/torque: site/trunk/xdocs/ templates/trunk/src/templates/om/
Date Wed, 06 Dec 2006 03:14:19 GMT
Author: gmonroe
Date: Tue Dec  5 19:14:18 2006
New Revision: 482872

URL: http://svn.apache.org/viewvc?view=rev&rev=482872
Log:
Fixed template package references that caused bad code to be 
generated if non-default packages where used.        

Modified:
    db/torque/site/trunk/xdocs/changes.xml
    db/torque/templates/trunk/src/templates/om/BaseManager.vm
    db/torque/templates/trunk/src/templates/om/MapBuilder.vm
    db/torque/templates/trunk/src/templates/om/Object.vm
    db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?view=diff&rev=482872&r1=482871&r2=482872
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Tue Dec  5 19:14:18 2006
@@ -23,6 +23,7 @@
     <author email="mpoeschl@marmot.at">Martin Poeschl</author>
     <author email="seade@backstagetech.com.au">Scott Eade</author>
     <author email="dion@multitask.com.au">dIon Gillard</author>
+    <author email="monroe@dukece.com">Greg Monroe</author>
     <author email="hps@intermeta.de">Henning P. Schmiedehausen</author>
     <author email="fischer@seitenbau.de">Thomas Fischer</author>
     <author email="tv@apache.org">Thomas Vandahl</author>
@@ -30,6 +31,12 @@
 
   <body>
 
+  <release version="3.3" date="in SVN">
+    <action type="fix" dev="gmonroe">
+      Fixed template package references that caused bad code to be generated
+      if non-default packages where used.        
+    </action>
+  </release>
   <release version="3.3-RC1" date="2006-11-23">
     <action type="fix" dev="tfischer">
       Fixed a synchronisation issue in the getDateString() method in 

Modified: db/torque/templates/trunk/src/templates/om/BaseManager.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/BaseManager.vm?view=diff&rev=482872&r1=482871&r2=482872
==============================================================================
--- db/torque/templates/trunk/src/templates/om/BaseManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/BaseManager.vm Tue Dec  5 19:14:18 2006
@@ -77,11 +77,11 @@
 
 #end
     /** The name of the manager */
-    protected static final String MANAGED_CLASS = "${package}.${interfaceName}";
+    protected static final String MANAGED_CLASS = "${packageObject}.${interfaceName}";
 
     /** The name of our class to pass to Torque as the default manager. */
     protected static final String DEFAULT_MANAGER_CLASS
-        = "${package}.${interfaceName}Manager";
+        = "${packageManager}.${interfaceName}Manager";
 
     /**
      * Retrieves an implementation of the manager, based on the settings in
@@ -123,7 +123,7 @@
 
     /**
      * Static accessor for the @see #getCachedInstanceImpl(ObjectKey).
-     * Loads <code>${interfaceName}</code> from cache, returns 
+     * Loads <code>${interfaceName}</code> from cache, returns
      * <code>null</code>, if instance is not in cache
      *
      * @param id an <code>ObjectKey</code> value
@@ -247,7 +247,7 @@
     public $basePrefix${interfaceName}Manager()
         throws TorqueException
     {
-        setClassName("${package}.${interfaceName}");
+        setClassName("${packageObject}.${interfaceName}");
     }
 
     /**
@@ -280,7 +280,7 @@
     }
 
     /**
-     * Get a ${interfaceName} with the given id from the cache. Returns 
+     * 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

Modified: db/torque/templates/trunk/src/templates/om/MapBuilder.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/MapBuilder.vm?view=diff&rev=482872&r1=482871&r2=482872
==============================================================================
--- db/torque/templates/trunk/src/templates/om/MapBuilder.vm (original)
+++ db/torque/templates/trunk/src/templates/om/MapBuilder.vm Tue Dec  5 19:14:18 2006
@@ -80,23 +80,23 @@
      */
     public synchronized void doBuild() throws TorqueException
     {
-    	if ( isBuilt() ) {
-    		return;
-    	}
+        if ( isBuilt() ) {
+                return;
+        }
         dbMap = Torque.getDatabaseMap("$table.Database.Name");
 
         dbMap.addTable("$table.Name");
         TableMap tMap = dbMap.getTable("$table.Name");
         tMap.setJavaName("$table.JavaName");
-        tMap.setOMClass( ${package}.${table.JavaName}.class );
+        tMap.setOMClass( ${packageObject}.${table.JavaName}.class );
         tMap.setPeerClass( ${packagePeer}.${table.JavaName}Peer.class );
-#if ( $table.Description )        
+#if ( $table.Description )
         tMap.setDescription("$table.Description");
-#end        
+#end
 #if ($table.IdMethod == "native")
-	    tMap.setPrimaryKeyMethod(TableMap.NATIVE);
+            tMap.setPrimaryKeyMethod(TableMap.NATIVE);
 #elseif ($table.IdMethod == "idbroker")
-    	tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
+        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
 #else
         tMap.setPrimaryKeyMethod("$table.IdMethod");
 #end
@@ -106,7 +106,7 @@
   #set ($imp = $table.IdMethodParameters.get(0) )
         tMap.setPrimaryKeyMethodInfo("$imp.Value");
 #elseif ($table.IdMethod == "idbroker")
-    	tMap.setPrimaryKeyMethodInfo(tMap.getName());
+        tMap.setPrimaryKeyMethodInfo(tMap.getName());
 #elseif ($table.IdMethod == "native" && $table.Database.Platform.NativeIdMethod ==
"sequence")
         tMap.setPrimaryKeyMethodInfo("$table.SequenceName");
 #elseif ($table.IdMethod == "native" && $table.Database.Platform.NativeIdMethod ==
"identity")
@@ -117,7 +117,7 @@
   #if ($table.Interface)
     #set ($interfaceName = $table.Interface)
   #end
-		tMap.setUseManager(true);
+                tMap.setUseManager(true);
         tMap.setManagerClass( ${packageManager}.${interfaceName}Manager.class );
 #end
 
@@ -129,7 +129,7 @@
 #foreach ($col in $table.Columns)
   #set ( $cfc=$col.JavaName )
   #set ( $cnm=$col.Name )
-  #if ( ${deprecatedUppercasePeer} ) 
+  #if ( ${deprecatedUppercasePeer} )
     #set ( $cnm=$col.Name.toUpperCase() )
   #end
   // ------------- Column: $cnm --------------------
@@ -138,41 +138,41 @@
         cMap.setTorqueType( "$col.Domain.Type.Name" );
         cMap.setUsePrimitive($col.UsePrimitive);
         cMap.setPrimaryKey($col.isPrimaryKey());
-  		cMap.setNotNull($col.isNotNull());
+                cMap.setNotNull($col.isNotNull());
         cMap.setJavaName( "$cfc" );
         cMap.setAutoIncrement($col.AutoIncrement);
-  		cMap.setProtected($col.Protected);
-  #if( $col.JavaType )   		
-  		cMap.setJavaType( "${col.JavaType}" );
-  #end
-  #if( $col.Description ) 
-  		cMap.setDescription("${col.Description}");
-  #end  		
+                cMap.setProtected($col.Protected);
+  #if( $col.JavaType )
+                cMap.setJavaType( "${col.JavaType}" );
+  #end
+  #if( $col.Description )
+                cMap.setDescription("${col.Description}");
+  #end
   #if( $col.DefaultValue )
-  		cMap.setDefault("$col.DefaultValue");
+                cMap.setDefault("$col.DefaultValue");
   #end
   #if( $col.InheritanceType )
-  		cMap.setInheritance("$col.InheritanceType");
+                cMap.setInheritance("$col.InheritanceType");
   #end
   #if( $col.InputValidator )
-  		cMap.setInputValidator("$col.InputValidator");
+                cMap.setInputValidator("$col.InputValidator");
   #end
   #if( $col.JavaNamingMethod )
-  		cMap.setJavaNamingMethod("$col.JavaNamingMethod");
+                cMap.setJavaNamingMethod("$col.JavaNamingMethod");
   #end
   #if( $col.Precision )
         cMap.setSize( $col.Precision );
-   	#if( $col.Scale )
+        #if( $col.Scale )
         cMap.setScale( $col.Scale );
     #end
   #end
   #if($col.isForeignKey())
-  	    cMap.setForeignKey("$col.RelatedTableName", "$col.RelatedColumnName"); 
+            cMap.setForeignKey("$col.RelatedTableName", "$col.RelatedColumnName");
   #end
-  #if($col.isInheritance() ) 
+  #if($col.isInheritance() )
     #set($tableUseInheritance = "true");
-  		cMap.setUseInheritance($col.Inheritance);
-  		InheritanceMap iMap = null;
+                cMap.setUseInheritance($col.Inheritance);
+                InheritanceMap iMap = null;
     #foreach ($inh in $col.Children)
         iMap = new InheritanceMap(cMap,"$inh.Key","$inh.ClassName","$inh.Ancestor");
         cMap.addInheritanceMap(iMap);

Modified: db/torque/templates/trunk/src/templates/om/Object.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Object.vm?view=diff&rev=482872&r1=482871&r2=482872
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Object.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Object.vm Tue Dec  5 19:14:18 2006
@@ -63,10 +63,22 @@
 #foreach ($col in $table.Columns)
   #if ($col.isForeignKey())
     #set ($fkPackage = $table.Database.getTable($col.RelatedTableName).getPackage())
-      #if  (!$fkPackage.equals($currentPackage) )
-import ${fkPackage}.${table.Database.getTable($col.RelatedTableName).JavaName};
-import ${fkPackage}.${table.Database.getTable($col.RelatedTableName).JavaName}Peer;
-      #end
+    #if ($subpackageObject)
+      #set ($fkPackageObject = "${fkPackage}.${subpackageObject}")
+    #else
+      #set ($fkPackageObject = $fkPackage)
+    #end
+    #if ($subpackagePeer)
+      #set ($fkPackagePeer = "${fkPackage}.${subpackagePeer}")
+    #else
+      #set ($fkPackagePeer = $fkPackage)
+    #end
+    #if  (!$fkPackageObject.equals($currentPackage) )
+import ${fkPackageObject}.${table.Database.getTable($col.RelatedTableName).JavaName};
+    #end
+    #if  (!$fkPackagePeer.equals($currentPackage) )
+import ${fkPackagePeer}.${table.Database.getTable($col.RelatedTableName).JavaName}Peer;
+    #end
   #end
 #end
 
@@ -1131,7 +1143,7 @@
             }
             ${col.SetterName}(((Short)value).shortValue());
       #elseif ($cjtype == "byte")
-        	if (value == null || ! (Byte.class.isInstance(value)))
+                if (value == null || ! (Byte.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or
not a Byte object.");
             }
@@ -1766,11 +1778,11 @@
         return copyInto(copyObj, true);
     }
   #end
-    
+
     /**
      * Fills the copyObj with the contents of this object.
   #if ($complexObjectModel)
-     * If deepcopy is true, The associated objects are also copied 
+     * If deepcopy is true, The associated objects are also copied
      * and treated as new objects.
   #end
      * @param copyObj the object to fill.
@@ -1791,8 +1803,8 @@
   #foreach ($col in $table.Columns)
     #if ($col.isPrimaryKey())
       #if($col.Primitive)
-		#set ($fktype = $col.JavaNative)
-	    #set ($casttype = "")
+                #set ($fktype = $col.JavaNative)
+            #set ($casttype = "")
         #if ($fktype == "short")
           #set ($casttype = "(short)")
         #elseif($fktype == "byte")
@@ -1810,7 +1822,7 @@
   #end
 
   #if ($complexObjectModel)
-        if (deepcopy) 
+        if (deepcopy)
         {
     #foreach ($fk in $table.Referrers)
       #set ( $tblFK = $fk.Table )

Modified: db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm?view=diff&rev=482872&r1=482871&r2=482872
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm Tue Dec  5 19:14:18 2006
@@ -63,15 +63,29 @@
 #foreach ($col in $table.Columns)
   #if ($col.isForeignKey())
     #set ($fkPackage = $table.Database.getTable($col.RelatedTableName).getPackage())
-      #if  (!$fkPackage.equals($currentPackage) )
-import ${fkPackage}.${table.Database.getTable($col.RelatedTableName).JavaName};
-import ${fkPackage}.${table.Database.getTable($col.RelatedTableName).JavaName}Peer;
-        #if ($subpackageManager)
+    #if  (!$fkPackage.equals($currentPackage) )
+      #if ($subpackageObject)
+        #set ($fkPackageObject = "${fkPackage}.${subpackageObject}")
+      #else
+        #set ($fkPackageObject = $fkPackage)
+      #end
+      #if ($subpackagePeer)
+        #set ($fkPackagePeer = "${fkPackage}.${subpackagePeer}")
+      #else
+        #set ($fkPackagePeer = $fkPackage)
+      #end
+      #if  (!$fkPackageObject.equals($currentPackage) )
+import ${fkPackageObject}.${table.Database.getTable($col.RelatedTableName).JavaName};
+      #end
+      #if  (!$fkPackagePeer.equals($currentPackage) )
+import ${fkPackagePeer}.${table.Database.getTable($col.RelatedTableName).JavaName}Peer;
+      #end
+      #if ($subpackageManager)
 import ${fkPackage}.${subpackageManager}.${table.Database.getTable($col.RelatedTableName).JavaName}Manager;
-        #else
+      #else
 import ${fkPackage}.${table.Database.getTable($col.RelatedTableName).JavaName}Manager;
-        #end
       #end
+    #end
   #end
 #end
 
@@ -1146,7 +1160,7 @@
             }
             ${col.SetterName}(((Short)value).shortValue());
       #elseif ($cjtype == "byte")
-        	if (value == null || ! (Byte.class.isInstance(value)))
+                if (value == null || ! (Byte.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or
not a Byte object.");
             }
@@ -1802,11 +1816,11 @@
         return copyInto(copyObj, true);
     }
   #end
-    
+
     /**
      * Fills the copyObj with the contents of this object.
   #if ($complexObjectModel)
-     * If deepcopy is true, The associated objects are also copied 
+     * If deepcopy is true, The associated objects are also copied
      * and treated as new objects.
   #end
      * @param copyObj the object to fill.
@@ -1846,7 +1860,7 @@
   #end
 
   #if ($complexObjectModel)
-        if (deepcopy) 
+        if (deepcopy)
         {
     #foreach ($fk in $table.Referrers)
       #set ( $tblFK = $fk.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