Source code: org/acs/damsel/client/remove/DeleteUserAction.java
1 package org.acs.damsel.client.remove;
2
3 import java.sql.*;
4 import java.util.*;
5 import javax.servlet.http.*;
6
7 import org.acs.damsel.srvr.db.*;
8 import org.apache.struts.action.*;
9
10
11 public class DeleteUserAction extends Action {
12 public ActionForward execute(ActionMapping actionMapping,
13 ActionForm actionForm,
14 HttpServletRequest httpServletRequest,
15 HttpServletResponse httpServletResponse) {
16 DeleteUserForm deleteUserForm = (DeleteUserForm) actionForm;
17
18 /*We need to check if a MetaData Tag has been selected from the MetaData pull
19 down menu in deleteUser.jsp. In other words, we need to check if this
20 Action was invoked by the onChange event in the MetaData pull down or a
21 submit event from the submit button. isCheckOrderBy will be true if
22 a MetaData Tag has been selected from the MetaData pull down menu...*/
23
24 if (deleteUserForm.isCheckOrderBy()) {
25 deleteUserForm.setCheckOrderBy(false);
26 return actionMapping.findForward("failure");
27 }
28
29
30 try {
31 AssetDB assetDB = AssetDB.instance();
32 String value;
33 String name;
34 String potentialName;
35 Vector deleteUserList = new Vector();
36
37 for (Enumeration e = httpServletRequest.getParameterNames();
38 e.hasMoreElements(); ) {
39 potentialName = (String) e.nextElement();
40
41 if (potentialName.indexOf("delete") != -1) {
42 name = potentialName.substring(potentialName.indexOf("delete") + 6);
43 value = httpServletRequest.getParameter(potentialName);
44 if (value.equals("true")) {
45 deleteUserList.addElement(name);
46 assetDB.deleteUser(name);
47 } // end of if statement
48 } // end of if statement
49 } // end of for loop
50 httpServletRequest.getSession().setAttribute("deleteUserList",deleteUserList);
51 } // end of try
52 catch (SQLException ex) {
53 }
54 return actionMapping.findForward("success");
55 }
56 } // end of DeleteUserAction class