| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.itracker.web.forms; |
| 20 |
|
|
| 21 |
|
import javax.servlet.http.HttpServletRequest; |
| 22 |
|
|
| 23 |
|
import org.apache.log4j.Logger; |
| 24 |
|
import org.apache.struts.action.ActionErrors; |
| 25 |
|
import org.apache.struts.action.ActionMapping; |
| 26 |
|
import org.apache.struts.action.ActionMessage; |
| 27 |
|
import org.apache.struts.action.ActionMessages; |
| 28 |
|
import org.apache.struts.validator.ValidatorForm; |
| 29 |
|
import org.itracker.web.actions.admin.project.EditProjectFormActionUtil; |
| 30 |
|
import org.itracker.web.util.ServletContextUtils; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@author |
| 36 |
|
|
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 103 (103) |
Complexity: 34 |
Complexity Density: 0.6 |
|
| 38 |
|
public class ProjectForm extends ValidatorForm { |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
private static final long serialVersionUID = 1L; |
| 43 |
|
private String action; |
| 44 |
|
private Integer id; |
| 45 |
|
private String name; |
| 46 |
|
private Integer status; |
| 47 |
|
private String description; |
| 48 |
|
private Integer[] owners; |
| 49 |
|
private Integer[] users; |
| 50 |
|
private Integer[] permissions; |
| 51 |
|
private Integer[] options; |
| 52 |
|
private Integer[] fields; |
| 53 |
|
|
| 54 |
|
private static final Logger log = Logger.getLogger(ProjectForm.class); |
| 55 |
|
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
| 56 |
0
|
public void reset(ActionMapping mapping, HttpServletRequest request) {... |
| 57 |
0
|
action = null; |
| 58 |
0
|
id = null; |
| 59 |
0
|
name = null; |
| 60 |
0
|
status = null; |
| 61 |
0
|
description = null; |
| 62 |
0
|
owners = null; |
| 63 |
0
|
users = null; |
| 64 |
0
|
permissions = null; |
| 65 |
0
|
options = null; |
| 66 |
0
|
fields = null; |
| 67 |
|
|
| 68 |
|
} |
| 69 |
|
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 70 |
0
|
public ActionErrors validate(ActionMapping mapping,... |
| 71 |
|
HttpServletRequest request) { |
| 72 |
0
|
ActionErrors errors = super.validate(mapping, request); |
| 73 |
0
|
if (log.isDebugEnabled()) { |
| 74 |
0
|
log.debug("ProjectForm validate called: mapping: " + mapping |
| 75 |
|
+ ", request: " + request + ", errors: " + errors); |
| 76 |
|
} |
| 77 |
0
|
if (ServletContextUtils.getItrackerServices().getProjectService() |
| 78 |
|
.isUniqueProjectName(getName(), getId())) { |
| 79 |
|
} else { |
| 80 |
0
|
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( |
| 81 |
|
"itracker.web.error.project.duplicate.name")); |
| 82 |
|
|
| 83 |
|
|
| 84 |
|
} |
| 85 |
|
|
| 86 |
0
|
new EditProjectFormActionUtil().init(mapping, request, this); |
| 87 |
0
|
return errors; |
| 88 |
|
} |
| 89 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 90 |
0
|
public String getAction() {... |
| 91 |
0
|
return action; |
| 92 |
|
} |
| 93 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
0
|
public void setAction(String action) {... |
| 95 |
0
|
this.action = action; |
| 96 |
|
} |
| 97 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 98 |
0
|
public String getDescription() {... |
| 99 |
0
|
return description; |
| 100 |
|
} |
| 101 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 102 |
0
|
public void setDescription(String description) {... |
| 103 |
0
|
this.description = description; |
| 104 |
|
} |
| 105 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 106 |
0
|
public Integer[] getFields() {... |
| 107 |
0
|
if (null == fields) |
| 108 |
0
|
return null; |
| 109 |
0
|
return fields.clone(); |
| 110 |
|
} |
| 111 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 112 |
0
|
public void setFields(Integer[] fields) {... |
| 113 |
0
|
if (null == fields) |
| 114 |
0
|
this.fields = null; |
| 115 |
|
else |
| 116 |
0
|
this.fields = fields.clone(); |
| 117 |
|
} |
| 118 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 119 |
0
|
public Integer getId() {... |
| 120 |
0
|
return id; |
| 121 |
|
} |
| 122 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
0
|
public void setId(Integer id) {... |
| 124 |
0
|
this.id = id; |
| 125 |
|
} |
| 126 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
0
|
public String getName() {... |
| 128 |
0
|
return name; |
| 129 |
|
} |
| 130 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 131 |
0
|
public void setName(String name) {... |
| 132 |
0
|
this.name = name; |
| 133 |
|
} |
| 134 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 135 |
0
|
public Integer[] getOptions() {... |
| 136 |
0
|
if (null == options) |
| 137 |
0
|
return null; |
| 138 |
0
|
return options.clone(); |
| 139 |
|
} |
| 140 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 141 |
0
|
public void setOptions(Integer[] options) {... |
| 142 |
0
|
if (null == options) |
| 143 |
0
|
this.options = null; |
| 144 |
|
else |
| 145 |
0
|
this.options = options.clone(); |
| 146 |
|
} |
| 147 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 148 |
0
|
public Integer[] getOwners() {... |
| 149 |
0
|
if (null == owners) |
| 150 |
0
|
return null; |
| 151 |
0
|
return owners.clone(); |
| 152 |
|
} |
| 153 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 154 |
0
|
public void setOwners(Integer[] owners) {... |
| 155 |
0
|
if (null == owners) |
| 156 |
0
|
this.owners = null; |
| 157 |
|
else |
| 158 |
0
|
this.owners = owners.clone(); |
| 159 |
|
} |
| 160 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 161 |
0
|
public Integer[] getPermissions() {... |
| 162 |
0
|
if (null == permissions) |
| 163 |
0
|
return null; |
| 164 |
|
|
| 165 |
0
|
return permissions.clone(); |
| 166 |
|
|
| 167 |
|
} |
| 168 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 169 |
0
|
public void setPermissions(Integer[] permissions) {... |
| 170 |
0
|
if (null == permissions) |
| 171 |
0
|
this.permissions = null; |
| 172 |
|
else |
| 173 |
0
|
this.permissions = permissions.clone(); |
| 174 |
|
} |
| 175 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 176 |
0
|
public Integer getStatus() {... |
| 177 |
0
|
return status; |
| 178 |
|
} |
| 179 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 180 |
0
|
public void setStatus(Integer status) {... |
| 181 |
0
|
this.status = status; |
| 182 |
|
} |
| 183 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 184 |
0
|
public Integer[] getUsers() {... |
| 185 |
0
|
if (null == users) |
| 186 |
0
|
return null; |
| 187 |
0
|
return users.clone(); |
| 188 |
|
} |
| 189 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 190 |
0
|
public void setUsers(Integer[] users) {... |
| 191 |
0
|
if (null == users) |
| 192 |
0
|
this.users = null; |
| 193 |
|
else |
| 194 |
0
|
this.users = users.clone(); |
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
} |