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.30.46;	author dlr;	state dead;
branches;
next	;


desc
@@


1.1
log
@file BaseProjectNews.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 392
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 ProjectNews 
 */
abstract class BaseProjectNews extends BaseObject
{
    /** the value for the news_id field */
    private int news_id;
    /** the value for the project_id field */
    private int project_id;
    /** the value for the event_date field */
    private Date event_date;
    /** the value for the headline field */
    private String headline;
    /** the value for the body field */
    private String body;
    /** the value for the proposed_by field */
    private int proposed_by;
    /** the value for the approved_by field */
    private int approved_by;
    /** the value for the publish_on field */
    private Date publish_on;
    /** the value for the remove_on field */
    private Date remove_on;
    /** the value for the priority field */
    private int priority;


    /**
     * Get the NewsId
     * @@return int
     */
     public int getNewsId()
     {
          return news_id;
     }


    /**
     * Set the value of NewsId
     */
     public void setNewsId(int v ) 
     {


           if (this.news_id != v)
           {
              this.news_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 EventDate
     * @@return Date
     */
     public Date getEventDate()
     {
          return event_date;
     }


    /**
     * Set the value of EventDate
     */
     public void setEventDate(Date v ) 
     {


           if ( !ObjectUtils.equals(this.event_date, v) )
           {
              this.event_date = v;
              setModified(true);
          }
     }
    /**
     * Get the Headline
     * @@return String
     */
     public String getHeadline()
     {
          return headline;
     }


    /**
     * Set the value of Headline
     */
     public void setHeadline(String v ) 
     {


           if ( !ObjectUtils.equals(this.headline, v) )
           {
              this.headline = v;
              setModified(true);
          }
     }
    /**
     * Get the Body
     * @@return String
     */
     public String getBody()
     {
          return body;
     }


    /**
     * Set the value of Body
     */
     public void setBody(String v ) 
     {


           if ( !ObjectUtils.equals(this.body, v) )
           {
              this.body = v;
              setModified(true);
          }
     }
    /**
     * Get the ProposedBy
     * @@return int
     */
     public int getProposedBy()
     {
          return proposed_by;
     }


    /**
     * Set the value of ProposedBy
     */
     public void setProposedBy(int v ) 
     {


           if (this.proposed_by != v)
           {
              this.proposed_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);
          }
     }
    /**
     * Get the PublishOn
     * @@return Date
     */
     public Date getPublishOn()
     {
          return publish_on;
     }


    /**
     * Set the value of PublishOn
     */
     public void setPublishOn(Date v ) 
     {


           if ( !ObjectUtils.equals(this.publish_on, v) )
           {
              this.publish_on = v;
              setModified(true);
          }
     }
    /**
     * Get the RemoveOn
     * @@return Date
     */
     public Date getRemoveOn()
     {
          return remove_on;
     }


    /**
     * Set the value of RemoveOn
     */
     public void setRemoveOn(Date v ) 
     {


           if ( !ObjectUtils.equals(this.remove_on, v) )
           {
              this.remove_on = v;
              setModified(true);
          }
     }
    /**
     * Get the Priority
     * @@return int
     */
     public int getPriority()
     {
          return priority;
     }


    /**
     * Set the value of Priority
     */
     public void setPriority(int v ) 
     {


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

       }


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

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


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

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

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      */
    public ProjectNews copy() throws Exception
    {
        ProjectNews copyObj = new ProjectNews();
         copyObj.setNewsId(news_id);
         copyObj.setProjectId(project_id);
         copyObj.setEventDate(event_date);
         copyObj.setHeadline(headline);
         copyObj.setBody(body);
         copyObj.setProposedBy(proposed_by);
         copyObj.setApprovedBy(approved_by);
         copyObj.setPublishOn(publish_on);
         copyObj.setRemoveOn(remove_on);
         copyObj.setPriority(priority);
 
  
                        
        copyObj.setNewsId(NEW_ID);
                                                                          return copyObj;
    }             

}
@


1.1.2.2
log
@Changes to generated classes.
@
text
@d20 1
a20 1
public abstract class BaseProjectNews 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
a276 71
    /**
     * Generate a Vector with field names.
     */
    static private Vector fieldNames_ = null;
    static public Vector getFieldNames()
    {
      if (fieldNames_ == null)
      {
        fieldNames_ = new Vector();
            fieldNames_.add("NewsId");
            fieldNames_.add("ProjectId");
            fieldNames_.add("EventDate");
            fieldNames_.add("Headline");
            fieldNames_.add("Body");
            fieldNames_.add("ProposedBy");
            fieldNames_.add("ApprovedBy");
            fieldNames_.add("PublishOn");
            fieldNames_.add("RemoveOn");
            fieldNames_.add("Priority");
          }
      return fieldNames_;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.
     */
    public Object getByName(String name)
    {
            if (name.equals("NewsId"))
	{
	  	    return new Integer(getNewsId());
	  	}
            if (name.equals("ProjectId"))
	{
	  	    return new Integer(getProjectId());
	  	}
            if (name.equals("EventDate"))
	{
	  	    return getEventDate();
	  	}
            if (name.equals("Headline"))
	{
	  	    return getHeadline();
	  	}
            if (name.equals("Body"))
	{
	  	    return getBody();
	  	}
            if (name.equals("ProposedBy"))
	{
	  	    return new Integer(getProposedBy());
	  	}
            if (name.equals("ApprovedBy"))
	{
	  	    return new Integer(getApprovedBy());
	  	}
            if (name.equals("PublishOn"))
	{
	  	    return getPublishOn();
	  	}
            if (name.equals("RemoveOn"))
	{
	  	    return getRemoveOn();
	  	}
            if (name.equals("Priority"))
	{
	  	    return new Integer(getPriority());
	  	}
            return null; 
    }
d387 1
a387 1
                       
d391 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
d54 1
a54 1
        
d60 1
a60 2
  
  
d77 1
a77 1
            
d81 1
a81 1
     public void setProjectId(int v ) throws Exception
d83 1
a83 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.");
        }
  
  
d100 1
a100 1
        
d106 1
a106 2
  
  
d123 1
a123 1
        
d129 1
a129 2
  
  
d146 1
a146 1
        
d152 1
a152 2
  
  
d169 1
a169 1
            
d173 1
a173 1
     public void setProposedBy(int v ) throws Exception
d175 1
a175 7
                  if ( aUserRelatedByProposedBy != null && !aUserRelatedByProposedBy.isNew())
        {
            throw new Exception("Can't set a foreign key directly after an "
                + " association is already made based on saved data.");
        }
  
  
d192 1
a192 1
            
d196 1
a196 1
     public void setApprovedBy(int v ) throws Exception
d198 1
a198 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.");
        }
  
  
d215 1
a215 1
        
d221 1
a221 2
  
  
d238 1
a238 1
        
d244 1
a244 2
  
  
d261 1
a261 1
        
d267 1
a267 2
  
  
a276 110
 
   
             
   
   
    /**
     * 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.addProjectNewss(this);
        }
        return aProject;
    }

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

                     
    public User getUserRelatedByProposedBy() throws Exception
    {
        if ( aUserRelatedByProposedBy==null && (this.proposed_by>0) )
        {
            aUserRelatedByProposedBy = UserPeer.retrieveByPK(this.proposed_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.proposed_by);
            // obj.addProjectNewssRelatedByProposedBy(this);
        }
        return aUserRelatedByProposedBy;
    }

 
   
                 
      
   
    /**
     * 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.addProjectNewssRelatedByApprovedBy(this);
        }
        return aUserRelatedByApprovedBy;
    }

    
        
a277 2
    private static Vector fieldNames_ = null;

d279 1
a279 1
     * Generate a list of field names.
d281 2
a282 1
    public static Vector getFieldNames()
d357 2
a358 2
         DBConnection dbCon = null;
        try
d360 9
a368 4
            dbCon = BasePeer.beginTransaction(
                ProjectNewsPeer.getMapBuilder()
                .getDatabaseMap().getName());
            save(dbCon);
d370 1
a370 7
        catch(Exception e)
        {
            BasePeer.rollBackTransaction(dbCon);
            throw e;
        }
        BasePeer.commitTransaction(dbCon);

a372 3
      // flag to prevent endless save loop, if this object is referenced
    // by another object which falls in this transaction.
    private boolean alreadyInSave = false;
a381 3
        if (!alreadyInSave)
      {
        alreadyInSave = true;
d395 2
a396 3
              alreadyInSave = false;
      }
      }
a397 1
                                                    
a442 2
      * It then fills all the association collections and sets the
     * related objects to isNew=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
@No longer used.
@
text
@@


