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.50;	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.02;	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 BaseVCView.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 217
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 VCView 
 */
abstract class BaseVCView extends BaseObject
{
    /** the value for the view_id field */
    private int view_id;
    /** the value for the domain_id field */
    private int domain_id;
    /** the value for the name field */
    private String name;


    /**
     * Get the ViewId
     * @@return int
     */
     public int getViewId()
     {
          return view_id;
     }


    /**
     * Set the value of ViewId
     */
     public void setViewId(int v ) 
     {


           if (this.view_id != v)
           {
              this.view_id = v;
              setModified(true);
          }
     }
    /**
     * Get the DomainId
     * @@return int
     */
     public int getDomainId()
     {
          return domain_id;
     }


    /**
     * Set the value of DomainId
     */
     public void setDomainId(int v ) 
     {


           if (this.domain_id != v)
           {
              this.domain_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);
          }
     }

 
    
     	

    /**
     * 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())
            {
                VCViewPeer.doInsert((VCView)this);
                setNew(false);
            }
            else
            {
                VCViewPeer.doUpdate((VCView)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())
            {
                VCViewPeer.doInsert((VCView)this, dbCon);
            }
            else
            {
                VCViewPeer.doUpdate((VCView)this, dbCon);
                setNew(false);
            }
        }

       }


    /** 
     * Set the Id using pk values.
     *
     * @@param int view_id
     * @@param int domain_id
     */
    public void setPrimaryKey(
                      int view_id
                                      , int domain_id
                                         ) 
    {
                     setViewId(view_id);
                             setDomainId(domain_id);
                            }

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


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

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

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      */
    public VCView copy() throws Exception
    {
        VCView copyObj = new VCView();
         copyObj.setViewId(view_id);
         copyObj.setDomainId(domain_id);
         copyObj.setName(name);
 
  
                        
        copyObj.setViewId(NEW_ID);
                              
        copyObj.setDomainId(NEW_ID);
                  return copyObj;
    }             

}
@


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

    /**
     * Retrieves a field from the object by name passed in
     * as a String.
     */
    public Object getByName(String name)
    {
            if (name.equals("ViewId"))
	{
	  	    return new Integer(getViewId());
	  	}
            if (name.equals("DomainId"))
	{
	  	    return new Integer(getDomainId());
	  	}
            if (name.equals("Name"))
	{
	  	    return getName();
	  	}
            return null; 
    }
d210 1
a210 1
                       
d212 1
a212 1
                             
d216 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 setViewId(int v ) throws Exception
d46 1
a46 14
  
       
        
                
          // update associated VCMap
          if (collVCMaps != null )
          {
              for (int i=0; i<collVCMaps.size(); i++)
              {
                  ((VCMap)collVCMaps.get(i))
                      .setViewId(v);
              }
          }
       
d63 1
a63 1
            
d67 1
a67 1
     public void setDomainId(int v ) throws Exception
d69 1
a69 7
                  if ( aDomain != null && !aDomain.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
d86 1
a86 1
        
d92 1
a92 2
  
  
a101 163
 
   
             
   
   
    /**
     * Declares an association between this object and a Domain object
     *
     * @@param Domain v
     */
    private Domain aDomain;
    public void setDomain(Domain v) throws Exception
    {
        aDomain = null;
           setDomainId(v.getDomainId());
           aDomain = v;
    }

                     
    public Domain getDomain() throws Exception
    {
        if ( aDomain==null && (this.domain_id>0) )
        {
            aDomain = DomainPeer.retrieveByPK(this.domain_id);
            // 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.  
            // Domain obj = DomainPeer.retrieveByPK(this.domain_id);
            // obj.addVCViews(this);
        }
        return aDomain;
    }

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

    public void initVCMaps()
    {
        if (collVCMaps == null)
            collVCMaps = new Vector();
    }

    /**
     * Method called to associate a VCMap object to this object
     * through the VCMap foreign key attribute
     *
     * @@param VCMap l
     */
    public void addVCMaps(VCMap l) throws Exception
    {
        /*
        if (collVCMaps == null)
        {
            if (tempcollVCMaps == null)
            {
                tempcollVCMaps = new Vector();
            }
            tempcollVCMaps.add(l);
        }
        else
        {
            collVCMaps.add(l);
        }
        */
        getVCMaps().add(l);
        l.setVCView((VCView)this);
    }

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

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

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this VCView is new, it will return
     * an empty collection; or if this VCView has previously
     * been saved, it will retrieve related VCMaps from storage.
     */
    public Vector getVCMaps(Criteria criteria) throws Exception
    {
        if (collVCMaps == null)
        {
            if ( isNew() ) 
            {
               collVCMaps = new Vector();       
            } 
            else
            {
                   criteria.add(VCMapPeer.VIEW_ID, getViewId() );               
                   collVCMaps = VCMapPeer.doSelect(criteria);
            }
/*
            if (tempcollVCMaps != null)
            {
                for (int i=0; i<tempcollVCMaps.size(); i++)
                {
                    collVCMaps.add(tempcollVCMaps.get(i));
                }
                tempcollVCMaps = 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(VCMapPeer.VIEW_ID, getViewId() );               
               if ( !lastVCMapsCriteria.equals(criteria)  )
            {
                collVCMaps = VCMapPeer.doSelect(criteria);  
            }
        }
        lastVCMapsCriteria = criteria; 

        return collVCMaps;
    }
   

        
      
         
          
                    
                
        
        
      



     
a102 2
    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(
                VCViewPeer.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 (collVCMaps != null )
          {
              for (int i=0; i<collVCMaps.size(); i++)
              {
                  ((VCMap)collVCMaps.get(i)).save(dbCon);
              }
          }
                  alreadyInSave = false;
      }
      }
a187 1
                                            
d192 1
d196 2
a197 1
                                                     ) throws Exception
d200 2
a201 1
                                        }
d210 2
a211 1
                                                }
d222 2
a223 1
                                                     ;
a237 2
      * It then fills all the association collections and sets the
     * related objects to isNew=true.
d246 1
a246 8
                                  
                
         List v = copyObj.getVCMaps();
         for (int i=0; i<v.size(); i++)
         {
             ((BaseObject)v.get(i)).setNew(true);
         }
         
d249 3
a251 1
                         return copyObj;
@


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
@@


