1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.web; |
21 |
|
|
22 |
|
import java.util.HashMap; |
23 |
|
import java.util.Map; |
24 |
|
|
25 |
|
import org.apache.commons.lang3.math.NumberUtils; |
26 |
|
|
27 |
|
import com.xpn.xwiki.util.Util; |
28 |
|
|
|
|
| 79.3% |
Uncovered Elements: 25 (121) |
Complexity: 43 |
Complexity Density: 0.59 |
|
29 |
|
public class EditForm extends XWikiForm |
30 |
|
{ |
31 |
|
|
32 |
|
private String content; |
33 |
|
|
34 |
|
private String web; |
35 |
|
|
36 |
|
private String name; |
37 |
|
|
38 |
|
private String parent; |
39 |
|
|
40 |
|
private String creator; |
41 |
|
|
42 |
|
private String template; |
43 |
|
|
44 |
|
private String language; |
45 |
|
|
46 |
|
private String defaultLanguage; |
47 |
|
|
48 |
|
private String defaultTemplate; |
49 |
|
|
50 |
|
private String title; |
51 |
|
|
52 |
|
private String comment; |
53 |
|
|
54 |
|
private boolean isMinorEdit = false; |
55 |
|
|
56 |
|
private String tags; |
57 |
|
|
58 |
|
private boolean lockForce; |
59 |
|
|
60 |
|
private String syntaxId; |
61 |
|
|
62 |
|
private String hidden; |
63 |
|
|
64 |
|
private ObjectPolicyType objectPolicy; |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
|
66 |
1840 |
@Override... |
67 |
|
public void readRequest() |
68 |
|
{ |
69 |
1840 |
XWikiRequest request = getRequest(); |
70 |
1838 |
setContent(request.getParameter("content")); |
71 |
1838 |
setWeb(request.getParameter("web")); |
72 |
1840 |
setName(request.getParameter("name")); |
73 |
1839 |
setParent(request.getParameter("parent")); |
74 |
1840 |
setTemplate(request.getParameter("template")); |
75 |
1840 |
setDefaultTemplate(request.getParameter("default_template")); |
76 |
1839 |
setCreator(request.getParameter("creator")); |
77 |
1840 |
setLanguage(request.getParameter("language")); |
78 |
1839 |
setTitle(request.getParameter("title")); |
79 |
1840 |
setComment(request.getParameter("comment")); |
80 |
1840 |
setDefaultLanguage(request.getParameter("defaultLanguage")); |
81 |
1840 |
setTags(request.getParameterValues("tags")); |
82 |
1839 |
setLockForce("1".equals(request.getParameter("force"))); |
83 |
1840 |
setMinorEdit(request.getParameter("minorEdit") != null); |
84 |
1840 |
setSyntaxId(request.getParameter("syntaxId")); |
85 |
1840 |
setHidden(request.getParameter("xhidden")); |
86 |
1840 |
setObjectPolicy(request.getParameter("objectPolicy")); |
87 |
|
} |
88 |
|
|
|
|
| 20% |
Uncovered Elements: 16 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
89 |
1839 |
public void setTags(String[] parameter)... |
90 |
|
{ |
91 |
1838 |
if (parameter == null) { |
92 |
1840 |
this.tags = null; |
93 |
1840 |
return; |
94 |
|
} |
95 |
0 |
StringBuilder tags = new StringBuilder(); |
96 |
0 |
boolean first = true; |
97 |
0 |
for (int i = 0; i < parameter.length; ++i) { |
98 |
0 |
if (!parameter[i].equals("")) { |
99 |
0 |
if (first) { |
100 |
0 |
first = false; |
101 |
|
} else { |
102 |
0 |
tags.append("|"); |
103 |
|
} |
104 |
0 |
tags.append(parameter[i]); |
105 |
|
} |
106 |
|
} |
107 |
0 |
this.tags = tags.toString(); |
108 |
|
} |
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
271 |
public String getTags()... |
111 |
|
{ |
112 |
271 |
return this.tags; |
113 |
|
} |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
272 |
public String getContent()... |
116 |
|
{ |
117 |
272 |
return this.content; |
118 |
|
} |
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
1911 |
public void setContent(String content)... |
121 |
|
{ |
122 |
1911 |
this.content = content; |
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
125 |
0 |
public String getWeb()... |
126 |
|
{ |
127 |
0 |
return this.web; |
128 |
|
} |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
1839 |
public void setWeb(String web)... |
131 |
|
{ |
132 |
1840 |
this.web = web; |
133 |
|
} |
134 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
135 |
0 |
public String getName()... |
136 |
|
{ |
137 |
0 |
return this.name; |
138 |
|
} |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
1841 |
public void setName(String name)... |
141 |
|
{ |
142 |
1842 |
this.name = name; |
143 |
|
} |
144 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
145 |
899 |
public String getLanguage()... |
146 |
|
{ |
147 |
899 |
return this.language; |
148 |
|
} |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
1891 |
public void setLanguage(String language)... |
151 |
|
{ |
152 |
1891 |
this.language = Util.normalizeLanguage(language); |
153 |
|
} |
154 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
155 |
0 |
public int getObjectNumbers(String prefix)... |
156 |
|
{ |
157 |
0 |
String nb = getRequest().getParameter(prefix + "_nb"); |
158 |
0 |
return NumberUtils.toInt(nb); |
159 |
|
} |
160 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
161 |
180 |
public Map<String, String[]> getObject(String prefix)... |
162 |
|
{ |
163 |
180 |
@SuppressWarnings("unchecked") |
164 |
|
Map<String, String[]> allParameters = getRequest().getParameterMap(); |
165 |
180 |
Map<String, String[]> result = new HashMap<String, String[]>(); |
166 |
180 |
for (String name : allParameters.keySet()) { |
167 |
1768 |
if (name.startsWith(prefix + "_")) { |
168 |
440 |
String newname = name.substring(prefix.length() + 1); |
169 |
440 |
result.put(newname, allParameters.get(name)); |
170 |
|
} |
171 |
|
} |
172 |
180 |
return result; |
173 |
|
} |
174 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
175 |
421 |
public String getParent()... |
176 |
|
{ |
177 |
421 |
return this.parent; |
178 |
|
} |
179 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
180 |
1930 |
public void setParent(String parent)... |
181 |
|
{ |
182 |
1930 |
this.parent = parent; |
183 |
|
} |
184 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
185 |
421 |
public String getCreator()... |
186 |
|
{ |
187 |
421 |
return this.creator; |
188 |
|
} |
189 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
1840 |
public void setCreator(String creator)... |
191 |
|
{ |
192 |
1840 |
this.creator = creator; |
193 |
|
} |
194 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
195 |
572 |
public String getTemplate()... |
196 |
|
{ |
197 |
572 |
return this.template; |
198 |
|
} |
199 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
200 |
1928 |
public void setTemplate(String template)... |
201 |
|
{ |
202 |
1928 |
this.template = template; |
203 |
|
} |
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
205 |
417 |
public String getDefaultTemplate()... |
206 |
|
{ |
207 |
417 |
return this.defaultTemplate; |
208 |
|
} |
209 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
210 |
1838 |
public void setDefaultTemplate(String defaultTemplate)... |
211 |
|
{ |
212 |
1839 |
this.defaultTemplate = defaultTemplate; |
213 |
|
} |
214 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
215 |
421 |
public String getDefaultLanguage()... |
216 |
|
{ |
217 |
421 |
return this.defaultLanguage; |
218 |
|
} |
219 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
220 |
1840 |
public void setDefaultLanguage(String defaultLanguage)... |
221 |
|
{ |
222 |
1840 |
this.defaultLanguage = Util.normalizeLanguage(defaultLanguage); |
223 |
|
} |
224 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
225 |
302 |
public String getTitle()... |
226 |
|
{ |
227 |
302 |
return this.title; |
228 |
|
} |
229 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
230 |
1946 |
public void setTitle(String title)... |
231 |
|
{ |
232 |
1947 |
this.title = title; |
233 |
|
} |
234 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
235 |
271 |
public String getComment()... |
236 |
|
{ |
237 |
271 |
return this.comment; |
238 |
|
} |
239 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
240 |
1897 |
public void setComment(String comment)... |
241 |
|
{ |
242 |
1897 |
this.comment = comment; |
243 |
|
} |
244 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
245 |
271 |
public boolean isMinorEdit()... |
246 |
|
{ |
247 |
271 |
return this.isMinorEdit; |
248 |
|
} |
249 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
250 |
1851 |
public void setMinorEdit(boolean isMinorEdit)... |
251 |
|
{ |
252 |
1851 |
this.isMinorEdit = isMinorEdit; |
253 |
|
} |
254 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
255 |
1 |
public boolean isLockForce()... |
256 |
|
{ |
257 |
1 |
return this.lockForce; |
258 |
|
} |
259 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
260 |
1839 |
public void setLockForce(boolean lockForce)... |
261 |
|
{ |
262 |
1840 |
this.lockForce = lockForce; |
263 |
|
} |
264 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
265 |
271 |
public String getSyntaxId()... |
266 |
|
{ |
267 |
271 |
return this.syntaxId; |
268 |
|
} |
269 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
270 |
1842 |
public void setSyntaxId(String syntaxId)... |
271 |
|
{ |
272 |
1842 |
this.syntaxId = syntaxId; |
273 |
|
} |
274 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
275 |
274 |
public String getHidden()... |
276 |
|
{ |
277 |
274 |
return this.hidden; |
278 |
|
} |
279 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
280 |
1840 |
public void setHidden(String hidden)... |
281 |
|
{ |
282 |
1840 |
this.hidden = hidden; |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
|
@link |
287 |
|
|
288 |
|
|
289 |
|
@return |
290 |
|
@since |
291 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
292 |
142 |
public ObjectPolicyType getObjectPolicy() {... |
293 |
142 |
return this.objectPolicy; |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
@link |
298 |
|
|
299 |
|
|
300 |
|
@since |
301 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
302 |
0 |
private void setObjectPolicy(ObjectPolicyType objectPolicy)... |
303 |
|
{ |
304 |
0 |
this.objectPolicy = objectPolicy; |
305 |
|
} |
306 |
|
|
307 |
|
|
308 |
|
@link |
309 |
|
|
310 |
|
@param@link |
311 |
|
@since |
312 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
313 |
1840 |
private void setObjectPolicy(String objectPolicyName)... |
314 |
|
{ |
315 |
1840 |
this.objectPolicy = ObjectPolicyType.forName(objectPolicyName); |
316 |
|
} |
317 |
|
} |