head	1.23;
access;
symbols
	TIGRIS_1_1_0RC2:1.17
	TIGRIS_1_1_0RC1:1.17
	TIGRIS_1_1:1.17.0.4
	TIGRIS_1_0_8:1.17
	TIGRIS_1_0_8RC3:1.17
	TIGRIS_1_0_8RC2:1.17
	TIGRIS_1_0_8RC1:1.17
	TIGRIS_1_0_7:1.17
	TIGRIS_1_0_7RC3:1.17
	TIGRIS_1_0_7RC2:1.17
	TIGRIS_1_0_7RC1:1.17
	TIGRIS_1_0_6:1.17
	TIGRIS_1_0_6RC5:1.17
	TIGRIS_1_0_6RC4:1.17
	TIGRIS_1_0_6RC3:1.17
	TIGRIS_1_0_6RC2:1.17
	TIGRIS_1_0_6RC1:1.17
	TIGRIS_1_0_5:1.17
	TIGRIS_1_0_5RC6:1.17
	TIGRIS_1_0_5RC5:1.17
	TIGRIS_1_0_5RC4:1.17
	TIGRIS_1_0_5RC3:1.17
	TIGRIS_1_0_5RC2:1.17
	TIGRIS_1_0_5RC1:1.17
	TIGRIS_1_0_4:1.17
	TIGRIS_1_0_3:1.17
	TIGRIS_1_0_2:1.17
	TIGRIS_1_0_1:1.17
	TIGRIS_1_0:1.17.0.6
	TIGRIS_1_0_0:1.17
	TIGRIS_1_0_0_RC1:1.17.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.8
	TIGRIS_0_9_2_3:1.8
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.10
	TIGRIS_0_9_2_1:1.10
	TIGRIS_0_9_2:1.8.0.2
	TIGRIS_0_9_0:1.3.0.2
	TIGRIS_0_8_4:1.1.0.2;
locks; strict;
comment	@# @;


1.23
date	2001.08.11.09.08.01;	author dlr;	state Exp;
branches;
next	1.22;

1.22
date	2001.07.18.10.05.12;	author dlr;	state Exp;
branches;
next	1.21;

1.21
date	2001.07.17.20.54.05;	author leonardr;	state Exp;
branches;
next	1.20;

1.20
date	2001.07.17.17.55.45;	author leonardr;	state Exp;
branches;
next	1.19;

1.19
date	2001.06.29.00.57.48;	author leonardr;	state Exp;
branches;
next	1.18;

1.18
date	2001.05.23.01.50.09;	author dlr;	state Exp;
branches;
next	1.17;

1.17
date	2001.03.12.23.22.11;	author dlr;	state Exp;
branches;
next	1.16;

1.16
date	2001.03.12.23.18.23;	author dlr;	state Exp;
branches;
next	1.15;

1.15
date	2001.03.12.20.08.55;	author dlr;	state Exp;
branches;
next	1.14;

1.14
date	2001.03.08.19.05.37;	author leonardr;	state Exp;
branches;
next	1.13;

1.13
date	2001.03.07.01.53.20;	author lucas;	state Exp;
branches;
next	1.12;

1.12
date	2001.02.27.01.45.29;	author dlr;	state Exp;
branches;
next	1.11;

1.11
date	2001.02.21.01.08.21;	author dlr;	state Exp;
branches;
next	1.10;

1.10
date	2001.01.26.18.29.02;	author edk;	state Exp;
branches
	1.10.2.1;
next	1.9;

1.9
date	2001.01.26.05.24.05;	author edk;	state dead;
branches;
next	1.8;

1.8
date	2001.01.11.18.53.01;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2001.01.11.18.45.57;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2001.01.06.02.02.23;	author leonardr;	state Exp;
branches;
next	1.5;

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

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

1.3
date	2000.12.18.19.15.54;	author leonardr;	state Exp;
branches;
next	1.2;

1.2
date	2000.12.14.18.53.58;	author leonardr;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.29.20.58.59;	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.10.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	1.10.2.2;

1.10.2.2
date	2001.02.14.00.34.09;	author leonardr;	state Exp;
branches;
next	1.10.2.3;

1.10.2.3
date	2001.02.15.20.50.35;	author leonardr;	state Exp;
branches;
next	1.10.2.4;

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


desc
@@


1.23
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
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.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;

import org.apache.velocity.context.Context;

import org.tigris.helm.security.RedirectException;

import org.tigris.helm.DoesNotExist;
import org.tigris.helm.security.*;
import org.tigris.helm.om.*;
import org.tigris.helm.tool.DBFlag;
import org.tigris.helm.tool.ContextAPI;

/**
 * Create a new project group.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: ProjectGroupAdd.java,v 1.22 2001/07/18 10:05:12 dlr Exp $
 */
public class ProjectGroupAdd extends HelmServlet 
{
    private static final boolean DEBUG = true;

    /**
     * Action which creates a group.
     */
    private static String CREATE_ACTION="Create Group";

    private static String NAME_FIELD="name";
    private static String PARENT_FIELD="parent";
    private static String SHORT_DESCRIPTION_FIELD="shortDescription";
    private static String LONG_DESCRIPTION_FIELD="longDescription";
    private static String ELEMENTS_FIELD="elements";

    /**
     * Servlet to redirect to after a successful add.
     */
    private static String SUCCESS_REDIRECT_TARGET="ProjectGroupList";
    
    /**
     * Create a group with some initial elements, after doing data
     * validation.
     */
    protected String processRequest(Context context)
	throws NestableException, RedirectException
    {
	String templateName = super.processRequest(context);
        try 
        {
            String action = getAction(context);
            Domain domain = getCurrentDomain(context);

            // Gather any user input, adding it to the context as well.
            String name = ContextAPI.processRequiredField
                (context, NAME_FIELD, "Group name");
            String parent = ContextAPI.processField
                (context, PARENT_FIELD, domain.getID());
            String shortDescription = ContextAPI.processRequiredField
                (context, SHORT_DESCRIPTION_FIELD, "Summary");
            String longDescription = ContextAPI.processRequiredField
                (context, LONG_DESCRIPTION_FIELD, "Description");    
            String elements = ContextAPI.processField(context, ELEMENTS_FIELD);

            if (CREATE_ACTION.equals(action))
            {
                Project parentProject = ProjectPeer.getInstance(parent);

                //Check for null so that an empty name doesn't cause
                //both a missing fields error and a validation error.
                if (name != null && !ProjectGroup.isValidName(name))
                {
                    ContextAPI.addValidationError(context,
                                                  "Group name is invalid.");
                }
   
                ProjectGroup.assertNonexistance(domain, name);
                
                List initialProjects = ProjectPeer.parseDesignantList
                    (elements, domain, 
                     ContextAPI.getValidationErrors(context));
                
                if (ContextAPI.isValidUserInput(context))
                {
                    ProjectGroup g = ProjectGroup.add
                        (getACL(context), parentProject, name,
                         shortDescription, longDescription,
                         initialProjects);
                    redirectToURL
                        (context, domain.getDomainHomeServletURL
                         (SUCCESS_REDIRECT_TARGET));
                }
            }
        }
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            String msg = "Couldn't add project group: " + e.getMessage();
            Log.error(msg, e);
            throw new NestableException(e);
        }

        return templateName;  
    }
}
@


1.22
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d54 1
a54 1
import org.apache.turbine.util.TurbineException;
d70 1
a70 1
 * @@version $Id: ProjectGroupAdd.java,v 1.21 2001/07/17 20:54:05 leonardr Exp $
d97 1
a97 1
	throws TurbineException, RedirectException
d154 1
a154 1
            throw new TurbineException(e);
@


1.21
log
@Cleanup for port to new error handling system.
@
text
@d58 1
a58 1
import org.joist.security.RedirectException;
d70 1
a70 1
 * @@version $Id: ProjectGroupAdd.java,v 1.20 2001/07/17 17:55:45 leonardr Exp $
@


1.20
log
@Porting of domain package to new error handling API.
@
text
@d70 1
a70 1
 * @@version $Id: ProjectGroupAdd.java,v 1.19 2001/06/29 00:57:48 leonardr Exp $
d110 1
a110 1
            String shortDescription = processRequiredField
d112 1
a112 1
            String longDescription = processRequiredField
d114 1
a114 1
            String elements = processField(context, ELEMENTS_FIELD);
@


1.19
log
@Implemented basic project group and category nesting.
@
text
@d64 1
d70 1
a70 1
 * @@version $Id: ProjectGroupAdd.java,v 1.18 2001/05/23 01:50:09 dlr Exp $
a104 3
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();

d106 3
a108 3
            String name = processField
                (context, NAME_FIELD, "Group name", missingFields);
            String parent = processField
d110 4
a113 5
            String shortDescription = processField
                (context, SHORT_DESCRIPTION_FIELD, "Summary", missingFields);
            String longDescription = processField
                (context, LONG_DESCRIPTION_FIELD, "Description", 
                 missingFields);    
d124 2
a125 1
                    validationErrors.add("Group name is invalid.");
d131 2
a132 2
                    (elements, domain, validationErrors);

d134 1
a134 1
                if (isValidUserInput(missingFields, validationErrors))
a142 6
                }
                else
                {
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(context, missingFields, 
                                           validationErrors);
@


1.18
log
@Ported Helm from WebMacro to Velocity.
@
text
@a54 1
import org.apache.turbine.util.TurbineException;
d63 1
d69 1
a69 1
 * @@version $Id: ProjectGroupAdd.java,v 1.17 2001/03/12 23:22:11 dlr Exp $
d71 1
a71 1
public class ProjectGroupAdd extends org.tigris.helm.security.HelmServlet 
d75 15
a89 6
    private static String CREATE_GROUP_ACTION="Create Group";
    private static String GROUP_NAME_FIELD="name";
    private static String GROUP_SHORT_DESCRIPTION_FIELD="shortDescription";
    private static String GROUP_LONG_DESCRIPTION_FIELD="longDescription";
    private static String GROUP_ELEMENTS_FIELD="elements";
    private static String GROUP_IS_CATEGORY_FIELD="isCategory";
d92 2
a93 2
     *  Create a group with some initial elements, after doing data
     *  validation.
d102 2
d108 4
a111 3
            String groupName = processField
                (context, GROUP_NAME_FIELD, "Group name", 
                 missingFields);
d113 1
a113 2
                (context, GROUP_SHORT_DESCRIPTION_FIELD, "Summary", 
                 missingFields);    
d115 1
a115 1
                (context, GROUP_LONG_DESCRIPTION_FIELD, "Description", 
d117 1
a117 4
            String elements = processField
                (context, GROUP_ELEMENTS_FIELD);
            boolean isCategory = processCheckbox
                (context, GROUP_IS_CATEGORY_FIELD);
d119 1
a119 1
            if (action != null)
d121 5
a125 1
                if (action.equals(CREATE_GROUP_ACTION))
d127 2
a128 6
                    //Check for null so that an empty name doesn't cause
                    //both a missing fields error and a validation error.
                    if (groupName != null && !Project.isValidName(groupName))
                    {
                        validationErrors.add("Group name is invalid.");
                    }
d130 4
a133 2
                    Domain currentDomain = getCurrentDomain(context);   
                    ProjectGroup.assertNonexistance(currentDomain, groupName);
a134 20
                    // Parse and validate the list project names of the desired
                    // initial projects for this group.
                    List initialProjects = new ArrayList();
                    StringTokenizer tok = new StringTokenizer(elements);
                    while (tok.hasMoreTokens())
                    {
                        String elementDesignant = tok.nextToken();
                        try 
                        {
                            Project p = null;
                            p = ProjectPeer.getInstanceByName
                                (currentDomain, elementDesignant);
                            initialProjects.add(p);
                        } 
                        catch (DoesNotExist e)
                        {
                            validationErrors.add("No such project on system: "
                                                 + elementDesignant);
                        }
                    }
d136 15
a150 16
                    if (isValidUserInput(missingFields, validationErrors))
                    {
                        ProjectGroup g = ProjectGroup.add
                            (getACL(context), currentDomain, isCategory,
                             groupName, shortDescription, longDescription, 
                             initialProjects);
                        redirectToURL
                            (context, currentDomain.getDomainHomeServletURL
                             ("ProjectGroupList"));
                    }
                    else
                    {
                        // Report missing fields and validation errors.
                        reportInvalidUserInput(context, missingFields, 
                                               validationErrors);
                    }
@


1.17
log
@Corrected comment.
@
text
@d54 2
d57 1
a57 1
import org.webmacro.servlet.*;
d69 1
a69 1
 * @@version $Id: ProjectGroupAdd.java,v 1.16 2001/03/12 23:18:23 dlr Exp $
d86 2
a87 2
    protected String processRequest (Connection connection, WebContext context)
	throws HandlerException, RedirectException
d89 1
a89 1
	String templateName = super.processRequest(connection, context);
d173 1
a173 1
            throw new HandlerException(msg);
@


1.16
log
@Actually add each parsed and validated project to the initial list of projects
for this new project group (IZ #2933).
@
text
@d67 1
a67 1
 * @@version $Id: ProjectGroupAdd.java,v 1.15 2001/03/12 20:08:55 dlr Exp $
d123 2
a124 2
                    // Parse and validate list of desired initial projects for
                    // this group.
@


1.15
log
@Corrected imports and brace placement.
@
text
@d67 1
a67 1
 * @@version $Id: ProjectGroupAdd.java,v 1.14 2001/03/08 19:05:37 leonardr Exp $
d123 3
a125 3
                    // Turn the list of elements they want to add into
                    // Project objects.
                    List initialElements = new ArrayList();
d135 1
d139 2
a140 3
                            validationErrors.add
                                ("No such project on system: "
                                 + elementDesignant);
d149 1
a149 1
                             initialElements);
@


1.14
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
@d53 2
a56 2
import org.apache.turbine.util.Log;

d62 1
a62 1
import org.tigris.helm.om.*;
d67 1
a67 1
 * @@version $Id: ProjectGroupAdd.java,v 1.13 2001/03/07 01:53:20 lucas Exp $
d153 3
a155 1
                    } else {
@


1.13
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d67 1
a67 1
 * @@version $Id: ProjectGroupAdd.java,v 1.12 2001/02/27 01:45:29 dlr Exp $
d77 1
a77 1
    private static String GROUP_MEMBERS_FIELD="members";
d81 1
a81 1
     *  Create a group with some initial members, after doing data
d104 2
a105 2
            String members = processField
                (context, GROUP_MEMBERS_FIELD);
d123 1
a123 1
                    // Turn the list of members they want to add into
d125 2
a126 2
                    List initialMembers = new ArrayList();
                    StringTokenizer tok = new StringTokenizer(members);
d129 1
a129 1
                        String memberDesignant = tok.nextToken();
d134 1
a134 1
                                (currentDomain, memberDesignant);
d140 1
a140 1
                                 + memberDesignant);
d149 1
a149 1
                             initialMembers);
@


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

d67 1
a67 1
 * @@version $Id: ProjectGroupAdd.java,v 1.11 2001/02/21 01:08:21 dlr Exp $
@


1.11
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d69 1
a69 1
 * @@version $Id: ProjectGroupAdd.java,v 1.10.2.4 2001/02/16 03:01:26 dlr Exp $
a92 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);
            }
d169 3
a171 2
            Log.error("Exception thrown in ProjectGroupMemberAdd", e);
            throw new HandlerException(e.getMessage());
d173 1
d176 1
a176 4

} /* end class ProjectGroupAdd */


@


1.10
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.
d50 1
a50 1
import java.io.*;
a51 1
import java.sql.*;
a52 1
import org.webmacro.util.Log;
d55 1
a55 5
import org.joist.*;
import org.joist.util.*;
import org.joist.session.*;

import com.workingdogs.village.*;
a57 1
import org.joist.database.*;
d59 5
a63 4
import org.tigris.helm.*;
import org.tigris.helm.project.Project;
import org.tigris.helm.domain.ProjectGroup;
import org.tigris.helm.security.HelmServlet;
d69 1
a69 1
 * @@version $Id: ProjectGroupAdd.java,v 1.8 2001/01/11 18:53:01 dlr Exp $
d73 1
a73 2
    private static Log log = new Log("PrjGrpAdd", "ProjectGroupAdd");
    private static final boolean debug = true;
d100 1
a100 1
                appendToMessage(context, errorMessage);
d102 2
d106 3
a108 4
            ArrayList missingFields = new ArrayList();
            ArrayList validationErrors = new ArrayList();
            String groupName = processField(context, GROUP_NAME_FIELD, 
                                            "Group name", missingFields);
d115 6
a120 4
            String members = processField(context, GROUP_MEMBERS_FIELD);
            boolean isCategory = processCheckbox(context,
                                                 GROUP_IS_CATEGORY_FIELD);
            if (action != null && action.equals(CREATE_GROUP_ACTION))
d122 1
a122 1
                if (groupName != null && !Project.isValidName(groupName))
d124 6
a129 2
                    validationErrors.add("Group name is invalid.");
                }
d131 2
a132 13
                Domain currentDomain = getCurrentDomain(context);   
                ProjectGroup.assertNonexistance
                    (connection, dMgr, currentDomain.getID(), groupName);

                // Turn the list of members they want to add into
                // Project objects.
                ArrayList initialMembers = new ArrayList();
                ArrayList memberDesignants = new ArrayList();
                StringTokenizer tok = new StringTokenizer(members);
                while (tok.hasMoreTokens())
                {
                    memberDesignants.add(tok.nextToken());
                }
d134 5
a138 5
                Project p;
                for (Iterator i = memberDesignants.iterator(); i.hasNext();)
                {
                    String member = (String)i.next();
                    try
d140 13
a152 3
                        p = new Project(connection, dMgr,
                                        currentDomain.getID(), member);
                        initialMembers.add(p);
d154 2
a155 1
                    catch (DoesNotExist e)
d157 12
a168 21
                        validationErrors.add("No such project on system: " +
                                             member);
                    }                
                }
                
                User loginUser = getLoginUser(context);
                
                if (isValidUserInput(missingFields, validationErrors))
                {
                    ProjectGroup g = new ProjectGroup
                        (connection, dMgr, loginUser.getACL(), 
                         currentDomain.getID(), isCategory,
                         groupName, shortDescription, longDescription, 
                         initialMembers);
                    redirectToURL
                        (context, currentDomain.getDomainHomeServletURL
                         ("ProjectGroupList"));
                } else {
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(context, missingFields, 
                                           validationErrors);
d171 8
a178 14
        } 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);
            throw new HandlerException(e.getMessage());
        } catch (AlreadyExists e) {
            log.exception(e);
a180 1

@


1.10.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d75 1
a75 1
 * @@version $Id: ProjectGroupAdd.java,v 1.10 2001/01/26 18:29:02 edk Exp $
@


1.10.2.2
log
@Adding support for project group manipulation servlets.
@
text
@d50 2
a52 1
import java.util.*;
d54 1
d57 5
a61 1
import org.apache.turbine.util.Log;
d64 1
d66 4
a69 4
import org.tigris.helm.DoesNotExist;
import org.tigris.helm.security.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d79 2
a80 1
    private static final boolean DEBUG = true;
d107 1
a107 1
                appendToError(context, errorMessage);
a108 2
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
d111 4
a114 3
            String groupName = processField
                (context, GROUP_NAME_FIELD, "Group name", 
                 missingFields);
d121 4
a124 6
            String members = processField
                (context, GROUP_MEMBERS_FIELD);
            boolean isCategory = processCheckbox
                (context, GROUP_IS_CATEGORY_FIELD);

            if (action != null)
d126 1
a126 1
                if (action.equals(CREATE_GROUP_ACTION))
d128 2
a129 6
                    //Check for null so that an empty name doesn't cause
                    //both a missing fields error and a validation error.
                    if (groupName != null && !Project.isValidName(groupName))
                    {
                        validationErrors.add("Group name is invalid.");
                    }
d131 13
a143 2
                    Domain currentDomain = getCurrentDomain(context);   
                    ProjectGroup.assertNonexistance(currentDomain, groupName);
d145 5
a149 5
                    // Turn the list of members they want to add into
                    // Project objects.
                    List initialMembers = new ArrayList();
                    StringTokenizer tok = new StringTokenizer(members);
                    while (tok.hasMoreTokens())
d151 3
a153 13
                        String memberDesignant = tok.nextToken();
                        try 
                        {
                            Project p = null;
                            p = ProjectPeer.getInstanceByName
                                (currentDomain, memberDesignant);
                        } 
                        catch (DoesNotExist e)
                        {
                            validationErrors.add
                                ("No such project on system: "
                                 + memberDesignant);
                        }
d155 6
d162 16
a177 14
                    if (isValidUserInput(missingFields, validationErrors))
                    {
                        ProjectGroup g = ProjectGroup.add
                            (getACL(context), currentDomain, isCategory,
                             groupName, shortDescription, longDescription, 
                             initialMembers);
                        redirectToURL
                            (context, currentDomain.getDomainHomeServletURL
                             ("ProjectGroupList"));
                    } else {
                        // Report missing fields and validation errors.
                        reportInvalidUserInput(context, missingFields, 
                                               validationErrors);
                    }
d180 14
a193 8
        }
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            Log.error("Exception thrown in ProjectGroupMemberAdd", e);
d196 1
@


1.10.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d68 1
a68 1
 * @@version $Id: ProjectGroupAdd.java,v 1.10.2.2 2001/02/14 00:34:09 leonardr Exp $
@


1.10.2.4
log
@Added new imports necessitated by Torque.
@
text
@a62 1
import org.tigris.helm.om.base.*;
d68 1
a68 1
 * @@version $Id: ProjectGroupAdd.java,v 1.10.2.3 2001/02/15 20:50:35 leonardr Exp $
@


1.9
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.8
log
@Trimmed cruft.
@
text
@d75 1
a75 1
 * @@version $Id: ProjectGroupAdd.java,v 1.7 2001/01/11 18:45:57 dlr Exp $
@


1.7
log
@Servlets should use business objects, not table managers.
@
text
@a52 2
import javax.servlet.*;
import javax.servlet.http.*;
d54 1
a54 1
import org.webmacro.util.*;
d75 1
a75 1
 * @@version $Id: ProjectGroupAdd.java,v 1.6 2001/01/06 02:02:23 leonardr Exp $
d79 2
a80 4
    public static final  String versionID = "$Id: ProjectGroupAdd.java,v 1.6 2001/01/06 02:02:23 leonardr Exp $";

    private static Log log = new Log("PrjGrpAdd", "Project Group Add Servlet");
    private static boolean debug = true;
@


1.6
log
@Prevent project groups from taking names already used by projects or project groups.
@
text
@d77 1
a77 1
 * @@version $Id: ProjectGroupAdd.java,v 1.5 2001/01/03 22:49:35 dlr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupAdd.java,v 1.5 2001/01/03 22:49:35 dlr Exp $";
d148 2
d153 7
a159 4
                    Record r = null;
                    r = projMgr.getProjectForName
                        (connection, currentDomain.getID(), member);
                    if (r == null)
d161 2
a162 4
                        validationErrors.add("No such project on system: " 
                                             + member);
                    } else {
                        initialMembers.add(new Project(connection, dMgr, r));
@


1.5
log
@Migrated to modified processCheckbox() signature (now returns the
boolean primitive equivalent of the object added to the context).
This change was made because it is usually the primitive value that
you're interested in--the object is just a wrapper.
@
text
@d77 1
a77 1
 * @@version $Id: ProjectGroupAdd.java,v 1.4 2001/01/03 22:09:21 leonardr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupAdd.java,v 1.4 2001/01/03 22:09:21 leonardr Exp $";
d135 4
a138 1
                Domain currentDomain = getCurrentDomain(context);
@


1.4
log
@Categories can now be created through the ProjectGroup interface.
@
text
@d77 1
a77 1
 * @@version $Id: ProjectGroupAdd.java,v 1.3 2000/12/18 19:15:54 leonardr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupAdd.java,v 1.3 2000/12/18 19:15:54 leonardr Exp $";
d126 2
a127 1
            Boolean isCategory = processCheckbox(context, GROUP_IS_CATEGORY_FIELD);
d166 1
a166 1
                         currentDomain.getID(), isCategory.booleanValue(),
@


1.3
log
@Project groups now have summary and description like regular projects.
@
text
@d77 1
a77 1
 * @@version $Id: ProjectGroupAdd.java,v 1.2 2000/12/14 18:53:58 leonardr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupAdd.java,v 1.2 2000/12/14 18:53:58 leonardr Exp $";
d91 1
d126 1
a126 1
            
d128 1
a128 1
           {
d165 3
a167 2
                         currentDomain.getID(), groupName, shortDescription, 
                         longDescription, initialMembers);
@


1.2
log
@Validate name of project groups.
@
text
@d77 1
a77 1
 * @@version $Id: ProjectGroupAdd.java,v 1.1 2000/11/29 20:58:59 leonardr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectGroupAdd.java,v 1.1 2000/11/29 20:58:59 leonardr Exp $";
d88 2
a89 1
    private static String GROUP_DESCRIPTION_FIELD="description";
d118 6
a123 3
            String description = processField(context, GROUP_DESCRIPTION_FIELD,
                                              "Description", 
                                              missingFields);    
d164 2
a165 2
                         currentDomain.getID(), groupName, description, 
                         initialMembers);
@


1.1
log
@ProjectGroup Add servlet implemented.
@
text
@d77 1
a77 1
 * @@version $Id: ProjectgroupAdd.java,v 1.5 2000/11/21 20:56:55 leonardr Exp $
d81 1
a81 1
    public static final  String versionID = "$Id: ProjectgroupAdd.java,v 1.5 2000/11/21 20:56:55 leonardr Exp $";
d123 6
a128 1
            {
@


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.
d50 2
d53 2
a54 1
import java.util.*;
d56 1
d59 5
a63 1
import org.apache.turbine.util.Log;
d66 1
d68 4
a71 5
import org.tigris.helm.DoesNotExist;
import org.tigris.helm.security.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d77 1
a77 1
 * @@version $Id: ProjectGroupAdd.java,v 1.10.2.4 2001/02/16 03:01:26 dlr Exp $
d81 4
a84 1
    private static final boolean DEBUG = true;
d88 1
a88 2
    private static String GROUP_SHORT_DESCRIPTION_FIELD="shortDescription";
    private static String GROUP_LONG_DESCRIPTION_FIELD="longDescription";
a89 1
    private static String GROUP_IS_CATEGORY_FIELD="isCategory";
d109 1
a109 1
                appendToError(context, errorMessage);
a110 2
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
d113 10
a122 15
            String groupName = processField
                (context, GROUP_NAME_FIELD, "Group name", 
                 missingFields);
            String shortDescription = processField
                (context, GROUP_SHORT_DESCRIPTION_FIELD, "Summary", 
                 missingFields);    
            String longDescription = processField
                (context, GROUP_LONG_DESCRIPTION_FIELD, "Description", 
                 missingFields);    
            String members = processField
                (context, GROUP_MEMBERS_FIELD);
            boolean isCategory = processCheckbox
                (context, GROUP_IS_CATEGORY_FIELD);

            if (action != null)
d124 7
a130 1
                if (action.equals(CREATE_GROUP_ACTION))
d132 9
a140 3
                    //Check for null so that an empty name doesn't cause
                    //both a missing fields error and a validation error.
                    if (groupName != null && !Project.isValidName(groupName))
d142 8
a149 26
                        validationErrors.add("Group name is invalid.");
                    }
   
                    Domain currentDomain = getCurrentDomain(context);   
                    ProjectGroup.assertNonexistance(currentDomain, groupName);

                    // Turn the list of members they want to add into
                    // Project objects.
                    List initialMembers = new ArrayList();
                    StringTokenizer tok = new StringTokenizer(members);
                    while (tok.hasMoreTokens())
                    {
                        String memberDesignant = tok.nextToken();
                        try 
                        {
                            Project p = null;
                            p = ProjectPeer.getInstanceByName
                                (currentDomain, memberDesignant);
                        } 
                        catch (DoesNotExist e)
                        {
                            validationErrors.add
                                ("No such project on system: "
                                 + memberDesignant);
                        }
                    }
d151 13
a163 14
                    if (isValidUserInput(missingFields, validationErrors))
                    {
                        ProjectGroup g = ProjectGroup.add
                            (getACL(context), currentDomain, isCategory,
                             groupName, shortDescription, longDescription, 
                             initialMembers);
                        redirectToURL
                            (context, currentDomain.getDomainHomeServletURL
                             ("ProjectGroupList"));
                    } else {
                        // Report missing fields and validation errors.
                        reportInvalidUserInput(context, missingFields, 
                                               validationErrors);
                    }
d166 14
a179 8
        }
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            Log.error("Exception thrown in ProjectGroupMemberAdd", e);
d182 1
@


