head	1.1;
access;
symbols
	HELM_PEER_PORT_BRANCH:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2001.02.09.23.30.15;	author dlr;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2001.02.09.23.30.15;	author dlr;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.13.00.55.50;	author dlr;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2001.02.13.03.03.01;	author dlr;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2001.02.16.03.05.24;	author dlr;	state dead;
branches;
next	;


desc
@@


1.1
log
@file BaseNewsItem.java was initially added on branch HELM_PEER_PORT_BRANCH.
@
text
@@


1.1.2.1
log
@Newly generated for elicia.
@
text
@a0 613
package org.tigris.helm.om;

// JDK classes
import java.util.*;
import java.math.*;

// 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 Feb 09 15:29:27 PST 2001]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to NewsItem 
 */
public abstract class BaseNewsItem 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 ) throws Exception
     {
                  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.");
        }
  
  

           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 ) throws Exception
     {
                  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.");
        }
  
  

           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 ) throws Exception
     {
                  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.");
        }
  
  

           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);
          }
     }

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

    
        
    
    private static Vector fieldNames_ = null;

    /**
     * Generate a list of field names.
     */
    public static 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; 
    }
     	

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     */
    public void save() throws Exception
    {
         DBConnection dbCon = null;
        try
        {
            dbCon = BasePeer.beginTransaction(
                NewsItemPeer.getMapBuilder()
                .getDatabaseMap().getName());
            save(dbCon);
        }
        catch(Exception e)
        {
            BasePeer.rollBackTransaction(dbCon);
            throw e;
        }
        BasePeer.commitTransaction(dbCon);

     }

      // flag to prevent endless save loop, if this object is referenced
    // by another object which falls in this transaction.
    private boolean alreadyInSave = false;
      /**
     * 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 (!alreadyInSave)
      {
        alreadyInSave = true;
          if (isModified())
        {
            if (isNew())
            {
                NewsItemPeer.doInsert((NewsItem)this, dbCon);
            }
            else
            {
                NewsItemPeer.doUpdate((NewsItem)this, dbCon);
                setNew(false);
            }
        }

              alreadyInSave = 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 "NewsItem[" + getPrimaryKey() + "]";
    }

    /**
     * Makes a copy of this object.  
     * It creates a new object filling in the simple attributes.
      * It then fills all the association collections and sets the
     * related objects to isNew=true.
      */
    public NewsItem copy() throws Exception
    {
        NewsItem copyObj = new NewsItem();
         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
@New Torque-generated classes.
@
text
@d19 1
a19 1
 * [Mon Feb 12 16:46:43 PST 2001]
d40 4
a43 4
    /** the value for the publish_date field */
    private Date publish_date;
    /** the value for the remove_date field */
    private Date remove_date;
d232 1
a232 1
     * Get the PublishDate
d235 1
a235 1
     public Date getPublishDate()
d237 1
a237 1
          return publish_date;
d242 1
a242 1
     * Set the value of PublishDate
d244 1
a244 1
     public void setPublishDate(Date v ) 
d249 1
a249 1
           if ( !ObjectUtils.equals(this.publish_date, v) )
d251 1
a251 1
              this.publish_date = v;
d256 1
a256 1
     * Get the RemoveDate
d259 1
a259 1
     public Date getRemoveDate()
d261 1
a261 1
          return remove_date;
d266 1
a266 1
     * Set the value of RemoveDate
d268 1
a268 1
     public void setRemoveDate(Date v ) 
d273 1
a273 1
           if ( !ObjectUtils.equals(this.remove_date, v) )
d275 1
a275 1
              this.remove_date = v;
d433 2
a434 2
            fieldNames_.add("PublishDate");
            fieldNames_.add("RemoveDate");
d474 1
a474 1
            if (name.equals("PublishDate"))
d476 1
a476 1
	  	    return getPublishDate();
d478 1
a478 1
            if (name.equals("RemoveDate"))
d480 1
a480 1
	  	    return getRemoveDate();
d604 2
a605 2
         copyObj.setPublishDate(publish_date);
         copyObj.setRemoveDate(remove_date);
@


1.1.2.3
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.4
log
@Deprecated by Torque modifications.
@
text
@@


