You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jo...@apache.org on 2001/08/13 05:50:31 UTC

cvs commit: jakarta-turbine-torque/src/templates/om Object.vm

jon         01/08/12 20:50:31

  Modified:    src/templates/om Object.vm
  Log:
  cleaned up the template to not produce as much commented out code.
  
  Revision  Changes    Path
  1.2       +13 -56    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Object.vm	2001/08/02 05:08:38	1.1
  +++ Object.vm	2001/08/13 03:50:31	1.2
  @@ -257,14 +257,15 @@
           $varName = ${className}Peer.retrieveByPK($arglist);
     #end
   
  -            // The following can be used instead of the line above to
  -            // guarantee the related object contains a reference
  -            // to this object, but this level of coupling 
  -            // may be undesirable in many circumstances.
  -            // As it can lead to a db query with many results that may
  -            // never be used.  
  -            // $className obj = ${className}Peer.retrieveByPK($arglist);
  -            // obj.add${pCollName}(this);
  +            /* The following can be used instead of the line above to
  +               guarantee the related object contains a reference
  +               to this object, but this level of coupling 
  +               may be undesirable in many circumstances.
  +               As it can lead to a db query with many results that may
  +               never be used.  
  +               $className obj = ${className}Peer.retrieveByPK($arglist);
  +               obj.add${pCollName}(this); 
  +             */
           }
           return $varName;
       }
  @@ -332,17 +333,18 @@
        * Collection to store aggregation of $collName
        */
       protected Vector $collName;
  +
       /**
        * Temporary storage of $collName to save a possible db hit in
        * the event objects are add to the collection, but the
        * complete collection is never requested.
        */
  -//    private Vector temp$collName;
  -
       protected void init${relCol}()
       {
           if ($collName == null)
  +        {
               $collName = new Vector();
  +        }
       }
   
       /**
  @@ -353,20 +355,6 @@
        */
       public void add${relColMs}($className l) throws Exception
       {
  -        /*
  -        if ($collName == null)
  -        {
  -            if (temp$collName == null)
  -            {
  -                temp$collName = new Vector();
  -            }
  -            temp${collName}.add(l);
  -        }
  -        else
  -        {
  -            ${collName}.add(l);
  -        }
  -        */
           get${relCol}().add(l);
           l.set${table.JavaName}${suffix}(($table.JavaName)this);
       }
  @@ -417,20 +405,10 @@
      #end
                   $collName = ${className}Peer.doSelect(criteria);
               }
  -/*
  -            if (temp$collName != null)
  -            {
  -                for (int i=0; i<temp${collName}.size(); i++)
  -                {
  -                    ${collName}.add(temp${collName}.get(i));
  -                }
  -                temp$collName = null;
  -            }
  -*/
           }
           else
           {
  -           // criteria has no effect for a new object
  +            // criteria has no effect for a new object
               if ( !isNew() ) 
               {
                   // the following code is to determine if a new query is
  @@ -536,17 +514,6 @@
      #end
                   $collName = ${className}Peer.doSelectJoin${relCol2}(criteria);
               }
  -            
  -            #* /*
  -            if (temp$collName != null)
  -            {
  -                for (int i=0; i<temp${collName}.size(); i++)
  -                {
  -                    ${collName}.add(temp${collName}.get(i));
  -                }
  -                temp$collName = null;
  -            } 
  -               */ *#
           }
           else
           {
  @@ -601,16 +568,6 @@
      #end
                   $collName = ${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria);
               }
  -/*
  -            if (temp$collName != null)
  -            {
  -                for (int i=0; i<temp${collName}.size(); i++)
  -                {
  -                    ${collName}.add(temp${collName}.get(i));
  -                }
  -                temp$collName = null;
  -            }
  -*/
           }
           else
           {
  
  
  

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