1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.api; |
21 |
|
|
22 |
|
import java.io.IOException; |
23 |
|
import java.io.InputStream; |
24 |
|
import java.util.ArrayList; |
25 |
|
import java.util.Collections; |
26 |
|
import java.util.Date; |
27 |
|
import java.util.HashMap; |
28 |
|
import java.util.List; |
29 |
|
import java.util.Locale; |
30 |
|
import java.util.Map; |
31 |
|
import java.util.Vector; |
32 |
|
|
33 |
|
import org.apache.commons.fileupload.FileItem; |
34 |
|
import org.apache.commons.lang3.StringUtils; |
35 |
|
import org.slf4j.Logger; |
36 |
|
import org.slf4j.LoggerFactory; |
37 |
|
import org.suigeneris.jrcs.diff.DifferentiationFailedException; |
38 |
|
import org.suigeneris.jrcs.diff.delta.Delta; |
39 |
|
import org.suigeneris.jrcs.rcs.Version; |
40 |
|
import org.xwiki.context.Execution; |
41 |
|
import org.xwiki.context.ExecutionContext; |
42 |
|
import org.xwiki.display.internal.DocumentDisplayerParameters; |
43 |
|
import org.xwiki.filter.output.OutputTarget; |
44 |
|
import org.xwiki.model.reference.DocumentReference; |
45 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
46 |
|
import org.xwiki.model.reference.EntityReferenceSerializer; |
47 |
|
import org.xwiki.rendering.block.XDOM; |
48 |
|
import org.xwiki.rendering.parser.ParseException; |
49 |
|
import org.xwiki.rendering.syntax.Syntax; |
50 |
|
import org.xwiki.rendering.syntax.SyntaxFactory; |
51 |
|
import org.xwiki.security.authorization.ContextualAuthorizationManager; |
52 |
|
|
53 |
|
import com.xpn.xwiki.XWiki; |
54 |
|
import com.xpn.xwiki.XWikiConstant; |
55 |
|
import com.xpn.xwiki.XWikiContext; |
56 |
|
import com.xpn.xwiki.XWikiException; |
57 |
|
import com.xpn.xwiki.criteria.impl.Period; |
58 |
|
import com.xpn.xwiki.criteria.impl.PeriodFactory; |
59 |
|
import com.xpn.xwiki.criteria.impl.Range; |
60 |
|
import com.xpn.xwiki.criteria.impl.RangeFactory; |
61 |
|
import com.xpn.xwiki.criteria.impl.RevisionCriteria; |
62 |
|
import com.xpn.xwiki.criteria.impl.Scope; |
63 |
|
import com.xpn.xwiki.criteria.impl.ScopeFactory; |
64 |
|
import com.xpn.xwiki.doc.MetaDataDiff; |
65 |
|
import com.xpn.xwiki.doc.XWikiAttachment; |
66 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
67 |
|
import com.xpn.xwiki.doc.XWikiDocumentArchive; |
68 |
|
import com.xpn.xwiki.doc.XWikiLink; |
69 |
|
import com.xpn.xwiki.doc.XWikiLock; |
70 |
|
import com.xpn.xwiki.objects.BaseObject; |
71 |
|
import com.xpn.xwiki.objects.BaseProperty; |
72 |
|
import com.xpn.xwiki.objects.ObjectDiff; |
73 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
74 |
|
import com.xpn.xwiki.plugin.fileupload.FileUploadPlugin; |
75 |
|
import com.xpn.xwiki.stats.api.XWikiStatsService; |
76 |
|
import com.xpn.xwiki.stats.impl.DocumentStats; |
77 |
|
import com.xpn.xwiki.stats.impl.RefererStats; |
78 |
|
import com.xpn.xwiki.util.TOCGenerator; |
79 |
|
import com.xpn.xwiki.util.Util; |
80 |
|
import com.xpn.xwiki.web.Utils; |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
@link |
85 |
|
|
86 |
|
|
87 |
|
@version |
88 |
|
|
|
|
| 44.1% |
Uncovered Elements: 639 (1,143) |
Complexity: 397 |
Complexity Density: 0.58 |
|
89 |
|
public class Document extends Api |
90 |
|
{ |
91 |
|
|
92 |
|
private static final Logger LOGGER = LoggerFactory.getLogger(Document.class); |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
protected XWikiDocument initialDoc; |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
protected XWikiDocument doc; |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
protected Object currentObj; |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
private DocumentReferenceResolver<String> currentMixedDocumentReferenceResolver; |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
private EntityReferenceSerializer<String> defaultEntityReferenceSerializer; |
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
private EntityReferenceSerializer<String> localEntityReferenceSerializer; |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
private EntityReferenceSerializer<String> compactWikiEntityReferenceSerializer; |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
private ContextualAuthorizationManager authorizationManager; |
135 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
136 |
2 |
private DocumentReferenceResolver<String> getCurrentMixedDocumentReferenceResolver()... |
137 |
|
{ |
138 |
2 |
if (this.currentMixedDocumentReferenceResolver == null) { |
139 |
2 |
this.currentMixedDocumentReferenceResolver = |
140 |
|
Utils.getComponent(DocumentReferenceResolver.TYPE_STRING, "currentmixed"); |
141 |
|
} |
142 |
|
|
143 |
2 |
return this.currentMixedDocumentReferenceResolver; |
144 |
|
} |
145 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
146 |
1477 |
private EntityReferenceSerializer<String> getDefaultEntityReferenceSerializer()... |
147 |
|
{ |
148 |
1477 |
if (this.defaultEntityReferenceSerializer == null) { |
149 |
988 |
this.defaultEntityReferenceSerializer = Utils.getComponent(EntityReferenceSerializer.TYPE_STRING); |
150 |
|
} |
151 |
|
|
152 |
1477 |
return this.defaultEntityReferenceSerializer; |
153 |
|
} |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
155 |
6768 |
private EntityReferenceSerializer<String> getLocalEntityReferenceSerializer()... |
156 |
|
{ |
157 |
6768 |
if (this.localEntityReferenceSerializer == null) { |
158 |
3385 |
this.localEntityReferenceSerializer = Utils.getComponent(EntityReferenceSerializer.TYPE_STRING, "local"); |
159 |
|
} |
160 |
|
|
161 |
6768 |
return this.localEntityReferenceSerializer; |
162 |
|
} |
163 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
164 |
0 |
private EntityReferenceSerializer<String> getCompactWikiEntityReferenceSerializer()... |
165 |
|
{ |
166 |
0 |
if (this.compactWikiEntityReferenceSerializer == null) { |
167 |
0 |
this.compactWikiEntityReferenceSerializer = |
168 |
|
Utils.getComponent(EntityReferenceSerializer.TYPE_STRING, "compactwiki"); |
169 |
|
} |
170 |
|
|
171 |
0 |
return this.compactWikiEntityReferenceSerializer; |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
@param |
178 |
|
@param |
179 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
180 |
193439 |
public Document(XWikiDocument doc, XWikiContext context)... |
181 |
|
{ |
182 |
193470 |
super(context); |
183 |
|
|
184 |
193433 |
this.initialDoc = doc; |
185 |
193432 |
this.doc = this.initialDoc; |
186 |
|
} |
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
@return |
193 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
194 |
8 |
public XWikiDocument getDocument()... |
195 |
|
{ |
196 |
8 |
if (hasProgrammingRights()) { |
197 |
8 |
return this.doc; |
198 |
|
} else { |
199 |
0 |
return null; |
200 |
|
} |
201 |
|
} |
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
@return |
207 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
208 |
27192 |
protected XWikiDocument getDoc()... |
209 |
|
{ |
210 |
27192 |
if (this.initialDoc == this.doc) { |
211 |
18529 |
this.doc = this.initialDoc.clone(); |
212 |
|
} |
213 |
|
|
214 |
27194 |
return this.doc; |
215 |
|
} |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@return |
221 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
222 |
0 |
public long getId()... |
223 |
|
{ |
224 |
0 |
return this.doc.getId(); |
225 |
|
} |
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
@return |
231 |
|
@since |
232 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
233 |
14240 |
public DocumentReference getDocumentReference()... |
234 |
|
{ |
235 |
14239 |
return this.doc.getDocumentReference(); |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
@return |
242 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
243 |
9101 |
public String getName()... |
244 |
|
{ |
245 |
9099 |
return this.doc.getDocumentReference().getName(); |
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
@return |
253 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
254 |
8570 |
public String getSpace()... |
255 |
|
{ |
256 |
8569 |
return this.doc.getSpace(); |
257 |
|
} |
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
@return |
263 |
|
@since |
264 |
|
@since |
265 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
266 |
4282 |
public String getWiki()... |
267 |
|
{ |
268 |
4282 |
return this.doc.getDocumentReference().getWikiReference().getName(); |
269 |
|
} |
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
@return |
276 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
277 |
6460 |
public String getFullName()... |
278 |
|
{ |
279 |
6460 |
return getLocalEntityReferenceSerializer().serialize(this.doc.getDocumentReference()); |
280 |
|
} |
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
@return |
288 |
|
@since |
289 |
|
@since |
290 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
291 |
1476 |
public String getPrefixedFullName()... |
292 |
|
{ |
293 |
1476 |
return getDefaultEntityReferenceSerializer().serialize(this.doc.getDocumentReference()); |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
@return |
300 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
301 |
852 |
public Version getRCSVersion()... |
302 |
|
{ |
303 |
852 |
return this.doc.getRCSVersion(); |
304 |
|
} |
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
@return |
310 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
311 |
1848 |
public String getVersion()... |
312 |
|
{ |
313 |
1848 |
return this.doc.getVersion(); |
314 |
|
} |
315 |
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
@return |
320 |
|
|
321 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
322 |
0 |
public String getPreviousVersion()... |
323 |
|
{ |
324 |
0 |
return this.doc.getPreviousVersion(); |
325 |
|
} |
326 |
|
|
327 |
|
|
328 |
|
|
329 |
|
|
330 |
|
@return |
331 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
332 |
454 |
public String getTitle()... |
333 |
|
{ |
334 |
454 |
return this.doc.getTitle(); |
335 |
|
} |
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
@return |
343 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
344 |
15896 |
public String getDisplayTitle()... |
345 |
|
{ |
346 |
15896 |
return this.doc.getRenderedTitle(getXWikiContext()); |
347 |
|
} |
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
@return |
353 |
|
@since |
354 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
355 |
2493 |
public String getPlainTitle()... |
356 |
|
{ |
357 |
2493 |
return this.doc.getRenderedTitle(Syntax.PLAIN_1_0, getXWikiContext()); |
358 |
|
} |
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
@return |
364 |
|
@see |
365 |
|
|
|
|
| 33.3% |
Uncovered Elements: 4 (6) |
Complexity: 3 |
Complexity Density: 0.5 |
|
366 |
373 |
public String getRenderedTitle(String syntaxId) throws XWikiException... |
367 |
|
{ |
368 |
373 |
try { |
369 |
373 |
return this.doc.getRenderedTitle(Utils.getComponent(SyntaxFactory.class).createSyntaxFromIdString(syntaxId), |
370 |
|
getXWikiContext()); |
371 |
|
} catch (ParseException e) { |
372 |
0 |
LOGGER.error("Failed to parse provided syntax identifier [" + syntaxId + "]", e); |
373 |
|
|
374 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_RENDERING, XWikiException.ERROR_XWIKI_UNKNOWN, |
375 |
|
"Failed to parse syntax identifier [" + syntaxId + "]", e); |
376 |
|
} catch (Exception e) { |
377 |
0 |
LOGGER.error("Failed to render document [" + getPrefixedFullName() + "] title content", e); |
378 |
|
|
379 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_RENDERING, XWikiException.ERROR_XWIKI_UNKNOWN, |
380 |
|
"Failed to render document [" + getPrefixedFullName() + "] content title", e); |
381 |
|
} |
382 |
|
} |
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
387 |
0 |
public String getFormat()... |
388 |
|
{ |
389 |
0 |
return this.doc.getFormat(); |
390 |
|
} |
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
@return |
396 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
397 |
1202 |
public String getAuthor()... |
398 |
|
{ |
399 |
1202 |
return this.doc.getAuthor(); |
400 |
|
} |
401 |
|
|
402 |
|
|
403 |
|
@return |
404 |
|
@since |
405 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
406 |
84 |
public DocumentReference getAuthorReference()... |
407 |
|
{ |
408 |
84 |
return this.doc.getAuthorReference(); |
409 |
|
} |
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
414 |
|
|
415 |
|
@return |
416 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
417 |
428 |
public String getContentAuthor()... |
418 |
|
{ |
419 |
428 |
return this.doc.getContentAuthor(); |
420 |
|
} |
421 |
|
|
422 |
|
|
423 |
|
@return |
424 |
|
@since |
425 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
426 |
6 |
public DocumentReference getContentAuthorReference()... |
427 |
|
{ |
428 |
6 |
return this.doc.getContentAuthorReference(); |
429 |
|
} |
430 |
|
|
431 |
|
|
432 |
|
@return |
433 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
434 |
520 |
public Date getDate()... |
435 |
|
{ |
436 |
520 |
return this.doc.getDate(); |
437 |
|
} |
438 |
|
|
439 |
|
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
|
@return |
444 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
445 |
415 |
public Date getContentUpdateDate()... |
446 |
|
{ |
447 |
415 |
return this.doc.getContentUpdateDate(); |
448 |
|
} |
449 |
|
|
450 |
|
|
451 |
|
@return |
452 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
453 |
868 |
public Date getCreationDate()... |
454 |
|
{ |
455 |
868 |
return this.doc.getCreationDate(); |
456 |
|
} |
457 |
|
|
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
@return |
462 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
463 |
7668 |
public String getParent()... |
464 |
|
{ |
465 |
7667 |
return this.doc.getParent(); |
466 |
|
} |
467 |
|
|
468 |
|
|
469 |
|
@return |
470 |
|
@since |
471 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
472 |
553 |
public DocumentReference getParentReference()... |
473 |
|
{ |
474 |
553 |
return this.doc.getParentReference(); |
475 |
|
} |
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
@return |
481 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
482 |
833 |
public String getCreator()... |
483 |
|
{ |
484 |
833 |
return this.doc.getCreator(); |
485 |
|
} |
486 |
|
|
487 |
|
|
488 |
|
@return |
489 |
|
@since |
490 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
491 |
84 |
public DocumentReference getCreatorReference()... |
492 |
|
{ |
493 |
84 |
return this.doc.getCreatorReference(); |
494 |
|
} |
495 |
|
|
496 |
|
|
497 |
|
|
498 |
|
|
499 |
|
@return |
500 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
501 |
479 |
public String getContent()... |
502 |
|
{ |
503 |
479 |
return this.doc.getContent(); |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
@return |
510 |
|
@since |
511 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
512 |
0 |
public XDOM getXDOM()... |
513 |
|
{ |
514 |
0 |
return this.doc.getXDOM(); |
515 |
|
} |
516 |
|
|
517 |
|
|
518 |
|
@return |
519 |
|
@since |
520 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
521 |
4033 |
public Syntax getSyntax()... |
522 |
|
{ |
523 |
4032 |
return this.doc.getSyntax(); |
524 |
|
} |
525 |
|
|
526 |
|
|
527 |
|
|
528 |
|
|
529 |
|
|
530 |
|
@return |
531 |
|
@deprecated@link |
532 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
533 |
3 |
@Deprecated... |
534 |
|
public String getSyntaxId() |
535 |
|
{ |
536 |
3 |
return this.doc.getSyntax().toIdString(); |
537 |
|
} |
538 |
|
|
539 |
|
|
540 |
|
@link |
541 |
|
|
542 |
|
@return |
543 |
|
@deprecated@link |
544 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
545 |
0 |
@Deprecated... |
546 |
|
public String getLanguage() |
547 |
|
{ |
548 |
0 |
return this.doc.getLanguage(); |
549 |
|
} |
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
@return |
556 |
|
@since |
557 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
558 |
720 |
public Locale getLocale()... |
559 |
|
{ |
560 |
718 |
return this.doc.getLocale(); |
561 |
|
} |
562 |
|
|
563 |
|
|
564 |
|
|
565 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
566 |
0 |
public String getTemplate()... |
567 |
|
{ |
568 |
0 |
String templateReferenceAsString = ""; |
569 |
0 |
DocumentReference templateDocumentReference = this.doc.getTemplateDocumentReference(); |
570 |
0 |
if (templateDocumentReference != null) { |
571 |
0 |
templateReferenceAsString = getLocalEntityReferenceSerializer().serialize(templateDocumentReference); |
572 |
|
} |
573 |
0 |
return templateReferenceAsString; |
574 |
|
} |
575 |
|
|
576 |
|
|
577 |
|
@link |
578 |
|
|
579 |
|
@return |
580 |
|
@deprecated@link |
581 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
582 |
22 |
@Deprecated... |
583 |
|
public String getRealLanguage() throws XWikiException |
584 |
|
{ |
585 |
22 |
return this.doc.getRealLanguage(getXWikiContext()); |
586 |
|
} |
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
@return |
594 |
|
@since |
595 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
596 |
772 |
public Locale getRealLocale()... |
597 |
|
{ |
598 |
772 |
return this.doc.getRealLocale(); |
599 |
|
} |
600 |
|
|
601 |
|
|
602 |
|
@link |
603 |
|
|
604 |
|
@return |
605 |
|
@deprecated@link |
606 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
607 |
11 |
@Deprecated... |
608 |
|
public String getDefaultLanguage() |
609 |
|
{ |
610 |
11 |
return this.doc.getDefaultLanguage(); |
611 |
|
} |
612 |
|
|
613 |
|
|
614 |
|
@return@link@link |
615 |
|
@since |
616 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
617 |
0 |
public Locale getDefaultLocale()... |
618 |
|
{ |
619 |
0 |
return this.doc.getDefaultLocale(); |
620 |
|
} |
621 |
|
|
622 |
|
|
623 |
|
|
624 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
625 |
0 |
public String getDefaultTemplate()... |
626 |
|
{ |
627 |
0 |
return this.doc.getDefaultTemplate(); |
628 |
|
} |
629 |
|
|
630 |
|
|
631 |
|
@return |
632 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
633 |
419 |
public String getComment()... |
634 |
|
{ |
635 |
419 |
return this.doc.getComment(); |
636 |
|
} |
637 |
|
|
638 |
|
|
639 |
|
@return |
640 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
641 |
0 |
public boolean isMinorEdit()... |
642 |
|
{ |
643 |
0 |
return this.doc.isMinorEdit(); |
644 |
|
} |
645 |
|
|
646 |
|
|
647 |
|
@return |
648 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
649 |
553 |
public List<String> getTranslationList() throws XWikiException... |
650 |
|
{ |
651 |
553 |
return this.doc.getTranslationList(getXWikiContext()); |
652 |
|
} |
653 |
|
|
654 |
|
|
655 |
|
@return |
656 |
|
|
657 |
|
|
658 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
659 |
158 |
public String getTranslatedContent() throws XWikiException... |
660 |
|
{ |
661 |
158 |
return this.doc.getTranslatedContent(getXWikiContext()); |
662 |
|
} |
663 |
|
|
664 |
|
|
665 |
|
@return |
666 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
667 |
0 |
public String getTranslatedContent(String locale) throws XWikiException... |
668 |
|
{ |
669 |
0 |
return this.doc.getTranslatedContent(locale, getXWikiContext()); |
670 |
|
} |
671 |
|
|
672 |
|
|
673 |
|
@return |
674 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
675 |
0 |
public Document getTranslatedDocument(String locale) throws XWikiException... |
676 |
|
{ |
677 |
0 |
return this.doc.getTranslatedDocument(locale, getXWikiContext()).newDocument(getXWikiContext()); |
678 |
|
} |
679 |
|
|
680 |
|
|
681 |
|
@return |
682 |
|
|
683 |
|
|
684 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
685 |
14861 |
public Document getTranslatedDocument() throws XWikiException... |
686 |
|
{ |
687 |
14861 |
return this.doc.getTranslatedDocument(getXWikiContext()).newDocument(getXWikiContext()); |
688 |
|
} |
689 |
|
|
690 |
|
|
691 |
|
@return |
692 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
693 |
592 |
public String getRenderedContent() throws XWikiException... |
694 |
|
{ |
695 |
592 |
return this.doc.getRenderedContent(getXWikiContext()); |
696 |
|
} |
697 |
|
|
698 |
|
|
699 |
|
|
700 |
|
|
701 |
|
|
702 |
|
|
703 |
|
@param@link |
704 |
|
@return |
705 |
|
@throws |
706 |
|
@since |
707 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
708 |
0 |
public String getRenderedContent(boolean transformationContextIsolated) throws XWikiException... |
709 |
|
{ |
710 |
0 |
return this.doc.getRenderedContent(transformationContextIsolated, getXWikiContext()); |
711 |
|
} |
712 |
|
|
713 |
|
|
714 |
|
@param |
715 |
|
@return |
716 |
|
@deprecated@link |
717 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
718 |
0 |
@Deprecated... |
719 |
|
public String getRenderedContent(String text) throws XWikiException |
720 |
|
{ |
721 |
0 |
return getRenderedContent(text, Syntax.XWIKI_1_0.toIdString()); |
722 |
|
} |
723 |
|
|
724 |
|
|
725 |
|
@param |
726 |
|
@param |
727 |
|
@return |
728 |
|
@since |
729 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
730 |
12 |
public String getRenderedContent(String text, String syntaxId) throws XWikiException... |
731 |
|
{ |
732 |
12 |
return getRenderedContent(text, syntaxId, false); |
733 |
|
} |
734 |
|
|
735 |
|
|
736 |
|
|
737 |
|
|
738 |
|
@param |
739 |
|
@param |
740 |
|
@return |
741 |
|
@since |
742 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
743 |
18 |
public String getRenderedContentRestricted(String text, String syntaxId) throws XWikiException... |
744 |
|
{ |
745 |
18 |
return getRenderedContent(text, syntaxId, true); |
746 |
|
} |
747 |
|
|
748 |
|
|
749 |
|
|
750 |
|
|
751 |
|
@param |
752 |
|
@param |
753 |
|
@param@link |
754 |
|
@return |
755 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
756 |
30 |
private String getRenderedContent(String text, String syntaxId, boolean restricted) throws XWikiException... |
757 |
|
{ |
758 |
|
|
759 |
30 |
return this.doc.getRenderedContent(text, syntaxId, restricted, getCallerDocument(getXWikiContext()), |
760 |
|
getXWikiContext()); |
761 |
|
} |
762 |
|
|
763 |
|
|
764 |
|
@param |
765 |
|
@param |
766 |
|
@param |
767 |
|
@return |
768 |
|
@since |
769 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
770 |
4 |
public String getRenderedContent(String text, String sourceSyntaxId, String targetSyntaxId) throws XWikiException... |
771 |
|
{ |
772 |
|
|
773 |
4 |
return this.doc.getRenderedContent(text, sourceSyntaxId, targetSyntaxId, false, |
774 |
|
getCallerDocument(getXWikiContext()), getXWikiContext()); |
775 |
|
} |
776 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
777 |
34 |
private XWikiDocument getCallerDocument(XWikiContext xcontext)... |
778 |
|
{ |
779 |
34 |
XWikiDocument sdoc = (XWikiDocument) xcontext.get("sdoc"); |
780 |
34 |
if (sdoc == null) { |
781 |
7 |
sdoc = xcontext.getDoc(); |
782 |
|
} |
783 |
|
|
784 |
34 |
return sdoc; |
785 |
|
} |
786 |
|
|
787 |
|
|
788 |
|
@param |
789 |
|
@return |
790 |
|
@throws |
791 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
792 |
5207 |
public String getRenderedContent(Syntax targetSyntax) throws XWikiException... |
793 |
|
{ |
794 |
5207 |
return this.doc.getRenderedContent(targetSyntax, getXWikiContext()); |
795 |
|
} |
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
|
@return |
801 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
802 |
0 |
public String getEscapedContent() throws XWikiException... |
803 |
|
{ |
804 |
0 |
return this.doc.getEscapedContent(getXWikiContext()); |
805 |
|
} |
806 |
|
|
807 |
|
|
808 |
|
@return |
809 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
810 |
0 |
public String getArchive() throws XWikiException... |
811 |
|
{ |
812 |
0 |
return this.doc.getDocumentArchive(getXWikiContext()).getArchive(getXWikiContext()); |
813 |
|
} |
814 |
|
|
815 |
|
|
816 |
|
|
817 |
|
|
818 |
|
@return@link |
819 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
820 |
0 |
public XWikiDocumentArchive getDocumentArchive() throws XWikiException... |
821 |
|
{ |
822 |
0 |
if (hasProgrammingRights()) { |
823 |
0 |
return this.doc.getDocumentArchive(getXWikiContext()); |
824 |
|
} |
825 |
0 |
return null; |
826 |
|
} |
827 |
|
|
828 |
|
|
829 |
|
@return |
830 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
831 |
9189 |
public boolean isNew()... |
832 |
|
{ |
833 |
9186 |
return this.doc.isNew(); |
834 |
|
} |
835 |
|
|
836 |
|
|
837 |
|
|
838 |
|
|
839 |
|
@param |
840 |
|
@return |
841 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
842 |
10 |
public String getAttachmentURL(String filename)... |
843 |
|
{ |
844 |
10 |
return this.doc.getAttachmentURL(filename, getXWikiContext()); |
845 |
|
} |
846 |
|
|
847 |
|
|
848 |
|
|
849 |
|
|
850 |
|
@param |
851 |
|
@param |
852 |
|
@return |
853 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
854 |
3 |
public String getAttachmentURL(String filename, String action)... |
855 |
|
{ |
856 |
3 |
return this.doc.getAttachmentURL(filename, action, getXWikiContext()); |
857 |
|
} |
858 |
|
|
859 |
|
|
860 |
|
|
861 |
|
|
862 |
|
|
863 |
|
@param |
864 |
|
@param |
865 |
|
@param |
866 |
|
|
867 |
|
@return |
868 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
869 |
24 |
public String getAttachmentURL(String filename, String action, String queryString)... |
870 |
|
{ |
871 |
24 |
return this.doc.getAttachmentURL(filename, action, queryString, getXWikiContext()); |
872 |
|
} |
873 |
|
|
874 |
|
|
875 |
|
|
876 |
|
|
877 |
|
@param |
878 |
|
@param |
879 |
|
@return |
880 |
|
|
881 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
882 |
0 |
public String getAttachmentRevisionURL(String filename, String version)... |
883 |
|
{ |
884 |
0 |
return this.doc.getAttachmentRevisionURL(filename, version, getXWikiContext()); |
885 |
|
} |
886 |
|
|
887 |
|
|
888 |
|
|
889 |
|
|
890 |
|
@param |
891 |
|
@param |
892 |
|
@param |
893 |
|
@return |
894 |
|
|
895 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
896 |
0 |
public String getAttachmentRevisionURL(String filename, String version, String queryString)... |
897 |
|
{ |
898 |
0 |
return this.doc.getAttachmentRevisionURL(filename, version, queryString, getXWikiContext()); |
899 |
|
} |
900 |
|
|
901 |
|
|
902 |
|
|
903 |
|
|
904 |
|
@return |
905 |
|
@see |
906 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
907 |
7226 |
public String getURL()... |
908 |
|
{ |
909 |
7226 |
return this.doc.getURL("view", getXWikiContext()); |
910 |
|
} |
911 |
|
|
912 |
|
|
913 |
|
|
914 |
|
|
915 |
|
@param |
916 |
|
@return |
917 |
|
@see |
918 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
919 |
21415 |
public String getURL(String action)... |
920 |
|
{ |
921 |
21414 |
return this.doc.getURL(action, getXWikiContext()); |
922 |
|
} |
923 |
|
|
924 |
|
|
925 |
|
|
926 |
|
|
927 |
|
@param |
928 |
|
@param |
929 |
|
@return |
930 |
|
@see |
931 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
932 |
13478 |
public String getURL(String action, String queryString)... |
933 |
|
{ |
934 |
13477 |
return this.doc.getURL(action, queryString, getXWikiContext()); |
935 |
|
} |
936 |
|
|
937 |
|
|
938 |
|
|
939 |
|
|
940 |
|
@return |
941 |
|
|
942 |
|
@see |
943 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
944 |
17 |
public String getExternalURL()... |
945 |
|
{ |
946 |
17 |
return this.doc.getExternalURL("view", getXWikiContext()); |
947 |
|
} |
948 |
|
|
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
@param |
953 |
|
@return |
954 |
|
@see |
955 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
956 |
553 |
public String getExternalURL(String action)... |
957 |
|
{ |
958 |
553 |
return this.doc.getExternalURL(action, getXWikiContext()); |
959 |
|
} |
960 |
|
|
961 |
|
|
962 |
|
|
963 |
|
|
964 |
|
@param |
965 |
|
@param |
966 |
|
@return |
967 |
|
@see |
968 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
969 |
25 |
public String getExternalURL(String action, String queryString)... |
970 |
|
{ |
971 |
25 |
return this.doc.getExternalURL(action, queryString, getXWikiContext()); |
972 |
|
} |
973 |
|
|
974 |
|
|
975 |
|
@return |
976 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
977 |
0 |
public String getParentURL() throws XWikiException... |
978 |
|
{ |
979 |
0 |
return this.doc.getParentURL(getXWikiContext()); |
980 |
|
} |
981 |
|
|
982 |
|
|
983 |
|
@return |
984 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
985 |
585 |
public Class getxWikiClass()... |
986 |
|
{ |
987 |
585 |
BaseClass bclass = this.getDoc().getXClass(); |
988 |
585 |
if (bclass == null) { |
989 |
0 |
return null; |
990 |
|
} else { |
991 |
585 |
return new Class(bclass, getXWikiContext()); |
992 |
|
} |
993 |
|
} |
994 |
|
|
995 |
|
|
996 |
|
@return |
997 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
998 |
44 |
public Class[] getxWikiClasses()... |
999 |
|
{ |
1000 |
44 |
List<BaseClass> list = this.getDoc().getXClasses(getXWikiContext()); |
1001 |
44 |
if (list == null) { |
1002 |
0 |
return null; |
1003 |
|
} |
1004 |
44 |
Class[] result = new Class[list.size()]; |
1005 |
112 |
for (int i = 0; i < list.size(); i++) { |
1006 |
68 |
result[i] = new Class(list.get(i), getXWikiContext()); |
1007 |
|
} |
1008 |
44 |
return result; |
1009 |
|
} |
1010 |
|
|
1011 |
|
|
1012 |
|
|
1013 |
|
|
1014 |
|
@param |
1015 |
|
@return |
1016 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1017 |
80 |
public int createNewObject(String classname) throws XWikiException... |
1018 |
|
{ |
1019 |
80 |
int index = getDoc().createNewObject(classname, getXWikiContext()); |
1020 |
|
|
1021 |
80 |
updateAuthor(); |
1022 |
|
|
1023 |
80 |
return index; |
1024 |
|
} |
1025 |
|
|
1026 |
|
|
1027 |
|
|
1028 |
|
|
1029 |
|
@param |
1030 |
|
@return |
1031 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1032 |
77 |
public Object newObject(String classname) throws XWikiException... |
1033 |
|
{ |
1034 |
77 |
int nb = createNewObject(classname); |
1035 |
77 |
return getObject(classname, nb); |
1036 |
|
} |
1037 |
|
|
1038 |
|
|
1039 |
|
@return |
1040 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1041 |
0 |
public boolean isFromCache()... |
1042 |
|
{ |
1043 |
0 |
return this.doc.isFromCache(); |
1044 |
|
} |
1045 |
|
|
1046 |
|
|
1047 |
|
@param |
1048 |
|
@return |
1049 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1050 |
0 |
public int getObjectNumbers(String classname)... |
1051 |
|
{ |
1052 |
0 |
return this.doc.getObjectNumbers(classname); |
1053 |
|
} |
1054 |
|
|
1055 |
|
|
1056 |
|
|
1057 |
|
|
1058 |
|
@return |
1059 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
1060 |
642 |
public Map<String, Vector<Object>> getxWikiObjects()... |
1061 |
|
{ |
1062 |
642 |
Map<DocumentReference, List<BaseObject>> map = this.getDoc().getXObjects(); |
1063 |
642 |
Map<String, Vector<Object>> resultmap = new HashMap<String, Vector<Object>>(); |
1064 |
642 |
for (Map.Entry<DocumentReference, List<BaseObject>> entry : map.entrySet()) { |
1065 |
308 |
List<BaseObject> objects = entry.getValue(); |
1066 |
308 |
if (objects != null) { |
1067 |
308 |
resultmap.put(getLocalEntityReferenceSerializer().serialize(entry.getKey()), getXObjects(objects)); |
1068 |
|
} |
1069 |
|
} |
1070 |
642 |
return resultmap; |
1071 |
|
} |
1072 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
1073 |
2513 |
protected Vector<Object> getXObjects(List<BaseObject> objects)... |
1074 |
|
{ |
1075 |
2513 |
if (objects == null) { |
1076 |
1522 |
return new Vector<Object>(0); |
1077 |
|
} |
1078 |
991 |
Vector<Object> result = new Vector<Object>(objects.size()); |
1079 |
991 |
for (BaseObject bobj : objects) { |
1080 |
1220 |
if (bobj != null) { |
1081 |
1200 |
result.add(newObjectApi(bobj, getXWikiContext())); |
1082 |
|
} |
1083 |
|
} |
1084 |
991 |
return result; |
1085 |
|
} |
1086 |
|
|
1087 |
|
|
1088 |
|
|
1089 |
|
|
1090 |
|
@return |
1091 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1092 |
1355 |
public Vector<Object> getObjects(String className)... |
1093 |
|
{ |
1094 |
1355 |
List<BaseObject> objects = this.getDoc().getXObjects(this.doc.resolveClassReference(className)); |
1095 |
1355 |
return getXObjects(objects); |
1096 |
|
} |
1097 |
|
|
1098 |
|
|
1099 |
|
|
1100 |
|
|
1101 |
|
@param |
1102 |
|
@return |
1103 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1104 |
3 |
public Object getFirstObject(String fieldname)... |
1105 |
|
{ |
1106 |
3 |
try { |
1107 |
3 |
BaseObject obj = this.getDoc().getFirstObject(fieldname, getXWikiContext()); |
1108 |
3 |
if (obj == null) { |
1109 |
0 |
return null; |
1110 |
|
} else { |
1111 |
3 |
return newObjectApi(obj, getXWikiContext()); |
1112 |
|
} |
1113 |
|
} catch (Exception e) { |
1114 |
0 |
return null; |
1115 |
|
} |
1116 |
|
} |
1117 |
|
|
1118 |
|
|
1119 |
|
|
1120 |
|
|
1121 |
|
@param |
1122 |
|
@param |
1123 |
|
@param |
1124 |
|
@param |
1125 |
|
@return |
1126 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1127 |
1 |
public Object getObject(String classname, String key, String value, boolean failover)... |
1128 |
|
{ |
1129 |
1 |
try { |
1130 |
1 |
BaseObject obj = this.getDoc().getObject(classname, key, value, failover); |
1131 |
1 |
if (obj == null) { |
1132 |
0 |
return null; |
1133 |
|
} else { |
1134 |
1 |
return newObjectApi(obj, getXWikiContext()); |
1135 |
|
} |
1136 |
|
} catch (Exception e) { |
1137 |
0 |
return null; |
1138 |
|
} |
1139 |
|
} |
1140 |
|
|
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
|
@param |
1145 |
|
@param |
1146 |
|
@param |
1147 |
|
@return@link |
1148 |
|
|
1149 |
|
|
|
|
| 84% |
Uncovered Elements: 4 (25) |
Complexity: 10 |
Complexity Density: 0.67 |
|
1150 |
15 |
public Vector<Object> getObjects(String classname, String key, String value)... |
1151 |
|
{ |
1152 |
15 |
Vector<Object> result = new Vector<Object>(); |
1153 |
15 |
if (StringUtils.isBlank(key) || value == null) { |
1154 |
0 |
return getObjects(classname); |
1155 |
|
} |
1156 |
15 |
try { |
1157 |
15 |
Vector<BaseObject> allObjects = this.getDoc().getObjects(classname); |
1158 |
15 |
if (allObjects == null || allObjects.size() == 0) { |
1159 |
0 |
return result; |
1160 |
|
} else { |
1161 |
15 |
for (BaseObject obj : allObjects) { |
1162 |
40 |
if (obj != null) { |
1163 |
34 |
BaseProperty prop = (BaseProperty) obj.get(key); |
1164 |
34 |
if (prop == null || prop.getValue() == null) { |
1165 |
20 |
continue; |
1166 |
|
} |
1167 |
14 |
if (value.equals(prop.getValue().toString())) { |
1168 |
9 |
result.add(newObjectApi(obj, getXWikiContext())); |
1169 |
|
} |
1170 |
|
} |
1171 |
|
} |
1172 |
|
} |
1173 |
|
} catch (Exception e) { |
1174 |
|
} |
1175 |
15 |
return result; |
1176 |
|
} |
1177 |
|
|
1178 |
|
|
1179 |
|
|
1180 |
|
|
1181 |
|
|
1182 |
|
@param |
1183 |
|
@param |
1184 |
|
@param |
1185 |
|
@return |
1186 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1187 |
238 |
public Object getObject(String classname, String key, String value)... |
1188 |
|
{ |
1189 |
238 |
try { |
1190 |
238 |
BaseObject obj = this.getDoc().getObject(classname, key, value); |
1191 |
238 |
if (obj == null) { |
1192 |
64 |
return null; |
1193 |
|
} else { |
1194 |
174 |
return newObjectApi(obj, getXWikiContext()); |
1195 |
|
} |
1196 |
|
} catch (Exception e) { |
1197 |
0 |
return null; |
1198 |
|
} |
1199 |
|
} |
1200 |
|
|
1201 |
|
|
1202 |
|
|