mpoeschl    02/05/27 18:00:16

  Modified:    src/templates/om MapBuilder.vm Object.vm Peer.vm
  Log:
  coding style for generated classes (fixes about 5000 errors reported by checkstyle 
for my project)
  
  Revision  Changes    Path
  1.10      +30 -29    jakarta-turbine-torque/src/templates/om/MapBuilder.vm
  
  Index: MapBuilder.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/MapBuilder.vm,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MapBuilder.vm     9 Apr 2002 16:08:29 -0000       1.9
  +++ MapBuilder.vm     28 May 2002 01:00:16 -0000      1.10
  @@ -10,7 +10,7 @@
   
   /**
   #if ($addTimeStamp)
  -  *  This class was autogenerated by Torque on: 
  +  *  This class was autogenerated by Torque on:
     *
     * [$now]
     *
  @@ -18,17 +18,17 @@
     */
   public class ${table.JavaName}MapBuilder implements MapBuilder
   {
  -    /** 
  -     * The name of this class 
  +    /**
  +     * The name of this class
        */
  -    public static final String CLASS_NAME = 
  +    public static final String CLASS_NAME =
           "${package}.map.${table.JavaName}MapBuilder";
   
  -    /** 
  -     * Item 
  +    /**
  +     * Item
        * @deprecated use ${table.JavaName}Peer.TABLE_NAME constant
        */
  -    public static String getTable( )
  +    public static String getTable()
       {
           return "$table.Name";
       }
  @@ -38,8 +38,9 @@
       #set ( $cfc=$col.JavaName )
       #set ( $cup=$col.Name.toUpperCase() )
   
  -    /** 
  -     * ${table.Name}.$cup 
  +    /**
  +     * ${table.Name}.$cup
  +     * @return the column name for the $cup field
        * @deprecated use ${table.JavaName}Peer.${table.Name}.$cup constant
        */
       public static String get${tfc}_${cfc}()
  @@ -48,35 +49,35 @@
       }
       #end
   
  - 
  -    /** 
  +
  +    /**
        * The database map.
        */
       private DatabaseMap dbMap = null;
   
       /**
  -     * Tells us if this DatabaseMapBuilder is built so that we 
  +     * 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 )
  +        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 TorqueException
       {
  @@ -106,7 +107,7 @@
           tMap.setPrimaryKeyMethodInfo(tMap.getName());
           #elseif ($table.IdMethod == "sequence" ||  ($table.IdMethod == "native" && 
$dbprops.get("idMethod") == "sequence"))
           tMap.setPrimaryKeyMethodInfo("$table.SequenceName");
  -        #end        
  +        #end
   
           #foreach ($col in $table.Columns)
           #set ( $tfc=$table.JavaName )
  @@ -114,19 +115,19 @@
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isPrimaryKey())
             #if($col.isForeignKey())
  -            tMap.addForeignPrimaryKey ( 
  -                "${table.Name}.$cup", $col.JavaObject , "$col.RelatedTableName" , 
  -                    "$col.RelatedColumnName" );
  -        #else
  -            tMap.addPrimaryKey ( "${table.Name}.$cup", $col.JavaObject );
  +            tMap.addForeignPrimaryKey(
  +                "${table.Name}.$cup", $col.JavaObject , "$col.RelatedTableName" ,
  +                    "$col.RelatedColumnName");
  +          #else
  +            tMap.addPrimaryKey("${table.Name}.$cup", $col.JavaObject);
             #end
           #else
             #if($col.isForeignKey())
  -            tMap.addForeignKey ( 
  -                "${table.Name}.$cup", $col.JavaObject , "$col.RelatedTableName" , 
  -                    "$col.RelatedColumnName" );
  +            tMap.addForeignKey(
  +                "${table.Name}.$cup", $col.JavaObject , "$col.RelatedTableName" ,
  +                    "$col.RelatedColumnName");
             #else
  -            tMap.addColumn ( "${table.Name}.$cup", $col.JavaObject );
  +            tMap.addColumn("${table.Name}.$cup", $col.JavaObject);
             #end
           #end
           #end
  
  
  
  1.31      +35 -35    jakarta-turbine-torque/src/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Object.vm,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Object.vm 21 May 2002 19:51:45 -0000      1.30
  +++ Object.vm 28 May 2002 01:00:16 -0000      1.31
  @@ -14,7 +14,6 @@
   
   import java.util.*;
   import java.math.*;
  -import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   import org.apache.torque.om.*;
   import org.apache.torque.util.BasePeer;
  @@ -76,7 +75,7 @@
                 #if (!$col.isPrimitive() && $cjtype != "String")
                     #set ( $defaultValue = "new ${cjtype}($defaultValue)" )
                 #end
  -              #set ($defVal = "=$quote$defaultValue$quote")
  +              #set ($defVal = " = $quote$defaultValue$quote")
             #end
           #end
   
  @@ -115,7 +114,7 @@
           /**
            * Set the value of $cfc
            */
  -        public void set${cfc}($cjtype v ) $throwsClause
  +        public void set${cfc}($cjtype v) $throwsClause
           {
             #if ( ($cjtype == "NumberKey")
                  || ($cjtype == "StringKey")
  @@ -142,7 +141,7 @@
           if (this.$clo != v)
           {
    #else
  -        if ( !Objects.equals(this.$clo, v) )
  +        if (!Objects.equals(this.$clo, v))
           {
    #end
               this.$clo = v;
  @@ -162,7 +161,7 @@
                 #set ( $varName = "a$tblFK.JavaName" )
               #end
   
  -        if ($varName != null &&  !Objects.equals(${varName}.get${colFK.JavaName}(), 
v) )
  +        if ($varName != null && !Objects.equals(${varName}.get${colFK.JavaName}(), 
v))
           {
               $varName = null;
           }
  @@ -180,9 +179,9 @@
                 #end
   
                 // update associated $tblFK.JavaName
  -              if ($collName != null )
  +              if ($collName != null)
                 {
  -                  for (int i=0; i<${collName}.size(); i++)
  +                  for (int i = 0; i < ${collName}.size(); i++)
                     {
                         ((${tblFK.JavaName})${collName}.get(i))
                             .set${colFK.JavaName}(v);
  @@ -199,7 +198,7 @@
        /**
         * Set the value of $cfc as a string.
         */
  -      public void set${cfc}(String v ) $throwsClause
  +      public void set${cfc}(String v) $throwsClause
         {
              set${cfc}(new ${cjtype}(v));
         }
  @@ -296,7 +295,6 @@
           return $varName;
       }
   
  -
       /**
        * Provides convenient way to set a relationship based on a
        * ObjectKey.  e.g.
  @@ -326,7 +324,6 @@
           set${col.JavaName}(($col.JavaNative)key);
       #end
       }
  -
    #end   ## end of foreach loop over foreign keys
   
    ##
  @@ -435,7 +432,7 @@
           else
           {
               // criteria has no effect for a new object
  -            if ( !isNew() )
  +            if (!isNew())
               {
                   // the following code is to determine if a new query is
                   // called for.  If the criteria is the same as the last
  @@ -446,7 +443,7 @@
          #set ( $colFK = $tblFK.getColumn($colFKName) )
                   criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, 
get${column.JavaName}() );
      #end
  -                if ( !last${relCol}Criteria.equals(criteria)  )
  +                if (!last${relCol}Criteria.equals(criteria))
                   {
                       $collName = ${className}Peer.doSelect(criteria);
                   }
  @@ -530,7 +527,7 @@
       {
           if ($collName == null)
           {
  -            if ( isNew() )
  +            if (isNew())
               {
                  $collName = new ArrayList();
               }
  @@ -557,7 +554,7 @@
          #set ( $colFK = $tblFK.getColumn($colFKName) )
                   criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, 
get${column.JavaName}() );
      #end
  -            if ( !last${relCol}Criteria.equals(criteria)  )
  +            if (!last${relCol}Criteria.equals(criteria))
               {
                   $collName = ${className}Peer.doSelectJoin${relCol2}(criteria);
               }
  @@ -588,7 +585,7 @@
       {
           if ($collName == null)
           {
  -            if ( isNew() )
  +            if (isNew())
               {
                  $collName = new ArrayList();
               }
  @@ -615,7 +612,7 @@
          #set ( $colFK = $tblFK.getColumn($colFKName) )
                   criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, 
get${column.JavaName}() );
      #end
  -            if ( !last${relCol}Criteria.equals(criteria)  )
  +            if (!last${relCol}Criteria.equals(criteria))
               {
                   $collName = 
${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria);
               }
  @@ -738,7 +735,7 @@
       #foreach ($col in $table.Columns)
         #set ( $cfc = $col.JavaName )
         #set ( $cjtype = $col.JavaNative )
  -    if ( pos == $i )
  +    if (pos == $i)
       {
         #if ($cjtype == "int")
           return new Integer(get${cfc}());
  @@ -784,12 +781,12 @@
           {
               if (isNew())
               {
  -                ${table.JavaName}Peer.doInsert(($table.JavaName)this);
  +                ${table.JavaName}Peer.doInsert(($table.JavaName) this);
                   setNew(false);
               }
               else
               {
  -                ${table.JavaName}Peer.doUpdate(($table.JavaName)this);
  +                ${table.JavaName}Peer.doUpdate(($table.JavaName) this);
               }
           }
    #end
  @@ -825,17 +822,17 @@
           {
               try
               {
  -                con = BasePeer.getConnection( dbName );
  +                con = BasePeer.getConnection(dbName);
                   if (isNew())
                   {
                       ${table.JavaName}Peer
  -                        .doInsert(($table.JavaName)this, con);
  +                        .doInsert(($table.JavaName) this, con);
                       setNew(false);
                   }
                   else
                   {
                       ${table.JavaName}Peer
  -                        .doUpdate(($table.JavaName)this, con);
  +                        .doUpdate(($table.JavaName) this, con);
                   }
               }
               finally
  @@ -881,7 +878,7 @@
         #foreach ($aVarName in $aVars)
           #set($i = $velocityCount - 1)
           if ($aVarName != null)
  -        {   
  +        {
               ${aVarName}.save(con);
               set$pVars.get($i)($aVarName);
           }
  @@ -896,12 +893,12 @@
           {
               if (isNew())
               {
  -                ${table.JavaName}Peer.doInsert(($table.JavaName)this, con);
  +                ${table.JavaName}Peer.doInsert(($table.JavaName) this, con);
                   setNew(false);
               }
               else
               {
  -                ${table.JavaName}Peer.doUpdate(($table.JavaName)this, con);
  +                ${table.JavaName}Peer.doUpdate(($table.JavaName) this, con);
               }
           }
   
  @@ -925,11 +922,11 @@
           #end
           #set ( $collName = "coll$relCol" )
   
  -          if ($collName != null )
  +          if ($collName != null)
             {
  -              for (int i=0; i<${collName}.size(); i++)
  +              for (int i = 0; i < ${collName}.size(); i++)
                 {
  -                  ((${className})${collName}.get(i)).save(con);
  +                  ((${className}) ${collName}.get(i)).save(con);
                 }
             }
        #end
  @@ -975,8 +972,9 @@
        * @param  $clo ObjectKey
        */
       public void setPrimaryKey(ObjectKey $clo)
  -        $throwsClause {
  -         set${col.JavaName}(($cjtype)$clo);
  +        $throwsClause
  +    {
  +        set${col.JavaName}(($cjtype)$clo);
       }
   
       /**
  @@ -1014,7 +1012,8 @@
   #end
        */
       public void setPrimaryKey($argList)
  -        $throwsClause {
  +        $throwsClause
  +    {
   #foreach ($col in $table.PrimaryKeys)
            set${col.JavaName}($col.Name.toLowerCase());
   #end
  @@ -1029,7 +1028,8 @@
   #end
        */
       public void setPrimaryKey($argList2)
  -        $throwsClause {
  +        $throwsClause
  +    {
   #foreach ($col in $table.PrimaryKeys)
            set${col.JavaName}(new ${col.JavaNative}($col.Name.toLowerCase()));
   #end
  @@ -1045,7 +1045,7 @@
        #set ($int = "int ")
        #foreach ($col in $table.PrimaryKeys)
           ${int}colonPos = key.indexOf(':', prevPos);
  -        set${col.JavaName}( new ${col.JavaNative}(key.substring(prevPos, colonPos)) 
);
  +        set${col.JavaName}(new ${col.JavaNative}(key.substring(prevPos, colonPos)));
           prevPos = colonPos + 1;
           #set ($int = "")
        #end
  @@ -1152,11 +1152,11 @@
           #end
   
           ${list}v = get${pCollName}();
  -        for (int i=0; i<v.size(); i++)
  +        for (int i = 0; i < v.size(); i++)
           {
               $className obj = ($className) v.get(i);
               copyObj.add$pCollNameNoS(obj.copy());
  -            ((Persistent)v.get(i)).setNew(true);
  +            ((Persistent) v.get(i)).setNew(true);
           }
           #set ( $list = "" )
       #end
  
  
  
  1.30      +96 -95    jakarta-turbine-torque/src/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Peer.vm,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Peer.vm   21 May 2002 19:51:45 -0000      1.29
  +++ Peer.vm   28 May 2002 01:00:16 -0000      1.30
  @@ -190,11 +190,11 @@
       /**
        * Method to do inserts
        */
  -    public static ObjectKey doInsert( Criteria criteria )
  +    public static ObjectKey doInsert(Criteria criteria)
           throws TorqueException
       {
           return $basePrefix${table.JavaName}Peer
  -            .doInsert( criteria, (Connection) null );
  +            .doInsert(criteria, (Connection) null);
       }
   
       /**
  @@ -202,19 +202,19 @@
        * otherwise use the doInsert(Criteria) method.  It will take care of
        * the connection details internally.
        */
  -    public static ObjectKey doInsert( Criteria criteria, Connection con ) 
  +    public static ObjectKey doInsert(Criteria criteria, Connection con)
           throws TorqueException
       {
        #foreach ($col in $table.Columns)
            #set ( $cup=$col.Name.toUpperCase() )
            #if($col.isBooleanInt())
           // check for conversion from boolean to int
  -        if ( criteria.containsKey($cup) )
  +        if (criteria.containsKey($cup))
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, 1);
                   }
  @@ -226,12 +226,12 @@
            }
            #elseif ($col.isBooleanChar())
           // check for conversion from boolean to Y/N
  -        if ( criteria.containsKey($cup) )
  +        if (criteria.containsKey($cup))
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, "Y");
                   }
  @@ -247,17 +247,17 @@
           // Set the correct dbName if it has not been overridden
           // criteria.getDbName will return the same object if not set to
           // another value so == check is okay and faster
  -        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        if (criteria.getDbName() == Torque.getDefaultDB())
           {
               criteria.setDbName(DATABASE_NAME);
           }
  -        if ( con == null )
  +        if (con == null)
           {
  -            return BasePeer.doInsert( criteria );
  +            return BasePeer.doInsert(criteria);
           }
           else
           {
  -            return BasePeer.doInsert( criteria, con );
  +            return BasePeer.doInsert(criteria, con);
           }
       }
   
  @@ -266,7 +266,7 @@
       {
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
  -        criteria.addSelectColumn( $cup );
  +        criteria.addSelectColumn($cup);
       #end
       }
   
  @@ -277,9 +277,9 @@
        * other rows than just those needed for this object.  You may
        * for example want to create two objects from the same row.
        */
  -    public static $table.JavaName row2Object (Record row,
  -                                              int offset,
  -                                              Class cls )
  +    public static $table.JavaName row2Object(Record row,
  +                                             int offset,
  +                                             Class cls)
           throws TorqueException
       {
           try
  @@ -309,9 +309,9 @@
        * other rows than just those needed for this object.  You may
        * for example want to create two objects from the same row.
        */
  -    public static void populateObject (Record row,
  -                                       int offset,
  -                                       $table.JavaName obj )
  +    public static void populateObject(Record row,
  +                                      int offset,
  +                                      $table.JavaName obj)
           throws TorqueException
       {
           try
  @@ -320,7 +320,7 @@
           #set ( $boolean = "boolean" )
           #foreach ($col in $table.Columns)
               #if ($col.isBooleanChar())
  -            $boolean b = "Y".equals(row.getValue(offset+$n).$col.VillageMethod);
  +            $boolean b = "Y".equals(row.getValue(offset + $n).$col.VillageMethod);
               #set ( $boolean = "" )
                   #if ($col.isUsePrimitive())
               obj.set${col.JavaName}(b);
  @@ -328,7 +328,7 @@
               obj.set${col.JavaName}(b ? Boolean.TRUE : Boolean.FALSE);
                   #end
               #elseif ($col.isBooleanInt())
  -            $boolean b = (row.getValue(offset+$n).$col.VillageMethod == 1);
  +            $boolean b = (row.getValue(offset + $n).$col.VillageMethod == 1);
                   #set ( $boolean = "" )
                   #if ($col.isUsePrimitive())
               obj.set${col.JavaName}(b);
  @@ -338,9 +338,9 @@
               #else
                   #if ($col.isPrimaryKey() || $col.isForeignKey() )
               obj.set${col.JavaName}(
  -                new ${col.JavaNative}(row.getValue(offset+$n).$col.VillageMethod));
  +                new ${col.JavaNative}(row.getValue(offset + 
$n).$col.VillageMethod));
                   #else
  -            obj.set${col.JavaName}(row.getValue(offset+$n).$col.VillageMethod);
  +            obj.set${col.JavaName}(row.getValue(offset + $n).$col.VillageMethod);
                   #end
               #end
                   #set ( $n = $n + 1 )
  @@ -353,17 +353,17 @@
       }
   
       /** Method to do selects */
  -    public static List doSelect( Criteria criteria ) throws TorqueException
  +    public static List doSelect(Criteria criteria) throws TorqueException
       {
  -        return populateObjects( doSelectVillageRecords(criteria) );
  +        return populateObjects(doSelectVillageRecords(criteria));
       }
   
   
       /** Method to do selects within a transaction */
  -    public static List doSelect(Criteria criteria, Connection con) 
  +    public static List doSelect(Criteria criteria, Connection con)
           throws TorqueException
       {
  -        return populateObjects( doSelectVillageRecords(criteria, con) ); 
  +        return populateObjects(doSelectVillageRecords(criteria, con));
       }
   
       /**
  @@ -373,7 +373,7 @@
        * alter the data and call save(), your results may vary, but are
        * certainly likely to result in hard to track MT bugs.
        */
  -    public static List doSelectVillageRecords( Criteria criteria )
  +    public static List doSelectVillageRecords(Criteria criteria)
           throws TorqueException
       {
           return $basePrefix${table.JavaName}Peer
  @@ -384,8 +384,7 @@
        * Grabs the raw Village records to be formed into objects.
        * This method should be used for transactions
        */
  -    public static List doSelectVillageRecords( Criteria criteria, 
  -                                               Connection con ) 
  +    public static List doSelectVillageRecords(Criteria criteria, Connection con)
           throws TorqueException
       {
       #if ($targetDatabase == "postgresql" && $table.requiresTransactionInPostgres())
  @@ -395,19 +394,19 @@
   
           if (criteria.getSelectColumns().size() == 0)
           {
  -            addSelectColumns ( criteria );
  +            addSelectColumns(criteria);
           }
   
        #foreach ($col in $table.Columns)
            #set ( $cup=$col.Name.toUpperCase() )
            #if($col.isBooleanInt())
           // check for conversion from boolean to int
  -        if ( criteria.containsKey($cup) )
  +        if (criteria.containsKey($cup))
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, 1);
                   }
  @@ -422,9 +421,9 @@
           if ( criteria.containsKey($cup) )
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, "Y");
                   }
  @@ -440,13 +439,13 @@
           // Set the correct dbName if it has not been overridden
           // criteria.getDbName will return the same object if not set to
           // another value so == check is okay and faster
  -        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        if (criteria.getDbName() == Torque.getDefaultDB())
           {
               criteria.setDbName(DATABASE_NAME);
           }
           // BasePeer returns a List of Value (Village) arrays.  The array
           // order follows the order columns were placed in the Select clause.
  -        if ( con == null)
  +        if (con == null)
           {
               return BasePeer.doSelect(criteria);
           }
  @@ -466,9 +465,9 @@
           List results = new ArrayList(records.size());
   
           // populate the object(s)
  -        for ( int i=0; i<records.size(); i++ )
  +        for (int i = 0; i < records.size(); i++)
           {
  -            Record row = (Record)records.get(i);
  +            Record row = (Record) records.get(i);
   #if ($table.ChildrenColumn)
               results.add(${table.JavaName}Peer.row2Object(row, 1,
                   ${table.JavaName}Peer.getOMClass(row, 1)));
  @@ -497,7 +496,7 @@
       #if ($col.isEnumeratedClasses())
               Class omClass = null;
               $col.JavaNative classKey =
  -                record.getValue(offset-1 + $col.Position)
  +                record.getValue(offset - 1 + $col.Position)
                   .$col.VillageMethod;
           #set ($if = "if")
           #foreach ($child in $col.Children)
  @@ -518,7 +517,7 @@
               c = omClass;
       #else
               c = Class.forName(
  -                record.getValue(offset-1 + $col.Position).asString());
  +                record.getValue(offset - 1 + $col.Position).asString());
       #end
           }
           catch (Exception e)
  @@ -560,7 +559,7 @@
       public static void doUpdate(Criteria criteria) throws TorqueException
       {
            $basePrefix${table.JavaName}Peer
  -            .doUpdate( criteria, (Connection) null );
  +            .doUpdate(criteria, (Connection) null);
       }
   
       /**
  @@ -572,7 +571,7 @@
        *        statement.
        * @param dbCon the connection to use
        */
  -    public static void doUpdate(Criteria criteria, Connection con) 
  +    public static void doUpdate(Criteria criteria, Connection con)
           throws TorqueException
       {
           Criteria selectCriteria = new
  @@ -581,12 +580,12 @@
            #set ( $cup=$col.Name.toUpperCase() )
            #if($col.isBooleanInt())
           // check for conversion from boolean to int
  -        if ( criteria.containsKey($cup) )
  +        if (criteria.containsKey($cup))
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, 1);
                   }
  @@ -601,9 +600,9 @@
           if ( criteria.containsKey($cup) )
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, "Y");
                   }
  @@ -628,11 +627,11 @@
           }
           if ( con == null )
           {
  -            BasePeer.doUpdate( selectCriteria, criteria );
  +            BasePeer.doUpdate(selectCriteria, criteria);
           }
           else
           {
  -            BasePeer.doUpdate( selectCriteria, criteria, con );
  +            BasePeer.doUpdate(selectCriteria, criteria, con);
           }
       }
   
  @@ -644,7 +643,7 @@
        public static void doDelete(Criteria criteria) throws TorqueException
        {
            $basePrefix${table.JavaName}Peer
  -            .doDelete ( criteria, (Connection) null );
  +            .doDelete(criteria, (Connection) null);
        }
   
       /**
  @@ -655,19 +654,19 @@
        * @param criteria object containing data that is used DELETE from database.
        * @param dbCon the connection to use
        */
  -     public static void doDelete(Criteria criteria, Connection con) 
  +     public static void doDelete(Criteria criteria, Connection con)
           throws TorqueException
        {
        #foreach ($col in $table.Columns)
            #set ( $cup=$col.Name.toUpperCase() )
            #if($col.isBooleanInt())
           // check for conversion from boolean to int
  -        if ( criteria.containsKey($cup) )
  +        if (criteria.containsKey($cup))
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, 1);
                   }
  @@ -679,12 +678,12 @@
            }
            #elseif ($col.isBooleanChar())
           // check for conversion from boolean to Y/N
  -        if ( criteria.containsKey($cup) )
  +        if (criteria.containsKey($cup))
           {
               Object possibleBoolean = criteria.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       criteria.add($cup, "Y");
                   }
  @@ -700,17 +699,17 @@
           // Set the correct dbName if it has not been overridden
           // criteria.getDbName will return the same object if not set to
           // another value so == check is okay and faster
  -        if ( criteria.getDbName() == Torque.getDefaultDB() )
  +        if (criteria.getDbName() == Torque.getDefaultDB())
           {
               criteria.setDbName(DATABASE_NAME);
           }
  -        if ( con == null )
  +        if (con == null)
           {
  -            BasePeer.doDelete ( criteria );
  +            BasePeer.doDelete(criteria);
           }
           else
           {
  -            BasePeer.doDelete ( criteria, con );
  +            BasePeer.doDelete(criteria, con);
           }
        }
   
  @@ -800,9 +799,9 @@
               #set ( $cfc=$col.JavaName )
               #set ( $cup=$col.Name.toUpperCase() )
               #if ($col.isPrimaryKey() && !$table.IdMethod.equals("none"))
  -        if ( !obj.isNew() )
  +        if (!obj.isNew())
              #end
  -            criteria.add( $cup, obj.get${cfc}() );
  +            criteria.add($cup, obj.get${cfc}());
           #end
           return criteria;
       }
  @@ -827,15 +826,17 @@
       {
           Connection db = null;
           $table.JavaName retVal = null;
  -       try
  +        try
           {
  -           db = Torque.getConnection( DATABASE_NAME );
  -           retVal = ${retrieveMethod}( pk, db );
  +            db = Torque.getConnection(DATABASE_NAME);
  +            retVal = ${retrieveMethod}(pk, db);
           }
           finally
           {
  -           if (db != null)
  -              closeConnection(db);
  +            if (db != null)
  +            {
  +                closeConnection(db);
  +            }
           }
           return(retVal);
       }
  @@ -846,24 +847,24 @@
        * @param pk the primary key
        * @param con the connection to use
        */
  -    public static $table.JavaName ${retrieveMethod}( ObjectKey pk, Connection con )
  +    public static $table.JavaName ${retrieveMethod}(ObjectKey pk, Connection con)
           throws TorqueException
       {
   
           Criteria criteria = new Criteria();
     #if ($table.PrimaryKeys.size() == 1)
  -            criteria.add( $table.PrimaryKeys.get(0).Name.toUpperCase(), pk );
  +            criteria.add($table.PrimaryKeys.get(0).Name.toUpperCase(), pk);
     #else
           SimpleKey[] keys = (SimpleKey[])pk.getValue();
       #set ( $i = 0 )
       #foreach ($col in $table.PrimaryKeys)
           #set ( $cup=$col.Name.toUpperCase() )
  -            criteria.add( $cup, keys[$i] );
  +            criteria.add($cup, keys[$i]);
           #set ( $i = $i + 1 )
       #end
     #end
           List v = doSelect(criteria, con);
  -        if ( v.size() != 1)
  +        if (v.size() != 1)
           {
               throw new TorqueException("Failed to select one and only one row.");
           }
  @@ -878,20 +879,22 @@
        *
        * @param pks List of primary keys
        */
  -    public static List ${retrieveMethod}s( List pks )
  +    public static List ${retrieveMethod}s(List pks)
           throws TorqueException
       {
           Connection db = null;
           List retVal = null;
           try
           {
  -           db = Torque.getConnection( DATABASE_NAME );
  -           retVal = ${retrieveMethod}s( pks, db );
  +           db = Torque.getConnection(DATABASE_NAME);
  +           retVal = ${retrieveMethod}s(pks, db);
           }
           finally
           {
  -           if (db != null)
  -              closeConnection(db);
  +            if (db != null)
  +            {
  +                closeConnection(db);
  +            }
           }
           return(retVal);
       }
  @@ -966,8 +969,8 @@
           $table.JavaName retVal = null;
          try
           {
  -           db = Torque.getConnection( DATABASE_NAME );
  -           retVal = retrieveByPK( 
  +           db = Torque.getConnection(DATABASE_NAME);
  +           retVal = retrieveByPK(
              #set ( $comma = false )
              #foreach ($col in $table.PrimaryKeys)
            #set ( $clo=$col.Name.toLowerCase() )
  @@ -1150,7 +1153,7 @@
           List rows = BasePeer.doSelect(c);
           List results = new ArrayList();
   
  -        for (int i=0; i<rows.size(); i++)
  +        for (int i = 0; i < rows.size(); i++)
           {
               Record row = (Record)rows.get(i);
   
  @@ -1163,7 +1166,7 @@
   #set ($classDecl = "")
   
               $className obj1 = ($className)${table.JavaName}Peer
  -                .row2Object( row, 1, omClass);
  +                .row2Object(row, 1, omClass);
   
   
   #if ($joinTable.ChildrenColumn)
  @@ -1176,11 +1179,11 @@
                   .row2Object(row, offset, omClass);
   
               boolean newObject = true;
  -            for (int j=0; j<results.size(); j++)
  +            for (int j = 0; j < results.size(); j++)
               {
                   $className temp_obj1 = ($className)results.get(j);
                   $joinClassName temp_obj2 = 
($joinClassName)temp_obj1.get${joinInterface}();
  -                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
  +                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
                   {
                       newObject = false;
                       temp_obj2.add${collThisTableMs}(obj1);
  @@ -1193,9 +1196,7 @@
                   obj2.add${collThisTableMs}(obj1);
               }
               results.add(obj1);
  -
           }
  -
           return results;
       }
     #end
  @@ -1249,7 +1250,7 @@
           // Set the correct dbName if it has not been overridden
           // c.getDbName will return the same object if not set to another value
           // so == check is okay and faster
  -        if ( c.getDbName() == Torque.getDefaultDB() )
  +        if (c.getDbName() == Torque.getDefaultDB())
           {
               c.setDbName(DATABASE_NAME);
           }
  @@ -1275,12 +1276,12 @@
            #set ( $cup=$col.Name.toUpperCase() )
            #if($col.isBooleanInt())
           // check for conversion from boolean to int
  -        if ( c.containsKey($cup) )
  +        if (c.containsKey($cup))
           {
               Object possibleBoolean = c.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean) possibleBoolean).booleanValue())
                   {
                       c.add($cup, 1);
                   }
  @@ -1295,9 +1296,9 @@
           if ( c.containsKey($cup) )
           {
               Object possibleBoolean = c.get($cup);
  -            if ( possibleBoolean instanceof Boolean )
  +            if (possibleBoolean instanceof Boolean)
               {
  -                if ( ((Boolean)possibleBoolean).booleanValue() )
  +                if (((Boolean)possibleBoolean).booleanValue())
                   {
                       c.add($cup, "Y");
                   }
  @@ -1313,7 +1314,7 @@
           List rows = BasePeer.doSelect(c);
           List results = new ArrayList();
   
  -        for (int i=0; i<rows.size(); i++)
  +        for (int i = 0; i < rows.size(); i++)
           {
               Record row = (Record)rows.get(i);
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to