View Javadoc

1   /*
2    * Generated by MyEclipse Struts
3    * Template path: templates/java/JavaClass.vtl
4    */
5   package hu.elte.tribus.form;
6   
7   import javax.servlet.http.HttpServletRequest;
8   
9   import org.apache.struts.action.ActionError;
10  import org.apache.struts.action.ActionErrors;
11  import org.apache.struts.action.ActionForm;
12  import org.apache.struts.action.ActionMapping;
13  
14  /*** 
15   * MyEclipse Struts
16   * Creation date: 11-10-2006
17   * 
18   * XDoclet definition:
19   * @struts.form name="registrationForm"
20   */
21  public class RegistrationForm extends ActionForm {
22  	/*
23  	 * Generated fields
24  	 */
25  
26  	/*** password property */
27  	private String password;
28  
29  	/*** userName property */
30  	private String userName;
31  
32  	/*** password2 property */
33  	private String password2;
34  
35  	/*** email property */
36  	private String email;
37  
38  	/*** firstName property */
39  	private String firstName;
40  
41  	/*** lastName property */
42  	private String lastName;
43  
44  	/*
45  	 * Generated Methods
46  	 */
47  
48  	/*** 
49  	 * Method validate
50  	 * @param mapping
51  	 * @param request
52  	 * @return ActionErrors
53  	 */
54  	public ActionErrors validate(ActionMapping mapping,
55  			HttpServletRequest request) {
56  		ActionErrors errors = new ActionErrors();
57  		if(!getPassword().equals(getPassword2()))
58  		{
59  			errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.password.mismatch"));
60  		}
61  		if(getPassword().equals("") || getPassword().length() < 8)
62  		{
63  			errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.password.invalid"));
64  		}
65  		if(getLastName().equals("") || getFirstName().equals(""))
66  		{
67  			errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.name.empty"));
68  		}
69  		if(getEmail().equals(""))
70  		{
71  			errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.email.empty"));
72  		}
73  		if(errors.size() == 0)
74  		{
75  			return null;
76  		}
77  		else
78  		{
79  			return errors;
80  		}
81  	}
82  
83  	/*** 
84  	 * Method reset
85  	 * @param mapping
86  	 * @param request
87  	 */
88  	public void reset(ActionMapping mapping, HttpServletRequest request) {
89  		// TODO Auto-generated method stub
90  	}
91  
92  	/*** 
93  	 * Returns the password.
94  	 * @return String
95  	 */
96  	public String getPassword() {
97  		return password;
98  	}
99  
100 	/*** 
101 	 * Set the password.
102 	 * @param password The password to set
103 	 */
104 	public void setPassword(String password) {
105 		this.password = password;
106 	}
107 
108 	/*** 
109 	 * Returns the userName.
110 	 * @return String
111 	 */
112 	public String getUserName() {
113 		return userName;
114 	}
115 
116 	/*** 
117 	 * Set the userName.
118 	 * @param userName The userName to set
119 	 */
120 	public void setUserName(String userName) {
121 		this.userName = userName;
122 	}
123 
124 	/*** 
125 	 * Returns the password2.
126 	 * @return String
127 	 */
128 	public String getPassword2() {
129 		return password2;
130 	}
131 
132 	/*** 
133 	 * Set the password2.
134 	 * @param password2 The password2 to set
135 	 */
136 	public void setPassword2(String password2) {
137 		this.password2 = password2;
138 	}
139 
140 	/*** 
141 	 * Returns the email.
142 	 * @return String
143 	 */
144 	public String getEmail() {
145 		return email;
146 	}
147 
148 	/*** 
149 	 * Set the email.
150 	 * @param email The email to set
151 	 */
152 	public void setEmail(String email) {
153 		this.email = email;
154 	}
155 
156 	/*** 
157 	 * Returns the firstName.
158 	 * @return String
159 	 */
160 	public String getFirstName() {
161 		return firstName;
162 	}
163 
164 	/*** 
165 	 * Set the firstName.
166 	 * @param firstName The firstName to set
167 	 */
168 	public void setFirstName(String firstName) {
169 		this.firstName = firstName;
170 	}
171 
172 	/*** 
173 	 * Returns the lastName.
174 	 * @return String
175 	 */
176 	public String getLastName() {
177 		return lastName;
178 	}
179 
180 	/*** 
181 	 * Set the lastName.
182 	 * @param lastName The lastName to set
183 	 */
184 	public void setLastName(String lastName) {
185 		this.lastName = lastName;
186 	}
187 }