View Javadoc

1   // Created on 24.11.2003
2   package com.pnpconsult.zeiterfassung.actions.admin;
3   
4   import java.io.Serializable;
5   
6   import org.apache.commons.logging.Log;
7   import org.apache.commons.logging.LogFactory;
8   
9   import com.pnpconsult.zeiterfassung.actions.DeleteForm;
10  import com.pnpconsult.zeiterfassung.helper.UserManager;
11  import com.pnpconsult.zeiterfassung.model.User;
12  
13  /***
14   * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
15   * @version $Id: DeleteUserForm.java,v 1.4 2004/06/24 20:54:18 powerpete Exp $
16   * 
17   * @struts.form name="deleteUserForm"
18   */
19  public class DeleteUserForm extends DeleteForm
20  {
21      private static final Log LOG = LogFactory.getLog(DeleteUserForm.class);
22  	private String login;
23  
24  	public void delete()
25  	{
26  		try
27  		{
28  			new UserManager().deleteUser(login);
29  		}
30  		catch (Exception e)
31  		{
32              LOG.fatal("Error deleting user with login " + login, e);
33  		}
34  	}
35      protected void writeToDataObject(Object obj)
36      {
37          throw new UnsupportedOperationException();
38      }
39  
40      protected void readFromDataObject(Object obj)
41      {
42          throw new UnsupportedOperationException();
43      }
44  
45      public String getLogin()
46      {
47          return login;
48      }
49  
50      public void setLogin(String login)
51      {
52          this.login = login;
53          try
54  		{
55  			User user = new UserManager().load(login);
56              setName("der Benutzer");
57              setDescription(user.toString());
58  //            setInformation("Alle mit diesem Benutzer verkn&uuml;pften " +
59  //                    "Eintr&auml;ge werden gel&ouml;scht.");
60  		}
61  		catch (Exception e)
62  		{
63              LOG.fatal("Error loading user with login " + login, e);
64  		}
65      }
66  
67      /***
68       * @see com.pnpconsult.zeiterfassung.actions.EditForm#newDataObject()
69       */
70      protected Object newDataObject()
71      {
72          throw new UnsupportedOperationException();
73      }
74  
75      /***
76       * @see com.pnpconsult.zeiterfassung.actions.EditForm#dataObjectType()
77       */
78      protected Class dataObjectType()
79      {
80          return User.class;
81      }
82  
83      /***
84       * @see com.pnpconsult.zeiterfassung.actions.EditForm#dataObjectKey()
85       */
86      protected Serializable dataObjectKey()
87      {
88          return login;
89      }
90  }