KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > form > CreateUserForm


1 package org.nextime.ion.backoffice.form;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4
5 import org.apache.struts.action.ActionError;
6 import org.apache.struts.action.ActionErrors;
7 import org.apache.struts.action.ActionForm;
8 import org.apache.struts.action.ActionMapping;
9
10 public class CreateUserForm extends ActionForm {
11
12     private String JavaDoc name;
13     private String JavaDoc email;
14     private String JavaDoc password;
15     private String JavaDoc login;
16     private String JavaDoc[] groups;
17
18     /**
19      * @see org.apache.struts.action.ActionForm#validate(ActionMapping, HttpServletRequest)
20      */

21     public ActionErrors myValidate(HttpServletRequest JavaDoc request) {
22         ActionErrors errors = new ActionErrors();
23         if ("".equals(getName()) || getName()==null) {
24             ActionError error =
25                 new ActionError("error.createUser.nameMissing");
26             errors.add("name", error);
27         }
28         if ("".equals(getEmail()) || getEmail()==null) {
29             ActionError error =
30                 new ActionError("error.createUser.emailMissing");
31             errors.add("email", error);
32         }
33         if ("".equals(getLogin()) || getLogin()==null) {
34             ActionError error =
35                 new ActionError("error.createUser.loginMissing");
36             errors.add("login", error);
37         }
38         if ("".equals(getPassword()) || getPassword()==null) {
39             ActionError error =
40                 new ActionError("error.createUser.passwordMissing");
41             errors.add("password", error);
42         }
43         return errors;
44     }
45
46     /**
47      * @see org.apache.struts.action.ActionForm#reset(ActionMapping, HttpServletRequest)
48      */

49     public void reset(ActionMapping arg0, HttpServletRequest JavaDoc arg1) {
50         setName(null);
51         setEmail(null);
52         setGroups(null);
53         setPassword(null);
54         setLogin(null);
55     }
56
57     
58     /**
59      * Returns the email.
60      * @return String
61      */

62     public String JavaDoc getEmail() {
63         return email;
64     }
65
66
67     /**
68      * Returns the groups.
69      * @return String[]
70      */

71     public String JavaDoc[] getGroups() {
72         return groups;
73     }
74
75
76     /**
77      * Returns the name.
78      * @return String
79      */

80     public String JavaDoc getName() {
81         return name;
82     }
83
84
85     /**
86      * Sets the email.
87      * @param email The email to set
88      */

89     public void setEmail(String JavaDoc email) {
90         this.email = email;
91     }
92
93
94     /**
95      * Sets the groups.
96      * @param groups The groups to set
97      */

98     public void setGroups(String JavaDoc[] groups) {
99         this.groups = groups;
100     }
101
102
103     /**
104      * Sets the name.
105      * @param name The name to set
106      */

107     public void setName(String JavaDoc name) {
108         this.name = name;
109     }
110
111
112     /**
113      * Returns the password.
114      * @return String
115      */

116     public String JavaDoc getPassword() {
117         return password;
118     }
119
120
121     /**
122      * Sets the password.
123      * @param password The password to set
124      */

125     public void setPassword(String JavaDoc password) {
126         this.password = password;
127     }
128
129
130     /**
131      * Returns the login.
132      * @return String
133      */

134     public String JavaDoc getLogin() {
135         return login;
136     }
137
138
139     /**
140      * Sets the login.
141      * @param login The login to set
142      */

143     public void setLogin(String JavaDoc login) {
144         this.login = login;
145     }
146
147
148 }
149
Popular Tags