1 package com.dotmarketing.portlets.usermanager.struts; 2 3 import java.util.List ; 4 5 import javax.servlet.http.HttpServletRequest ; 6 7 import org.apache.struts.action.ActionErrors; 8 import org.apache.struts.action.ActionForm; 9 import org.apache.struts.action.ActionMapping; 10 import org.apache.struts.action.ActionMessage; 11 12 import com.dotmarketing.portlets.organization.model.Organization; 13 import com.dotmarketing.util.UtilMethods; 14 15 20 public class UserManagerForm extends ActionForm { 21 22 23 24 private static final long serialVersionUID = 1L; 25 26 private String userID; 28 private String emailAddress; 29 private String password; 30 private String passChanged; 31 private String newPassword; 32 private String verifyPassword; 33 private String firstName; 34 private String lastName; 35 36 37 private String description; 39 private String addressID; 40 private String typeAddress; 41 private String street1; 42 private String street2; 43 private String city; 44 private String state; 45 private String zip; 46 private String phone; 47 private String fax; 48 49 private String school; 50 private int graduation_year; 51 private String country; 52 53 private long userProxyInode; 55 private String referrer; 56 private String longLivedCookie; 57 private String website; 58 private String company; 59 private String howHeard; 60 private String prefix; 61 private String otherPrefix; 62 private String suffix; 63 private String title; 64 private String [] category; 66 67 68 public String getCompany() { 69 return company; 70 } 71 72 public void setCompany(String company) { 73 this.company = company; 74 } 75 76 public String getHowHeard() { 77 return howHeard; 78 } 79 80 public void setHowHeard(String howHeard) { 81 this.howHeard = howHeard; 82 } 83 84 public String getLongLivedCookie() { 85 return longLivedCookie; 86 } 87 88 public void setLongLivedCookie(String longLivedCookie) { 89 this.longLivedCookie = longLivedCookie; 90 } 91 92 public String getWebsite() { 93 return website; 94 } 95 96 public void setWebsite(String website) { 97 this.website = website; 98 } 99 100 public UserManagerForm() { 101 this.city = ""; 102 this.description = ""; 103 this.emailAddress = ""; 104 this.fax = ""; 105 this.firstName = ""; 106 this.lastName = ""; 107 this.passChanged = "false"; 108 this.otherPrefix = ""; 109 this.password = ""; 110 this.phone = ""; 111 this.prefix = ""; 112 this.state = ""; 113 this.street1 = ""; 114 this.street2 = ""; 115 this.suffix = ""; 116 this.title = ""; 117 this.typeAddress = ""; 118 this.verifyPassword = ""; 119 this.zip = ""; 120 this.school=""; 121 } 122 123 @Override 124 public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) { 125 ActionErrors errors = new ActionErrors (); 126 127 if (!UtilMethods.isSet(firstName)) 128 errors.add("firstName", new ActionMessage ("error.usermanager.form.mandatory", "First Name")); 129 if (!UtilMethods.isSet(lastName)) 130 errors.add("lastName", new ActionMessage ("error.usermanager.form.mandatory", "Last Name")); 131 if (!UtilMethods.isSet(emailAddress)) 132 errors.add("emailAddress", new ActionMessage ("error.usermanager.form.mandatory", "Email Address")); 133 if (!emailAddress.matches("[^@]+@[^@]+")) 134 errors.add("emailAddress", new ActionMessage ("error.usermanager.form.format", "Email Address")); 135 if (!UtilMethods.isSet(password)) 136 errors.add("password", new ActionMessage ("error.usermanager.form.mandatory", "Password")); 137 if (!UtilMethods.isSet(verifyPassword)) 138 errors.add("verifyPassword", new ActionMessage ("error.usermanager.form.mandatory", "verifyPassword")); 139 if (passChanged.equals("true")) { 140 if (UtilMethods.isSet(password) && !password.equals(verifyPassword)) { 141 errors.add("newPassword", new ActionMessage ("error.usermanager.form.verifyPassword")); 142 } 143 } 144 if (!UtilMethods.isSet(street1)) 145 errors.add("street1", new ActionMessage ("error.usermanager.form.mandatory", "Street 1")); 146 if (!UtilMethods.isSet(city)) 147 errors.add("city", new ActionMessage ("error.usermanager.form.mandatory", "City")); 148 if (!UtilMethods.isSet(state)) 149 errors.add("street1", new ActionMessage ("error.usermanager.form.mandatory", "State")); 150 if (!UtilMethods.isSet(zip)) 151 errors.add("zip", new ActionMessage ("error.usermanager.form.mandatory", "Zip")); 152 if (!UtilMethods.isSet(phone)) 153 errors.add("phone", new ActionMessage ("error.usermanager.form.mandatory", "Phone")); 154 if (!UtilMethods.isSet(country)) 155 errors.add("country", new ActionMessage ("error.usermanager.form.mandatory", "Country")); 156 157 return errors; 158 } 159 160 public String getCity() { 161 return city; 162 } 163 public void setCity(String city) { 164 this.city = city; 165 } 166 public String getEmailAddress() { 167 return emailAddress; 168 } 169 public void setEmailAddress(String emailAddress) { 170 this.emailAddress = emailAddress; 171 } 172 public String getFax() { 173 return fax; 174 } 175 public void setFax(String fax) { 176 if (fax!=null && !fax.equals("null")) 177 this.fax = fax; 178 } 179 public String getFirstName() { 180 return firstName; 181 } 182 public void setFirstName(String firstName) { 183 this.firstName = firstName; 184 } 185 public String getLastName() { 186 return lastName; 187 } 188 public void setLastName(String lastName) { 189 this.lastName = lastName; 190 } 191 public String getPassword() { 192 return password; 193 } 194 public void setPassword(String password) { 195 this.password = password; 196 } 197 public String getVerifyPassword() { 198 return verifyPassword; 199 } 200 public void setVerifyPassword(String verifyPassword) { 201 this.verifyPassword = verifyPassword; 202 } 203 public String getPhone() { 204 return phone; 205 } 206 public void setPhone(String phone) { 207 if (phone!=null && !phone.equals("null")) 208 this.phone = phone; 209 } 210 public String getPrefix() { 211 return prefix; 212 } 213 public void setPrefix(String prefix) { 214 if (prefix!=null && !prefix.equals("null")) 215 this.prefix = prefix; 216 } 217 public String getState() { 218 return state; 219 } 220 public void setState(String state) { 221 this.state = state; 222 } 223 public String getStreet1() { 224 return street1; 225 } 226 public void setStreet1(String street1) { 227 this.street1 = street1; 228 } 229 public String getStreet2() { 230 return street2; 231 } 232 public void setStreet2(String street2) { 233 this.street2 = street2; 234 } 235 public String getSuffix() { 236 return suffix; 237 } 238 public void setSuffix(String suffix) { 239 if (suffix!=null && !suffix.equals("null")) 240 this.suffix = suffix; 241 } 242 public String getTitle() { 243 return title; 244 } 245 public void setTitle(String title) { 246 if (title!=null && !title.equals("null")) 247 this.title = title; 248 } 249 public String getTypeAddress() { 250 return typeAddress; 251 } 252 public void setTypeAddress(String typeAddress) { 253 this.typeAddress = typeAddress; 254 } 255 public String getZip() { 256 return zip; 257 } 258 public void setZip(String zip) { 259 this.zip = zip; 260 } 261 public String [] getCategory() { 262 return category; 263 } 264 public void setCategory(String [] category) { 265 this.category = category; 266 } 267 public String getAddressID() { 268 return addressID; 269 } 270 public void setAddressIS(String addressID) { 271 this.addressID = addressID; 272 } 273 274 public String getUserID() { 275 return userID; 276 } 277 public void setUserID(String userID) { 278 this.userID = userID; 279 } 280 public long getUserProxyInode() { 281 return userProxyInode; 282 } 283 public void setUserProxyInode(long userProxyInode) { 284 this.userProxyInode = userProxyInode; 285 } 286 public void setAddressID(String addressID) { 287 this.addressID = addressID; 288 } 289 public String getDescription() { 290 return description; 291 } 292 public void setDescription(String description) { 293 this.description = description; 294 } 295 296 public String getReferrer() { 297 return referrer; 298 } 299 public void setReferrer(String referrer) { 300 this.referrer = referrer; 301 } 302 public String getPassChanged() { 303 return passChanged; 304 } 305 public void setPassChanged(String newValue) { 306 this.passChanged = newValue; 307 } 308 public String getOtherPrefix() { 309 return otherPrefix; 310 } 311 public void setOtherPrefix(String otherPrefix) { 312 this.otherPrefix = otherPrefix; 313 } 314 315 public String getNewPassword() { 316 return newPassword; 317 } 318 319 public void setNewPassword(String newPassword) { 320 this.newPassword = newPassword; 321 } 322 323 public boolean isCategorySelected(String strCategory){ 324 if(this.category != null){ 325 for(int i = 0; i < this.category.length;++i){ 326 if(this.category[i].equals(strCategory)) 327 return true; 328 } 329 } 330 return false; 331 } 332 333 public int getGraduation_year() { 334 return graduation_year; 335 } 336 337 public void setGraduation_year(int graduation_year) { 338 this.graduation_year = graduation_year; 339 } 340 341 public String getSchool() { 342 return school; 343 } 344 345 public void setSchool(String school) { 346 this.school = school; 347 } 348 349 public String getCountry() { 350 return country; 351 } 352 353 public void setCountry(String country) { 354 this.country = country; 355 } 356 357 } 358 359 360 | Popular Tags |