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