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


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

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

1.1.2.2
date	2001.02.01.02.56.57;	author leonardr;	state Exp;
branches;
next	1.1.2.3;

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

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

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

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

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

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

1.1.2.9
date	2001.02.16.03.05.24;	author dlr;	state dead;
branches;
next	;


desc
@@


1.1
log
@file BaseAction.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 210
package org.tigris.helm.om;

// JDK classes
import java.util.*;

// Turbine classes
import org.apache.turbine.om.BaseObject;
import org.apache.turbine.om.peer.BasePeer;
import org.tigris.helm.om.peer.*;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.db.pool.DBConnection;

/** 
 * This class was autogenerated by Torque on: Fri Jan 26 19:21:34 PST 2001
 * You should not use this class directly.  It should not even be
 * extended all references should be to Action 
 */
abstract class BaseAction extends BaseObject
{
    /** the value for the action_id field */
    private int action_id;
    /** the value for the name field */
    private String name;
    /** the value for the type field */
    private String type;


    /**
     * Get the ActionId
     * @@return int
     */
     public int getActionId()
     {
          return action_id;
     }


    /**
     * Set the value of ActionId
     */
     public void setActionId(int v ) 
     {


           if (this.action_id != v)
           {
              this.action_id = v;
              setModified(true);
          }
     }
    /**
     * Get the Name
     * @@return String
     */
     public String getName()
     {
          return name;
     }


    /**
     * Set the value of Name
     */
     public void setName(String v ) 
     {


           if ( !ObjectUtils.equals(this.name, v) )
           {
              this.name = v;
              setModified(true);
          }
     }
    /**
     * Get the Type
     * @@return String
     */
     public String getType()
     {
          return type;
     }


    /**
     * Set the value of Type
     */
     public void setType(String v ) 
     {


           if ( !ObjectUtils.equals(this.type, v) )
           {
              this.type = v;
              setModified(true);
          }
     }

 
    
     	

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     */
    public void save() throws Exception
    {
 
        if (isModified())
        {
            if (isNew())
            {
                ActionPeer.doInsert((Action)this);
                setNew(false);
            }
            else
            {
                ActionPeer.doUpdate((Action)this);
            }
        }
      
     }

      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     */
    public void save(DBConnection dbCon) throws Exception
    {
          if (isModified())
        {
            if (isNew())
            {
                ActionPeer.doInsert((Action)this, dbCon);
            }
            else
            {
                ActionPeer.doUpdate((Action)this, dbCon);
                setNew(false);
            }
        }

       }


    /** 
     * Set the Id using pk values.
     *
     * @@param int action_id
     */
    public void setPrimaryKey(
                      int action_id
                                                     ) 
    {
                     setActionId(action_id);
                                        }

    /** 
     * Set the Id using a : separated String of pk values.
     */
    public void setPrimaryKey(Object id) throws Exception
    {
        StringTokenizer st = new StringTokenizer(id.toString(), ":");
                           setActionId( Integer.parseInt(st.nextToken()) );
                                                }


    /** 
     * returns an id that differentiates this object from others
     * of its class.
     */
    public Object getPrimaryKey() 
    {
        return ""
                      + getActionId()
                                                     ;
    } 

    /** 
     * returns an id that can be used to specify this object in
     * a query string.
     */
    public String getQueryOID() 
    {
        return "Action[" + getPrimaryKey() + "]";
    }

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      */
    public Action copy() throws Exception
    {
        Action copyObj = new Action();
         copyObj.setActionId(action_id);
         copyObj.setName(name);
         copyObj.setType(type);
 
  
                        
        copyObj.setActionId(NEW_ID);
                         return copyObj;
    }             

}
@


1.1.2.2
log
@Changes to generated classes.
@
text
@d20 1
a20 1
public abstract class BaseAction extends BaseObject
@


1.1.2.3
log
@Latest Torque generated code (simple object model).
@
text
@a4 1
import java.math.*;
d16 1
a16 1
 * This class was autogenerated by Torque on: Tue Feb 06 19:46:40 PST 2001
a101 36
    /**
     * Generate a Vector with field names.
     */
    static private Vector fieldNames_ = null;
    static public Vector getFieldNames()
    {
      if (fieldNames_ == null)
      {
        fieldNames_ = new Vector();
            fieldNames_.add("ActionId");
            fieldNames_.add("Name");
            fieldNames_.add("Type");
          }
      return fieldNames_;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.
     */
    public Object getByName(String name)
    {
            if (name.equals("ActionId"))
	{
	  	    return new Integer(getActionId());
	  	}
            if (name.equals("Name"))
	{
	  	    return getName();
	  	}
            if (name.equals("Type"))
	{
	  	    return getType();
	  	}
            return null; 
    }
d205 1
a205 1
                       
d209 1
@


1.1.2.4
log
@Newest generated code (complex model this time).  Removed getUsers from Domain to side step decl conflict.
@
text
@d17 1
a17 1
 * This class was autogenerated by Torque on: Wed Feb 07 12:45:09 PST 2001
d40 1
a40 1
                            
d44 1
a44 1
     public void setActionId(int v ) throws Exception
d46 1
a46 14
  
       
        
                
          // update associated RoleActionResource
          if (collRoleActionResources != null )
          {
              for (int i=0; i<collRoleActionResources.size(); i++)
              {
                  ((RoleActionResource)collRoleActionResources.get(i))
                      .setActionId(v);
              }
          }
       
d63 1
a63 1
        
d69 1
a69 2
  
  
d86 1
a86 1
        
d92 1
a92 2
  
  
a102 227
                
      
    /**
     * Collection to store aggregation of collRoleActionResources
     */
    private Vector collRoleActionResources;
    /**
     * Temporary storage of collRoleActionResources to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
//    private Vector tempcollRoleActionResources;

    public void initRoleActionResources()
    {
        if (collRoleActionResources == null)
            collRoleActionResources = new Vector();
    }

    /**
     * Method called to associate a RoleActionResource object to this object
     * through the RoleActionResource foreign key attribute
     *
     * @@param RoleActionResource l
     */
    public void addRoleActionResources(RoleActionResource l) throws Exception
    {
        /*
        if (collRoleActionResources == null)
        {
            if (tempcollRoleActionResources == null)
            {
                tempcollRoleActionResources = new Vector();
            }
            tempcollRoleActionResources.add(l);
        }
        else
        {
            collRoleActionResources.add(l);
        }
        */
        getRoleActionResources().add(l);
        l.setAction((Action)this);
    }

    /**
     * The criteria used to select the current contents of collRoleActionResources
     */
    private Criteria lastRoleActionResourcesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of 
     * getRoleActionResources(new Criteria())
     */
    public Vector getRoleActionResources() throws Exception
    {
        if (collRoleActionResources == null)
        {
            collRoleActionResources = getRoleActionResources(new Criteria(10));
        }
        return collRoleActionResources;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Action is new, it will return
     * an empty collection; or if this Action has previously
     * been saved, it will retrieve related RoleActionResources from storage.
     */
    public Vector getRoleActionResources(Criteria criteria) throws Exception
    {
        if (collRoleActionResources == null)
        {
            if ( isNew() ) 
            {
               collRoleActionResources = new Vector();       
            } 
            else
            {
                   criteria.add(RoleActionResourcePeer.ACTION_ID, getActionId() );               
                   collRoleActionResources = RoleActionResourcePeer.doSelect(criteria);
            }
/*
            if (tempcollRoleActionResources != null)
            {
                for (int i=0; i<tempcollRoleActionResources.size(); i++)
                {
                    collRoleActionResources.add(tempcollRoleActionResources.get(i));
                }
                tempcollRoleActionResources = null;
            }
*/
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                   criteria.add(RoleActionResourcePeer.ACTION_ID, getActionId() );               
               if ( !lastRoleActionResourcesCriteria.equals(criteria)  )
            {
                collRoleActionResources = RoleActionResourcePeer.doSelect(criteria);  
            }
        }
        lastRoleActionResourcesCriteria = criteria; 

        return collRoleActionResources;
    }
     

        
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Action is new, it will return
     * an empty collection; or if this Action has previously
     * been saved, it will retrieve related RoleActionResources from storage.
     */
    public Vector getRoleActionResourcesJoinRole(Criteria criteria) 
        throws Exception
    {
        if (collRoleActionResources == null)
        {
            if ( isNew() ) 
            {
               collRoleActionResources = new Vector();       
            } 
            else
            {
                   criteria.add(RoleActionResourcePeer.ACTION_ID, getActionId() );               
                   collRoleActionResources = RoleActionResourcePeer.doSelectJoinRole(criteria);
            }
            
            
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                   criteria.add(RoleActionResourcePeer.ACTION_ID, getActionId() );               
               if ( !lastRoleActionResourcesCriteria.equals(criteria)  )
            {
                collRoleActionResources = RoleActionResourcePeer.doSelectJoinRole(criteria);
            }
        }
        lastRoleActionResourcesCriteria = criteria; 

        return collRoleActionResources;
    }
      
      
         
          
                    
                
        
        
       
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Action is new, it will return
     * an empty collection; or if this Action has previously
     * been saved, it will retrieve related RoleActionResources from storage.
     */
    public Vector getRoleActionResourcesJoinResource(Criteria criteria) 
        throws Exception
    {
        if (collRoleActionResources == null)
        {
            if ( isNew() ) 
            {
               collRoleActionResources = new Vector();       
            } 
            else
            {
                   criteria.add(RoleActionResourcePeer.ACTION_ID, getActionId() );               
                   collRoleActionResources = RoleActionResourcePeer.doSelectJoinResource(criteria);
            }
            
            
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                   criteria.add(RoleActionResourcePeer.ACTION_ID, getActionId() );               
               if ( !lastRoleActionResourcesCriteria.equals(criteria)  )
            {
                collRoleActionResources = RoleActionResourcePeer.doSelectJoinResource(criteria);
            }
        }
        lastRoleActionResourcesCriteria = criteria; 

        return collRoleActionResources;
    }
     



     
    
    private static Vector fieldNames_ = null;

d104 1
a104 1
     * Generate a list of field names.
d106 2
a107 1
    public static Vector getFieldNames()
d147 2
a148 2
         DBConnection dbCon = null;
        try
d150 9
a158 4
            dbCon = BasePeer.beginTransaction(
                ActionPeer.getMapBuilder()
                .getDatabaseMap().getName());
            save(dbCon);
d160 1
a160 7
        catch(Exception e)
        {
            BasePeer.rollBackTransaction(dbCon);
            throw e;
        }
        BasePeer.commitTransaction(dbCon);

a162 3
      // flag to prevent endless save loop, if this object is referenced
    // by another object which falls in this transaction.
    private boolean alreadyInSave = false;
a171 3
        if (!alreadyInSave)
      {
        alreadyInSave = true;
d185 2
a186 12
                                    
                
          if (collRoleActionResources != null )
          {
              for (int i=0; i<collRoleActionResources.size(); i++)
              {
                  ((RoleActionResource)collRoleActionResources.get(i)).save(dbCon);
              }
          }
                  alreadyInSave = false;
      }
      }
a187 1
                                            
d195 1
a195 1
                                                     ) throws Exception
a232 2
      * It then fills all the association collections and sets the
     * related objects to isNew=true.
d241 1
a241 8
                                  
                
         List v = copyObj.getRoleActionResources();
         for (int i=0; i<v.size(); i++)
         {
             ((BaseObject)v.get(i)).setNew(true);
         }
         
@


1.1.2.5
log
@Torque autogen files.
@
text
@d17 1
a17 4
 * This class was autogenerated by Torque on:
 *
 * [Thu Feb 08 17:56:55 PST 2001]
 *
@


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


1.1.2.7
log
@New Torque-generated classes.
@
text
@d19 1
a19 1
 * [Mon Feb 12 16:46:43 PST 2001]
@


1.1.2.8
log
@Latest Torque-generated code to handle inheritance based on values in a database field column.
@
text
@d19 1
a19 1
 * [Mon Feb 12 19:03:25 PST 2001]
@


1.1.2.9
log
@Deprecated by Torque modifications.
@
text
@@


