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 BaseStyle.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 Style 
 */
abstract class BaseStyle extends BaseObject
{
    /** the value for the style_id field */
    private int style_id;
    /** the value for the name field */
    private String name;
    /** the value for the description field */
    private String description;


    /**
     * Get the StyleId
     * @@return int
     */
     public int getStyleId()
     {
          return style_id;
     }


    /**
     * Set the value of StyleId
     */
     public void setStyleId(int v ) 
     {


           if (this.style_id != v)
           {
              this.style_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 Description
     * @@return String
     */
     public String getDescription()
     {
          return description;
     }


    /**
     * Set the value of Description
     */
     public void setDescription(String v ) 
     {


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

       }


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

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


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

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

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      */
    public Style copy() throws Exception
    {
        Style copyObj = new Style();
         copyObj.setStyleId(style_id);
         copyObj.setName(name);
         copyObj.setDescription(description);
 
  
                        
        copyObj.setStyleId(NEW_ID);
                         return copyObj;
    }             

}
@


1.1.2.2
log
@Changes to generated classes.
@
text
@d20 1
a20 1
public abstract class BaseStyle 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("StyleId");
            fieldNames_.add("Name");
            fieldNames_.add("Description");
          }
      return fieldNames_;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.
     */
    public Object getByName(String name)
    {
            if (name.equals("StyleId"))
	{
	  	    return new Integer(getStyleId());
	  	}
            if (name.equals("Name"))
	{
	  	    return getName();
	  	}
            if (name.equals("Description"))
	{
	  	    return getDescription();
	  	}
            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 setStyleId(int v ) throws Exception
d46 1
a46 14
  
       
        
                
          // update associated SkinStyleElementValue
          if (collSkinStyleElementValues != null )
          {
              for (int i=0; i<collSkinStyleElementValues.size(); i++)
              {
                  ((SkinStyleElementValue)collSkinStyleElementValues.get(i))
                      .setStyleId(v);
              }
          }
       
d63 1
a63 1
        
d69 1
a69 2
  
  
d86 1
a86 1
        
d92 1
a92 2
  
  
a102 227
                
      
    /**
     * 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.setStyle((Style)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 Style is new, it will return
     * an empty collection; or if this Style 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.STYLE_ID, getStyleId() );               
                   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.STYLE_ID, getStyleId() );               
               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 Style is new, it will return
     * an empty collection; or if this Style has previously
     * been saved, it will retrieve related SkinStyleElementValues from storage.
     */
    public Vector getSkinStyleElementValuesJoinSkin(Criteria criteria) 
        throws Exception
    {
        if (collSkinStyleElementValues == null)
        {
            if ( isNew() ) 
            {
               collSkinStyleElementValues = new Vector();       
            } 
            else
            {
                   criteria.add(SkinStyleElementValuePeer.STYLE_ID, getStyleId() );               
                   collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinSkin(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.STYLE_ID, getStyleId() );               
               if ( !lastSkinStyleElementValuesCriteria.equals(criteria)  )
            {
                collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinSkin(criteria);
            }
        }
        lastSkinStyleElementValuesCriteria = criteria; 

        return collSkinStyleElementValues;
    }
      
      
         
          
                    
                
        
        
       
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Style is new, it will return
     * an empty collection; or if this Style 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.STYLE_ID, getStyleId() );               
                   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.STYLE_ID, getStyleId() );               
               if ( !lastSkinStyleElementValuesCriteria.equals(criteria)  )
            {
                collSkinStyleElementValues = SkinStyleElementValuePeer.doSelectJoinStyleElement(criteria);
            }
        }
        lastSkinStyleElementValuesCriteria = criteria; 

        return collSkinStyleElementValues;
    }
     



     
    
    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(
                StylePeer.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 (collSkinStyleElementValues != null )
          {
              for (int i=0; i<collSkinStyleElementValues.size(); i++)
              {
                  ((SkinStyleElementValue)collSkinStyleElementValues.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.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
@@


