head	1.1;
access;
symbols
	HELM_PEER_PORT_BRANCH:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2001.01.28.01.18.25;	author dlr;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2001.01.28.01.18.25;	author dlr;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.01.17.49.45;	author dlr;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2001.02.02.18.00.03;	author dlr;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2001.02.02.19.09.49;	author dlr;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2001.02.07.03.46.30;	author dlr;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2001.02.07.21.18.02;	author dlr;	state Exp;
branches;
next	1.1.2.7;

1.1.2.7
date	2001.02.09.02.01.52;	author dlr;	state Exp;
branches;
next	1.1.2.8;

1.1.2.8
date	2001.02.09.23.25.42;	author dlr;	state Exp;
branches;
next	1.1.2.9;

1.1.2.9
date	2001.02.13.00.55.53;	author dlr;	state Exp;
branches;
next	1.1.2.10;

1.1.2.10
date	2001.02.13.03.03.05;	author dlr;	state Exp;
branches;
next	1.1.2.11;

1.1.2.11
date	2001.02.16.03.04.58;	author dlr;	state dead;
branches;
next	;


desc
@@


1.1
log
@file BaseProjectDownloadPeer.java was initially added on branch HELM_PEER_PORT_BRANCH.
@
text
@@


1.1.2.1
log
@Classes ported to the Turbine Peer system. -dlr and leonardr
@
text
@a0 348
package org.tigris.helm.om.peer;

// JDK classes
import java.util.*;

// Village classes
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.tigris.helm.om.ProjectDownload;

// Local classes
import org.tigris.helm.om.map.*;
import org.tigris.helm.om.*;

/** This class was autogenerated by GenerateMapBuilder on: Fri Jan 26 19:21:34 PST 2001 */
public class BaseProjectDownloadPeer extends BasePeer
{
    /** the mapbuilder for this class */
    private static final ProjectDownloadMapBuilder mapBuilder = 
        (ProjectDownloadMapBuilder)getMapBuilder(ProjectDownloadMapBuilder.CLASS_NAME);

    /** the table name for this class */
    public static final String TABLE_NAME = mapBuilder.getTable();

    /** the column name for the DOWNLOAD_ID field */
    public static final String DOWNLOAD_ID = mapBuilder.getProjectDownload_DownloadId();
    /** the column name for the PROJECT_ID field */
    public static final String PROJECT_ID = mapBuilder.getProjectDownload_ProjectId();
    /** the column name for the FILE_NAME field */
    public static final String FILE_NAME = mapBuilder.getProjectDownload_FileName();
    /** the column name for the LOCATION field */
    public static final String LOCATION = mapBuilder.getProjectDownload_Location();
    /** the column name for the SUGGESTED_BY field */
    public static final String SUGGESTED_BY = mapBuilder.getProjectDownload_SuggestedBy();
    /** the column name for the APPROVED_BY field */
    public static final String APPROVED_BY = mapBuilder.getProjectDownload_ApprovedBy();
    /** the column name for the IS_PUBLIC field */
    public static final String IS_PUBLIC = mapBuilder.getProjectDownload_IsPublic();
    /** the column name for the DESCRIPTION field */
    public static final String DESCRIPTION = mapBuilder.getProjectDownload_Description();
    /** the column name for the UPLOADED_DATE field */
    public static final String UPLOADED_DATE = mapBuilder.getProjectDownload_UploadedDate();
    /** the column name for the SIZE field */
    public static final String SIZE = mapBuilder.getProjectDownload_Size();
    /** the column name for the MD5 field */
    public static final String MD5 = mapBuilder.getProjectDownload_Md5();

    /** number of columns for this peer */
    public static final int numColumns =  11;;

    /** Method to do inserts */
    public static Object doInsert( Criteria criteria ) throws Exception
    {
        criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
                                                                                                                                                                       return BasePeer.doInsert( criteria );
    }

    /** 
     * Method to do inserts.  This method is to be used during a transaction,
     * otherwise use the doInsert(Criteria) method.  It will take care of 
     * the connection details internally. 
     */
    public static Object doInsert( Criteria criteria, DBConnection dbCon ) throws Exception
    {
        criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
                                                                                                                                                                       return BasePeer.doInsert( criteria, dbCon );
    }

    /** Add all the columns needed to create a new object */
    public static void addSelectColumns (Criteria criteria) throws Exception
    {
            criteria.addSelectColumn( DOWNLOAD_ID );
            criteria.addSelectColumn( PROJECT_ID );
            criteria.addSelectColumn( FILE_NAME );
            criteria.addSelectColumn( LOCATION );
            criteria.addSelectColumn( SUGGESTED_BY );
            criteria.addSelectColumn( APPROVED_BY );
            criteria.addSelectColumn( IS_PUBLIC );
            criteria.addSelectColumn( DESCRIPTION );
            criteria.addSelectColumn( UPLOADED_DATE );
            criteria.addSelectColumn( SIZE );
            criteria.addSelectColumn( MD5 );
        }


    /** Create a new object of type cls from a resultset row starting
      * from a specified offset.  This is done so that you can select
      * other rows than just those needed for this object.  You may
      * for example want to create two objects from the same row.
      */
    public static ProjectDownload row2Object (Record row, int offset, Class cls ) throws Exception
    {
        ProjectDownload obj = (ProjectDownload)cls.newInstance();
                                        obj.setDownloadId(row.getValue(offset+0).asInt());
                                            obj.setProjectId(row.getValue(offset+1).asInt());
                                            obj.setFileName(row.getValue(offset+2).asString());
                                            obj.setLocation(row.getValue(offset+3).asString());
                                            obj.setSuggestedBy(row.getValue(offset+4).asInt());
                                            obj.setApprovedBy(row.getValue(offset+5).asInt());
                                            obj.setIsPublic(row.getValue(offset+6).asString());
                                            obj.setDescription(row.getValue(offset+7).asString());
                                            obj.setUploadedDate(row.getValue(offset+8).asDate());
                                            obj.setSize(row.getValue(offset+9).asLong());
                                            obj.setMd5(row.getValue(offset+10).asString());
                                        obj.setModified(false);
                obj.setNew(false);
        return obj;
    }

    /** Method to do selects */
    public static Vector doSelect( Criteria criteria ) throws Exception
    {
        criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
        return doSelect (criteria,"org.tigris.helm.om.ProjectDownload", null);
    }

    /** 
     * Method to do selects.  This method is to be used during a transaction,
     * otherwise use the doSelect(Criteria) method.  It will take care of 
     * the connection details internally. 
     */
    public static Vector doSelect( Criteria criteria, DBConnection dbCon ) throws Exception
    {
        criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
        return doSelect (criteria,"org.tigris.helm.om.ProjectDownload", dbCon);
    }

    /** Method to do selects. The returned vector will have object
      * of className
      */
    public static Vector doSelect( Criteria criteria, String className, DBConnection dbCon) throws Exception
    {
        addSelectColumns ( criteria );

                                                                                                                                                               
        // BasePeer returns a Vector of Value (Village) arrays.  The array
        // order follows the order columns were placed in the Select clause.
        Vector rows = null;
        if (dbCon == null)
        {
            rows = BasePeer.doSelect(criteria);
        }
        else
        {
            rows = BasePeer.doSelect(criteria, dbCon);
        }
        Vector results = new Vector();

        // populate the object(s)
        for ( int i=0; i<rows.size(); i++ )
        {
            Record row = (Record)rows.elementAt(i);
            results.add (row2Object (row,1,Class.forName (className)));
         }
         return results;
    }

    /**
     * Method to do updates. 
     *
     * @@param Criteria object containing data that is used to create the UPDATE statement.
     */
    public static void doUpdate(Criteria criteria) throws Exception
    {
        criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
        Criteria selectCriteria = new Criteria(2);
                                selectCriteria.put( DOWNLOAD_ID, criteria.remove(DOWNLOAD_ID) );
                                                                                                                                                                                                                                                             BasePeer.doUpdate( selectCriteria, criteria );
    }

    /** 
     * Method to do updates.  This method is to be used during a transaction,
     * otherwise use the doUpdate(Criteria) method.  It will take care of 
     * the connection details internally. 
     *
     * @@param Criteria object containing data that is used to create the UPDATE statement.
     */
    public static void doUpdate(Criteria criteria, DBConnection dbCon) throws Exception
    {
         criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
         Criteria selectCriteria = new Criteria(2);
                                selectCriteria.put( DOWNLOAD_ID, criteria.remove(DOWNLOAD_ID) );
                                                                                                                                                                                                                                                             BasePeer.doUpdate( selectCriteria, criteria, dbCon );
     }

    /** 
     * Method to do deletes.
     *
     * @@param Criteria object containing data that is used DELETE from database.
     */
     public static void doDelete(Criteria criteria) throws Exception
     {
         criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
                                                                                                                                                                        BasePeer.doDelete ( criteria );
     }

    /** 
     * Method to do deletes.  This method is to be used during a transaction,
     * otherwise use the doInsert(Criteria) method.  It will take care of 
     * the connection details internally. 
     *
     * @@param Criteria object containing data that is used DELETE from database.
     */
     public static void doDelete(Criteria criteria, DBConnection dbCon) throws Exception
     {
         criteria.setDbName(getMapBuilder().getDatabaseMap().getName());
                                                                                                                                                                        BasePeer.doDelete ( criteria, dbCon );
     }

    /** Method to do inserts */
    public static void doInsert( ProjectDownload obj ) throws Exception
    {
                obj.setPrimaryKey(doInsert(buildCriteria(obj)));
                obj.setNew(false);
    }

    /**
     * @@param obj the data object to update in the database.
     */
    public static void doUpdate(ProjectDownload obj) throws Exception
    {
        doUpdate(buildCriteria(obj));
    }
    /**
     * @@param obj the data object to delete in the database.
     */
    public static void doDelete(ProjectDownload obj) throws Exception
    {
        doDelete(buildCriteria(obj));
    }

    /** 
     * Method to do inserts.  This method is to be used during a transaction,
     * otherwise use the doInsert(ProjectDownload) method.  It will take 
     * care of the connection details internally. 
     *
     * @@param obj the data object to insert into the database.
     */
    public static void doInsert( ProjectDownload obj, DBConnection dbCon) throws Exception
    {
                obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
                obj.setNew(false);
    }

    /**
     * Method to do update.  This method is to be used during a transaction,
     * otherwise use the doUpdate(ProjectDownload) method.  It will take 
     * care of the connection details internally. 
     *
     * @@param obj the data object to update in the database.
     */
    public static void doUpdate(ProjectDownload obj, DBConnection dbCon) throws Exception
    {
        doUpdate(buildCriteria(obj), dbCon);
    }
    /**
     * Method to delete.  This method is to be used during a transaction,
     * otherwise use the doDelete(ProjectDownload) method.  It will take 
     * care of the connection details internally. 
     *
     * @@param obj the data object to delete in the database.
     */
    public static void doDelete(ProjectDownload obj, DBConnection dbCon) throws Exception
    {
        doDelete(buildCriteria(obj), dbCon);
    }

    /** Build a Criteria object from the data object for this peer */
    public static Criteria buildCriteria( ProjectDownload obj )
    {
        Criteria criteria = new Criteria();
                            if ( !obj.isNew() )
	                criteria.add( DOWNLOAD_ID, obj.getDownloadId() );
                                criteria.add( PROJECT_ID, obj.getProjectId() );
                                criteria.add( FILE_NAME, obj.getFileName() );
                                criteria.add( LOCATION, obj.getLocation() );
                                criteria.add( SUGGESTED_BY, obj.getSuggestedBy() );
                                criteria.add( APPROVED_BY, obj.getApprovedBy() );
                                criteria.add( IS_PUBLIC, obj.getIsPublic() );
                                criteria.add( DESCRIPTION, obj.getDescription() );
                                criteria.add( UPLOADED_DATE, obj.getUploadedDate() );
                                criteria.add( SIZE, obj.getSize() );
                                criteria.add( MD5, obj.getMd5() );
                return criteria;
    }

    /** 
     * Retrieve a single object by pk where multiple PK's are separated
     * by colons
     *
     * @@param int download_id
     */
    public static ProjectDownload retrieveById(Object pkid) 
        throws Exception
    {
        StringTokenizer stok = new StringTokenizer((String)pkid, ":");
        if ( stok.countTokens() < 1 )
        {   
            throw new TurbineException(
                "id tokens did not match number of primary keys" );
        }
           int download_id = Integer.parseInt(stok.nextToken());;

       return retrieveByPK(
             download_id
              );
    }

    /** 
     * Retrieve a single object by pk
     *
     * @@param int download_id
     */
    public static ProjectDownload retrieveByPK(
                      int download_id
                                                                                                                                                     ) throws Exception
    {
        Criteria criteria = new Criteria();
                       if( download_id > 0 )
                  criteria.add( BaseProjectDownloadPeer.DOWNLOAD_ID, download_id );
                                                                                                           Vector ProjectDownloadVector = doSelect(criteria);
        if (ProjectDownloadVector.size() != 1)
        {
            throw new Exception("Failed to select one and only one row.");
        }
        else
        {
            return (ProjectDownload) ProjectDownloadVector.firstElement();
        }
    }


}








@


1.1.2.2
log
@Mark these base peer classes as 'abstract class', rather than 'public class' to better note that their extensions should be used.
@
text
@d23 1
a23 1
abstract class BaseProjectDownloadPeer extends BasePeer
@


1.1.2.3
log
@Regenerated BasePeer extensions.
@
text
@a4 1
import java.math.*;
d22 1
a22 1
/** This class was autogenerated by GenerateMapBuilder on: Fri Feb 02 09:53:57 PST 2001 */
d61 1
a61 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d72 1
a72 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d120 1
a120 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d131 1
a131 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d172 1
a172 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d187 1
a187 1
         criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d200 1
a200 1
         criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d213 1
a213 1
         criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d327 1
a327 1
                  criteria.add( ProjectDownloadPeer.DOWNLOAD_ID, download_id );
@


1.1.2.4
log
@Regenerated BasePeer extensions.
@
text
@d23 1
a23 1
/** This class was autogenerated by GenerateMapBuilder on: Fri Feb 02 11:12:25 PST 2001 */
@


1.1.2.5
log
@Latest Torque generated code (simple object model).
@
text
@d23 2
a24 2
/** This class was autogenerated by GenerateMapBuilder on: Tue Feb 06 19:46:40 PST 2001 */
public abstract class BaseProjectDownloadPeer extends BasePeer
d174 1
a174 2
        Criteria selectCriteria = new
            Criteria(mapBuilder.getDatabaseMap().getName(), 2);
d188 2
a189 3
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
        Criteria selectCriteria = new
            Criteria(mapBuilder.getDatabaseMap().getName(), 2);
@


1.1.2.6
log
@Newest generated code (complex model this time).  Removed getUsers from Domain to side step decl conflict.
@
text
@d23 1
a23 1
/** This class was autogenerated by GenerateMapBuilder on: Wed Feb 07 12:45:09 PST 2001 */
a342 418
       
        
                       
     
          


   /**
    * selects a collection of ProjectDownload objects pre-filled with their
    * Project objects.
    */
    public static Vector doSelectJoinProject(Criteria c)
        throws Exception
    {
         c.setDbName(mapBuilder.getDatabaseMap().getName());

        addSelectColumns(c);
        int offset = numColumns + 1;
        ProjectPeer.addSelectColumns(c);

                                                                                                                                                                       
        Vector rows = BasePeer.doSelect(c);
        Vector results = new Vector();

        for (int i=0; i<rows.size(); i++)
        {
            ProjectDownload obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.ProjectDownload") );
            Project obj2 = ProjectPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset, Class.forName("org.tigris.helm.om.Project") );
            
            boolean newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                Project temp_obj2 = temp_obj1.getProject();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addProjectDownloads(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initProjectDownloads();
                obj2.addProjectDownloads(obj1);
            }
            results.add(obj1);

        }

        return results;
    }
         
                               
     
          


   /**
    * selects a collection of ProjectDownload objects pre-filled with their
    * User objects.
    */
    public static Vector doSelectJoinUserRelatedBySuggestedBy(Criteria c)
        throws Exception
    {
         c.setDbName(mapBuilder.getDatabaseMap().getName());

        addSelectColumns(c);
        int offset = numColumns + 1;
        UserPeer.addSelectColumns(c);

                                                                                                                                                                       
        Vector rows = BasePeer.doSelect(c);
        Vector results = new Vector();

        for (int i=0; i<rows.size(); i++)
        {
            ProjectDownload obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.ProjectDownload") );
            User obj2 = UserPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset, Class.forName("org.tigris.helm.om.User") );
            
            boolean newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                User temp_obj2 = temp_obj1.getUserRelatedBySuggestedBy();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addProjectDownloadsRelatedBySuggestedBy(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initProjectDownloadsRelatedBySuggestedBy();
                obj2.addProjectDownloadsRelatedBySuggestedBy(obj1);
            }
            results.add(obj1);

        }

        return results;
    }
         
                               
     
          


   /**
    * selects a collection of ProjectDownload objects pre-filled with their
    * User objects.
    */
    public static Vector doSelectJoinUserRelatedByApprovedBy(Criteria c)
        throws Exception
    {
         c.setDbName(mapBuilder.getDatabaseMap().getName());

        addSelectColumns(c);
        int offset = numColumns + 1;
        UserPeer.addSelectColumns(c);

                                                                                                                                                                       
        Vector rows = BasePeer.doSelect(c);
        Vector results = new Vector();

        for (int i=0; i<rows.size(); i++)
        {
            ProjectDownload obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.ProjectDownload") );
            User obj2 = UserPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset, Class.forName("org.tigris.helm.om.User") );
            
            boolean newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                User temp_obj2 = temp_obj1.getUserRelatedByApprovedBy();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addProjectDownloadsRelatedByApprovedBy(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initProjectDownloadsRelatedByApprovedBy();
                obj2.addProjectDownloadsRelatedByApprovedBy(obj1);
            }
            results.add(obj1);

        }

        return results;
    }
    

  
  
     
                       
          


   /**
    * selects a collection of ProjectDownload objects pre-filled with 
    * all related objects.
    */
    public static Vector doSelectJoinAllExceptProject(Criteria c) 
        throws Exception
    {
         c.setDbName(mapBuilder.getDatabaseMap().getName());

        addSelectColumns(c);
        int offset2 = numColumns + 1;
                    
                                      
                UserPeer.addSelectColumns(c);
        int offset3 = offset2 + UserPeer.numColumns;
                                          
                UserPeer.addSelectColumns(c);
        int offset4 = offset3 + UserPeer.numColumns;
                                                                                                                                                                                             
        Vector rows = BasePeer.doSelect(c);
        Vector results = new Vector();

        for (int i=0; i<rows.size(); i++)
        {
            ProjectDownload obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.ProjectDownload") );
                    
                                  
                                                                
                        
                        User obj2 = UserPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset2, Class.forName("org.tigris.helm.om.User") );

            
             boolean  newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                User temp_obj2 = temp_obj1.getUserRelatedBySuggestedBy();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addProjectDownloadsRelatedBySuggestedBy(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initProjectDownloadsRelatedBySuggestedBy();
                obj2.addProjectDownloadsRelatedBySuggestedBy(obj1);
            }
                        
                                                                
                        
                        User obj3 = UserPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset3, Class.forName("org.tigris.helm.om.User") );

            
             newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                User temp_obj3 = temp_obj1.getUserRelatedByApprovedBy();
                if ( temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj3.addProjectDownloadsRelatedByApprovedBy(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj3.initProjectDownloadsRelatedByApprovedBy();
                obj3.addProjectDownloadsRelatedByApprovedBy(obj1);
            }
                        results.add(obj1);

        }

        return results;
    }
 
     
                               
          


   /**
    * selects a collection of ProjectDownload objects pre-filled with 
    * all related objects.
    */
    public static Vector doSelectJoinAllExceptUserRelatedBySuggestedBy(Criteria c) 
        throws Exception
    {
         c.setDbName(mapBuilder.getDatabaseMap().getName());

        addSelectColumns(c);
        int offset2 = numColumns + 1;
                    
                ProjectPeer.addSelectColumns(c);
        int offset3 = offset2 + ProjectPeer.numColumns;
                                          
                                      
                                                                                                                                                                                         
        Vector rows = BasePeer.doSelect(c);
        Vector results = new Vector();

        for (int i=0; i<rows.size(); i++)
        {
            ProjectDownload obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.ProjectDownload") );
                    
                                                
                        
                        Project obj2 = ProjectPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset2, Class.forName("org.tigris.helm.om.Project") );

            
             boolean  newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                Project temp_obj2 = temp_obj1.getProject();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addProjectDownloads(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initProjectDownloads();
                obj2.addProjectDownloads(obj1);
            }
                        
                                  
                                  results.add(obj1);

        }

        return results;
    }
 
     
                               
          


   /**
    * selects a collection of ProjectDownload objects pre-filled with 
    * all related objects.
    */
    public static Vector doSelectJoinAllExceptUserRelatedByApprovedBy(Criteria c) 
        throws Exception
    {
         c.setDbName(mapBuilder.getDatabaseMap().getName());

        addSelectColumns(c);
        int offset2 = numColumns + 1;
                    
                ProjectPeer.addSelectColumns(c);
        int offset3 = offset2 + ProjectPeer.numColumns;
                                          
                                      
                                                                                                                                                                                         
        Vector rows = BasePeer.doSelect(c);
        Vector results = new Vector();

        for (int i=0; i<rows.size(); i++)
        {
            ProjectDownload obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.ProjectDownload") );
                    
                                                
                        
                        Project obj2 = ProjectPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset2, Class.forName("org.tigris.helm.om.Project") );

            
             boolean  newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                ProjectDownload temp_obj1 = (ProjectDownload)results.elementAt(j);
                Project temp_obj2 = temp_obj1.getProject();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addProjectDownloads(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initProjectDownloads();
                obj2.addProjectDownloads(obj1);
            }
                        
                                  
                                  results.add(obj1);

        }

        return results;
    }
  


    
    /** 
     * Retrieve objects by fk
     *
     * @@param int project_id
     */
//    public static Vector retrieveByProjectId(int project_id)
//    {
        
        
    /** 
     * Retrieve objects by fk
     *
     * @@param int suggested_by
     */
//    public static Vector retrieveBySuggestedBy(int suggested_by)
//    {
        
    
    /** 
     * Retrieve objects by fk
     *
     * @@param int approved_by
     */
//    public static Vector retrieveByApprovedBy(int approved_by)
//    {
        
            
@


1.1.2.7
log
@Torque autogen files.
@
text
@d23 1
a23 6
/**
  * This class was autogenerated by Torque on:
  *
  * [Thu Feb 08 17:56:55 PST 2001]
  *
  */
@


1.1.2.8
log
@New Torque-generated classes.  NewsItem replaces ProjectNews.
@
text
@d26 1
a26 1
  * [Fri Feb 09 15:29:27 PST 2001]
@


1.1.2.9
log
@New Torque-generated classes.
@
text
@d26 1
a26 1
  * [Mon Feb 12 16:46:43 PST 2001]
d46 2
a47 2
    /** the column name for the PROPOSED_BY field */
    public static final String PROPOSED_BY = mapBuilder.getProjectDownload_ProposedBy();
d62 1
a62 6
    public static final int numColumns =  11;

    /** A class that can be returned by this peer. */
    protected static final String CLASSNAME_DEFAULT = 
        "org.tigris.helm.om.ProjectDownload";

d89 1
a89 1
            criteria.addSelectColumn( PROPOSED_BY );
d99 20
a118 25
    /** 
     * Create a new object of type cls from a resultset row starting
     * from a specified offset.  This is done so that you can select
     * other rows than just those needed for this object.  You may
     * for example want to create two objects from the same row.
     */
    public static ProjectDownload row2Object (Record row, 
                                              int offset, 
                                              String cls ) 
        throws Exception
    {
        ProjectDownload obj = 
            (ProjectDownload)Class.forName(cls).newInstance();
                                                        obj.setDownloadId(row.getValue(offset+0).asInt());
                                                                            obj.setProjectId(row.getValue(offset+1).asInt());
                                                                            obj.setFileName(row.getValue(offset+2).asString());
                                                                            obj.setLocation(row.getValue(offset+3).asString());
                                                                            obj.setProposedBy(row.getValue(offset+4).asInt());
                                                                            obj.setApprovedBy(row.getValue(offset+5).asInt());
                                                                            obj.setIsPublic(row.getValue(offset+6).asString());
                                                                            obj.setDescription(row.getValue(offset+7).asString());
                                                                            obj.setUploadedDate(row.getValue(offset+8).asDate());
                                                                            obj.setSize(row.getValue(offset+9).asLong());
                                                                            obj.setMd5(row.getValue(offset+10).asString());
                                                        obj.setModified(false);
d126 2
a127 10
        return populateObjects( doSelectVillageRecords(criteria) ); 
    }


    /** Method to do selects within a transaction */
    public static Vector doSelect( Criteria criteria, 
                                   DBConnection dbCon ) 
        throws Exception
    {
        return populateObjects( doSelectVillageRecords(criteria, dbCon) ); 
d131 3
a133 2
     * Grabs the raw Village records to be formed into objects.
     * This method handles connections internally 
d135 1
a135 2
    public static Vector doSelectVillageRecords( Criteria criteria ) 
        throws Exception
d138 1
a138 9
        if (criteria.getSelectColumns().size() == 0)
        {
            addSelectColumns ( criteria );
        }

                                                                                                                                                               
        // BasePeer returns a Vector of Value (Village) arrays.  The array
        // order follows the order columns were placed in the Select clause.
        return BasePeer.doSelect(criteria);
d141 4
a144 8

    /** 
     * Grabs the raw Village records to be formed into objects.
     * This method should be used for transactions 
     */
    public static Vector doSelectVillageRecords( Criteria criteria, 
                                                 DBConnection dbCon ) 
        throws Exception
d151 10
a160 11
        return BasePeer.doSelect(criteria, dbCon);
    }

    /** 
     * The returned vector will contain objects of the default type or
     * objects that inherit from the default.
     */
    private static Vector populateObjects(Vector records) 
        throws Exception
    {
        Vector results = new Vector(records.size());
d163 1
a163 1
        for ( int i=0; i<records.size(); i++ )
d165 4
a168 5
            Record row = (Record)records.elementAt(i);

            results.add(row2Object( row,1, CLASSNAME_DEFAULT ));
        }
        return results;
d292 1
a292 1
                                criteria.add( PROPOSED_BY, obj.getProposedBy() );
d374 3
a376 28
            Record row = (Record)rows.elementAt(i);

            ProjectDownload obj1 = row2Object( row,1, CLASSNAME_DEFAULT );


                        String className = null;
                                String classKey = row.getValue(ProjectPeer.TYPE)
                .asString();
                                        if (ProjectPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_GROUP;
            }
                                            else if (ProjectPeer.CLASSKEY_CATEGORY.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_CATEGORY;
            }
                                            else if (ProjectPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_DOMAIN;
            }
                                            else if (ProjectPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
d378 3
a380 2
                .row2Object(row, offset, className);
                
d414 1
a414 1
    public static Vector doSelectJoinUserRelatedByProposedBy(Criteria c)
d429 3
a431 24
            Record row = (Record)rows.elementAt(i);

            ProjectDownload obj1 = row2Object( row,1, CLASSNAME_DEFAULT );


                        String className = null;
                                String classKey = row.getValue(UserPeer.TYPE)
                .asString();
                                        if (UserPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_GROUP;
            }
                                            else if (UserPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_DOMAIN;
            }
                                            else if (UserPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
d433 3
a435 2
                .row2Object(row, offset, className);
                
d440 1
a440 1
                User temp_obj2 = temp_obj1.getUserRelatedByProposedBy();
d444 1
a444 1
                    temp_obj2.addProjectDownloadsRelatedByProposedBy(obj1);
d450 2
a451 2
                obj2.initProjectDownloadsRelatedByProposedBy();
                obj2.addProjectDownloadsRelatedByProposedBy(obj1);
d484 3
a486 24
            Record row = (Record)rows.elementAt(i);

            ProjectDownload obj1 = row2Object( row,1, CLASSNAME_DEFAULT );


                        String className = null;
                                String classKey = row.getValue(UserPeer.TYPE)
                .asString();
                                        if (UserPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_GROUP;
            }
                                            else if (UserPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_DOMAIN;
            }
                                            else if (UserPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
d488 3
a490 2
                .row2Object(row, offset, className);
                
d547 3
a549 4
            Record row = (Record)rows.elementAt(i);

                ProjectDownload obj1 = row2Object( row,1, CLASSNAME_DEFAULT );
  
d554 4
a558 23

                        String className = null;
                                String classKey = row.getValue(UserPeer.TYPE)
                .asString();
                                        if (UserPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_GROUP;
            }
                                            else if (UserPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_DOMAIN;
            }
                                            else if (UserPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
            User obj2 = UserPeer
                .row2Object(row, offset2, className);
                
d563 1
a563 1
                User temp_obj2 = temp_obj1.getUserRelatedByProposedBy();
d567 1
a567 1
                    temp_obj2.addProjectDownloadsRelatedByProposedBy(obj1);
d573 2
a574 2
                obj2.initProjectDownloadsRelatedByProposedBy();
                obj2.addProjectDownloadsRelatedByProposedBy(obj1);
d579 4
a583 22

                                 classKey = row.getValue(UserPeer.TYPE)
                .asString();
                                        if (UserPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_GROUP;
            }
                                            else if (UserPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_DOMAIN;
            }
                                            else if (UserPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = UserPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
            User obj3 = UserPeer
                .row2Object(row, offset3, className);
                
d617 1
a617 1
    public static Vector doSelectJoinAllExceptUserRelatedByProposedBy(Criteria c) 
d635 3
a637 4
            Record row = (Record)rows.elementAt(i);

                ProjectDownload obj1 = row2Object( row,1, CLASSNAME_DEFAULT );
  
d641 4
a645 27

                        String className = null;
                                String classKey = row.getValue(ProjectPeer.TYPE)
                .asString();
                                        if (ProjectPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_GROUP;
            }
                                            else if (ProjectPeer.CLASSKEY_CATEGORY.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_CATEGORY;
            }
                                            else if (ProjectPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_DOMAIN;
            }
                                            else if (ProjectPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
            Project obj2 = ProjectPeer
                .row2Object(row, offset2, className);
                
d699 3
a701 4
            Record row = (Record)rows.elementAt(i);

                ProjectDownload obj1 = row2Object( row,1, CLASSNAME_DEFAULT );
  
d705 4
a709 27

                        String className = null;
                                String classKey = row.getValue(ProjectPeer.TYPE)
                .asString();
                                        if (ProjectPeer.CLASSKEY_GROUP.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_GROUP;
            }
                                            else if (ProjectPeer.CLASSKEY_CATEGORY.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_CATEGORY;
            }
                                            else if (ProjectPeer.CLASSKEY_DOMAIN.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_DOMAIN;
            }
                                            else if (ProjectPeer.CLASSKEY_HOST.equals(classKey))
                        {
                className = ProjectPeer.CLASSNAME_HOST;
            }
                                else
            {
                className = CLASSNAME_DEFAULT;
            }
            Project obj2 = ProjectPeer
                .row2Object(row, offset2, className);
                
d738 28
a765 2


@


1.1.2.10
log
@Latest Torque-generated code to handle inheritance based on values in a database field column.
@
text
@d26 1
a26 1
  * [Mon Feb 12 19:03:25 PST 2001]
d117 12
a128 12
                                            obj.setDownloadId(row.getValue(offset+0).asInt());
                                                    obj.setProjectId(row.getValue(offset+1).asInt());
                                                    obj.setFileName(row.getValue(offset+2).asString());
                                                    obj.setLocation(row.getValue(offset+3).asString());
                                                    obj.setProposedBy(row.getValue(offset+4).asInt());
                                                    obj.setApprovedBy(row.getValue(offset+5).asInt());
                                                    obj.setIsPublic(row.getValue(offset+6).asString());
                                                    obj.setDescription(row.getValue(offset+7).asString());
                                                    obj.setUploadedDate(row.getValue(offset+8).asDate());
                                                    obj.setSize(row.getValue(offset+9).asLong());
                                                    obj.setMd5(row.getValue(offset+10).asString());
                                            obj.setModified(false);
a129 1

d246 1
a246 1
     * otherwise use the doDelete(Criteria) method.  It will take care of 
d320 1
a320 1
    	                criteria.add( DOWNLOAD_ID, obj.getDownloadId() );
@


1.1.2.11
log
@Deprecated by Torque modificaitons.
@
text
@@


