head	1.7;
access;
symbols
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.1
	TIGRIS_0_9_2_3:1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.3
	TIGRIS_0_9_2_1:1.3
	TIGRIS_0_9_2:1.1.0.6
	TIGRIS_0_9_0:1.1.0.4
	TIGRIS_0_8_4:1.1.0.2;
locks; strict;
comment	@# @;


1.7
date	2001.03.08.19.05.37;	author leonardr;	state dead;
branches;
next	1.6;

1.6
date	2001.03.07.01.53.20;	author lucas;	state Exp;
branches;
next	1.5;

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

1.4
date	2001.02.21.01.08.21;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2001.01.26.18.29.02;	author edk;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2001.01.26.05.24.06;	author edk;	state dead;
branches;
next	1.1;

1.1
date	2000.11.30.00.27.57;	author leonardr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2001.02.21.00.32.35;	author dlr;	state Exp;
branches;
next	;

1.3.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	1.3.2.2;

1.3.2.2
date	2001.02.14.00.34.10;	author leonardr;	state Exp;
branches;
next	1.3.2.3;

1.3.2.3
date	2001.02.15.20.50.35;	author leonardr;	state Exp;
branches;
next	1.3.2.4;

1.3.2.4
date	2001.02.16.03.01.26;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Political correctness strikes Tigris.org! The components of project and user groups no longer wish to be called "members", as that causes them to be confused with users who have roles in projects. The new, approved term is "elements".
@
text
@/* ================================================================
 * Copyright (c) 2000-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 java.sql.*;
import java.util.*;

import org.webmacro.servlet.*;

import org.apache.turbine.util.Log;

import org.joist.security.RedirectException;

import org.tigris.helm.security.*;

import org.tigris.helm.om.*;
import org.tigris.helm.om.*;
/**
 * Add projects to a project group.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.6 2001/03/07 01:53:20 lucas Exp $
 */
public class ProjectGroupMemberAdd extends HelmServlet 
{
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.6 2001/03/07 01:53:20 lucas Exp $";
    
    private static boolean debug = true;

    private static String ADD_MEMBERS_ACTION="Add to Group";
    private static String ADD_MEMBER_FIELD_PREFIX="Add ";
    
    /**
     * Add some projects to the group.
     */
    protected String processRequest (Connection connection, WebContext context)
	throws HandlerException, RedirectException
    {
	String templateName = super.processRequest(connection, context);
        try 
        {
            String action = getAction(context);
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();

            if (action != null)
            {
                ProjectGroup group = getCurrentProjectGroup(context);
                AccessControlList acl = getLoginUser(context).getACL();
                Domain currentDomain = getCurrentDomain(context);

                if (action.equals(ADD_MEMBERS_ACTION))
                {
                    //Add members to the project group.
                    Enumeration paramNames =
                        context.getRequest().getParameterNames();
                    while (paramNames.hasMoreElements())
                    {
                        String paramName = (String)paramNames.nextElement();
                        
                        if (paramName.startsWith(ADD_MEMBER_FIELD_PREFIX))
                        {
                            StringTokenizer tok = new StringTokenizer
                                (paramName);
                            tok.nextToken(); //Ignore prefix.
                            Project project = ProjectPeer.getInstance
                                (tok.nextToken());
                            group.addProject(acl, project);
                        }
                    }    
                    redirectToURL
                        (context, currentDomain.getDomainHomeServletURL
                         ("ProjectGroupEdit?projectGroupID="+group.getID()));
                }
            }
        } 
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            String msg = "Couldn't add member to project group: " +
                e.getMessage();
            Log.error(msg, e);
            throw new HandlerException(msg);
        }

        return templateName;  
    }
}
@


1.6
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d66 1
a66 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.5 2001/02/27 01:42:36 dlr Exp $
d70 1
a70 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.5 2001/02/27 01:42:36 dlr Exp $";
@


1.5
log
@Improved error messaging and removed unnecessary special "Error" query
string parameter check.
@
text
@d61 1
a61 3
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;

d66 1
a66 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.4 2001/02/21 01:08:21 dlr Exp $
d70 1
a70 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.4 2001/02/21 01:08:21 dlr Exp $";
@


1.4
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d68 1
a68 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.3.2.4 2001/02/16 03:01:26 dlr Exp $
d72 1
a72 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.3.2.4 2001/02/16 03:01:26 dlr Exp $";
a88 9
            // If we are returning to this page as a result of an
            // error, we just want to refresh the display, without
            // doing any further action.
            String errorMessage = (String)context.get("Error");
            if (errorMessage != null)
            {
                action = null;
                appendToError(context, errorMessage);
            }
d129 4
a132 2
            Log.error("Exception thrown in ProjectGroupMemberAdd", e);
            throw new HandlerException(e.getMessage());
d137 1
a137 4

} /* end class ProjectGroupMemberAdd */


@


1.3
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
a46 1

d49 1
a49 1
import java.io.*;
a50 3
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
a51 1
import org.webmacro.util.*;
d54 1
a54 3
import org.joist.*;
import org.joist.util.*;
import org.joist.session.*;
d56 1
a56 1
import com.workingdogs.village.*;
d58 1
a58 2
import org.joist.security.RedirectException;
import org.joist.database.*;
d60 3
a62 5
import org.tigris.helm.*;
import org.tigris.helm.domain.ProjectGroup;
import org.tigris.helm.project.Project;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.security.AccessControlList;
d68 1
a68 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.1 2000/11/30 00:27:57 leonardr Exp $
d70 3
a72 2
public class ProjectGroupMemberAdd extends org.tigris.helm.security.HelmServlet {
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.1 2000/11/30 00:27:57 leonardr Exp $";
a73 1
    private static Log log = new Log("PGMemAdd", "Project Group Member Add Servlet");
d96 1
a96 1
                appendToMessage(context, errorMessage);
d98 2
d101 5
a105 7
            // Gather any project input, adding it to the context as well.
            ProjectGroup group = getCurrentProjectGroup(context);
            AccessControlList acl = getLoginUser(context).getACL();
            Domain currentDomain = getCurrentDomain(context);

            ArrayList missingFields = new ArrayList();
            ArrayList validationErrors = new ArrayList();
d107 1
a107 5
            if (action != null && action.equals(ADD_MEMBERS_ACTION))
            {
                Enumeration paramNames =
                    context.getRequest().getParameterNames();
                while (paramNames.hasMoreElements())
d109 4
a112 3
                    String paramName = (String) paramNames.nextElement ();
                    
                    if (paramName.startsWith(ADD_MEMBER_FIELD_PREFIX))
d114 16
a129 10
                        StringTokenizer tok = new StringTokenizer (paramName);
                        tok.nextToken ();
                        Project project = new Project(connection, dMgr, tok.nextToken());
                        log.info("Adding project " + project.getName());
                        group.addProject(acl, project);
                    }
                }    
                redirectToURL
                    (context, currentDomain.getDomainHomeServletURL
                     ("ProjectGroupEdit?projectGroupID="+group.getID()));       
d131 8
a138 11
        } catch (DataSetException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (SQLException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (JoistDatabaseException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (DoesNotExist e) {
            log.exception(e);
d145 1
a145 1
} /* end class ProjectGroupAdd */
@


1.3.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d78 1
a78 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.3 2001/01/26 18:29:02 edk Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.3 2001/01/26 18:29:02 edk Exp $";
@


1.3.2.2
log
@Adding support for project group manipulation servlets.
@
text
@d2 1
a2 1
 * Copyright (c) 2001 CollabNet.  All rights reserved.
d47 1
d50 2
d53 2
a54 1
import java.util.*;
d56 1
d59 5
a63 1
import org.apache.turbine.util.Log;
d66 1
d68 5
a72 4
import org.tigris.helm.security.*;

import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d80 1
a80 2
public class ProjectGroupMemberAdd extends HelmServlet 
{
d83 1
d106 1
a106 1
                appendToError(context, errorMessage);
a107 2
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
d109 9
a117 1
            if (action != null)
d119 3
a121 5
                ProjectGroup group = getCurrentProjectGroup(context);
                AccessControlList acl = getLoginUser(context).getACL();
                Domain currentDomain = getCurrentDomain(context);

                if (action.equals(ADD_MEMBERS_ACTION))
d123 3
a125 4
                    //Add members to the project group.
                    Enumeration paramNames =
                        context.getRequest().getParameterNames();
                    while (paramNames.hasMoreElements())
d127 10
a136 16
                        String paramName = (String)paramNames.nextElement();
                        
                        if (paramName.startsWith(ADD_MEMBER_FIELD_PREFIX))
                        {
                            StringTokenizer tok = new StringTokenizer
                                (paramName);
                            tok.nextToken(); //Ignore prefix.
                            Project project = ProjectPeer.getInstance
                                (tok.nextToken());
                            group.addProject(acl, project);
                        }
                    }    
                    redirectToURL
                        (context, currentDomain.getDomainHomeServletURL
                         ("ProjectGroupEdit?projectGroupID="+group.getID()));
                }
d138 11
a148 8
        } 
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            Log.error("Exception thrown in ProjectGroupMemberAdd", e);
d155 1
a155 1
} /* end class ProjectGroupMemberAdd */
@


1.3.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d67 1
a67 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.3.2.2 2001/02/14 00:34:10 leonardr Exp $
d71 1
a71 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.3.2.2 2001/02/14 00:34:10 leonardr Exp $";
@


1.3.2.4
log
@Added new imports necessitated by Torque.
@
text
@a61 1
import org.tigris.helm.om.base.*;
d67 1
a67 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.3.2.3 2001/02/15 20:50:35 leonardr Exp $
d71 1
a71 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.3.2.3 2001/02/15 20:50:35 leonardr Exp $";
@


1.2
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@@


1.1
log
@Implemented ProjectGroupMemberAdd.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.1 2000/11/28 21:08:23 leonardr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.1 2000/11/28 21:08:23 leonardr Exp $";
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d47 1
d50 2
d53 2
a54 1
import java.util.*;
d56 1
d59 5
a63 1
import org.apache.turbine.util.Log;
d66 1
d68 5
a72 5
import org.tigris.helm.security.*;

import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d78 1
a78 1
 * @@version $Id: ProjectGroupMemberAdd.java,v 1.3.2.4 2001/02/16 03:01:26 dlr Exp $
d80 2
a81 3
public class ProjectGroupMemberAdd extends HelmServlet 
{
    public static final  String versionID = "$Id: ProjectGroupMemberAdd.java,v 1.3.2.4 2001/02/16 03:01:26 dlr Exp $";
d83 1
d106 1
a106 1
                appendToError(context, errorMessage);
a107 2
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
d109 9
a117 1
            if (action != null)
d119 3
a121 5
                ProjectGroup group = getCurrentProjectGroup(context);
                AccessControlList acl = getLoginUser(context).getACL();
                Domain currentDomain = getCurrentDomain(context);

                if (action.equals(ADD_MEMBERS_ACTION))
d123 3
a125 4
                    //Add members to the project group.
                    Enumeration paramNames =
                        context.getRequest().getParameterNames();
                    while (paramNames.hasMoreElements())
d127 10
a136 16
                        String paramName = (String)paramNames.nextElement();
                        
                        if (paramName.startsWith(ADD_MEMBER_FIELD_PREFIX))
                        {
                            StringTokenizer tok = new StringTokenizer
                                (paramName);
                            tok.nextToken(); //Ignore prefix.
                            Project project = ProjectPeer.getInstance
                                (tok.nextToken());
                            group.addProject(acl, project);
                        }
                    }    
                    redirectToURL
                        (context, currentDomain.getDomainHomeServletURL
                         ("ProjectGroupEdit?projectGroupID="+group.getID()));
                }
d138 11
a148 8
        } 
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            Log.error("Exception thrown in ProjectGroupMemberAdd", e);
d155 1
a155 1
} /* end class ProjectGroupMemberAdd */
@


