1
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.BillManager;
11 import com.pnpconsult.zeiterfassung.model.Bill;
12
13 /***
14 * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
15 * @version $Id: DeleteBillForm.java,v 1.4 2004/06/24 20:54:18 powerpete Exp $
16 *
17 * @struts.form
18 * name="deleteBillForm"
19 */
20 public class DeleteBillForm extends DeleteForm
21 {
22 private static final Log LOG = LogFactory.getLog(DeleteBillForm.class);
23 private long id;
24
25 public long getId()
26 {
27 return id;
28 }
29
30 public void setId(long id)
31 {
32 this.id = id;
33 try
34 {
35 Bill bill = new BillManager().load(id);
36 setName(bill.toString());
37
38
39
40 }
41 catch (Exception e)
42 {
43 LOG.fatal("Error loading bill with id " + id, e);
44 }
45 }
46
47 public void delete()
48 {
49 try
50 {
51 new BillManager().delete(id);
52 }
53 catch (Exception e)
54 {
55 LOG.fatal("Error deleting bill with id " + id, e);
56 }
57 }
58
59 /***
60 * @see com.pnpconsult.zeiterfassung.actions.EditForm#writeToDataObject(java.lang.Object)
61 */
62 protected void writeToDataObject(Object obj)
63 {
64 throw new UnsupportedOperationException();
65 }
66
67 /***
68 * @see com.pnpconsult.zeiterfassung.actions.EditForm#readFromDataObject(java.lang.Object)
69 */
70 protected void readFromDataObject(Object obj)
71 {
72 throw new UnsupportedOperationException();
73 }
74
75 /***
76 * @see com.pnpconsult.zeiterfassung.actions.EditForm#newDataObject()
77 */
78 protected Object newDataObject()
79 {
80 throw new UnsupportedOperationException();
81 }
82
83 /***
84 * @see com.pnpconsult.zeiterfassung.actions.EditForm#dataObjectType()
85 */
86 protected Class dataObjectType()
87 {
88 return Bill.class;
89 }
90
91 /***
92 * @see com.pnpconsult.zeiterfassung.actions.EditForm#dataObjectKey()
93 */
94 protected Serializable dataObjectKey()
95 {
96 return new Long(id);
97 }
98 }