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.08.17.38.55;	author leonardr;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2001.02.08.18.18.59;	author leonardr;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2001.02.09.22.45.50;	author dlr;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2001.02.09.22.48.16;	author dlr;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2001.02.09.23.43.46;	author elicia;	state dead;
branches;
next	;


desc
@@


1.1
log
@file ProjectNews.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 24
package org.tigris.helm.om;

import java.util.*;

import org.apache.turbine.om.BaseObject;
import org.apache.turbine.om.peer.BasePeer;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.StringUtils;
import org.apache.turbine.util.ParameterParser;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.db.pool.DBConnection;

import org.tigris.helm.om.peer.*;

/** 
    The skeleton for this class was autogenerated by Torque on: Fri Jan 26 17:54:39 PST 2001. 
    You should add additional methods to this class to meet the
    application requirements.  This class will only be generated as
    long as the firstTime file does not exist in the build directory.
*/
public class ProjectNews extends BaseProjectNews
{
}
@


1.1.2.2
log
@Ported in some accessor methods.
@
text
@a23 67

    //
    // Accessor methods
    //



    /**
     * Determines whether a news item should be posted now
     * or at a later date 
     */
    public boolean isPosted()
    {
        boolean isPosted = true;
        if  (getPublishOn().compareTo(new Date()) > 0)
        {
            isPosted = false;
        }
        
        return isPosted;
    }

    /**
     * Determines whether a news item should be posted now
     * Or if it has already passed the removeOn() date
     */
    public boolean isRemoved()
    {
        boolean isRemoved = false;
        if (getRemoveOn() != null)
        {
            if (getRemoveOn().compareTo(new Date()) < 0)
                isRemoved = true;
        }
        return isRemoved;
    }

    /**
     * Determines whether a news item has been approved
     */
    public boolean isApproved()
        throws Exception
    {
        return getApprovedBy() != UserPeer.getNobodyUser().getUserId();
    }


    //
    // Permission methods
    //

    /**
     * Returns the appropriate permission needed 
     */
    public String requiredViewPermission()
        throws Exception
    {
        String permission = "Project News - Edit";
        if (isPosted() && !isRemoved() && isApproved())
        {
            permission = "Project News - View";
        } else if (!isApproved()) {
            permission = "Project News - Approve";
        }
        return permission;
    }

@


1.1.2.3
log
@Got rid of whitespace.
@
text
@d70 1
@


1.1.2.4
log
@Added stub moved here from Project.
@
text
@d59 1
a59 1
p    }
a67 12
    }

    /**
     * TODO: List other parameters.
     */
    public static ProjectNews add(Project project, Object otherParamsHere)
    {
        ProjectNews news = new ProjectNews();
        // TODO: Set attributes.
        //news.setXXX(yyy);
        news.setPrimaryKey(ProjectNewsPeer.doInsert(news));
        return news;
@


1.1.2.5
log
@Correcte compile errors.
@
text
@d59 1
a59 1
    }
a73 1
        throws Exception
d78 1
a78 1
        ProjectNewsPeer.doInsert(news);
@


1.1.2.6
log
@renamed ProjectNews to NewsItem
@
text
@@


