head	1.6;
access;
symbols;
locks; strict;
comment	@# @;


1.6
date	2001.08.29.18.42.10;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2001.08.29.18.41.23;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2001.08.29.18.13.44;	author leonardr;	state Exp;
branches;
next	1.3;

1.3
date	2001.08.29.17.18.09;	author dlr;	state Exp;
branches;
next	1.2;

1.2
date	2001.08.29.00.00.00;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.08.27.19.31.20;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.6
log
@ACL is not necessary.
@
text
@/* ================================================================
 * Copyright (c) 2001 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by CollabNet (http://www.collab.net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.domain;

import org.apache.commons.util.exception.NestableException;
import org.apache.turbine.util.Log;
import org.apache.velocity.context.Context;

import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.security.RedirectException;
import org.tigris.helm.tool.ContextAPI;

/**
 * Allows the logged-in user to express interest in a project.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: UserProjectInterestAdd.java,v 1.5 2001/08/29 18:41:23 dlr Exp $
 */
public class UserProjectInterestAdd extends HelmServlet
{
    /**
     * Action which triggers interest addition.
     */
    private static String CREATE_ACTION = "Express Interest";

    /**
     * Display UI and allow for expression of interest in a project.
     */
    protected String processRequest(Context context)
        throws NestableException, RedirectException
    {
        String templateName = super.processRequest(context);
        try 
        {
            String interestID = ContextAPI.processRequiredField
                (context, "interestID", "Project to express interest in");

            if (CREATE_ACTION.equals(getAction(context)))
            {
                if (ContextAPI.isValidUserInput(context))
                {
                    User loginUser = getLoginUser(context);
                    Project project = ProjectPeer.getInstance(interestID);
                    UserProjectInterest.add(loginUser, project);
                    redirectToURL(context,
                                  getCurrentProject(context)
                                  .getProjectPageURL("StartPage"));
                }
            }
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e) 
        {
            Log.error("Error registering user interest in project", e);
            throw new NestableException(e);
        }

        return templateName;  
    }
}
@


1.5
log
@Redirect to the right project's start page.
@
text
@a54 1
import org.tigris.helm.security.AccessControlList;
d63 1
a63 1
 * @@version $Id: UserProjectInterestAdd.java,v 1.4 2001/08/29 18:13:44 leonardr Exp $
a89 1
                    AccessControlList acl = loginUser.getACL();
@


1.4
log
@Haha, finally *Daniel* breaks the build and *I* fix it!
@
text
@d64 1
a64 1
 * @@version $Id: UserProjectInterestAdd.java,v 1.3 2001/08/29 17:18:09 dlr Exp $
d83 1
a83 1
                (context, "interestID", "Project to note interest in");
d94 2
a95 1
                                  project.getProjectPageURL("StartPage"));
@


1.3
log
@Used explicit imports.
@
text
@d55 1
d64 1
a64 1
 * @@version $Id: UserProjectInterestAdd.java,v 1.2 2001/08/29 00:00:00 dlr Exp $
@


1.2
log
@Now fully functional.
@
text
@a52 2
import org.tigris.helm.security.RedirectException;

d55 2
a56 1
import org.tigris.helm.security.*;
d63 1
a63 1
 * @@version $Id: UserProjectInterestAdd.java,v 1.1 2001/08/27 19:31:20 dlr Exp $
@


1.1
log
@First crack at the servlet which allows users to express interest in a
project.
@
text
@a48 5
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

d61 1
a61 1
 * Add user interest in a project.
d64 1
a64 1
 * @@version $Id: UserProjectInterestAdd.java,v 1.6 2001/08/11 09:08:01 dlr Exp $
d71 1
a71 1
    private static String CREATE_ACTION = "Add Interest";
d74 1
a74 1
     *  Validate data and create a new license.
d82 2
a83 1
            String action = getAction(context);
d85 1
a85 1
            if (CREATE_ACTION.equals(action))
a86 8
                User loginUser = getLoginUser(context);
                Project project = getCurrentProject(context);
                if (project == null)
                {
                    ContextAPI.addError(context, "Project to note interest " +
                                        "in not specified");
                }

d89 2
d94 2
a95 3
                                  project.getProjectPageURL
                                  ("UserProjectInterestList"));
                } 
d97 1
a97 1
        } 
@

