KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > webapp > admin > resources > MailSessionForm


1 /*
2  * Copyright 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.webapp.admin.resources;
18
19 import java.util.List JavaDoc;
20 import java.util.ArrayList JavaDoc;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import org.apache.struts.action.ActionError;
24 import org.apache.struts.action.ActionErrors;
25 import org.apache.struts.action.ActionForm;
26 import org.apache.struts.action.ActionMapping;
27 import org.apache.webapp.admin.LabelValueBean;
28
29 /**
30  * Form bean for the individual mail session page.
31  *
32  * @author Amy Roh
33  * @version $Revision: 1.4 $ $Date: 2004/02/27 14:59:04 $
34  * @since 4.1
35  */

36
37 public final class MailSessionForm extends BaseForm {
38
39
40     // ----------------------------------------------------- Instance Variables
41

42
43     // ------------------------------------------------------------- Properties
44

45     
46     /**
47      * The name of the mail session.
48      */

49     private String JavaDoc name = null;
50
51     public String JavaDoc getName() {
52         return (this.name);
53     }
54
55     public void setName(String JavaDoc name) {
56         this.name = name;
57     }
58     
59     /**
60      * The mail.smtp.host of the mail session.
61      */

62     private String JavaDoc mailhost = null;
63
64     public String JavaDoc getMailhost() {
65         return (this.mailhost);
66     }
67
68     public void setMailhost(String JavaDoc mailhost) {
69         this.mailhost = mailhost;
70     }
71
72     /**
73      * The resource type of this mail session.
74      */

75     private String JavaDoc resourcetype = null;
76     
77     /**
78      * Return the resource type of the mail session this bean refers to.
79      */

80     public String JavaDoc getResourcetype() {
81         return this.resourcetype;
82     }
83
84     /**
85      * Set the resource type of the mail session this bean refers to.
86      */

87     public void setResourcetype(String JavaDoc resourcetype) {
88         this.resourcetype = resourcetype;
89     }
90        
91     /**
92      * The path of this mail session.
93      */

94     private String JavaDoc path = null;
95     
96     /**
97      * Return the path of the mail session this bean refers to.
98      */

99     public String JavaDoc getPath() {
100         return this.path;
101     }
102
103     /**
104      * Set the path of the mail session this bean refers to.
105      */

106     public void setPath(String JavaDoc path) {
107         this.path = path;
108     }
109        
110     /**
111      * The host of this mail session.
112      */

113     private String JavaDoc host = null;
114     
115     /**
116      * Return the host of the mail session this bean refers to.
117      */

118     public String JavaDoc getHost() {
119         return this.host;
120     }
121
122     /**
123      * Set the host of the mail session this bean refers to.
124      */

125     public void setHost(String JavaDoc host) {
126         this.host = host;
127     }
128     
129        
130     /**
131      * The domain of this mail session.
132      */

133     private String JavaDoc domain = null;
134     
135     /**
136      * Return the domain of the mail session this bean refers to.
137      */

138     public String JavaDoc getDomain() {
139         return this.domain;
140     }
141
142     /**
143      * Set the domain of the mail session this bean refers to.
144      */

145     public void setDomain(String JavaDoc domain) {
146         this.domain = domain;
147     }
148     
149     /**
150      * The type of the resource.
151      */

152     private String JavaDoc type = null;
153
154     public String JavaDoc getType() {
155         return (this.type);
156     }
157
158     public void setType(String JavaDoc type) {
159         this.type = type;
160     }
161
162     // --------------------------------------------------------- Public Methods
163

164     /**
165      * Reset all properties to their default values.
166      *
167      * @param mapping The mapping used to select this instance
168      * @param request The servlet request we are processing
169      */

170     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
171
172         super.reset(mapping, request);
173         mailhost = null;
174         type = null;
175     }
176
177     /**
178      * Validate the properties that have been set from this HTTP request,
179      * and return an <code>ActionErrors</code> object that encapsulates any
180      * validation errors that have been found. If no errors are found, return
181      * <code>null</code> or an <code>ActionErrors</code> object with no
182      * recorded error messages.
183      *
184      * @param mapping The mapping used to select this instance
185      * @param request The servlet request we are processing
186      */

187     
188     private ActionErrors errors = null;
189     
190     public ActionErrors validate(ActionMapping mapping,
191     HttpServletRequest JavaDoc request) {
192
193         errors = new ActionErrors();
194
195         String JavaDoc submit = request.getParameter("submit");
196
197         //if (submit != null) {
198

199             // mailSmtpHost is a required field
200
if ((mailhost == null) || (mailhost.length() < 1)) {
201                 errors.add("mailhost",
202                       new ActionError("resources.error.mailhost.required"));
203             }
204          //}
205

206         return (errors);
207     }
208     
209 }
210
Popular Tags