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.54;	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 BaseRoleActionResourcePeer.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 328
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.RoleActionResource;

// 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 BaseRoleActionResourcePeer extends BasePeer
{
    /** the mapbuilder for this class */
    private static final RoleActionResourceMapBuilder mapBuilder = 
        (RoleActionResourceMapBuilder)getMapBuilder(RoleActionResourceMapBuilder.CLASS_NAME);

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

    /** the column name for the ROLE_ID field */
    public static final String ROLE_ID = mapBuilder.getRoleActionResource_RoleId();
    /** the column name for the ACTION_ID field */
    public static final String ACTION_ID = mapBuilder.getRoleActionResource_ActionId();
    /** the column name for the RESOURCE_ID field */
    public static final String RESOURCE_ID = mapBuilder.getRoleActionResource_ResourceId();

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

    /** 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( ROLE_ID );
            criteria.addSelectColumn( ACTION_ID );
            criteria.addSelectColumn( RESOURCE_ID );
        }


    /** 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 RoleActionResource row2Object (Record row, int offset, Class cls ) throws Exception
    {
        RoleActionResource obj = (RoleActionResource)cls.newInstance();
                                        obj.setRoleId(row.getValue(offset+0).asInt());
                                            obj.setActionId(row.getValue(offset+1).asInt());
                                            obj.setResourceId(row.getValue(offset+2).asInt());
                                        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.RoleActionResource", 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.RoleActionResource", 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( ROLE_ID, criteria.remove(ROLE_ID) );
                                         selectCriteria.put( ACTION_ID, criteria.remove(ACTION_ID) );
                                         selectCriteria.put( RESOURCE_ID, criteria.remove(RESOURCE_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( ROLE_ID, criteria.remove(ROLE_ID) );
                                         selectCriteria.put( ACTION_ID, criteria.remove(ACTION_ID) );
                                         selectCriteria.put( RESOURCE_ID, criteria.remove(RESOURCE_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( RoleActionResource 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(RoleActionResource obj) throws Exception
    {
        doUpdate(buildCriteria(obj));
    }
    /**
     * @@param obj the data object to delete in the database.
     */
    public static void doDelete(RoleActionResource obj) throws Exception
    {
        doDelete(buildCriteria(obj));
    }

    /** 
     * Method to do inserts.  This method is to be used during a transaction,
     * otherwise use the doInsert(RoleActionResource) method.  It will take 
     * care of the connection details internally. 
     *
     * @@param obj the data object to insert into the database.
     */
    public static void doInsert( RoleActionResource 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(RoleActionResource) method.  It will take 
     * care of the connection details internally. 
     *
     * @@param obj the data object to update in the database.
     */
    public static void doUpdate(RoleActionResource 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(RoleActionResource) method.  It will take 
     * care of the connection details internally. 
     *
     * @@param obj the data object to delete in the database.
     */
    public static void doDelete(RoleActionResource obj, DBConnection dbCon) throws Exception
    {
        doDelete(buildCriteria(obj), dbCon);
    }

    /** Build a Criteria object from the data object for this peer */
    public static Criteria buildCriteria( RoleActionResource obj )
    {
        Criteria criteria = new Criteria();
                            if ( !obj.isNew() )
	                criteria.add( ROLE_ID, obj.getRoleId() );
                            if ( !obj.isNew() )
	                criteria.add( ACTION_ID, obj.getActionId() );
                            if ( !obj.isNew() )
	                criteria.add( RESOURCE_ID, obj.getResourceId() );
                return criteria;
    }

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

       return retrieveByPK(
             role_id
              , action_id
              , resource_id
              );
    }

    /** 
     * Retrieve a single object by pk
     *
     * @@param int role_id
     * @@param int action_id
     * @@param int resource_id
     */
    public static RoleActionResource retrieveByPK(
                      int role_id
                                      , int action_id
                                      , int resource_id
                             ) throws Exception
    {
        Criteria criteria = new Criteria();
                       if( role_id > 0 )
                  criteria.add( BaseRoleActionResourcePeer.ROLE_ID, role_id );
                            if( action_id > 0 )
                  criteria.add( BaseRoleActionResourcePeer.ACTION_ID, action_id );
                            if( resource_id > 0 )
                  criteria.add( BaseRoleActionResourcePeer.RESOURCE_ID, resource_id );
                 Vector RoleActionResourceVector = doSelect(criteria);
        if (RoleActionResourceVector.size() != 1)
        {
            throw new Exception("Failed to select one and only one row.");
        }
        else
        {
            return (RoleActionResource) RoleActionResourceVector.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 BaseRoleActionResourcePeer 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 */
d45 1
a45 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d56 1
a56 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d88 1
a88 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d99 1
a99 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d140 1
a140 1
        criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d157 1
a157 1
         criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d172 1
a172 1
         criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d185 1
a185 1
         criteria.setDbName(mapBuilder.getDatabaseMap().getName());
d303 1
a303 1
                  criteria.add( RoleActionResourcePeer.ROLE_ID, role_id );
d305 1
a305 1
                  criteria.add( RoleActionResourcePeer.ACTION_ID, action_id );
d307 1
a307 1
                  criteria.add( RoleActionResourcePeer.RESOURCE_ID, resource_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 */
d193 1
a193 1
                doInsert(buildCriteria(obj));
d221 1
a221 1
                doInsert(buildCriteria(obj), dbCon);
d252 6
a257 3
                                criteria.add( ROLE_ID, obj.getRoleId() );
                                criteria.add( ACTION_ID, obj.getActionId() );
                                criteria.add( RESOURCE_ID, obj.getResourceId() );
@


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 BaseRoleActionResourcePeer extends BasePeer
d142 1
a142 2
        Criteria selectCriteria = new
            Criteria(mapBuilder.getDatabaseMap().getName(), 2);
d158 2
a159 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 */
a319 470
       
        
                       
     
          


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

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

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

        for (int i=0; i<rows.size(); i++)
        {
            RoleActionResource obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.RoleActionResource") );
            Role obj2 = RolePeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset, Class.forName("org.tigris.helm.om.Role") );
            
            boolean newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Role temp_obj2 = temp_obj1.getRole();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initRoleActionResources();
                obj2.addRoleActionResources(obj1);
            }
            results.add(obj1);

        }

        return results;
    }
         
                       
     
          


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

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

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

        for (int i=0; i<rows.size(); i++)
        {
            RoleActionResource obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.RoleActionResource") );
            Action obj2 = ActionPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset, Class.forName("org.tigris.helm.om.Action") );
            
            boolean newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Action temp_obj2 = temp_obj1.getAction();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initRoleActionResources();
                obj2.addRoleActionResources(obj1);
            }
            results.add(obj1);

        }

        return results;
    }
         
                       
     
          


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

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

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

        for (int i=0; i<rows.size(); i++)
        {
            RoleActionResource obj1 = 
                row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            1, Class.forName("org.tigris.helm.om.RoleActionResource") );
            Resource obj2 = ResourcePeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset, Class.forName("org.tigris.helm.om.Resource") );
            
            boolean newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Resource temp_obj2 = temp_obj1.getResource();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initRoleActionResources();
                obj2.addRoleActionResources(obj1);
            }
            results.add(obj1);

        }

        return results;
    }
    

  
  
     
                       
          


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

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

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

            
             boolean  newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Action temp_obj2 = temp_obj1.getAction();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initRoleActionResources();
                obj2.addRoleActionResources(obj1);
            }
                        
                                                
                        
                        Resource obj3 = ResourcePeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset3, Class.forName("org.tigris.helm.om.Resource") );

            
             newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Resource temp_obj3 = temp_obj1.getResource();
                if ( temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj3.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj3.initRoleActionResources();
                obj3.addRoleActionResources(obj1);
            }
                        results.add(obj1);

        }

        return results;
    }
 
     
                       
          


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

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

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

            
             boolean  newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Role temp_obj2 = temp_obj1.getRole();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initRoleActionResources();
                obj2.addRoleActionResources(obj1);
            }
                        
                                  
                                                
                        
                        Resource obj3 = ResourcePeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset3, Class.forName("org.tigris.helm.om.Resource") );

            
             newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Resource temp_obj3 = temp_obj1.getResource();
                if ( temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj3.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj3.initRoleActionResources();
                obj3.addRoleActionResources(obj1);
            }
                        results.add(obj1);

        }

        return results;
    }
 
     
                       
          


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

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

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

            
             boolean  newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Role temp_obj2 = temp_obj1.getRole();
                if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj2.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj2.initRoleActionResources();
                obj2.addRoleActionResources(obj1);
            }
                        
                                                
                        
                        Action obj3 = ActionPeer
                .row2Object((com.workingdogs.village.Record)rows.elementAt(i),
                            offset3, Class.forName("org.tigris.helm.om.Action") );

            
             newObject = true;
            for (int j=0; j<results.size(); j++)
            {
                RoleActionResource temp_obj1 = (RoleActionResource)results.elementAt(j);
                Action temp_obj3 = temp_obj1.getAction();
                if ( temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey() ) )
                {
                    newObject = false;
                    temp_obj3.addRoleActionResources(obj1);
                    break;
                }
            }
            if (newObject)
            {
                obj3.initRoleActionResources();
                obj3.addRoleActionResources(obj1);
            }
                        
                                  results.add(obj1);

        }

        return results;
    }
  


  
    /** 
     * Retrieve objects by fk
     *
     * @@param int role_id
     */
//    public static Vector retrieveByRoleId(int role_id)
//    {
        
    
    /** 
     * Retrieve objects by fk
     *
     * @@param int action_id
     */
//    public static Vector retrieveByActionId(int action_id)
//    {
        
    
    /** 
     * Retrieve objects by fk
     *
     * @@param int resource_id
     */
//    public static Vector retrieveByResourceId(int resource_id)
//    {
        
  
@


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 1
a46 6
    public static final int numColumns =  3;

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

d75 12
a86 17
    /** 
     * 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 RoleActionResource row2Object (Record row, 
                                              int offset, 
                                              String cls ) 
        throws Exception
    {
        RoleActionResource obj = 
            (RoleActionResource)Class.forName(cls).newInstance();
                                                        obj.setRoleId(row.getValue(offset+0).asInt());
                                                                            obj.setActionId(row.getValue(offset+1).asInt());
                                                                            obj.setResourceId(row.getValue(offset+2).asInt());
                                                        obj.setModified(false);
d94 2
a95 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) ); 
d99 3
a101 2
     * Grabs the raw Village records to be formed into objects.
     * This method handles connections internally 
d103 1
a103 2
    public static Vector doSelectVillageRecords( Criteria criteria ) 
        throws Exception
d106 1
a106 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);
d109 4
a112 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
d119 10
a128 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());
d131 1
a131 1
        for ( int i=0; i<records.size(); i++ )
d133 4
a136 5
            Record row = (Record)records.elementAt(i);

            results.add(row2Object( row,1, CLASSNAME_DEFAULT ));
        }
        return results;
d351 3
a353 5
            Record row = (Record)rows.elementAt(i);

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


d355 2
a356 2
                .row2Object(row, offset, 
                    RolePeer.CLASSNAME_DEFAULT);
d406 3
a408 5
            Record row = (Record)rows.elementAt(i);

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


d410 2
a411 2
                .row2Object(row, offset, 
                    ActionPeer.CLASSNAME_DEFAULT);
d461 3
a463 5
            Record row = (Record)rows.elementAt(i);

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


d465 2
a466 2
                .row2Object(row, offset, 
                    ResourcePeer.CLASSNAME_DEFAULT);
d524 3
a526 4
            Record row = (Record)rows.elementAt(i);

                RoleActionResource obj1 = row2Object( row,1, CLASSNAME_DEFAULT );
  
d531 3
a533 1
            
a534 3
            Action obj2 = ActionPeer
                .row2Object(row, offset2, 
                    ActionPeer.CLASSNAME_DEFAULT);
d556 3
a558 1
            
a559 3
            Resource obj3 = ResourcePeer
                .row2Object(row, offset3, 
                    ResourcePeer.CLASSNAME_DEFAULT);
d614 3
a616 4
            Record row = (Record)rows.elementAt(i);

                RoleActionResource obj1 = row2Object( row,1, CLASSNAME_DEFAULT );
  
d620 3
a622 1
            
a623 3
            Role obj2 = RolePeer
                .row2Object(row, offset2, 
                    RolePeer.CLASSNAME_DEFAULT);
d646 3
a648 1
            
a649 3
            Resource obj3 = ResourcePeer
                .row2Object(row, offset3, 
                    ResourcePeer.CLASSNAME_DEFAULT);
d704 3
a706 4
            Record row = (Record)rows.elementAt(i);

                RoleActionResource obj1 = row2Object( row,1, CLASSNAME_DEFAULT );
  
d710 3
a712 1
            
a713 3
            Role obj2 = RolePeer
                .row2Object(row, offset2, 
                    RolePeer.CLASSNAME_DEFAULT);
d735 3
a737 1
            
a738 3
            Action obj3 = ActionPeer
                .row2Object(row, offset3, 
                    ActionPeer.CLASSNAME_DEFAULT);
d767 28
a794 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]
d93 4
a96 4
                                            obj.setRoleId(row.getValue(offset+0).asInt());
                                                    obj.setActionId(row.getValue(offset+1).asInt());
                                                    obj.setResourceId(row.getValue(offset+2).asInt());
                                            obj.setModified(false);
a97 1

d218 1
a218 1
     * otherwise use the doDelete(Criteria) method.  It will take care of 
@


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


