You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/06/25 07:20:01 UTC

cvs commit: jakarta-turbine/conf/torque/templates/om ExtensionObject.vm ExtensionPeer.vm MapBuilder.vm MultiExtendObject.vm Object.vm Peer.vm

jvanzyl     01/06/24 22:20:01

  Modified:    conf/torque/templates/om ExtensionObject.vm ExtensionPeer.vm
                        MapBuilder.vm MultiExtendObject.vm Object.vm
                        Peer.vm
  Log:
  - updating templates with new torque/om class locations
  - started cleaning up the templates as there is a source
    formatter in the TDK now.
  
  Revision  Changes    Path
  1.14      +9 -25     jakarta-turbine/conf/torque/templates/om/ExtensionObject.vm
  
  Index: ExtensionObject.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/ExtensionObject.vm,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ExtensionObject.vm	2001/05/11 22:26:49	1.13
  +++ ExtensionObject.vm	2001/06/25 05:19:59	1.14
  @@ -10,35 +10,19 @@
       #set ($abstract = "abstract")
   #end
   
  -// JDK classes
  -import java.util.*;
  +import org.apache.turbine.services.db.om.Persistent;
   
  -// Turbine classes
  -import org.apache.turbine.om.*;
  -import org.apache.turbine.om.peer.BasePeer;
  -import org.apache.turbine.util.db.Criteria;
  -#if ($addSaveMethod)
  -import org.apache.turbine.util.ObjectUtils;
  -#end
  -import org.apache.turbine.util.StringUtils;
  -import org.apache.turbine.util.ParameterParser;
  -import org.apache.turbine.util.Log;
  -import org.apache.turbine.util.db.pool.DBConnection;
  -
   /** 
  -  * The skeleton for this class was autogenerated by Torque on:
  -  *
  -  * [$now]
  -  *
  -  * 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.
  -  */
  + * The skeleton for this class was autogenerated by Torque on:
  + *
  + * [$now]
  + *
  + * 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 $!abstract class $table.JavaName 
       extends ${package}.$basePrefix$table.JavaName
       implements Persistent
   {
   }
  -
  -
  -
  
  
  
  1.8       +12 -14    jakarta-turbine/conf/torque/templates/om/ExtensionPeer.vm
  
  Index: ExtensionPeer.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/ExtensionPeer.vm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ExtensionPeer.vm	2001/03/25 23:08:54	1.7
  +++ ExtensionPeer.vm	2001/06/25 05:19:59	1.8
  @@ -13,26 +13,24 @@
   import com.workingdogs.village.*;
   
   // Turbine classes
  -import org.apache.turbine.om.peer.*;
  -import org.apache.turbine.util.*;
  -import org.apache.turbine.util.db.*;
  -import org.apache.turbine.util.db.map.*;
  -import org.apache.turbine.util.db.pool.DBConnection;
  +import org.apache.turbine.services.db.om.peer.*;
  +import org.apache.turbine.services.db.*;
  +import org.apache.turbine.services.db.map.*;
  +import org.apache.turbine.services.db.pool.DBConnection;
   
   // Local classes
   import ${package}.map.*;
   
   /** 
  -  * The skeleton for this class was autogenerated by Torque on:
  -  *
  -  * [$now]
  -  *
  -  *  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.
  -  */
  + * The skeleton for this class was autogenerated by Torque on:
  + *
  + * [$now]
  + *
  + *  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 class ${table.JavaName}Peer 
       extends ${package}.$basePrefix${table.JavaName}Peer
   {
   }
  -
  
  
  
  1.22      +65 -47    jakarta-turbine/conf/torque/templates/om/MapBuilder.vm
  
  Index: MapBuilder.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/MapBuilder.vm,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- MapBuilder.vm	2001/06/14 15:18:26	1.21
  +++ MapBuilder.vm	2001/06/25 05:19:59	1.22
  @@ -6,9 +6,9 @@
   
   // Turbine classes
   import org.apache.turbine.services.db.TurbineDB;
  -import org.apache.turbine.util.db.map.MapBuilder;
  -import org.apache.turbine.util.db.map.DatabaseMap;
  -import org.apache.turbine.util.db.map.TableMap;
  +import org.apache.turbine.services.db.map.MapBuilder;
  +import org.apache.turbine.services.db.map.DatabaseMap;
  +import org.apache.turbine.services.db.map.TableMap;
   
   /**
     *  This class was autogenerated by Torque on: 
  @@ -18,47 +18,63 @@
     */
   public class ${table.JavaName}MapBuilder implements MapBuilder
   {
  -    /** the name of this class */
  -    public static final String CLASS_NAME = "${package}.map.${table.JavaName}MapBuilder";
  -
  -    /** item */
  +    /** 
  +     * The name of this class 
  +     */
  +    public static final String CLASS_NAME = 
  +        "${package}.map.${table.JavaName}MapBuilder";
  +
  +    /** 
  +     * Item 
  +     */
       public static String getTable( )
       {
           return "$table.Name";
       }
   
  -#foreach ($col in $table.Columns)
  +    #foreach ($col in $table.Columns)
       #set ( $tfc=$table.JavaName )
       #set ( $cfc=$col.JavaName )
       #set ( $cup=$col.Name.toUpperCase() )
   
  -    /** ${table.Name}.$cup */
  +    /** 
  +     * ${table.Name}.$cup 
  +     */
       public static String get${tfc}_${cfc}()
       {
           return getTable() + ".$cup";
       }
  -#end
  +    #end
   
  -    /**  the database map  */
  +    /** 
  +     * The database map.
  +     */
       private DatabaseMap dbMap = null;
   
       /**
  -        tells us if this DatabaseMapBuilder is built so that we don't have
  -        to re-build it every time
  -    */
  +     * Tells us if this DatabaseMapBuilder is built so that we 
  +     * don't have to re-build it every time.
  +     */
       public boolean isBuilt()
       {
           if ( dbMap != null )
  +        {
               return true;
  +        }            
           return false;
       }
   
  -    /**  gets the databasemap this map builder built.  */
  +    /**  
  +     * Gets the databasemap this map builder built.  
  +     */
       public DatabaseMap getDatabaseMap()
       {
           return this.dbMap;
       }
  -    /** the doBuild() method builds the DatabaseMap */
  +    
  +    /** 
  +     * The doBuild() method builds the DatabaseMap 
  +     */
       public void doBuild ( ) throws Exception
       {
           dbMap = TurbineDB.getDatabaseMap("$table.Database.Name");
  @@ -66,47 +82,49 @@
           dbMap.addTable(getTable());
           TableMap tMap = dbMap.getTable(getTable());
   
  -#if ($table.IdMethod == "autoincrement")
  +        #if ($table.IdMethod == "autoincrement")
           tMap.setPrimaryKeyMethod(TableMap.AUTOINCREMENT);
  -#elseif ($table.IdMethod == "sequence")
  +        #elseif ($table.IdMethod == "sequence")
           tMap.setPrimaryKeyMethod(TableMap.SEQUENCE);
  -#elseif ($table.IdMethod == "idbroker")
  +        #elseif ($table.IdMethod == "idbroker")
           tMap.setPrimaryKeyMethod(TableMap.IDBROKERTABLE);
  -#else
  +        #else
           tMap.setPrimaryKeyMethod(TableMap.NONE);
  -#end
  +        #end
   
  -#if ($table.IdMethod == "idbroker")
  +        #if ($table.IdMethod == "idbroker")
           tMap.setPrimaryKeyMethodInfo(tMap.getName());
  -#elseif ($table.IdMethod == "sequence")
  +        #elseif ($table.IdMethod == "sequence")
           tMap.setPrimaryKeyMethodInfo("$table.SequenceName");
  -#elseif ($table.IdMethodParameters)
  +        #elseif ($table.IdMethodParameters)
           // this might need upgrading based on what all the databases
           // need, but for now assume one parameter.
  -    #set ($imp = $table.IdMethodParameters.get(0) )
  +        #set ($imp = $table.IdMethodParameters.get(0) )
           tMap.setPrimaryKeyMethodInfo("$imp.Value");
  -#end        
  +        #end        
   
  -#foreach ($col in $table.Columns)
  -    #set ( $tfc=$table.JavaName )
  -    #set ( $cfc=$col.JavaName )
  -    #set ( $cup=$col.Name.toUpperCase() )
  -
  -    #if($col.isPrimaryKey())
  -      #if($col.isForeignKey())
  -        tMap.addForeignPrimaryKey ( get${tfc}_${cfc}(), $col.JavaObject , "$col.RelatedTableName" , "$col.RelatedColumnName" );
  -      #else
  -        tMap.addPrimaryKey ( get${tfc}_${cfc}(), $col.JavaObject );
  -      #end
  -    #else
  -      #if($col.isForeignKey())
  -        tMap.addForeignKey ( get${tfc}_${cfc}(), $col.JavaObject , "$col.RelatedTableName" , "$col.RelatedColumnName" );
  -      #else
  -        tMap.addColumn ( get${tfc}_${cfc}(), $col.JavaObject );
  -      #end
  -    #end
  -#end
  -
  +        #foreach ($col in $table.Columns)
  +        #set ( $tfc=$table.JavaName )
  +        #set ( $cfc=$col.JavaName )
  +        #set ( $cup=$col.Name.toUpperCase() )
  +
  +        #if($col.isPrimaryKey())
  +          #if($col.isForeignKey())
  +            tMap.addForeignPrimaryKey ( 
  +                get${tfc}_${cfc}(), $col.JavaObject , "$col.RelatedTableName" , 
  +                    "$col.RelatedColumnName" );
  +      	#else
  +            tMap.addPrimaryKey ( get${tfc}_${cfc}(), $col.JavaObject );
  +          #end
  +        #else
  +          #if($col.isForeignKey())
  +            tMap.addForeignKey ( 
  +                get${tfc}_${cfc}(), $col.JavaObject , "$col.RelatedTableName" , 
  +                    "$col.RelatedColumnName" );
  +          #else
  +            tMap.addColumn ( get${tfc}_${cfc}(), $col.JavaObject );
  +          #end
  +        #end
  +        #end
       }
  -
   }
  
  
  
  1.6       +12 -22    jakarta-turbine/conf/torque/templates/om/MultiExtendObject.vm
  
  Index: MultiExtendObject.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/MultiExtendObject.vm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MultiExtendObject.vm	2001/03/25 23:08:54	1.5
  +++ MultiExtendObject.vm	2001/06/25 05:19:59	1.6
  @@ -6,22 +6,12 @@
   #end
   package $package;
   
  -// JDK classes
   import java.util.*;
  +import org.apache.turbine.services.db.om.BaseObject;
  +import org.apache.turbine.services.db.om.peer.BasePeer;
  +import org.apache.turbine.services.db.util.Criteria;
  +import org.apache.turbine.services.db.pool.DBConnection;
   
  -// Turbine classes
  -import org.apache.turbine.om.BaseObject;
  -import org.apache.turbine.om.peer.BasePeer;
  -import org.apache.turbine.util.db.Criteria;
  -#if ($addSaveMethod)
  -import org.apache.turbine.util.ObjectUtils;
  -#end
  -import org.apache.turbine.util.StringUtils;
  -import org.apache.turbine.util.ParameterParser;
  -import org.apache.turbine.util.Log;
  -import org.apache.turbine.util.db.pool.DBConnection;
  -
  -
   #if ($child.Ancestor)
       #set ($parent = $child.Ancestor)
   #else
  @@ -29,14 +19,14 @@
   #end
   
   /** 
  -  * The skeleton for this class was autogenerated by Torque on:
  -  *
  -  * [$now]
  -  *
  -  * 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.
  -  */
  + * The skeleton for this class was autogenerated by Torque on:
  + *
  + * [$now]
  + *
  + * 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 class $child.ClassName extends $parent
   {
       public ${child.ClassName}()
  
  
  
  1.60      +85 -94    jakarta-turbine/conf/torque/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/Object.vm,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- Object.vm	2001/06/20 17:55:42	1.59
  +++ Object.vm	2001/06/25 05:19:59	1.60
  @@ -12,21 +12,15 @@
       #set ($extendsBaseClass = "extends $table.BaseClass" )
   #end
   
  -// JDK classes
   import java.util.*;
   import java.math.*;
  -
  -// Turbine classes
  -import org.apache.turbine.om.*;
  -import org.apache.turbine.om.peer.BasePeer;
  -import org.apache.turbine.util.db.Criteria;
  +import org.apache.turbine.services.db.om.*;
  +import org.apache.turbine.services.db.om.peer.BasePeer;
  +import org.apache.turbine.services.db.util.Criteria;
  +import org.apache.turbine.services.db.pool.DBConnection;
   #if ($addSaveMethod)
   import org.apache.turbine.util.ObjectUtils;
   #end
  -import org.apache.turbine.util.StringUtils;
  -import org.apache.turbine.util.ParameterParser;
  -import org.apache.turbine.util.Log;
  -import org.apache.turbine.util.db.pool.DBConnection;
   #if (!$complexObjectModel)
   import org.apache.turbine.services.db.TurbineDB;
   #end
  @@ -42,105 +36,102 @@
   public abstract class $basePrefix$table.JavaName $extendsBaseClass
       implements Retrievable
   {
  -#if (!$table.isAlias())
  -  #foreach ($col in $table.Columns)
  -    #set ( $cjtype = $col.JavaNative )
  -    #set ( $clo=$col.Name.toLowerCase() )
  -    #set ($defVal = "")
  -    #if ($col.DefaultValue && !$col.DefaultValue.equalsIgnoreCase("NULL") )
  -        #set ( $quote = '' )
  -        #if ( $cjtype == "String" ) 
  +    #if (!$table.isAlias())
  +      #foreach ($col in $table.Columns)
  +        #set ( $cjtype = $col.JavaNative )
  +        #set ( $clo=$col.Name.toLowerCase() )
  +        #set ($defVal = "")
  +        #if ($col.DefaultValue && !$col.DefaultValue.equalsIgnoreCase("NULL") )
  +          #set ( $quote = '' )
  +          #if ( $cjtype == "String" ) 
               #set ( $quote = '"' )
  -        #end
  -        #set ( $defaultValue = $col.DefaultValue )
  -        #if ( $cjtype == "boolean" )
  +          #end
  +          #set ( $defaultValue = $col.DefaultValue )
  +          #if ( $cjtype == "boolean" )
               #if ( $defaultValue == "1" || $defaultValue == "Y" )
  -                #set ( $defaultValue = "true" )
  +              #set ( $defaultValue = "true" )
               #elseif ( $defaultValue == "0" || $defaultValue == "N" )
  -                #set ( $defaultValue = "false" )
  +              #set ( $defaultValue = "false" )
               #end
  -        #end
  -        #if ($cjtype == "BigDecimal")
  -            #set ($defVal = "= new BigDecimal($defaultValue)")
  -        #else
  -            #set ($defVal = "=$quote$defaultValue$quote")
  +          #end
  +          #set ($defVal = "=$quote$defaultValue$quote")
           #end
  -    #end
  -    /** the value for the $clo field */
  -    private $cjtype $clo$defVal;
  -  #end
  -
  -
  -  #foreach ($col in $table.Columns)
  -    #set ( $cfc=$col.JavaName )
  -    #set ( $clo=$col.Name.toLowerCase() )
  -    #set ( $cjtype = $col.JavaNative )
  -    /**
  -     * Get the $cfc
  -     * @return $cjtype
  -     */
  -     public $cjtype get${cfc}()
  -     {
  +      
  +        /** 
  +         * The value for the $clo field 
  +         */
  +        private $cjtype $clo$defVal;
  +      #end
  +
  +      #foreach ($col in $table.Columns)
  +        #set ( $cfc=$col.JavaName )
  +        #set ( $clo=$col.Name.toLowerCase() )
  +        #set ( $cjtype = $col.JavaNative )
  +    
  +        /**
  +         * Get the $cfc
  +         * @return $cjtype
  +         */
  +        public $cjtype get${cfc}()
  +        {
             return $clo;
  -     }
  +        }
   
  -    #set ( $throwsClause = "" )
  -    #if ($complexObjectModel)
  -        #if ($col.isForeignKey())
  +        #set ( $throwsClause = "" )
  +        #if ($complexObjectModel)
  +          #if ($col.isForeignKey())
               #set ( $throwsClause = "throws Exception" )
  -        #end    
  -        #if ( $col.Referrers.size() > 0 )
  +          #end    
  +          #if ( $col.Referrers.size() > 0 )
               #if ($throwsClause == "")
  -                #set ( $throwsClause = "throws Exception" )
  +              #set ( $throwsClause = "throws Exception" )
               #end
  +          #end
           #end
  -    #end
   
  -    /**
  -     * Set the value of $cfc
  -     */
  -     public void set${cfc}($cjtype v ) $throwsClause
  -     {
  -#if ($complexObjectModel)
  -  #if ($col.isForeignKey())
  -    #set ( $tmp = $col.RelatedTableName )
  -    #set ( $tblFK = $table.Database.getTable($tmp) )
  -    #set ( $colFK = $tblFK.getColumn($col.RelatedColumnName) )
  -    #if ($col.isMultipleFK())
  -        #set ( $varName = $strings.concat(["a", $tblFK.JavaName, "RelatedBy", $col.JavaName]) )
  -    #elseif ($tmp.equals($table.Name))
  -        #set ( $varName = $strings.concat(["a", $tblFK.JavaName, "RelatedBy", $col.JavaName]) )
  -    #else
  -        #set ( $varName = $strings.concat(["a", $tblFK.JavaName]) )
  -    #end
  -    $varName = null;
  -  #end
  -
  -  #foreach ($fk in $col.Referrers)
  -     #set ( $fkColName = $fk.ForeignLocalMapping.get($col.Name) )
  -     #set ( $tblFK = $fk.Table )
  -     #if ( !($tblFK.Name.equals($table.Name)) )
  -
  -        #set ( $colFK = $tblFK.getColumn($fkColName) )
  -
  -        #if ($colFK.isMultipleFK())
  -            #set ( $collName = $strings.concat(["coll", $tblFK.JavaName, "sRelatedBy", $colFK.JavaName]) )
  -        #else
  -            #set ( $collName = $strings.concat(["coll", $tblFK.JavaName, "s"]) )
  -        #end
  +        /**
  +         * Set the value of $cfc
  +         */
  +        public void set${cfc}($cjtype v ) $throwsClause
  +        {
  +        #if ($complexObjectModel)
  +          #if ($col.isForeignKey())
  +            #set ( $tmp = $col.RelatedTableName )
  +            #set ( $tblFK = $table.Database.getTable($tmp) )
  +            #set ( $colFK = $tblFK.getColumn($col.RelatedColumnName) )
  +            #if ($col.isMultipleFK())
  +              #set ( $varName = $strings.concat(["a", $tblFK.JavaName, "RelatedBy", $col.JavaName]) )
  +            #elseif ($tmp.equals($table.Name))
  +              #set ( $varName = $strings.concat(["a", $tblFK.JavaName, "RelatedBy", $col.JavaName]) )
  +            #else
  +              #set ( $varName = $strings.concat(["a", $tblFK.JavaName]) )
  +            #end
  +            $varName = null;
  +          #end
   
  -          // update associated $tblFK.JavaName
  -          if ($collName != null )
  -          {
  -              for (int i=0; i<${collName}.size(); i++)
  +          #foreach ($fk in $col.Referrers)
  +            #set ( $fkColName = $fk.ForeignLocalMapping.get($col.Name) )
  +            #set ( $tblFK = $fk.Table )
  +            #if ( !($tblFK.Name.equals($table.Name)) )
  +              #set ( $colFK = $tblFK.getColumn($fkColName) )
  +              #if ($colFK.isMultipleFK())
  +                #set ( $collName = $strings.concat(["coll", $tblFK.JavaName, "sRelatedBy", $colFK.JavaName]) )
  +              #else
  +                #set ( $collName = $strings.concat(["coll", $tblFK.JavaName, "s"]) )
  +              #end
  +
  +              // update associated $tblFK.JavaName
  +              if ($collName != null )
                 {
  -                  ((${tblFK.JavaName})${collName}.get(i))
  -                      .set${colFK.JavaName}(v);
  +                  for (int i=0; i<${collName}.size(); i++)
  +                  {
  +                      ((${tblFK.JavaName})${collName}.get(i))
  +                          .set${colFK.JavaName}(v);
  +                  }
                 }
  -          }
  -     #end
  -  #end 
  -#end
  +            #end
  +          #end 
  +        #end
   
   #if ($addSaveMethod)
   
  
  
  
  1.63      +7 -8      jakarta-turbine/conf/torque/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/Peer.vm,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- Peer.vm	2001/06/24 18:14:40	1.62
  +++ Peer.vm	2001/06/25 05:19:59	1.63
  @@ -15,12 +15,11 @@
   import com.workingdogs.village.*;
   
   // Turbine classes
  -import org.apache.turbine.om.*;
  -import org.apache.turbine.om.peer.*;
  -import org.apache.turbine.util.*;
  -import org.apache.turbine.util.db.*;
  -import org.apache.turbine.util.db.map.*;
  -import org.apache.turbine.util.db.pool.DBConnection;
  +import org.apache.turbine.services.db.om.*;
  +import org.apache.turbine.services.db.om.peer.*;
  +import org.apache.turbine.services.db.util.*;
  +import org.apache.turbine.services.db.map.*;
  +import org.apache.turbine.services.db.pool.DBConnection;
   import org.apache.turbine.services.db.TurbineDB;
   
   // Local classes
  @@ -82,7 +81,7 @@
           }
           catch (Exception e)
           {
  -            Log.error("A FATAL ERROR has occurred which should not" +
  +            category.error("A FATAL ERROR has occurred which should not" +
                   "have happened under any circumstance.  Please notify" +
                   "Turbine and give as many details as possible including the " +
                   "error stacktrace.", e);
  @@ -155,7 +154,7 @@
           }
           catch (Exception e)
           {
  -            Log.error("A FATAL ERROR has occurred which should not" +
  +            category.error("A FATAL ERROR has occurred which should not" +
                   "have happened under any circumstance.  Please notify " +
                   "Turbine and give as many details as possible including the " +
                   "error stacktrace.", e);
  
  
  

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