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 BaseProjectSection.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 314
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 ProjectSection 
 */
abstract class BaseProjectSection extends BaseObject
{
    /** the value for the section_id field */
    private int section_id;
    /** the value for the parent_id field */
    private int parent_id;
    /** the value for the project_id field */
    private int project_id;
    /** the value for the name field */
    private String name;
    /** the value for the description field */
    private String description;
    /** the value for the suggested_by field */
    private int suggested_by;
    /** the value for the approved_by field */
    private int approved_by;


    /**
     * Get the SectionId
     * @@return int
     */
     public int getSectionId()
     {
          return section_id;
     }


    /**
     * Set the value of SectionId
     */
     public void setSectionId(int v ) 
     {


           if (this.section_id != v)
           {
              this.section_id = v;
              setModified(true);
          }
     }
    /**
     * Get the ParentId
     * @@return int
     */
     public int getParentId()
     {
          return parent_id;
     }


    /**
     * Set the value of ParentId
     */
     public void setParentId(int v ) 
     {


           if (this.parent_id != v)
           {
              this.parent_id = v;
              setModified(true);
          }
     }
    /**
     * Get the ProjectId
     * @@return int
     */
     public int getProjectId()
     {
          return project_id;
     }


    /**
     * Set the value of ProjectId
     */
     public void setProjectId(int v ) 
     {


           if (this.project_id != v)
           {
              this.project_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);
          }
     }
    /**
     * Get the SuggestedBy
     * @@return int
     */
     public int getSuggestedBy()
     {
          return suggested_by;
     }


    /**
     * Set the value of SuggestedBy
     */
     public void setSuggestedBy(int v ) 
     {


           if (this.suggested_by != v)
           {
              this.suggested_by = v;
              setModified(true);
          }
     }
    /**
     * Get the ApprovedBy
     * @@return int
     */
     public int getApprovedBy()
     {
          return approved_by;
     }


    /**
     * Set the value of ApprovedBy
     */
     public void setApprovedBy(int v ) 
     {


           if (this.approved_by != v)
           {
              this.approved_by = 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())
            {
                ProjectSectionPeer.doInsert((ProjectSection)this);
                setNew(false);
            }
            else
            {
                ProjectSectionPeer.doUpdate((ProjectSection)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())
            {
                ProjectSectionPeer.doInsert((ProjectSection)this, dbCon);
            }
            else
            {
                ProjectSectionPeer.doUpdate((ProjectSection)this, dbCon);
                setNew(false);
            }
        }

       }


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

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


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

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

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      */
    public ProjectSection copy() throws Exception
    {
        ProjectSection copyObj = new ProjectSection();
         copyObj.setSectionId(section_id);
         copyObj.setParentId(parent_id);
         copyObj.setProjectId(project_id);
         copyObj.setName(name);
         copyObj.setDescription(description);
         copyObj.setSuggestedBy(suggested_by);
         copyObj.setApprovedBy(approved_by);
 
  
                        
        copyObj.setSectionId(NEW_ID);
                                                     return copyObj;
    }             

}
@


1.1.2.2
log
@Changes to generated classes.
@
text
@d20 1
a20 1
public abstract class BaseProjectSection 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
a201 56
    /**
     * Generate a Vector with field names.
     */
    static private Vector fieldNames_ = null;
    static public Vector getFieldNames()
    {
      if (fieldNames_ == null)
      {
        fieldNames_ = new Vector();
            fieldNames_.add("SectionId");
            fieldNames_.add("ParentId");
            fieldNames_.add("ProjectId");
            fieldNames_.add("Name");
            fieldNames_.add("Description");
            fieldNames_.add("SuggestedBy");
            fieldNames_.add("ApprovedBy");
          }
      return fieldNames_;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.
     */
    public Object getByName(String name)
    {
            if (name.equals("SectionId"))
	{
	  	    return new Integer(getSectionId());
	  	}
            if (name.equals("ParentId"))
	{
	  	    return new Integer(getParentId());
	  	}
            if (name.equals("ProjectId"))
	{
	  	    return new Integer(getProjectId());
	  	}
            if (name.equals("Name"))
	{
	  	    return getName();
	  	}
            if (name.equals("Description"))
	{
	  	    return getDescription();
	  	}
            if (name.equals("SuggestedBy"))
	{
	  	    return new Integer(getSuggestedBy());
	  	}
            if (name.equals("ApprovedBy"))
	{
	  	    return new Integer(getApprovedBy());
	  	}
            return null; 
    }
d309 1
a309 1
                       
d313 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
d48 1
a48 1
                            
d52 1
a52 1
     public void setSectionId(int v ) throws Exception
d54 1
a54 14
  
       
        
                
          // update associated ProjectDocumentSection
          if (collProjectDocumentSections != null )
          {
              for (int i=0; i<collProjectDocumentSections.size(); i++)
              {
                  ((ProjectDocumentSection)collProjectDocumentSections.get(i))
                      .setSectionId(v);
              }
          }
              
d71 1
a71 1
            
d75 1
a75 1
     public void setParentId(int v ) throws Exception
d77 1
a77 7
                  if ( aProjectSectionRelatedByParentId != null && !aProjectSectionRelatedByParentId.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
d94 1
a94 1
            
d98 1
a98 1
     public void setProjectId(int v ) throws Exception
d100 1
a100 7
                  if ( aProject != null && !aProject.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
d117 1
a117 1
        
d123 1
a123 2
  
  
d140 1
a140 1
        
d146 1
a146 2
  
  
d163 1
a163 1
            
d167 1
a167 1
     public void setSuggestedBy(int v ) throws Exception
d169 1
a169 7
                  if ( aUserRelatedBySuggestedBy != null && !aUserRelatedBySuggestedBy.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
d186 1
a186 1
            
d190 1
a190 1
     public void setApprovedBy(int v ) throws Exception
d192 1
a192 7
                  if ( aUserRelatedByApprovedBy != null && !aUserRelatedByApprovedBy.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
a201 256
 
   
                 
      
   
    /**
     * Declares an association between this object and a ProjectSection object
     *
     * @@param ProjectSection v
     */
    private ProjectSection aProjectSectionRelatedByParentId;
    public void setProjectSectionRelatedByParentId(ProjectSection v) throws Exception
    {
        aProjectSectionRelatedByParentId = null;
           setParentId(v.getSectionId());
           aProjectSectionRelatedByParentId = v;
    }

                     
    public ProjectSection getProjectSectionRelatedByParentId() throws Exception
    {
        if ( aProjectSectionRelatedByParentId==null && (this.parent_id>0) )
        {
            aProjectSectionRelatedByParentId = ProjectSectionPeer.retrieveByPK(this.parent_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.  
            // ProjectSection obj = ProjectSectionPeer.retrieveByPK(this.parent_id);
            // obj.addProjectSectionsRelatedByParentId(this);
        }
        return aProjectSectionRelatedByParentId;
    }

 
   
             
   
   
    /**
     * Declares an association between this object and a Project object
     *
     * @@param Project v
     */
    private Project aProject;
    public void setProject(Project v) throws Exception
    {
        aProject = null;
           setProjectId(v.getProjectId());
           aProject = v;
    }

                     
    public Project getProject() throws Exception
    {
        if ( aProject==null && (this.project_id>0) )
        {
            aProject = ProjectPeer.retrieveByPK(this.project_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.  
            // Project obj = ProjectPeer.retrieveByPK(this.project_id);
            // obj.addProjectSections(this);
        }
        return aProject;
    }

 
   
                 
      
   
    /**
     * Declares an association between this object and a User object
     *
     * @@param User v
     */
    private User aUserRelatedBySuggestedBy;
    public void setUserRelatedBySuggestedBy(User v) throws Exception
    {
        aUserRelatedBySuggestedBy = null;
           setSuggestedBy(v.getUserId());
           aUserRelatedBySuggestedBy = v;
    }

                     
    public User getUserRelatedBySuggestedBy() throws Exception
    {
        if ( aUserRelatedBySuggestedBy==null && (this.suggested_by>0) )
        {
            aUserRelatedBySuggestedBy = UserPeer.retrieveByPK(this.suggested_by);
            // 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.  
            // User obj = UserPeer.retrieveByPK(this.suggested_by);
            // obj.addProjectSectionsRelatedBySuggestedBy(this);
        }
        return aUserRelatedBySuggestedBy;
    }

 
   
                 
      
   
    /**
     * Declares an association between this object and a User object
     *
     * @@param User v
     */
    private User aUserRelatedByApprovedBy;
    public void setUserRelatedByApprovedBy(User v) throws Exception
    {
        aUserRelatedByApprovedBy = null;
           setApprovedBy(v.getUserId());
           aUserRelatedByApprovedBy = v;
    }

                     
    public User getUserRelatedByApprovedBy() throws Exception
    {
        if ( aUserRelatedByApprovedBy==null && (this.approved_by>0) )
        {
            aUserRelatedByApprovedBy = UserPeer.retrieveByPK(this.approved_by);
            // 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.  
            // User obj = UserPeer.retrieveByPK(this.approved_by);
            // obj.addProjectSectionsRelatedByApprovedBy(this);
        }
        return aUserRelatedByApprovedBy;
    }

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

    public void initProjectDocumentSections()
    {
        if (collProjectDocumentSections == null)
            collProjectDocumentSections = new Vector();
    }

    /**
     * Method called to associate a ProjectDocumentSection object to this object
     * through the ProjectDocumentSection foreign key attribute
     *
     * @@param ProjectDocumentSection l
     */
    public void addProjectDocumentSections(ProjectDocumentSection l) throws Exception
    {
        /*
        if (collProjectDocumentSections == null)
        {
            if (tempcollProjectDocumentSections == null)
            {
                tempcollProjectDocumentSections = new Vector();
            }
            tempcollProjectDocumentSections.add(l);
        }
        else
        {
            collProjectDocumentSections.add(l);
        }
        */
        getProjectDocumentSections().add(l);
        l.setProjectSection((ProjectSection)this);
    }

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

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

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this ProjectSection is new, it will return
     * an empty collection; or if this ProjectSection has previously
     * been saved, it will retrieve related ProjectDocumentSections from storage.
     */
    public Vector getProjectDocumentSections(Criteria criteria) throws Exception
    {
        if (collProjectDocumentSections == null)
        {
            if ( isNew() ) 
            {
               collProjectDocumentSections = new Vector();       
            } 
            else
            {
                   criteria.add(ProjectDocumentSectionPeer.SECTION_ID, getSectionId() );               
                   collProjectDocumentSections = ProjectDocumentSectionPeer.doSelect(criteria);
            }
/*
            if (tempcollProjectDocumentSections != null)
            {
                for (int i=0; i<tempcollProjectDocumentSections.size(); i++)
                {
                    collProjectDocumentSections.add(tempcollProjectDocumentSections.get(i));
                }
                tempcollProjectDocumentSections = 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(ProjectDocumentSectionPeer.SECTION_ID, getSectionId() );               
               if ( !lastProjectDocumentSectionsCriteria.equals(criteria)  )
            {
                collProjectDocumentSections = ProjectDocumentSectionPeer.doSelect(criteria);  
            }
        }
        lastProjectDocumentSectionsCriteria = criteria; 

        return collProjectDocumentSections;
    }
a202 70

        
      
      
          
                    
                
        
        
   
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection. 
     * Otherwise if this ProjectSection is new, it will return
     * an empty collection; or if this ProjectSection has previously
     * been saved, it will retrieve related ProjectDocumentSections from storage.
     */
    public Vector getProjectDocumentSectionsJoinProjectDocument(Criteria criteria) 
        throws Exception
    {
        if (collProjectDocumentSections == null)
        {
            if ( isNew() ) 
            {
               collProjectDocumentSections = new Vector();       
            } 
            else
            {
                   criteria.add(ProjectDocumentSectionPeer.SECTION_ID, getSectionId() );               
                   collProjectDocumentSections = ProjectDocumentSectionPeer.doSelectJoinProjectDocument(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(ProjectDocumentSectionPeer.SECTION_ID, getSectionId() );               
               if ( !lastProjectDocumentSectionsCriteria.equals(criteria)  )
            {
                collProjectDocumentSections = ProjectDocumentSectionPeer.doSelectJoinProjectDocument(criteria);
            }
        }
        lastProjectDocumentSectionsCriteria = criteria; 

        return collProjectDocumentSections;
    }
      
      
         
          
                    
                
        
        
      



   



     
    
    private static Vector fieldNames_ = null;

d204 1
a204 1
     * Generate a list of field names.
d206 2
a207 1
    public static Vector getFieldNames()
d267 2
a268 2
         DBConnection dbCon = null;
        try
d270 9
a278 4
            dbCon = BasePeer.beginTransaction(
                ProjectSectionPeer.getMapBuilder()
                .getDatabaseMap().getName());
            save(dbCon);
d280 1
a280 7
        catch(Exception e)
        {
            BasePeer.rollBackTransaction(dbCon);
            throw e;
        }
        BasePeer.commitTransaction(dbCon);

a282 3
      // flag to prevent endless save loop, if this object is referenced
    // by another object which falls in this transaction.
    private boolean alreadyInSave = false;
a291 3
        if (!alreadyInSave)
      {
        alreadyInSave = true;
d305 2
a306 12
                                    
                
          if (collProjectDocumentSections != null )
          {
              for (int i=0; i<collProjectDocumentSections.size(); i++)
              {
                  ((ProjectDocumentSection)collProjectDocumentSections.get(i)).save(dbCon);
              }
          }
                         alreadyInSave = false;
      }
      }
a307 1
                                                            
d315 1
a315 1
                                                                                                     ) throws Exception
a352 2
      * It then fills all the association collections and sets the
     * related objects to isNew=true.
d365 1
a365 8
                                  
                
         List v = copyObj.getProjectDocumentSections();
         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]
d36 2
a37 2
    /** the value for the proposed_by field */
    private int proposed_by;
d185 1
a185 1
     * Get the ProposedBy
d188 1
a188 1
     public int getProposedBy()
d190 1
a190 1
          return proposed_by;
d195 1
a195 1
     * Set the value of ProposedBy
d197 1
a197 1
     public void setProposedBy(int v ) throws Exception
d199 1
a199 1
                  if ( aUserRelatedByProposedBy != null && !aUserRelatedByProposedBy.isNew())
d207 1
a207 1
           if (this.proposed_by != v)
d209 1
a209 1
              this.proposed_by = v;
d326 2
a327 2
    private User aUserRelatedByProposedBy;
    public void setUserRelatedByProposedBy(User v) throws Exception
d329 3
a331 3
        aUserRelatedByProposedBy = null;
           setProposedBy(v.getUserId());
           aUserRelatedByProposedBy = v;
d335 1
a335 1
    public User getUserRelatedByProposedBy() throws Exception
d337 1
a337 1
        if ( aUserRelatedByProposedBy==null && (this.proposed_by>0) )
d339 1
a339 1
            aUserRelatedByProposedBy = UserPeer.retrieveByPK(this.proposed_by);
d346 2
a347 2
            // User obj = UserPeer.retrieveByPK(this.proposed_by);
            // obj.addProjectSectionsRelatedByProposedBy(this);
d349 1
a349 1
        return aUserRelatedByProposedBy;
d584 1
a584 1
            fieldNames_.add("ProposedBy");
d616 1
a616 1
            if (name.equals("ProposedBy"))
d618 1
a618 1
	  	    return new Integer(getProposedBy());
d749 1
a749 1
         copyObj.setProposedBy(proposed_by);
@


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


