Source code: com/RuntimeCollective/webapps/form/AbstractEntityBeanForm.java
1 /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/webapps/form/AbstractEntityBeanForm.java,v 1.3 2003/09/30 15:13:13 joe Exp $
2 * $Revision: 1.3 $
3 * $Date: 2003/09/30 15:13:13 $
4 *
5 * ====================================================================
6 *
7 * Josephine : http://www.runtime-collective.com/josephine/index.html
8 *
9 * Copyright (C) 2003 Runtime Collective
10 *
11 * This product includes software developed by the
12 * Apache Software Foundation (http://www.apache.org/).
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30 package com.RuntimeCollective.webapps.form;
31
32 import com.RuntimeCollective.webapps.bean.EntityBean;
33
34 import javax.servlet.http.HttpServletRequest;
35
36 import org.apache.struts.action.ActionForm;
37 import org.apache.struts.action.ActionMapping;
38
39 /**
40 * A form that provides a `front end' for editing an <code>EntityBean</code>.
41 * Based on EntityBeanForm but using a String id to allow the id "new"
42 *
43 * @version $Id: AbstractEntityBeanForm.java,v 1.3 2003/09/30 15:13:13 joe Exp $
44 */
45 public abstract class AbstractEntityBeanForm extends ActionForm implements BeanForm {
46
47 /** The id of the EntityBean we are dealing with */
48 private String id;
49
50 /** Get id */
51 public String getId() { return id; }
52
53 /** Set id */
54 public void setId(String id) { this.id = id; }
55
56 /** Utility method that allows us to call setId with an int */
57 protected void setId(int id) { this.id = ""+id; }
58
59 /** May be useful to use an action, to use this form to do something in particular*/
60 private String action;
61 /** Get the form's action */
62
63 public String getFormAction() { return this.action; }
64 /** Set the form's action */
65 public void setFormAction(String action) { this.action = action; }
66
67 /** Reset all properties to default values.
68 * @param mapping The mapping used to select this instance
69 * @param request The servlet request we are processing
70 */
71 public void reset(ActionMapping mapping, HttpServletRequest request) {
72 setId(EntityBean.NULL_ID);
73 setFormAction("");
74 }
75 }