head	1.16;
access;
symbols
	TIGRIS_1_1_0RC2:1.11
	TIGRIS_1_1_0RC1:1.11
	TIGRIS_1_1:1.11.0.4
	TIGRIS_1_0_8:1.11
	TIGRIS_1_0_8RC3:1.11
	TIGRIS_1_0_8RC2:1.11
	TIGRIS_1_0_8RC1:1.11
	TIGRIS_1_0_7:1.11
	TIGRIS_1_0_7RC3:1.11
	TIGRIS_1_0_7RC2:1.11
	TIGRIS_1_0_7RC1:1.11
	TIGRIS_1_0_6:1.11
	TIGRIS_1_0_6RC5:1.11
	TIGRIS_1_0_6RC4:1.11
	TIGRIS_1_0_6RC3:1.11
	TIGRIS_1_0_6RC2:1.11
	TIGRIS_1_0_6RC1:1.11
	TIGRIS_1_0_5:1.11
	TIGRIS_1_0_5RC6:1.11
	TIGRIS_1_0_5RC5:1.11
	TIGRIS_1_0_5RC4:1.11
	TIGRIS_1_0_5RC3:1.11
	TIGRIS_1_0_5RC2:1.11
	TIGRIS_1_0_5RC1:1.11
	TIGRIS_1_0_4:1.11
	TIGRIS_1_0_3:1.11
	TIGRIS_1_0_2:1.11
	TIGRIS_1_0_1:1.11
	TIGRIS_1_0:1.11.0.6
	TIGRIS_1_0_0:1.11
	TIGRIS_1_0_0_RC1:1.11.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.6
	TIGRIS_0_9_2_3:1.6
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.8
	TIGRIS_0_9_2_1:1.8
	TIGRIS_0_9_2:1.6.0.4
	TIGRIS_0_9_0:1.6.0.2
	TIGRIS_0_8_4:1.3.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


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

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

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

1.13
date	2001.05.23.02.41.08;	author dlr;	state Exp;
branches;
next	1.12;

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

1.11
date	2001.03.08.03.23.32;	author leonardr;	state Exp;
branches;
next	1.10;

1.10
date	2001.03.08.02.01.55;	author leonardr;	state Exp;
branches;
next	1.9;

1.9
date	2001.02.21.01.08.23;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2001.01.26.18.29.04;	author edk;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2001.01.26.05.24.06;	author edk;	state dead;
branches;
next	1.6;

1.6
date	2000.12.13.19.07.48;	author leonardr;	state Exp;
branches
	1.6.4.1;
next	1.5;

1.5
date	2000.12.13.18.59.06;	author leonardr;	state Exp;
branches;
next	1.4;

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

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

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

1.1
date	2000.11.12.21.15.58;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.15.58;	author dlr;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.02.21.00.35.03;	author dlr;	state Exp;
branches;
next	;

1.6.4.1
date	2001.03.08.02.05.39;	author leonardr;	state Exp;
branches;
next	;

1.8.2.1
date	2001.01.28.01.02.18;	author dlr;	state dead;
branches;
next	1.8.2.2;

1.8.2.2
date	2001.02.17.00.19.47;	author elicia;	state Exp;
branches;
next	;


desc
@@


1.16
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.project;

import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;

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

import org.tigris.helm.security.RedirectException;
import org.tigris.helm.tool.FormCache;

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

/**
 * Deletes a project.
 */
public class ProjectDelete extends HelmServlet 
{
    private static final boolean DEBUG = true;
  
    protected String processRequest(Context context)
        throws NestableException, ACLException, RedirectException 
    {
        
        String templateName = super.processRequest(context);
        
        User loginUser = getLoginUser(context);
        Domain currentDomain = getCurrentDomain(context);
        Project currentProject = getCurrentProject(context);
        
        // Determine which button was pushed
        String action = getAction(context);

        if ("Confirm Delete".equals(action))
        {                                  
            try 
            {
                currentProject.delete(loginUser.getACL());
                AuditLog.logEvent
                    (loginUser, currentDomain, 
                     "Deleted project " + currentProject.getName());
                context.put("projectID", "");
                ContextAPI.getFormCache(context).remove("projectID");
            }
            catch (Exception e)
            {
                throw new NestableException(e);
            }

            redirectTo("StartPage");
        }          
        
        return templateName;
    }   
}
@


1.15
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d56 2
a57 2
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.TurbineException;
d76 1
a76 1
        throws TurbineException, ACLException, RedirectException 
d101 1
a101 1
                throw new TurbineException(e);
@


1.14
log
@Ported servlets to new error-handling mechanism.
@
text
@d59 1
a59 1
import org.joist.security.RedirectException;
@


1.13
log
@Import Helm FormCache (moved in from Joist).
@
text
@a84 7
        String projectName = null;

        if (currentProject == null) 
        {
            redirectToError(context, "ProjectDelete: No project specified");
        }
        
d88 1
a88 1
        if (action.equals("Confirm Delete")) 
@


1.12
log
@Ported Helm from WebMacro to Velocity.
@
text
@d60 1
a60 1
import org.joist.util.FormCache;
@


1.11
log
@Fixed compile error.
@
text
@d54 1
a54 1
import org.webmacro.servlet.*;
d56 2
d64 1
d69 1
a69 1
 * Delete a project
d73 1
a73 2

  static private final boolean DEBUG = true;
d75 2
a76 2
  protected String processRequest(Connection conn, WebContext context)
      throws HandlerException, ACLException, RedirectException 
d79 1
a79 1
        String templateName = super.processRequest(conn, context);
d104 5
a108 5
                ((FormCache)context.getTool("Form")).remove("projectID");
            } catch (DoesNotExist e) {
                throw new HandlerException(e.getMessage());
            } catch (Exception e) {
                throw new HandlerException(e.getMessage());
d110 1
d116 1
a116 1
} /* end class ProjectDelete */
@


1.10
log
@Modernized code, and changed redirect on successful delete.
@
text
@d100 1
a100 1
                     "Deleted project " + project.getName());
@


1.9
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d32 1
a32 1
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
a54 1
//import com.workingdogs.village.*;
d68 2
d71 1
a71 3
public class ProjectDelete extends HelmServlet {

  static private boolean debug = true;
d73 2
a74 2
  protected String processRequest(Connection conn, WebContext ctx)
    throws HandlerException, ACLException, RedirectException 
a75 2
    
        String templateName = super.processRequest(conn, ctx);
d77 5
a81 3
        User loginUser = getLoginUser(ctx);
        Domain currentDomain = getCurrentDomain(ctx);
        Project currentProject = getCurrentProject(ctx);
d87 1
a87 1
            redirectToError(ctx, "ProjectDelete: No project specified");
d91 1
a91 9
        String action = (String) ctx.get("action");
        try 
        {
            projectName = currentProject.getName();
            if (debug) Log.debug("ProjectDelete: project=" + 
                                 projectName + currentProject.getID());
        } catch (Exception e) {
            throw new HandlerException(e.getMessage());
        }
d95 2
a96 1
            try {
d100 3
a102 3
                     "Deleted project " + projectName);
                ctx.put("projectID", "");
                ((FormCache)ctx.getTool("Form")).remove("projectID");
d108 1
a108 1
            redirectTo("DomainProjects");
@


1.8
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@a49 3
import org.webmacro.util.*;
import org.webmacro.servlet.*;
import org.webmacro.ContextException;
a51 1

d54 3
a56 1
import com.workingdogs.village.*;
a57 1
import org.joist.database.JoistDatabaseException;
a59 1
import org.tigris.helm.security.HelmServlet;
d62 1
a62 4
import org.tigris.helm.domain.*;
import org.tigris.helm.database.ProjectManager;
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.security.ACLException;
d64 1
a71 1
  static private Log log = new Log("projdel", "Project Delete");
d74 1
a74 1
  protected String processRequest(Connection connection, WebContext context)
d78 1
a78 1
        String templateName = super.processRequest(connection, context);
d80 3
a82 3
        User loginUser = getLoginUser(context);
        Domain currentDomain = getCurrentDomain(context);
        Project currentProject = getCurrentProject(context);
d88 1
a88 1
            redirectToError(context, "ProjectDelete: No project specified");
d92 1
a92 1
        String action = (String) context.get("action");
d96 1
a96 1
            if (debug) log.debug("ProjectDelete: project=" + 
d98 1
a98 1
        } catch (DataSetException e) {
d106 2
a107 2
                AuditLog.logItem
                    (connection, dMgr, loginUser, currentDomain, 
d109 3
a111 3
                context.put("projectID", "");
                ((FormCache)context.getTool("Form")).remove("projectID");
            } catch (ContextException e) {
d113 1
a113 7
            } catch (SQLException e) {
                throw new HandlerException(e.getMessage());
            } catch (DataSetException e) {
                throw new HandlerException(e.getMessage());
            } catch (JoistDatabaseException e) {
                throw new HandlerException(e.getMessage());
            } catch (DoesNotExist e) {
a115 1
            log.info("Redirecting.");
@


1.8.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@@


1.8.2.2
log
@ported to turbine
@
text
@d50 3
d55 1
d58 1
a58 3
import org.webmacro.servlet.*;
//import com.workingdogs.village.*;
import org.apache.turbine.util.Log;
d60 1
d63 1
d66 4
a69 1
import org.tigris.helm.om.*;
a70 1
import org.tigris.helm.security.*;
d78 1
d81 1
a81 1
  protected String processRequest(Connection conn, WebContext ctx)
d85 1
a85 1
        String templateName = super.processRequest(conn, ctx);
d87 3
a89 3
        User loginUser = getLoginUser(ctx);
        Domain currentDomain = getCurrentDomain(ctx);
        Project currentProject = getCurrentProject(ctx);
d95 1
a95 1
            redirectToError(ctx, "ProjectDelete: No project specified");
d99 1
a99 1
        String action = (String) ctx.get("action");
d103 1
a103 1
            if (debug) Log.debug("ProjectDelete: project=" + 
d105 1
a105 1
        } catch (Exception e) {
d113 2
a114 2
                AuditLog.logEvent
                    (loginUser, currentDomain, 
d116 10
a125 2
                ctx.put("projectID", "");
                ((FormCache)ctx.getTool("Form")).remove("projectID");
a127 2
            } catch (Exception e) {
                throw new HandlerException(e.getMessage());
d129 1
@


1.7
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.6
log
@Moved AuditLog to its own directory, where it will be joined by servlets.
@
text
@@


1.6.4.1
log
@Changed redirect.
@
text
@d130 1
a130 1
            redirectTo("StartPage");
@


1.5
log
@Fixed broken ProjectDelete redirect.
@
text
@d70 1
a70 1
import org.tigris.helm.tool.AuditLog;
@


1.4
log
@Added logging to project deletion.
@
text
@d52 1
a52 1

d62 1
d117 3
a119 1
                log.info("!!!projectID: "+ (String)context.get("projectID"));
@


1.3
log
@Made the TigrisUpdate stuff saner with the use of business objects.
@
text
@d65 1
d69 1
d86 2
d90 2
a98 1
        
d101 1
d103 1
a103 2
                                 currentProject.getName() + 
                                 currentProject.getID());
d107 1
a107 1
        
d111 6
a116 1
                currentProject.delete(getACL(context, connection));
d126 1
@


1.2
log
@Made project deletion more consistent.
@
text
@d64 1
a65 1
import org.tigris.helm.tool.UpdateException; 
d113 1
a113 1
            } catch (UpdateException e) {
a115 1

@


1.1
log
@Initial revision
@
text
@d60 1
d65 1
a65 1
import org.tigris.helm.tool.UpdateException;
d67 1
d79 2
a80 1
    throws HandlerException, RedirectException {
d82 40
a121 32
      String templateName = super.processRequest(connection, context);

      Project currentProject = getCurrentProject(context);
      
      if (currentProject == null) {
          redirectToError(context, "ProjectDelete: No project specified");
      }
      
          // Determine which button was pushed
          String action = (String) context.get("action");
          
          try {
              if (debug) log.debug("ProjectDelete: project=" + 
                                   currentProject.getName() + 
                                   currentProject.getID());
          } catch (DataSetException e) {
              throw new HandlerException(e.getMessage());
          }

          if (action.equals("Confirm Delete")) {                        
              
              try {
                  getCurrentProject(context)
                      .delete(getACL(context, connection));
              } catch (Exception e) {
                  throw new HandlerException(e.getMessage());
              }
              redirectTo("DomainProjects");
          }          
  
      return templateName;
  }   
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d50 3
d55 1
d58 1
a58 3
import org.webmacro.servlet.*;
//import com.workingdogs.village.*;
import org.apache.turbine.util.Log;
d61 1
a61 1
import org.joist.util.FormCache;
d63 3
a65 4
import org.tigris.helm.DoesNotExist;
import org.tigris.helm.om.*;
import org.tigris.helm.tool.audit.AuditLog;
import org.tigris.helm.security.*;
d73 1
d76 2
a77 3
  protected String processRequest(Connection conn, WebContext ctx)
    throws HandlerException, ACLException, RedirectException 
    {
d79 32
a110 43
        String templateName = super.processRequest(conn, ctx);
        
        User loginUser = getLoginUser(ctx);
        Domain currentDomain = getCurrentDomain(ctx);
        Project currentProject = getCurrentProject(ctx);
        
        String projectName = null;

        if (currentProject == null) 
        {
            redirectToError(ctx, "ProjectDelete: No project specified");
        }
        
        // Determine which button was pushed
        String action = (String) ctx.get("action");
        try 
        {
            projectName = currentProject.getName();
            if (debug) Log.debug("ProjectDelete: project=" + 
                                 projectName + currentProject.getID());
        } catch (Exception e) {
            throw new HandlerException(e.getMessage());
        }

        if (action.equals("Confirm Delete")) 
        {                                  
            try {
                currentProject.delete(loginUser.getACL());
                AuditLog.logEvent
                    (loginUser, currentDomain, 
                     "Deleted project " + projectName);
                ctx.put("projectID", "");
                ((FormCache)ctx.getTool("Form")).remove("projectID");
            } catch (DoesNotExist e) {
                throw new HandlerException(e.getMessage());
            } catch (Exception e) {
                throw new HandlerException(e.getMessage());
            }
            redirectTo("DomainProjects");
        }          
        
        return templateName;
    }   
@

