1 18 19 package cowsultants.itracker.web.forms; 20 21 import java.util.*; 22 import javax.servlet.http.*; 23 import org.apache.struts.action.*; 24 import org.apache.struts.validator.*; 25 26 import cowsultants.itracker.ejb.client.models.*; 27 import cowsultants.itracker.ejb.client.util.*; 28 import cowsultants.itracker.web.util.*; 29 30 public class UserForm extends ValidatorForm { 31 private String action = null; 32 private Integer id = new Integer (-1); 33 private String login = null; 34 private String currPassword = null; 35 private String password = null; 36 private String confPassword = null; 37 private String firstName = null; 38 private String lastName = null; 39 private String email = null; 40 41 private boolean superUser = false; 42 43 private HashMap permissions = new HashMap(); 44 45 private String userLocale = null; 46 private String saveLogin = null; 47 private String numItemsOnIndex = null; 48 private String numItemsOnIssueList = null; 49 private String showClosedOnIssueList = null; 50 private String sortColumnOnIssueList = null; 51 private Integer [] hiddenIndexSections = null; 52 private String rememberLastSearch = null; 53 54 public String getAction() { 55 return action; 56 } 57 58 public void setAction(String value) { 59 action = value; 60 } 61 62 public Integer getId() { 63 return id; 64 } 65 66 public void setId(Integer value) { 67 id = value; 68 } 69 70 public String getLogin() { 71 return login; 72 } 73 74 public void setLogin(String value) { 75 login = value; 76 } 77 78 public String getCurrPassword() { 79 return currPassword; 80 } 81 82 public void setCurrPassword(String value) { 83 currPassword = value; 84 } 85 86 public String getPassword() { 87 return password; 88 } 89 90 public void setPassword(String value) { 91 password = value; 92 } 93 94 public String getConfPassword() { 95 return confPassword; 96 } 97 98 public void setConfPassword(String value) { 99 confPassword = value; 100 } 101 102 public String getFirstName() { 103 return firstName; 104 } 105 106 public void setFirstName(String value) { 107 firstName = value; 108 } 109 110 public String getLastName() { 111 return lastName; 112 } 113 114 public void setLastName(String value) { 115 lastName = value; 116 } 117 118 public String getEmail() { 119 return email; 120 } 121 122 public void setEmail(String value) { 123 email = value; 124 } 125 126 public boolean isSuperUser() { 127 return superUser; 128 } 129 130 public void setSuperUser(boolean value) { 131 superUser = value; 132 } 133 134 public HashMap getPermissions() { 135 return permissions; 136 } 137 138 public void setPermissions(HashMap value) { 139 permissions = value; 140 } 141 142 public String getUserLocale() { 143 return userLocale; 144 } 145 146 public void setUserLocale(String value) { 147 userLocale = value; 148 } 149 150 public String getSaveLogin() { 151 return saveLogin; 152 } 153 154 public void setSaveLogin(String value) { 155 saveLogin = value; 156 } 157 158 public String getNumItemsOnIndex() { 159 return numItemsOnIndex; 160 } 161 162 public void setNumItemsOnIndex(String value) { 163 numItemsOnIndex = value; 164 } 165 166 public String getNumItemsOnIssueList() { 167 return numItemsOnIssueList; 168 } 169 170 public void setNumItemsOnIssueList(String value) { 171 numItemsOnIssueList = value; 172 } 173 174 public String getShowClosedOnIssueList() { 175 return showClosedOnIssueList; 176 } 177 178 public void setShowClosedOnIssueList(String value) { 179 showClosedOnIssueList = value; 180 } 181 182 public String getSortColumnOnIssueList() { 183 return sortColumnOnIssueList; 184 } 185 186 public void setSortColumnOnIssueList(String value) { 187 sortColumnOnIssueList = value; 188 } 189 190 public Integer [] getHiddenIndexSections() { 191 return hiddenIndexSections; 192 } 193 194 public void setHiddenIndexSections(Integer [] value) { 195 hiddenIndexSections = value; 196 } 197 198 public String getRememberLastSearch() { 199 return rememberLastSearch; 200 } 201 202 public void setRememberLastSearch(String value) { 203 rememberLastSearch = value; 204 } 205 206 public void reset(ActionMapping mapping, HttpServletRequest request) { 207 action = null; 208 id = new Integer (-1); 209 login = null; 210 currPassword = null; 211 password = null; 212 confPassword = null; 213 firstName = null; 214 lastName = null; 215 email = null; 216 superUser = false; 217 218 permissions = new HashMap(); 219 220 userLocale = null; 221 saveLogin = null; 222 numItemsOnIndex = null; 223 numItemsOnIssueList = null; 224 showClosedOnIssueList = null; 225 sortColumnOnIssueList = null; 226 hiddenIndexSections = null; 227 rememberLastSearch = null; 228 } 229 230 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 231 ActionErrors errors = super.validate(mapping, request); 232 233 if(password != null && ! "".equals(password)) { 234 if(! ("register".equalsIgnoreCase(action) || "create".equalsIgnoreCase(action) || "update".equalsIgnoreCase(action)) && 235 (currPassword == null || "".equals(currPassword))) { 236 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("itracker.web.error.missingpassword")); 237 } else if(! password.equals(confPassword)) { 238 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("itracker.web.error.matchingpass")); 239 } 240 } 241 return errors; 242 } 243 244 245 } 246 | Popular Tags |