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.58;	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.39;	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 BaseSkin.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 236
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 Skin 
 */
abstract class BaseSkin extends BaseObject
{
    /** the value for the skin_id field */
    private int skin_id;
    /** the value for the base_skin field */
    private int base_skin;
    /** the value for the name field */
    private String name;
    /** the value for the resource field */
    private String resource;


    /**
     * Get the SkinId
     * @@return int
     */
     public int getSkinId()
     {
          return skin_id;
     }


    /**
     * Set the value of SkinId
     */
     public void setSkinId(int v ) 
     {


           if (this.skin_id != v)
           {
              this.skin_id = v;
              setModified(true);
          }
     }
    /**
     * Get the BaseSkin
     * @@return int
     */
     public int getBaseSkin()
     {
          return base_skin;
     }


    /**
     * Set the value of BaseSkin
     */
     public void setBaseSkin(int v ) 
     {


           if (this.base_skin != v)
           {
              this.base_skin = 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 Resource
     * @@return String
     */
     public String getResource()
     {
          return resource;
     }


    /**
     * Set the value of Resource
     */
     public void setResource(String v ) 
     {


           if ( !ObjectUtils.equals(this.resource, v) )
           {
              this.resource = 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())
            {
                SkinPeer.doInsert((Skin)this);
                setNew(false);
            }
            else
            {
                SkinPeer.doUpdate((Skin)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())
            {
                SkinPeer.doInsert((Skin)this, dbCon);
            }
            else
            {
                SkinPeer.doUpdate((Skin)this, dbCon);
                setNew(false);
            }
        }

       }


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

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


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

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

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      */
    public Skin copy() throws Exception
    {
        Skin copyObj = new Skin();
         copyObj.setSkinId(skin_id);
         copyObj.setBaseSkin(base_skin);
         copyObj.setName(name);
         copyObj.setResource(resource);
 
  
                        
        copyObj.setSkinId(NEW_ID);
                                return copyObj;
    }             

}
@


1.1.2.2
log
@Changes to generated classes.
@
text
@d20 1
a20 1
public abstract class BaseSkin 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
a126 41
    /**
     * Generate a Vector with field names.
     */
    static private Vector fieldNames_ = null;
    static public Vector getFieldNames()
    {
      if (fieldNames_ == null)
      {
        fieldNames_ = new Vector();
            fieldNames_.add("SkinId");
            fieldNames_.add("BaseSkin");
            fieldNames_.add("Name");
            fieldNames_.add("Resource");
          }
      return fieldNames_;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.
     */
    public Object getByName(String name)
    {
            if (name.equals("SkinId"))
	{
	  	    return new Integer(getSkinId());
	  	}
            if (name.equals("BaseSkin"))
	{
	  	    return new Integer(getBaseSkin());
	  	}
            if (name.equals("Name"))
	{
	  	    return getName();
	  	}
            if (name.equals("Resource"))
	{
	  	    return getResource();
	  	}
            return null; 
    }
d231 1
a231 1
                       
d235 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
d42 1
a42 1
                            
d46 1
a46 1
     public void setSkinId(int v ) throws Exception
d48 1
a48 26
  
       
        
                
          // update associated Project
          if (collProjects != null )
          {
              for (int i=0; i<collProjects.size(); i++)
              {
                  ((Project)collProjects.get(i))
                      .setSkinId(v);
              }
          }
                   
        
                
          // update associated SkinStyleElementValue
          if (collSkinStyleElementValues != null )
          {
              for (int i=0; i<collSkinStyleElementValues.size(); i++)
              {
                  ((SkinStyleElementValue)collSkinStyleElementValues.get(i))
                      .setSkinId(v);
              }
          }
       
d65 1
a65 1
            
d69 1
a69 1
     public void setBaseSkin(int v ) throws Exception
d71 1
a71 7
                  if ( aSkinRelatedByBaseSkin != null && !aSkinRelatedByBaseSkin.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
d88 1
a88 1
        
d94 1
a94 2
  
  
d111 1
a111 1
        
d117 1
a117 2
  
  
a126 537
 
   
                 
      
   
    /**
     * Declares an association between this object and a Skin object
     *
     * @@param Skin v
     */
    private Skin aSkinRelatedByBaseSkin;
    public void setSkinRelatedByBaseSkin(Skin v) throws Exception
    {
        aSkinRelatedByBaseSkin = null;
           setBaseSkin(v.getSkinId());
           aSkinRelatedByBaseSkin = v;
    }

                     
    public Skin getSkinRelatedByBaseSkin() throws Exception
    {
        if ( aSkinRelatedByBaseSkin==null && (this.base_skin>0) )
        {
            aSkinRelatedByBaseSkin = SkinPeer.retrieveByPK(this.base_skin);
            // The following can be used instead of the line above to
            // guarantee the related object contains a reference
            // to this object, but this level of coupling 
            // may be undesirable in many circumstances.
            // As it can lead to a db query with many results that may
            // never be used.  
            // Skin obj = SkinPeer.retrieveByPK(this.base_skin);
            // obj.addSkinsRelatedByBaseSkin(this);
        }
        return aSkinRelatedByBaseSkin;
    }

    
                
      
    /**
     * Collection to store aggregation of collProjects
     */
    private Vector collProjects;
    /**
     * Temporary storage of collProjects to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
//    private Vector tempcollProjects;

    public void initProjects()
    {
        if (collProjects == null)
            collProjects = new Vector();
    }

    /**
     * Method called to associate a Project object to this object
     * through the Project foreign key attribute
     *
     * @@param Project l
     */
    public void addProjects(Project l) throws Exception
    {
        /*
        if (collProjects == null)
        {
            if (tempcollProjects == null)
            {
                tempcollProjects = new Vector();
            }
            tempcollProjects.add(l);
        }
        else
        {
            collProjects.add(l);
        }
        */
        getProjects().add(l);
        l.setSkin((Skin)this);
    }

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

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

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related Projects from storage.
     */
    public Vector getProjects(Criteria criteria) throws Exception
    {
        if (collProjects == null)
        {
            if ( isNew() ) 
            {
               collProjects = new Vector();       
            } 
            else
            {
                   criteria.add(ProjectPeer.SKIN_ID, getSkinId() );               
                   collProjects = ProjectPeer.doSelect(criteria);
            }
/*
            if (tempcollProjects != null)
            {
                for (int i=0; i<tempcollProjects.size(); i++)
                {
                    collProjects.add(tempcollProjects.get(i));
                }
                tempcollProjects = 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(ProjectPeer.SKIN_ID, getSkinId() );               
               if ( !lastProjectsCriteria.equals(criteria)  )
            {
                collProjects = ProjectPeer.doSelect(criteria);  
            }
        }
        lastProjectsCriteria = criteria; 

        return collProjects;
    }
      

        
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related Projects from storage.
     */
    public Vector getProjectsJoinDomain(Criteria criteria) 
        throws Exception
    {
        if (collProjects == null)
        {
            if ( isNew() ) 
            {
               collProjects = new Vector();       
            } 
            else
            {
                   criteria.add(ProjectPeer.SKIN_ID, getSkinId() );               
                   collProjects = ProjectPeer.doSelectJoinDomain(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(ProjectPeer.SKIN_ID, getSkinId() );               
               if ( !lastProjectsCriteria.equals(criteria)  )
            {
                collProjects = ProjectPeer.doSelectJoinDomain(criteria);
            }
        }
        lastProjectsCriteria = criteria; 

        return collProjects;
    }
      
      
      
              
                            
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related Projects from storage.
     */
    public Vector getProjectsJoinUserRelatedByProposedBy(Criteria criteria) 
        throws Exception
    {
        if (collProjects == null)
        {
            if ( isNew() ) 
            {
               collProjects = new Vector();       
            } 
            else
            {
                   criteria.add(ProjectPeer.SKIN_ID, getSkinId() );               
                   collProjects = ProjectPeer.doSelectJoinUserRelatedByProposedBy(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(ProjectPeer.SKIN_ID, getSkinId() );               
               if ( !lastProjectsCriteria.equals(criteria)  )
            {
                collProjects = ProjectPeer.doSelectJoinUserRelatedByProposedBy(criteria);
            }
        }
        lastProjectsCriteria = criteria; 

        return collProjects;
    }
      
      
      
              
                            
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related Projects from storage.
     */
    public Vector getProjectsJoinUserRelatedByApprovedBy(Criteria criteria) 
        throws Exception
    {
        if (collProjects == null)
        {
            if ( isNew() ) 
            {
               collProjects = new Vector();       
            } 
            else
            {
                   criteria.add(ProjectPeer.SKIN_ID, getSkinId() );               
                   collProjects = ProjectPeer.doSelectJoinUserRelatedByApprovedBy(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(ProjectPeer.SKIN_ID, getSkinId() );               
               if ( !lastProjectsCriteria.equals(criteria)  )
            {
                collProjects = ProjectPeer.doSelectJoinUserRelatedByApprovedBy(criteria);
            }
        }
        lastProjectsCriteria = criteria; 

        return collProjects;
    }
      
      
         
          
                    
                
        
        
      



   



             
      
    /**
     * Collection to store aggregation of collSkinStyleElementValues
     */
    private Vector collSkinStyleElementValues;
    /**
     * Temporary storage of collSkinStyleElementValues to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
//    private Vector tempcollSkinStyleElementValues;

    public void initSkinStyleElementValues()
    {
        if (collSkinStyleElementValues == null)
            collSkinStyleElementValues = new Vector();
    }

    /**
     * Method called to associate a SkinStyleElementValue object to this object
     * through the SkinStyleElementValue foreign key attribute
     *
     * @@param SkinStyleElementValue l
     */
    public void addSkinStyleElementValues(SkinStyleElementValue l) throws Exception
    {
        /*
        if (collSkinStyleElementValues == null)
        {
            if (tempcollSkinStyleElementValues == null)
            {
                tempcollSkinStyleElementValues = new Vector();
            }
            tempcollSkinStyleElementValues.add(l);
        }
        else
        {
            collSkinStyleElementValues.add(l);
        }
        */
        getSkinStyleElementValues().add(l);
        l.setSkin((Skin)this);
    }

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

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

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related SkinStyleElementValues from storage.
     */
    public Vector getSkinStyleElementValues(Criteria criteria) throws Exception
    {
        if (collSkinStyleElementValues == null)
        {
            if ( isNew() ) 
            {
               collSkinStyleElementValues = new Vector();       
            } 
            else
            {
                   criteria.add(SkinStyleElementValuePeer.SKIN_ID, getSkinId() );               
                   collSkinStyleElementValues = SkinStyleElementValuePeer.doSelect(criteria);
            }
/*
            if (tempcollSkinStyleElementValues != null)
            {
                for (int i=0; i<tempcollSkinStyleElementValues.size(); i++)
                {
                    collSkinStyleElementValues.add(tempcollSkinStyleElementValues.get(i));
                }
                tempcollSkinStyleElementValues = 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(SkinStyleElementValuePeer.SKIN_ID, getSkinId() );               
               if ( !lastSkinStyleElementValuesCriteria.equals(criteria)  )
            {
                collSkinStyleElementValues = SkinStyleElementValuePeer.doSelect(criteria);  
            }
        }
        lastSkinStyleElementValuesCriteria = criteria; 

        return collSkinStyleElementValues;
    }
     

        
      
         
          
                    
                
        
        
       
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related SkinStyleElementValues from storage.
     */
    public Vector getSkinStyleElementValuesJoinStyle(Criteria criteria) 
        throws Exception
    {
        if (collSkinStyleElementValues == null)
        {
            if ( isNew() ) 
            {
               collSkinStyleElementValues = new Vector();       
            } 
            else
            {
                   criteria.add(SkinStyleElementValuePeer.SKIN_ID, getSkinId() );               
                   collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinStyle(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(SkinStyleElementValuePeer.SKIN_ID, getSkinId() );               
               if ( !lastSkinStyleElementValuesCriteria.equals(criteria)  )
            {
                collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinStyle(criteria);
            }
        }
        lastSkinStyleElementValuesCriteria = criteria; 

        return collSkinStyleElementValues;
    }
      
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Skin is new, it will return
     * an empty collection; or if this Skin has previously
     * been saved, it will retrieve related SkinStyleElementValues from storage.
     */
    public Vector getSkinStyleElementValuesJoinStyleElement(Criteria criteria) 
        throws Exception
    {
        if (collSkinStyleElementValues == null)
        {
            if ( isNew() ) 
            {
               collSkinStyleElementValues = new Vector();       
            } 
            else
            {
                   criteria.add(SkinStyleElementValuePeer.SKIN_ID, getSkinId() );               
                   collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinStyleElement(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(SkinStyleElementValuePeer.SKIN_ID, getSkinId() );               
               if ( !lastSkinStyleElementValuesCriteria.equals(criteria)  )
            {
                collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinStyleElement(criteria);
            }
        }
        lastSkinStyleElementValuesCriteria = criteria; 

        return collSkinStyleElementValues;
    }
     



     
a127 2
    private static Vector fieldNames_ = null;

d129 1
a129 1
     * Generate a list of field names.
d131 2
a132 1
    public static Vector getFieldNames()
d177 2
a178 2
         DBConnection dbCon = null;
        try
d180 9
a188 4
            dbCon = BasePeer.beginTransaction(
                SkinPeer.getMapBuilder()
                .getDatabaseMap().getName());
            save(dbCon);
d190 1
a190 7
        catch(Exception e)
        {
            BasePeer.rollBackTransaction(dbCon);
            throw e;
        }
        BasePeer.commitTransaction(dbCon);

a192 3
      // flag to prevent endless save loop, if this object is referenced
    // by another object which falls in this transaction.
    private boolean alreadyInSave = false;
a201 3
        if (!alreadyInSave)
      {
        alreadyInSave = true;
d215 2
a216 21
                                    
                
          if (collProjects != null )
          {
              for (int i=0; i<collProjects.size(); i++)
              {
                  ((Project)collProjects.get(i)).save(dbCon);
              }
          }
                                               
                
          if (collSkinStyleElementValues != null )
          {
              for (int i=0; i<collSkinStyleElementValues.size(); i++)
              {
                  ((SkinStyleElementValue)collSkinStyleElementValues.get(i)).save(dbCon);
              }
          }
                  alreadyInSave = false;
      }
      }
a217 1
                                                
d225 1
a225 1
                                                                 ) throws Exception
a262 2
      * It then fills all the association collections and sets the
     * related objects to isNew=true.
d272 1
a272 15
                                  
                
         List v = copyObj.getProjects();
         for (int i=0; i<v.size(); i++)
         {
             ((BaseObject)v.get(i)).setNew(true);
         }
                                              
                
         v = copyObj.getSkinStyleElementValues();
         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
@@


