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.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 BaseDomain.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 184
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 Domain 
 */
abstract class BaseDomain extends BaseObject
{
    /** the value for the domain_id field */
    private int domain_id;
    /** the value for the name field */
    private String name;


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

       }


    /** 
     * Set the Id using pk values.
     *
     * @@param int domain_id
     */
    public void setPrimaryKey(
                      int domain_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(), ":");
                           setDomainId( Integer.parseInt(st.nextToken()) );
                                    }


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

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

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

}
@


1.1.2.2
log
@Changes to generated classes.
@
text
@d20 1
a20 1
public abstract class BaseDomain 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
a76 31
    /**
     * Generate a Vector with field names.
     */
    static private Vector fieldNames_ = null;
    static public Vector getFieldNames()
    {
      if (fieldNames_ == null)
      {
        fieldNames_ = new Vector();
            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("DomainId"))
	{
	  	    return new Integer(getDomainId());
	  	}
            if (name.equals("Name"))
	{
	  	    return getName();
	  	}
            return null; 
    }
d179 1
a179 1
                       
d183 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
d38 1
a38 1
                            
d42 1
a42 1
     public void setDomainId(int v ) throws Exception
d44 1
a44 38
  
       
        
                
          // update associated Project
          if (collProjects != null )
          {
              for (int i=0; i<collProjects.size(); i++)
              {
                  ((Project)collProjects.get(i))
                      .setDomainId(v);
              }
          }
            
        
                
          // update associated User
          if (collUsers != null )
          {
              for (int i=0; i<collUsers.size(); i++)
              {
                  ((User)collUsers.get(i))
                      .setDomainId(v);
              }
          }
            
        
                
          // update associated VCView
          if (collVCViews != null )
          {
              for (int i=0; i<collVCViews.size(); i++)
              {
                  ((VCView)collVCViews.get(i))
                      .setDomainId(v);
              }
          }
       
d61 1
a61 1
        
d67 1
a67 2
  
  
a77 45
                
      
    /**
     * 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.setDomain((Domain)this);
    }

d79 1
a79 1
     * The criteria used to select the current contents of collProjects
d81 2
a82 482
    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 Domain is new, it will return
     * an empty collection; or if this Domain 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.DOMAIN_ID, getDomainId() );               
                   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.DOMAIN_ID, getDomainId() );               
               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 Domain is new, it will return
     * an empty collection; or if this Domain 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.DOMAIN_ID, getDomainId() );               
                   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.DOMAIN_ID, getDomainId() );               
               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 Domain is new, it will return
     * an empty collection; or if this Domain 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.DOMAIN_ID, getDomainId() );               
                   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.DOMAIN_ID, getDomainId() );               
               if ( !lastProjectsCriteria.equals(criteria)  )
            {
                collProjects = ProjectPeer.doSelectJoinUserRelatedByApprovedBy(criteria);
            }
        }
        lastProjectsCriteria = criteria; 

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

        return collProjects;
    }
     



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

    public void initUsers()
    {
        if (collUsers == null)
            collUsers = new Vector();
    }

    /**
     * Method called to associate a User object to this object
     * through the User foreign key attribute
     *
     * @@param User l
     */
    public void addUsers(User l) throws Exception
    {
        /*
        if (collUsers == null)
        {
            if (tempcollUsers == null)
            {
                tempcollUsers = new Vector();
            }
            tempcollUsers.add(l);
        }
        else
        {
            collUsers.add(l);
        }
        */
        getUsers().add(l);
        l.setDomain((Domain)this);
    }

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

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

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Domain is new, it will return
     * an empty collection; or if this Domain has previously
     * been saved, it will retrieve related Users from storage.
     */
    public Vector getUsers(Criteria criteria) throws Exception
    {
        if (collUsers == null)
        {
            if ( isNew() ) 
            {
               collUsers = new Vector();       
            } 
            else
            {
                   criteria.add(UserPeer.DOMAIN_ID, getDomainId() );               
                   collUsers = UserPeer.doSelect(criteria);
            }
/*
            if (tempcollUsers != null)
            {
                for (int i=0; i<tempcollUsers.size(); i++)
                {
                    collUsers.add(tempcollUsers.get(i));
                }
                tempcollUsers = 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(UserPeer.DOMAIN_ID, getDomainId() );               
               if ( !lastUsersCriteria.equals(criteria)  )
            {
                collUsers = UserPeer.doSelect(criteria);  
            }
        }
        lastUsersCriteria = criteria; 

        return collUsers;
    }
   

        
      
         
          
                    
                
        
        
      



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

    public void initVCViews()
    {
        if (collVCViews == null)
            collVCViews = new Vector();
    }

    /**
     * Method called to associate a VCView object to this object
     * through the VCView foreign key attribute
     *
     * @@param VCView l
     */
    public void addVCViews(VCView l) throws Exception
    {
        /*
        if (collVCViews == null)
        {
            if (tempcollVCViews == null)
            {
                tempcollVCViews = new Vector();
            }
            tempcollVCViews.add(l);
        }
        else
        {
            collVCViews.add(l);
        }
        */
        getVCViews().add(l);
        l.setDomain((Domain)this);
    }

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

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

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this Domain is new, it will return
     * an empty collection; or if this Domain has previously
     * been saved, it will retrieve related VCViews from storage.
     */
    public Vector getVCViews(Criteria criteria) throws Exception
    {
        if (collVCViews == null)
        {
            if ( isNew() ) 
            {
               collVCViews = new Vector();       
            } 
            else
            {
                   criteria.add(VCViewPeer.DOMAIN_ID, getDomainId() );               
                   collVCViews = VCViewPeer.doSelect(criteria);
            }
/*
            if (tempcollVCViews != null)
            {
                for (int i=0; i<tempcollVCViews.size(); i++)
                {
                    collVCViews.add(tempcollVCViews.get(i));
                }
                tempcollVCViews = 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(VCViewPeer.DOMAIN_ID, getDomainId() );               
               if ( !lastVCViewsCriteria.equals(criteria)  )
            {
                collVCViews = VCViewPeer.doSelect(criteria);  
            }
        }
        lastVCViewsCriteria = criteria; 

        return collVCViews;
    }
   

        
      
         
          
                    
                
        
        
      



     
    
    private static Vector fieldNames_ = null;

    /**
     * Generate a list of field names.
     */
    public static Vector getFieldNames()
d117 2
a118 2
         DBConnection dbCon = null;
        try
d120 9
a128 4
            dbCon = BasePeer.beginTransaction(
                DomainPeer.getMapBuilder()
                .getDatabaseMap().getName());
            save(dbCon);
d130 1
a130 7
        catch(Exception e)
        {
            BasePeer.rollBackTransaction(dbCon);
            throw e;
        }
        BasePeer.commitTransaction(dbCon);

a132 3
      // flag to prevent endless save loop, if this object is referenced
    // by another object which falls in this transaction.
    private boolean alreadyInSave = false;
a141 3
        if (!alreadyInSave)
      {
        alreadyInSave = true;
d155 2
a156 30
                                    
                
          if (collProjects != null )
          {
              for (int i=0; i<collProjects.size(); i++)
              {
                  ((Project)collProjects.get(i)).save(dbCon);
              }
          }
                                        
                
          if (collUsers != null )
          {
              for (int i=0; i<collUsers.size(); i++)
              {
                  ((User)collUsers.get(i)).save(dbCon);
              }
          }
                                        
                
          if (collVCViews != null )
          {
              for (int i=0; i<collVCViews.size(); i++)
              {
                  ((VCView)collVCViews.get(i)).save(dbCon);
              }
          }
                  alreadyInSave = false;
      }
      }
a157 1
                                        
d165 1
a165 1
                                         ) throws Exception
a202 2
      * It then fills all the association collections and sets the
     * related objects to isNew=true.
d210 1
a210 22
                                  
                
         List v = copyObj.getProjects();
         for (int i=0; i<v.size(); i++)
         {
             ((BaseObject)v.get(i)).setNew(true);
         }
                                         
                
         v = copyObj.getUsers();
         for (int i=0; i<v.size(); i++)
         {
             ((BaseObject)v.get(i)).setNew(true);
         }
                                         
                
         v = copyObj.getVCViews();
         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
@@


