| 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 |
|
|
| 1203 |
|
|
| 1204 |
|
@param |
| 1205 |
|
@return |
| 1206 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1207 |
7866 |
public Object getObject(String classname)... |
| 1208 |
|
{ |
| 1209 |
7864 |
return getObject(classname, false); |
| 1210 |
|
} |
| 1211 |
|
|
| 1212 |
|
|
| 1213 |
|
|
| 1214 |
|
|
| 1215 |
|
|
| 1216 |
|
@param |
| 1217 |
|
@param |
| 1218 |
|
@return |
| 1219 |
|
|
| |
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 1220 |
7869 |
public Object getObject(String classname, boolean create)... |
| 1221 |
|
{ |
| 1222 |
7870 |
try { |
| 1223 |
7870 |
BaseObject obj = getDoc().getObject(classname, create, getXWikiContext()); |
| 1224 |
|
|
| 1225 |
7870 |
if (obj == null) { |
| 1226 |
6270 |
return null; |
| 1227 |
|
} else { |
| 1228 |
1600 |
return newObjectApi(obj, getXWikiContext()); |
| 1229 |
|
} |
| 1230 |
|
} catch (Exception e) { |
| 1231 |
0 |
return null; |
| 1232 |
|
} |
| 1233 |
|
} |
| 1234 |
|
|
| 1235 |
|
|
| 1236 |
|
|
| 1237 |
|
|
| 1238 |
|
@param |
| 1239 |
|
@param |
| 1240 |
|
@return |
| 1241 |
|
|
| |
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 1242 |
7982 |
public Object getObject(String classname, int nb)... |
| 1243 |
|
{ |
| 1244 |
7982 |
try { |
| 1245 |
7982 |
BaseObject obj = this.getDoc().getObject(classname, nb); |
| 1246 |
7981 |
if (obj == null) { |
| 1247 |
4474 |
return null; |
| 1248 |
|
} else { |
| 1249 |
3502 |
return newObjectApi(obj, getXWikiContext()); |
| 1250 |
|
} |
| 1251 |
|
} catch (Exception e) { |
| 1252 |
0 |
return null; |
| 1253 |
|
} |
| 1254 |
|
} |
| 1255 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1256 |
6488 |
private Object newObjectApi(BaseObject obj, XWikiContext context)... |
| 1257 |
|
{ |
| 1258 |
6488 |
return obj.newObjectApi(obj, context); |
| 1259 |
|
} |
| 1260 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 1261 |
0 |
public String getXMLContent() throws XWikiException... |
| 1262 |
|
{ |
| 1263 |
0 |
String xml = this.doc.getXMLContent(getXWikiContext()); |
| 1264 |
0 |
return getXWikiContext().getUtil().substitute("s/<email>.*?<\\/email>/<email>********<\\/email>/goi", |
| 1265 |
|
getXWikiContext().getUtil().substitute("s/<password>.*?<\\/password>/<password>********<\\/password>/goi", |
| 1266 |
|
xml)); |
| 1267 |
|
} |
| 1268 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1269 |
0 |
public String toXML() throws XWikiException... |
| 1270 |
|
{ |
| 1271 |
0 |
if (hasProgrammingRights()) { |
| 1272 |
0 |
return this.doc.toXML(getXWikiContext()); |
| 1273 |
|
} else { |
| 1274 |
0 |
return ""; |
| 1275 |
|
} |
| 1276 |
|
} |
| 1277 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1278 |
0 |
public org.dom4j.Document toXMLDocument() throws XWikiException... |
| 1279 |
|
{ |
| 1280 |
0 |
if (hasProgrammingRights()) { |
| 1281 |
0 |
return this.doc.toXMLDocument(getXWikiContext()); |
| 1282 |
|
} else { |
| 1283 |
0 |
return null; |
| 1284 |
|
} |
| 1285 |
|
} |
| 1286 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1287 |
0 |
public Version[] getRevisions() throws XWikiException... |
| 1288 |
|
{ |
| 1289 |
0 |
return this.doc.getRevisions(getXWikiContext()); |
| 1290 |
|
} |
| 1291 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1292 |
0 |
public String[] getRecentRevisions() throws XWikiException... |
| 1293 |
|
{ |
| 1294 |
0 |
return this.doc.getRecentRevisions(5, getXWikiContext()); |
| 1295 |
|
} |
| 1296 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1297 |
0 |
public String[] getRecentRevisions(int nb) throws XWikiException... |
| 1298 |
|
{ |
| 1299 |
0 |
return this.doc.getRecentRevisions(nb, getXWikiContext()); |
| 1300 |
|
} |
| 1301 |
|
|
| 1302 |
|
|
| 1303 |
|
|
| 1304 |
|
|
| 1305 |
|
@param |
| 1306 |
|
@return |
| 1307 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1308 |
14 |
public List<String> getRevisions(RevisionCriteria criteria) throws XWikiException... |
| 1309 |
|
{ |
| 1310 |
14 |
return this.doc.getRevisions(criteria, this.context); |
| 1311 |
|
} |
| 1312 |
|
|
| 1313 |
|
|
| 1314 |
|
|
| 1315 |
|
|
| 1316 |
|
@param |
| 1317 |
|
@return |
| 1318 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1319 |
11 |
public RevisionInfo getRevisionInfo(String version) throws XWikiException... |
| 1320 |
|
{ |
| 1321 |
11 |
return new RevisionInfo(this.doc.getRevisionInfo(version, getXWikiContext()), getXWikiContext()); |
| 1322 |
|
} |
| 1323 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 1324 |
1685 |
public List<Attachment> getAttachmentList()... |
| 1325 |
|
{ |
| 1326 |
1685 |
List<Attachment> apis = new ArrayList<Attachment>(); |
| 1327 |
1685 |
for (XWikiAttachment attachment : this.getDoc().getAttachmentList()) { |
| 1328 |
190 |
apis.add(new Attachment(this, attachment, getXWikiContext())); |
| 1329 |
|
} |
| 1330 |
1685 |
return apis; |
| 1331 |
|
} |
| 1332 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1333 |
850 |
public Vector<Object> getComments()... |
| 1334 |
|
{ |
| 1335 |
850 |
return getComments(true); |
| 1336 |
|
} |
| 1337 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1338 |
850 |
public Vector<Object> getComments(boolean asc)... |
| 1339 |
|
{ |
| 1340 |
850 |
return getXObjects(this.getDoc().getComments(asc)); |
| 1341 |
|
} |
| 1342 |
|
|
| 1343 |
|
|
| 1344 |
|
|
| 1345 |
|
|
| 1346 |
|
|
| 1347 |
|
@param |
| 1348 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1349 |
145 |
public void use(Object object)... |
| 1350 |
|
{ |
| 1351 |
145 |
this.currentObj = object; |
| 1352 |
|
} |
| 1353 |
|
|
| 1354 |
|
|
| 1355 |
|
|
| 1356 |
|
|
| 1357 |
|
|
| 1358 |
|
@param |
| 1359 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1360 |
311 |
public void use(String className)... |
| 1361 |
|
{ |
| 1362 |
311 |
this.currentObj = getObject(className); |
| 1363 |
|
} |
| 1364 |
|
|
| 1365 |
|
|
| 1366 |
|
|
| 1367 |
|
|
| 1368 |
|
|
| 1369 |
|
@param |
| 1370 |
|
@param |
| 1371 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1372 |
0 |
public void use(String className, int nb)... |
| 1373 |
|
{ |
| 1374 |
0 |
this.currentObj = getObject(className, nb); |
| 1375 |
|
} |
| 1376 |
|
|
| 1377 |
|
|
| 1378 |
|
@return |
| 1379 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1380 |
0 |
public String getActiveClass()... |
| 1381 |
|
{ |
| 1382 |
0 |
if (this.currentObj == null) { |
| 1383 |
0 |
return null; |
| 1384 |
|
} else { |
| 1385 |
0 |
return this.currentObj.getName(); |
| 1386 |
|
} |
| 1387 |
|
} |
| 1388 |
|
|
| 1389 |
|
|
| 1390 |
|
|
| 1391 |
|
|
| 1392 |
|
|
| 1393 |
|
@param |
| 1394 |
|
@return |
| 1395 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1396 |
450 |
public String displayPrettyName(String fieldname)... |
| 1397 |
|
{ |
| 1398 |
450 |
if (this.currentObj == null) { |
| 1399 |
0 |
return this.doc.displayPrettyName(fieldname, getXWikiContext()); |
| 1400 |
|
} else { |
| 1401 |
450 |
return this.doc.displayPrettyName(fieldname, this.currentObj.getBaseObject(), getXWikiContext()); |
| 1402 |
|
} |
| 1403 |
|
} |
| 1404 |
|
|
| 1405 |
|
|
| 1406 |
|
|
| 1407 |
|
|
| 1408 |
|
@param |
| 1409 |
|
@param |
| 1410 |
|
@return |
| 1411 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1412 |
4 |
public String displayPrettyName(String fieldname, Object obj)... |
| 1413 |
|
{ |
| 1414 |
4 |
if (obj == null) { |
| 1415 |
0 |
return ""; |
| 1416 |
|
} |
| 1417 |
4 |
return this.doc.displayPrettyName(fieldname, obj.getBaseObject(), getXWikiContext()); |
| 1418 |
|
} |
| 1419 |
|
|
| 1420 |
|
|
| 1421 |
|
|
| 1422 |
|
|
| 1423 |
|
|
| 1424 |
|
@param |
| 1425 |
|
@param |
| 1426 |
|
@return |
| 1427 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1428 |
0 |
public String displayPrettyName(String fieldname, boolean showMandatory)... |
| 1429 |
|
{ |
| 1430 |
0 |
if (this.currentObj == null) { |
| 1431 |
0 |
return this.doc.displayPrettyName(fieldname, showMandatory, getXWikiContext()); |
| 1432 |
|
} else { |
| 1433 |
0 |
return this.doc.displayPrettyName(fieldname, showMandatory, this.currentObj.getBaseObject(), |
| 1434 |
|
getXWikiContext()); |
| 1435 |
|
} |
| 1436 |
|
} |
| 1437 |
|
|
| 1438 |
|
|
| 1439 |
|
|
| 1440 |
|
|
| 1441 |
|
@param |
| 1442 |
|
@param |
| 1443 |
|
@param |
| 1444 |
|
@return |
| 1445 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1446 |
0 |
public String displayPrettyName(String fieldname, boolean showMandatory, Object obj)... |
| 1447 |
|
{ |
| 1448 |
0 |
if (obj == null) { |
| 1449 |
0 |
return ""; |
| 1450 |
|
} |
| 1451 |
0 |
return this.doc.displayPrettyName(fieldname, showMandatory, obj.getBaseObject(), getXWikiContext()); |
| 1452 |
|
} |
| 1453 |
|
|
| 1454 |
|
|
| 1455 |
|
|
| 1456 |
|
|
| 1457 |
|
|
| 1458 |
|
@param |
| 1459 |
|
@param |
| 1460 |
|
@param |
| 1461 |
|
@return |
| 1462 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1463 |
0 |
public String displayPrettyName(String fieldname, boolean showMandatory, boolean before)... |
| 1464 |
|
{ |
| 1465 |
0 |
if (this.currentObj == null) { |
| 1466 |
0 |
return this.doc.displayPrettyName(fieldname, showMandatory, before, getXWikiContext()); |
| 1467 |
|
} else { |
| 1468 |
0 |
return this.doc.displayPrettyName(fieldname, showMandatory, before, this.currentObj.getBaseObject(), |
| 1469 |
|
getXWikiContext()); |
| 1470 |
|
} |
| 1471 |
|
} |
| 1472 |
|
|
| 1473 |
|
|
| 1474 |
|
|
| 1475 |
|
|
| 1476 |
|
|
| 1477 |
|
@param |
| 1478 |
|
@param |
| 1479 |
|
@param |
| 1480 |
|
@param |
| 1481 |
|
@return |
| 1482 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1483 |
0 |
public String displayPrettyName(String fieldname, boolean showMandatory, boolean before, Object obj)... |
| 1484 |
|
{ |
| 1485 |
0 |
if (obj == null) { |
| 1486 |
0 |
return ""; |
| 1487 |
|
} |
| 1488 |
0 |
return this.doc.displayPrettyName(fieldname, showMandatory, before, obj.getBaseObject(), getXWikiContext()); |
| 1489 |
|
} |
| 1490 |
|
|
| 1491 |
|
|
| 1492 |
|
|
| 1493 |
|
|
| 1494 |
|
|
| 1495 |
|
@param |
| 1496 |
|
@return |
| 1497 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1498 |
0 |
public String displayTooltip(String fieldname)... |
| 1499 |
|
{ |
| 1500 |
0 |
if (this.currentObj == null) { |
| 1501 |
0 |
return this.doc.displayTooltip(fieldname, getXWikiContext()); |
| 1502 |
|
} else { |
| 1503 |
0 |
return this.doc.displayTooltip(fieldname, this.currentObj.getBaseObject(), getXWikiContext()); |
| 1504 |
|
} |
| 1505 |
|
} |
| 1506 |
|
|
| 1507 |
|
|
| 1508 |
|
|
| 1509 |
|
|
| 1510 |
|
@param |
| 1511 |
|
@param |
| 1512 |
|
@return |
| 1513 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1514 |
0 |
public String displayTooltip(String fieldname, Object obj)... |
| 1515 |
|
{ |
| 1516 |
0 |
if (obj == null) { |
| 1517 |
0 |
return ""; |
| 1518 |
|
} |
| 1519 |
0 |
return this.doc.displayTooltip(fieldname, obj.getBaseObject(), getXWikiContext()); |
| 1520 |
|
} |
| 1521 |
|
|
| 1522 |
|
|
| 1523 |
|
|
| 1524 |
|
|
| 1525 |
|
|
| 1526 |
|
|
| 1527 |
|
@param |
| 1528 |
|
@return |
| 1529 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1530 |
585 |
public String display(String fieldname)... |
| 1531 |
|
{ |
| 1532 |
585 |
if (this.currentObj == null) { |
| 1533 |
39 |
return this.doc.display(fieldname, getXWikiContext()); |
| 1534 |
|
} else { |
| 1535 |
546 |
return this.doc.display(fieldname, this.currentObj.getBaseObject(), getXWikiContext()); |
| 1536 |
|
} |
| 1537 |
|
} |
| 1538 |
|
|
| 1539 |
|
|
| 1540 |
|
|
| 1541 |
|
|
| 1542 |
|
|
| 1543 |
|
@param |
| 1544 |
|
@param |
| 1545 |
|
@return |
| 1546 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1547 |
131 |
public String display(String fieldname, String mode)... |
| 1548 |
|
{ |
| 1549 |
131 |
if (this.currentObj == null) { |
| 1550 |
0 |
return this.doc.display(fieldname, mode, getXWikiContext()); |
| 1551 |
|
} else { |
| 1552 |
131 |
return this.doc.display(fieldname, mode, this.currentObj.getBaseObject(), getXWikiContext()); |
| 1553 |
|
} |
| 1554 |
|
} |
| 1555 |
|
|
| 1556 |
|
|
| 1557 |
|
|
| 1558 |
|
|
| 1559 |
|
|
| 1560 |
|
|
| 1561 |
|
@param |
| 1562 |
|
@param |
| 1563 |
|
@param |
| 1564 |
|
@return |
| 1565 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1566 |
0 |
public String display(String fieldname, String mode, String prefix)... |
| 1567 |
|
{ |
| 1568 |
0 |
if (this.currentObj == null) { |
| 1569 |
0 |
return this.doc.display(fieldname, mode, prefix, getXWikiContext()); |
| 1570 |
|
} else { |
| 1571 |
0 |
return this.doc.display(fieldname, mode, prefix, this.currentObj.getBaseObject(), getSyntaxId(), |
| 1572 |
|
getXWikiContext()); |
| 1573 |
|
} |
| 1574 |
|
} |
| 1575 |
|
|
| 1576 |
|
|
| 1577 |
|
|
| 1578 |
|
|
| 1579 |
|
|
| 1580 |
|
@param |
| 1581 |
|
@param |
| 1582 |
|
@return |
| 1583 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1584 |
61 |
public String display(String fieldname, Object obj)... |
| 1585 |
|
{ |
| 1586 |
61 |
if (obj == null) { |
| 1587 |
0 |
return ""; |
| 1588 |
|
} |
| 1589 |
61 |
return this.doc.display(fieldname, obj.getBaseObject(), getXWikiContext()); |
| 1590 |
|
} |
| 1591 |
|
|
| 1592 |
|
|
| 1593 |
|
|
| 1594 |
|
|
| 1595 |
|
|
| 1596 |
|
|
| 1597 |
|
@param |
| 1598 |
|
@param |
| 1599 |
|
@param |
| 1600 |
|
@param |
| 1601 |
|
|
| 1602 |
|
@return |
| 1603 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1604 |
0 |
public String display(String fieldname, String type, Object obj, String wrappingSyntaxId)... |
| 1605 |
|
{ |
| 1606 |
0 |
if (obj == null) { |
| 1607 |
0 |
return ""; |
| 1608 |
|
} |
| 1609 |
0 |
return this.doc.display(fieldname, type, obj.getBaseObject(), wrappingSyntaxId, getXWikiContext()); |
| 1610 |
|
} |
| 1611 |
|
|
| 1612 |
|
|
| 1613 |
|
|
| 1614 |
|
|
| 1615 |
|
|
| 1616 |
|
@param |
| 1617 |
|
@param |
| 1618 |
|
@param |
| 1619 |
|
@return |
| 1620 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1621 |
839 |
public String display(String fieldname, String mode, Object obj)... |
| 1622 |
|
{ |
| 1623 |
839 |
if (obj == null) { |
| 1624 |
0 |
return ""; |
| 1625 |
|
} |
| 1626 |
839 |
return this.doc.display(fieldname, mode, obj.getBaseObject(), getXWikiContext()); |
| 1627 |
|
} |
| 1628 |
|
|
| 1629 |
|
|
| 1630 |
|
|
| 1631 |
|
|
| 1632 |
|
|
| 1633 |
|
@param |
| 1634 |
|
@param |
| 1635 |
|
@param |
| 1636 |
|
@param |
| 1637 |
|
@return |
| 1638 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1639 |
0 |
public String display(String fieldname, String mode, String prefix, Object obj)... |
| 1640 |
|
{ |
| 1641 |
0 |
if (obj == null) { |
| 1642 |
0 |
return ""; |
| 1643 |
|
} |
| 1644 |
0 |
return this.doc.display(fieldname, mode, prefix, obj.getBaseObject(), getSyntaxId(), getXWikiContext()); |
| 1645 |
|
} |
| 1646 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1647 |
0 |
public String displayForm(String className, String header, String format)... |
| 1648 |
|
{ |
| 1649 |
0 |
return this.doc.displayForm(className, header, format, getXWikiContext()); |
| 1650 |
|
} |
| 1651 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1652 |
0 |
public String displayForm(String className, String header, String format, boolean linebreak)... |
| 1653 |
|
{ |
| 1654 |
0 |
return this.doc.displayForm(className, header, format, linebreak, getXWikiContext()); |
| 1655 |
|
} |
| 1656 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1657 |
0 |
public String displayForm(String className)... |
| 1658 |
|
{ |
| 1659 |
0 |
return this.doc.displayForm(className, getXWikiContext()); |
| 1660 |
|
} |
| 1661 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 1662 |
0 |
public String displayRendered(com.xpn.xwiki.api.PropertyClass pclass, String prefix, Collection object)... |
| 1663 |
|
throws XWikiException |
| 1664 |
|
{ |
| 1665 |
0 |
if ((pclass == null) || (object == null)) { |
| 1666 |
0 |
return ""; |
| 1667 |
|
} |
| 1668 |
0 |
return this.doc.displayRendered(pclass.getBasePropertyClass(), prefix, object.getCollection(), |
| 1669 |
|
getXWikiContext()); |
| 1670 |
|
} |
| 1671 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 1672 |
326 |
public String displayView(com.xpn.xwiki.api.PropertyClass pclass, String prefix, Collection object)... |
| 1673 |
|
{ |
| 1674 |
326 |
if ((pclass == null) || (object == null)) { |
| 1675 |
0 |
return ""; |
| 1676 |
|
} |
| 1677 |
326 |
return this.doc.displayView(pclass.getBasePropertyClass(), prefix, object.getCollection(), getXWikiContext()); |
| 1678 |
|
} |
| 1679 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 1680 |
2034 |
public String displayEdit(com.xpn.xwiki.api.PropertyClass pclass, String prefix, Collection object)... |
| 1681 |
|
{ |
| 1682 |
2034 |
if ((pclass == null) || (object == null)) { |
| 1683 |
0 |
return ""; |
| 1684 |
|
} |
| 1685 |
2034 |
return this.doc.displayEdit(pclass.getBasePropertyClass(), prefix, object.getCollection(), getXWikiContext()); |
| 1686 |
|
} |
| 1687 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 1688 |
0 |
public String displayHidden(com.xpn.xwiki.api.PropertyClass pclass, String prefix, Collection object)... |
| 1689 |
|
{ |
| 1690 |
0 |
if ((pclass == null) || (object == null)) { |
| 1691 |
0 |
return ""; |
| 1692 |
|
} |
| 1693 |
0 |
return this.doc.displayHidden(pclass.getBasePropertyClass(), prefix, object.getCollection(), getXWikiContext()); |
| 1694 |
|
} |
| 1695 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1696 |
1 |
public List<String> getIncludedPages()... |
| 1697 |
|
{ |
| 1698 |
1 |
return this.doc.getIncludedPages(getXWikiContext()); |
| 1699 |
|
} |
| 1700 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1701 |
0 |
public List<String> getIncludedMacros()... |
| 1702 |
|
{ |
| 1703 |
0 |
return this.doc.getIncludedMacros(getXWikiContext()); |
| 1704 |
|
} |
| 1705 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1706 |
0 |
public List<String> getLinkedPages()... |
| 1707 |
|
{ |
| 1708 |
0 |
return new ArrayList<String>(this.doc.getUniqueLinkedPages(getXWikiContext())); |
| 1709 |
|
} |
| 1710 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 1711 |
4052 |
public Attachment getAttachment(String filename)... |
| 1712 |
|
{ |
| 1713 |
4052 |
XWikiAttachment attach = this.getDoc().getAttachment(filename); |
| 1714 |
4052 |
if (attach == null) { |
| 1715 |
505 |
return null; |
| 1716 |
|
} else { |
| 1717 |
3547 |
return new Attachment(this, attach, getXWikiContext()); |
| 1718 |
|
} |
| 1719 |
|
} |
| 1720 |
|
|
| |
|
| 40% |
Uncovered Elements: 12 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 1721 |
1 |
public List<Delta> getContentDiff(Document origdoc, Document newdoc)... |
| 1722 |
|
throws XWikiException, DifferentiationFailedException |
| 1723 |
|
{ |
| 1724 |
1 |
try { |
| 1725 |
1 |
if ((origdoc == null) && (newdoc == null)) { |
| 1726 |
0 |
return Collections.emptyList(); |
| 1727 |
|
} |
| 1728 |
1 |
if (origdoc == null) { |
| 1729 |
0 |
return this.doc.getContentDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc, |
| 1730 |
|
getXWikiContext()); |
| 1731 |
|
} |
| 1732 |
1 |
if (newdoc == null) { |
| 1733 |
0 |
return this.doc.getContentDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()), |
| 1734 |
|
getXWikiContext()); |
| 1735 |
|
} |
| 1736 |
|
|
| 1737 |
1 |
return this.doc.getContentDiff(origdoc.doc, newdoc.doc, getXWikiContext()); |
| 1738 |
|
} catch (Exception e) { |
| 1739 |
0 |
java.lang.Object[] args = { origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion() }; |
| 1740 |
0 |
List list = new ArrayList(); |
| 1741 |
0 |
XWikiException xe = |
| 1742 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CONTENT_ERROR, |
| 1743 |
|
"Error while making content diff of {0} between version {1} and version {2}", e, args); |
| 1744 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1745 |
0 |
list.add(errormsg); |
| 1746 |
0 |
return list; |
| 1747 |
|
} |
| 1748 |
|
} |
| 1749 |
|
|
| |
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 1750 |
0 |
public List<Delta> getXMLDiff(Document origdoc, Document newdoc)... |
| 1751 |
|
throws XWikiException, DifferentiationFailedException |
| 1752 |
|
{ |
| 1753 |
0 |
try { |
| 1754 |
0 |
if ((origdoc == null) && (newdoc == null)) { |
| 1755 |
0 |
return Collections.emptyList(); |
| 1756 |
|
} |
| 1757 |
0 |
if (origdoc == null) { |
| 1758 |
0 |
return this.doc.getXMLDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc, |
| 1759 |
|
getXWikiContext()); |
| 1760 |
|
} |
| 1761 |
0 |
if (newdoc == null) { |
| 1762 |
0 |
return this.doc.getXMLDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()), |
| 1763 |
|
getXWikiContext()); |
| 1764 |
|
} |
| 1765 |
|
|
| 1766 |
0 |
return this.doc.getXMLDiff(origdoc.doc, newdoc.doc, getXWikiContext()); |
| 1767 |
|
} catch (Exception e) { |
| 1768 |
0 |
java.lang.Object[] args = { origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion() }; |
| 1769 |
0 |
List list = new ArrayList(); |
| 1770 |
0 |
XWikiException xe = |
| 1771 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_XML_ERROR, |
| 1772 |
|
"Error while making xml diff of {0} between version {1} and version {2}", e, args); |
| 1773 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1774 |
0 |
list.add(errormsg); |
| 1775 |
0 |
return list; |
| 1776 |
|
} |
| 1777 |
|
} |
| 1778 |
|
|
| |
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 1779 |
0 |
public List<Delta> getRenderedContentDiff(Document origdoc, Document newdoc)... |
| 1780 |
|
throws XWikiException, DifferentiationFailedException |
| 1781 |
|
{ |
| 1782 |
0 |
try { |
| 1783 |
0 |
if ((origdoc == null) && (newdoc == null)) { |
| 1784 |
0 |
return Collections.emptyList(); |
| 1785 |
|
} |
| 1786 |
0 |
if (origdoc == null) { |
| 1787 |
0 |
return this.doc.getRenderedContentDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc, |
| 1788 |
|
getXWikiContext()); |
| 1789 |
|
} |
| 1790 |
0 |
if (newdoc == null) { |
| 1791 |
0 |
return this.doc.getRenderedContentDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()), |
| 1792 |
|
getXWikiContext()); |
| 1793 |
|
} |
| 1794 |
|
|
| 1795 |
0 |
return this.doc.getRenderedContentDiff(origdoc.doc, newdoc.doc, getXWikiContext()); |
| 1796 |
|
} catch (Exception e) { |
| 1797 |
0 |
java.lang.Object[] args = { origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion() }; |
| 1798 |
0 |
List list = new ArrayList(); |
| 1799 |
0 |
XWikiException xe = |
| 1800 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_RENDERED_ERROR, |
| 1801 |
|
"Error while making rendered diff of {0} between version {1} and version {2}", e, args); |
| 1802 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1803 |
0 |
list.add(errormsg); |
| 1804 |
0 |
return list; |
| 1805 |
|
} |
| 1806 |
|
} |
| 1807 |
|
|
| |
|
| 40% |
Uncovered Elements: 12 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 1808 |
3 |
public List<MetaDataDiff> getMetaDataDiff(Document origdoc, Document newdoc) throws XWikiException... |
| 1809 |
|
{ |
| 1810 |
3 |
try { |
| 1811 |
3 |
if ((origdoc == null) && (newdoc == null)) { |
| 1812 |
0 |
return Collections.emptyList(); |
| 1813 |
|
} |
| 1814 |
3 |
if (origdoc == null) { |
| 1815 |
0 |
return this.doc.getMetaDataDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc, |
| 1816 |
|
getXWikiContext()); |
| 1817 |
|
} |
| 1818 |
3 |
if (newdoc == null) { |
| 1819 |
0 |
return this.doc.getMetaDataDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()), |
| 1820 |
|
getXWikiContext()); |
| 1821 |
|
} |
| 1822 |
|
|
| 1823 |
3 |
return this.doc.getMetaDataDiff(origdoc.doc, newdoc.doc, getXWikiContext()); |
| 1824 |
|
} catch (Exception e) { |
| 1825 |
0 |
java.lang.Object[] args = { origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion() }; |
| 1826 |
0 |
List list = new ArrayList(); |
| 1827 |
0 |
XWikiException xe = |
| 1828 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_METADATA_ERROR, |
| 1829 |
|
"Error while making meta data diff of {0} between version {1} and version {2}", e, args); |
| 1830 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1831 |
0 |
list.add(errormsg); |
| 1832 |
0 |
return list; |
| 1833 |
|
} |
| 1834 |
|
} |
| 1835 |
|
|
| |
|
| 40% |
Uncovered Elements: 12 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 1836 |
3 |
public List<List<ObjectDiff>> getObjectDiff(Document origdoc, Document newdoc)... |
| 1837 |
|
{ |
| 1838 |
3 |
try { |
| 1839 |
3 |
if ((origdoc == null) && (newdoc == null)) { |
| 1840 |
0 |
return Collections.emptyList(); |
| 1841 |
|
} |
| 1842 |
3 |
if (origdoc == null) { |
| 1843 |
0 |
return this.doc.getObjectDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc, |
| 1844 |
|
getXWikiContext()); |
| 1845 |
|
} |
| 1846 |
3 |
if (newdoc == null) { |
| 1847 |
0 |
return this.doc.getObjectDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()), |
| 1848 |
|
getXWikiContext()); |
| 1849 |
|
} |
| 1850 |
|
|
| 1851 |
3 |
return this.doc.getObjectDiff(origdoc.doc, newdoc.doc, getXWikiContext()); |
| 1852 |
|
} catch (Exception e) { |
| 1853 |
0 |
java.lang.Object[] args = { origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion() }; |
| 1854 |
0 |
List list = new ArrayList(); |
| 1855 |
0 |
XWikiException xe = |
| 1856 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_OBJECT_ERROR, |
| 1857 |
|
"Error while making meta object diff of {0} between version {1} and version {2}", e, args); |
| 1858 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1859 |
0 |
list.add(errormsg); |
| 1860 |
0 |
return list; |
| 1861 |
|
} |
| 1862 |
|
} |
| 1863 |
|
|
| |
|
| 40% |
Uncovered Elements: 12 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 1864 |
3 |
public List<List<ObjectDiff>> getClassDiff(Document origdoc, Document newdoc)... |
| 1865 |
|
{ |
| 1866 |
3 |
try { |
| 1867 |
3 |
if ((origdoc == null) && (newdoc == null)) { |
| 1868 |
0 |
return Collections.emptyList(); |
| 1869 |
|
} |
| 1870 |
3 |
if (origdoc == null) { |
| 1871 |
0 |
return this.doc.getClassDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc, |
| 1872 |
|
getXWikiContext()); |
| 1873 |
|
} |
| 1874 |
3 |
if (newdoc == null) { |
| 1875 |
0 |
return this.doc.getClassDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()), |
| 1876 |
|
getXWikiContext()); |
| 1877 |
|
} |
| 1878 |
|
|
| 1879 |
3 |
return this.doc.getClassDiff(origdoc.doc, newdoc.doc, getXWikiContext()); |
| 1880 |
|
} catch (Exception e) { |
| 1881 |
0 |
java.lang.Object[] args = { origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion() }; |
| 1882 |
0 |
List list = new ArrayList(); |
| 1883 |
0 |
XWikiException xe = |
| 1884 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CLASS_ERROR, |
| 1885 |
|
"Error while making class diff of {0} between version {1} and version {2}", e, args); |
| 1886 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1887 |
0 |
list.add(errormsg); |
| 1888 |
0 |
return list; |
| 1889 |
|
} |
| 1890 |
|
} |
| 1891 |
|
|
| |
|
| 30.8% |
Uncovered Elements: 18 (26) |
Complexity: 9 |
Complexity Density: 0.64 |
|
| 1892 |
3 |
public List<AttachmentDiff> getAttachmentDiff(Document origdoc, Document newdoc)... |
| 1893 |
|
{ |
| 1894 |
3 |
try { |
| 1895 |
3 |
if ((origdoc == null) && (newdoc == null)) { |
| 1896 |
0 |
return Collections.emptyList(); |
| 1897 |
|
} |
| 1898 |
3 |
if (origdoc == null) { |
| 1899 |
0 |
return wrapAttachmentDiff(this.doc.getAttachmentDiff(new XWikiDocument(newdoc.getDocumentReference()), |
| 1900 |
|
newdoc.doc, getXWikiContext())); |
| 1901 |
|
} |
| 1902 |
3 |
if (newdoc == null) { |
| 1903 |
0 |
return wrapAttachmentDiff(this.doc.getAttachmentDiff(origdoc.doc, |
| 1904 |
|
new XWikiDocument(origdoc.getDocumentReference()), getXWikiContext())); |
| 1905 |
|
} |
| 1906 |
|
|
| 1907 |
3 |
return wrapAttachmentDiff(this.doc.getAttachmentDiff(origdoc.doc, newdoc.doc, getXWikiContext())); |
| 1908 |
|
} catch (Exception e) { |
| 1909 |
0 |
java.lang.Object[] args = { (origdoc != null) ? origdoc.getFullName() : null, |
| 1910 |
0 |
(origdoc != null) ? origdoc.getVersion() : null, (newdoc != null) ? newdoc.getVersion() : null }; |
| 1911 |
0 |
List list = new ArrayList(); |
| 1912 |
0 |
XWikiException xe = |
| 1913 |
|
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_ATTACHMENT_ERROR, |
| 1914 |
|
"Error while making attachment diff of {0} between version {1} and version {2}", e, args); |
| 1915 |
0 |
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext()); |
| 1916 |
0 |
list.add(errormsg); |
| 1917 |
0 |
return list; |
| 1918 |
|
} |
| 1919 |
|
} |
| 1920 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 1921 |
3 |
private List<AttachmentDiff> wrapAttachmentDiff(List<com.xpn.xwiki.doc.AttachmentDiff> diffs)... |
| 1922 |
|
{ |
| 1923 |
3 |
List<AttachmentDiff> safeAttachmentDiffs = new ArrayList<>(); |
| 1924 |
3 |
for (com.xpn.xwiki.doc.AttachmentDiff diff : diffs) { |
| 1925 |
0 |
safeAttachmentDiffs.add(new AttachmentDiff(diff, getXWikiContext())); |
| 1926 |
|
} |
| 1927 |
3 |
return safeAttachmentDiffs; |
| 1928 |
|
} |
| 1929 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1930 |
0 |
public List<Delta> getLastChanges() throws XWikiException, DifferentiationFailedException... |
| 1931 |
|
{ |
| 1932 |
0 |
return this.doc.getLastChanges(getXWikiContext()); |
| 1933 |
|
} |
| 1934 |
|
|
| 1935 |
|
|
| 1936 |
|
|
| 1937 |
|
|
| 1938 |
|
@param |
| 1939 |
|
@return |
| 1940 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 1941 |
0 |
public DocumentStats getCurrentMonthPageStats(String action)... |
| 1942 |
|
{ |
| 1943 |
0 |
Scope scope = ScopeFactory.createPageScope(this.getFullName()); |
| 1944 |
0 |
Range range = RangeFactory.ALL; |
| 1945 |
0 |
Period period = PeriodFactory.getCurrentMonth(); |
| 1946 |
0 |
XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext()); |
| 1947 |
0 |
List<DocumentStats> stats = statisticsService.getDocumentStatistics(action, scope, period, range, this.context); |
| 1948 |
0 |
if (stats.size() > 0) { |
| 1949 |
0 |
return stats.get(0); |
| 1950 |
|
} |
| 1951 |
0 |
return new DocumentStats(); |
| 1952 |
|
} |
| 1953 |
|
|
| 1954 |
|
|
| 1955 |
|
|
| 1956 |
|
|
| 1957 |
|
@param |
| 1958 |
|
@return |
| 1959 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 1960 |
0 |
public DocumentStats getCurrentMonthSpaceStats(String action)... |
| 1961 |
|
{ |
| 1962 |
0 |
Scope scope = ScopeFactory.createSpaceScope(this.doc.getSpace(), false); |
| 1963 |
0 |
Range range = RangeFactory.ALL; |
| 1964 |
0 |
Period period = PeriodFactory.getCurrentMonth(); |
| 1965 |
0 |
XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext()); |
| 1966 |
0 |
List<DocumentStats> stats = statisticsService.getDocumentStatistics(action, scope, period, range, this.context); |
| 1967 |
0 |
if (stats.size() > 0) { |
| 1968 |
0 |
return stats.get(0); |
| 1969 |
|
} |
| 1970 |
0 |
return new DocumentStats(); |
| 1971 |
|
} |
| 1972 |
|
|
| 1973 |
|
|
| 1974 |
|
|
| 1975 |
|
|
| 1976 |
|
@return |
| 1977 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 1978 |
0 |
public List<RefererStats> getCurrentMonthRefStats()... |
| 1979 |
|
{ |
| 1980 |
0 |
Scope scope = ScopeFactory.createPageScope(this.getFullName()); |
| 1981 |
0 |
Range range = RangeFactory.ALL; |
| 1982 |
0 |
Period period = PeriodFactory.getCurrentMonth(); |
| 1983 |
0 |
XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext()); |
| 1984 |
0 |
List<RefererStats> stats = statisticsService.getRefererStatistics("", scope, period, range, this.context); |
| 1985 |
0 |
return stats; |
| 1986 |
|
} |
| 1987 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1988 |
0 |
public boolean checkAccess(String right)... |
| 1989 |
|
{ |
| 1990 |
0 |
try { |
| 1991 |
0 |
return getXWikiContext().getWiki().checkAccess(right, this.doc, getXWikiContext()); |
| 1992 |
|
} catch (XWikiException e) { |
| 1993 |
0 |
return false; |
| 1994 |
|
} |
| 1995 |
|
} |
| 1996 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1997 |
369 |
public boolean hasAccessLevel(String level)... |
| 1998 |
|
{ |
| 1999 |
369 |
try { |
| 2000 |
369 |
return getXWikiContext().getWiki().getRightService().hasAccessLevel(level, getXWikiContext().getUser(), |
| 2001 |
|
this.getPrefixedFullName(), getXWikiContext()); |
| 2002 |
|
} catch (Exception e) { |
| 2003 |
0 |
return false; |
| 2004 |
|
} |
| 2005 |
|
} |
| 2006 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 2007 |
88 |
@Override... |
| 2008 |
|
public boolean hasAccessLevel(String level, String user) |
| 2009 |
|
{ |
| 2010 |
88 |
try { |
| 2011 |
88 |
return getXWikiContext().getWiki().getRightService().hasAccessLevel(level, user, this.getPrefixedFullName(), |
| 2012 |
|
getXWikiContext()); |
| 2013 |
|
} catch (Exception e) { |
| 2014 |
0 |
return false; |
| 2015 |
|
} |
| 2016 |
|
} |
| 2017 |
|
|
| |
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 2018 |
615 |
public boolean getLocked()... |
| 2019 |
|
{ |
| 2020 |
615 |
try { |
| 2021 |
615 |
XWikiLock lock = this.doc.getLock(getXWikiContext()); |
| 2022 |
615 |
if (lock != null && !getXWikiContext().getUser().equals(lock.getUserName())) { |
| 2023 |
1 |
return true; |
| 2024 |
|
} else { |
| 2025 |
614 |
return false; |
| 2026 |
|
} |
| 2027 |
|
} catch (Exception e) { |
| 2028 |
0 |
return false; |
| 2029 |
|
} |
| 2030 |
|
} |
| 2031 |
|
|
| |
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 2032 |
1 |
public String getLockingUser()... |
| 2033 |
|
{ |
| 2034 |
1 |
try { |
| 2035 |
1 |
XWikiLock lock = this.doc.getLock(getXWikiContext()); |
| 2036 |
1 |
if (lock != null && !getXWikiContext().getUser().equals(lock.getUserName())) { |
| 2037 |
1 |
return lock.getUserName(); |
| 2038 |
|
} else { |
| 2039 |
0 |
return ""; |
| 2040 |
|
} |
| 2041 |
|
} catch (XWikiException e) { |
| 2042 |
0 |
return ""; |
| 2043 |
|
} |
| 2044 |
|
} |
| 2045 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 2046 |
0 |
public Date getLockingDate()... |
| 2047 |
|
{ |
| 2048 |
0 |
try { |
| 2049 |
0 |
XWikiLock lock = this.doc.getLock(getXWikiContext()); |
| 2050 |
0 |
if (lock != null && !getXWikiContext().getUser().equals(lock.getUserName())) { |
| 2051 |
0 |
return lock.getDate(); |
| 2052 |
|
} else { |
| 2053 |
0 |
return null; |
| 2054 |
|
} |
| 2055 |
|
} catch (XWikiException e) { |
| 2056 |
0 |
return null; |
| 2057 |
|
} |
| 2058 |
|
} |
| 2059 |
|
|
| |
|
| 30% |
Uncovered Elements: 7 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 2060 |
6 |
public java.lang.Object get(String classOrFieldName)... |
| 2061 |
|
{ |
| 2062 |
6 |
if (this.currentObj != null) { |
| 2063 |
6 |
return this.doc.display(classOrFieldName, this.currentObj.getBaseObject(), getXWikiContext()); |
| 2064 |
|
} |
| 2065 |
0 |
BaseObject object = this.doc.getFirstObject(classOrFieldName, getXWikiContext()); |
| 2066 |
0 |
if (object != null) { |
| 2067 |
0 |
return this.doc.display(classOrFieldName, object, getXWikiContext()); |
| 2068 |
|
} |
| 2069 |
0 |
return this.getDoc().getObject(classOrFieldName); |
| 2070 |
|
} |
| 2071 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 2072 |
976 |
public java.lang.Object getValue(String fieldName)... |
| 2073 |
|
{ |
| 2074 |
976 |
Object object; |
| 2075 |
976 |
if (this.currentObj == null) { |
| 2076 |
625 |
object = new Object(this.getDoc().getFirstObject(fieldName, getXWikiContext()), getXWikiContext()); |
| 2077 |
|
} else { |
| 2078 |
351 |
object = this.currentObj; |
| 2079 |
|
} |
| 2080 |
976 |
return getValue(fieldName, object); |
| 2081 |
|
} |
| 2082 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 2083 |
4344 |
public java.lang.Object getValue(String fieldName, Object object)... |
| 2084 |
|
{ |
| 2085 |
4346 |
if (object != null) { |
| 2086 |
4344 |
return object.getValue(fieldName); |
| 2087 |
|
} |
| 2088 |
|
|
| 2089 |
0 |
return null; |
| 2090 |
|
} |
| 2091 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2092 |
0 |
public String getTextArea()... |
| 2093 |
|
{ |
| 2094 |
0 |
return com.xpn.xwiki.XWiki.getTextArea(this.doc.getContent(), getXWikiContext()); |
| 2095 |
|
} |
| 2096 |
|
|
| 2097 |
|
|
| 2098 |
|
|
| 2099 |
|
|
| 2100 |
|
@param |
| 2101 |
|
@param |
| 2102 |
|
@param |
| 2103 |
|
@return |
| 2104 |
|
|
| 2105 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2106 |
0 |
public Map<String, Map<String, java.lang.Object>> getTOC(int init, int max, boolean numbered)... |
| 2107 |
|
{ |
| 2108 |
0 |
getXWikiContext().put("tocNumbered", new Boolean(numbered)); |
| 2109 |
0 |
return TOCGenerator.generateTOC(getContent(), init, max, numbered, getXWikiContext()); |
| 2110 |
|
} |
| 2111 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2112 |
0 |
public String getTags()... |
| 2113 |
|
{ |
| 2114 |
0 |
return this.doc.getTags(getXWikiContext()); |
| 2115 |
|
} |
| 2116 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2117 |
343 |
public List<String> getTagList()... |
| 2118 |
|
{ |
| 2119 |
343 |
return this.getDoc().getTagsList(getXWikiContext()); |
| 2120 |
|
} |
| 2121 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2122 |
0 |
public List<String> getTagsPossibleValues()... |
| 2123 |
|
{ |
| 2124 |
0 |
return this.doc.getTagsPossibleValues(getXWikiContext()); |
| 2125 |
|
} |
| 2126 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2127 |
0 |
public void insertText(String text, String marker) throws XWikiException... |
| 2128 |
|
{ |
| 2129 |
0 |
if (hasAccessLevel("edit")) { |
| 2130 |
0 |
getDoc().insertText(text, marker, getXWikiContext()); |
| 2131 |
|
|
| 2132 |
0 |
updateAuthor(); |
| 2133 |
0 |
updateContentAuthor(); |
| 2134 |
|
} |
| 2135 |
|
} |
| 2136 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2137 |
0 |
@Override... |
| 2138 |
|
public boolean equals(java.lang.Object arg0) |
| 2139 |
|
{ |
| 2140 |
0 |
if (!(arg0 instanceof Document)) { |
| 2141 |
0 |
return false; |
| 2142 |
|
} |
| 2143 |
0 |
Document d = (Document) arg0; |
| 2144 |
0 |
return d.getXWikiContext().equals(getXWikiContext()) && this.doc.equals(d.doc); |
| 2145 |
|
} |
| 2146 |
|
|
| 2147 |
|
|
| 2148 |
|
@link |
| 2149 |
|
|
| 2150 |
|
@param |
| 2151 |
|
@return |
| 2152 |
|
@since |
| 2153 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2154 |
366818 |
public boolean same(XWikiDocument document)... |
| 2155 |
|
{ |
| 2156 |
366814 |
return document == this.doc || document == this.initialDoc; |
| 2157 |
|
} |
| 2158 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2159 |
13 |
public List<String> getBacklinks() throws XWikiException... |
| 2160 |
|
{ |
| 2161 |
13 |
return this.doc.getBackLinkedPages(getXWikiContext()); |
| 2162 |
|
} |
| 2163 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2164 |
0 |
public List<XWikiLink> getLinks() throws XWikiException... |
| 2165 |
|
{ |
| 2166 |
0 |
return new ArrayList<XWikiLink>(this.doc.getUniqueWikiLinkedPages(getXWikiContext())); |
| 2167 |
|
} |
| 2168 |
|
|
| 2169 |
|
|
| 2170 |
|
|
| 2171 |
|
|
| 2172 |
|
|
| 2173 |
|
|
| 2174 |
|
|
| 2175 |
|
@return |
| 2176 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2177 |
0 |
public List<DocumentSection> getSections() throws XWikiException... |
| 2178 |
|
{ |
| 2179 |
0 |
return this.doc.getSections(); |
| 2180 |
|
} |
| 2181 |
|
|
| 2182 |
|
|
| 2183 |
|
|
| 2184 |
|
|
| 2185 |
|
@return |
| 2186 |
|
@since |
| 2187 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2188 |
553 |
public List<String> getChildren() throws XWikiException... |
| 2189 |
|
{ |
| 2190 |
553 |
return this.doc.getChildren(getXWikiContext()); |
| 2191 |
|
} |
| 2192 |
|
|
| 2193 |
|
|
| 2194 |
|
|
| 2195 |
|
|
| 2196 |
|
|
| 2197 |
|
|
| 2198 |
|
@param |
| 2199 |
|
@param |
| 2200 |
|
@return |
| 2201 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2202 |
0 |
public List<String> getChildren(int nb, int start) throws XWikiException... |
| 2203 |
|
{ |
| 2204 |
0 |
return this.doc.getChildren(nb, start, getXWikiContext()); |
| 2205 |
|
} |
| 2206 |
|
|
| 2207 |
|
|
| 2208 |
|
@return |
| 2209 |
|
@throws |
| 2210 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2211 |
799 |
public String getDefaultEditMode() throws XWikiException... |
| 2212 |
|
{ |
| 2213 |
799 |
return this.doc.getDefaultEditMode(getXWikiContext()); |
| 2214 |
|
} |
| 2215 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2216 |
0 |
public String getDefaultEditURL() throws XWikiException... |
| 2217 |
|
{ |
| 2218 |
0 |
return this.doc.getDefaultEditURL(getXWikiContext()); |
| 2219 |
|
} |
| 2220 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2221 |
0 |
public String getEditURL(String action, String mode) throws XWikiException... |
| 2222 |
|
{ |
| 2223 |
0 |
return this.doc.getEditURL(action, mode, getXWikiContext()); |
| 2224 |
|
} |
| 2225 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2226 |
0 |
public String getEditURL(String action, String mode, String locale)... |
| 2227 |
|
{ |
| 2228 |
0 |
return this.doc.getEditURL(action, mode, locale, getXWikiContext()); |
| 2229 |
|
} |
| 2230 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2231 |
0 |
public boolean isCurrentUserCreator()... |
| 2232 |
|
{ |
| 2233 |
0 |
return this.doc.isCurrentUserCreator(getXWikiContext()); |
| 2234 |
|
} |
| 2235 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2236 |
0 |
public boolean isCurrentUserPage()... |
| 2237 |
|
{ |
| 2238 |
0 |
return this.doc.isCurrentUserPage(getXWikiContext()); |
| 2239 |
|
} |
| 2240 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2241 |
0 |
public boolean isCurrentLocalUserPage()... |
| 2242 |
|
{ |
| 2243 |
0 |
return this.doc.isCurrentLocalUserPage(getXWikiContext()); |
| 2244 |
|
} |
| 2245 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2246 |
0 |
public boolean isCreator(String username)... |
| 2247 |
|
{ |
| 2248 |
0 |
return this.doc.isCreator(username); |
| 2249 |
|
} |
| 2250 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 2251 |
9 |
public void set(String fieldname, java.lang.Object value)... |
| 2252 |
|
{ |
| 2253 |
9 |
Object obj; |
| 2254 |
9 |
if (this.currentObj != null) { |
| 2255 |
6 |
obj = this.currentObj; |
| 2256 |
|
} else { |
| 2257 |
3 |
obj = getFirstObject(fieldname); |
| 2258 |
|
} |
| 2259 |
9 |
set(fieldname, value, obj); |
| 2260 |
|
} |
| 2261 |
|
|
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 2262 |
11 |
public void set(String fieldname, java.lang.Object value, Object obj)... |
| 2263 |
|
{ |
| 2264 |
11 |
if (obj == null) { |
| 2265 |
0 |
return; |
| 2266 |
|
} |
| 2267 |
11 |
obj.set(fieldname, value); |
| 2268 |
|
} |
| 2269 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2270 |
99 |
public void setTitle(String title)... |
| 2271 |
|
{ |
| 2272 |
99 |
getDoc().setTitle(title); |
| 2273 |
|
|
| 2274 |
99 |
updateAuthor(); |
| 2275 |
99 |
updateContentAuthor(); |
| 2276 |
|
} |
| 2277 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2278 |
0 |
public void setCustomClass(String customClass)... |
| 2279 |
|
{ |
| 2280 |
0 |
getDoc().setCustomClass(customClass); |
| 2281 |
|
|
| 2282 |
0 |
updateAuthor(); |
| 2283 |
|
} |
| 2284 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2285 |
34 |
public void setParent(String parent)... |
| 2286 |
|
{ |
| 2287 |
34 |
getDoc().setParent(parent); |
| 2288 |
|
|
| 2289 |
34 |
updateAuthor(); |
| 2290 |
|
} |
| 2291 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2292 |
134 |
private void updateContentAuthor()... |
| 2293 |
|
{ |
| 2294 |
|
|
| 2295 |
134 |
XWikiContext xcontext = getXWikiContext(); |
| 2296 |
134 |
getDoc().setContentAuthorReference(xcontext.getAuthorReference()); |
| 2297 |
|
} |
| 2298 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2299 |
248 |
private void updateAuthor()... |
| 2300 |
|
{ |
| 2301 |
|
|
| 2302 |
248 |
XWikiContext xcontext = getXWikiContext(); |
| 2303 |
248 |
getDoc().setAuthorReference(xcontext.getAuthorReference()); |
| 2304 |
|
} |
| 2305 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2306 |
32 |
public void setContent(String content)... |
| 2307 |
|
{ |
| 2308 |
32 |
getDoc().setContent(content); |
| 2309 |
|
|
| 2310 |
32 |
updateAuthor(); |
| 2311 |
32 |
updateContentAuthor(); |
| 2312 |
|
} |
| 2313 |
|
|
| 2314 |
|
|
| 2315 |
|
@param |
| 2316 |
|
@throws |
| 2317 |
|
@since |
| 2318 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2319 |
0 |
public void setContent(XDOM content) throws XWikiException... |
| 2320 |
|
{ |
| 2321 |
0 |
getDoc().setContent(content); |
| 2322 |
|
|
| 2323 |
0 |
updateAuthor(); |
| 2324 |
0 |
updateContentAuthor(); |
| 2325 |
|
} |
| 2326 |
|
|
| 2327 |
|
|
| 2328 |
|
@param |
| 2329 |
|
@since |
| 2330 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2331 |
0 |
public void setSyntax(Syntax syntax)... |
| 2332 |
|
{ |
| 2333 |
0 |
getDoc().setSyntax(syntax); |
| 2334 |
|
|
| 2335 |
0 |
updateAuthor(); |
| 2336 |
0 |
updateContentAuthor(); |
| 2337 |
|
} |
| 2338 |
|
|
| 2339 |
|
|
| 2340 |
|
@param |
| 2341 |
|
|
| 2342 |
|
|
| 2343 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2344 |
3 |
public void setSyntaxId(String syntaxId)... |
| 2345 |
|
{ |
| 2346 |
3 |
getDoc().setSyntaxId(syntaxId); |
| 2347 |
|
|
| 2348 |
3 |
updateAuthor(); |
| 2349 |
3 |
updateContentAuthor(); |
| 2350 |
|
} |
| 2351 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2352 |
0 |
public void setDefaultTemplate(String dtemplate)... |
| 2353 |
|
{ |
| 2354 |
0 |
getDoc().setDefaultTemplate(dtemplate); |
| 2355 |
|
|
| 2356 |
0 |
updateAuthor(); |
| 2357 |
|
} |
| 2358 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2359 |
0 |
public void setComment(String comment)... |
| 2360 |
|
{ |
| 2361 |
0 |
getDoc().setComment(comment); |
| 2362 |
|
} |
| 2363 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2364 |
0 |
public void setMinorEdit(boolean isMinor)... |
| 2365 |
|
{ |
| 2366 |
0 |
getDoc().setMinorEdit(isMinor); |
| 2367 |
|
} |
| 2368 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2369 |
58 |
public void save() throws XWikiException... |
| 2370 |
|
{ |
| 2371 |
58 |
save("", false); |
| 2372 |
|
} |
| 2373 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2374 |
189 |
public void save(String comment) throws XWikiException... |
| 2375 |
|
{ |
| 2376 |
189 |
save(comment, false); |
| 2377 |
|
} |
| 2378 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2379 |
254 |
public void save(String comment, boolean minorEdit) throws XWikiException... |
| 2380 |
|
{ |
| 2381 |
254 |
if (hasAccessLevel("edit")) { |
| 2382 |
253 |
saveDocument(comment, minorEdit); |
| 2383 |
|
} else { |
| 2384 |
1 |
java.lang.Object[] args = { getDefaultEntityReferenceSerializer().serialize(getDocumentReference()) }; |
| 2385 |
1 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2386 |
|
"Access denied in edit mode on document {0}", null, args); |
| 2387 |
|
} |
| 2388 |
|
} |
| 2389 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2390 |
0 |
public void saveWithProgrammingRights() throws XWikiException... |
| 2391 |
|
{ |
| 2392 |
0 |
saveWithProgrammingRights("", false); |
| 2393 |
|
} |
| 2394 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2395 |
0 |
public void saveWithProgrammingRights(String comment) throws XWikiException... |
| 2396 |
|
{ |
| 2397 |
0 |
saveWithProgrammingRights(comment, false); |
| 2398 |
|
} |
| 2399 |
|
|
| |
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
| 2400 |
0 |
public void saveWithProgrammingRights(String comment, boolean minorEdit) throws XWikiException... |
| 2401 |
|
{ |
| 2402 |
0 |
if (hasProgrammingRights()) { |
| 2403 |
|
|
| 2404 |
|
|
| 2405 |
0 |
XWikiContext context = getXWikiContext(); |
| 2406 |
0 |
String currentWikiId = context.getWikiId(); |
| 2407 |
0 |
try { |
| 2408 |
|
|
| 2409 |
0 |
context.setWikiId(getWiki()); |
| 2410 |
|
|
| 2411 |
0 |
if (!context.getWiki().isReadOnly()) { |
| 2412 |
0 |
saveDocument(comment, minorEdit); |
| 2413 |
|
} else { |
| 2414 |
0 |
java.lang.Object[] args = |
| 2415 |
|
{ getDefaultEntityReferenceSerializer().serialize(getDocumentReference()), getWiki() }; |
| 2416 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, |
| 2417 |
|
XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2418 |
|
"Access denied in edit mode on document [{0}]. The wiki [{1}] is in read only mode.", null, |
| 2419 |
|
args); |
| 2420 |
|
} |
| 2421 |
|
} finally { |
| 2422 |
|
|
| 2423 |
0 |
context.setWikiId(currentWikiId); |
| 2424 |
|
} |
| 2425 |
|
} else { |
| 2426 |
0 |
java.lang.Object[] args = { this.getFullName() }; |
| 2427 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2428 |
|
"Access denied with no programming rights document {0}", null, args); |
| 2429 |
|
} |
| 2430 |
|
} |
| 2431 |
|
|
| 2432 |
|
|
| 2433 |
|
@link |
| 2434 |
|
|
| 2435 |
|
|
| 2436 |
|
@throws |
| 2437 |
|
@since |
| 2438 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2439 |
2 |
public void saveAsAuthor() throws XWikiException... |
| 2440 |
|
{ |
| 2441 |
2 |
saveAsAuthor("", false); |
| 2442 |
|
} |
| 2443 |
|
|
| 2444 |
|
|
| 2445 |
|
@link |
| 2446 |
|
|
| 2447 |
|
|
| 2448 |
|
@param |
| 2449 |
|
@throws |
| 2450 |
|
@since |
| 2451 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2452 |
0 |
public void saveAsAuthor(String comment) throws XWikiException... |
| 2453 |
|
{ |
| 2454 |
0 |
saveAsAuthor(comment, false); |
| 2455 |
|
} |
| 2456 |
|
|
| 2457 |
|
|
| 2458 |
|
@link |
| 2459 |
|
|
| 2460 |
|
|
| 2461 |
|
@param |
| 2462 |
|
@param |
| 2463 |
|
|
| 2464 |
|
@throws |
| 2465 |
|
@since |
| 2466 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 2467 |
5 |
public void saveAsAuthor(String comment, boolean minorEdit) throws XWikiException... |
| 2468 |
|
{ |
| 2469 |
5 |
String author = this.getEffectiveScriptAuthorName(); |
| 2470 |
5 |
if (hasAccessLevel("edit", author)) { |
| 2471 |
4 |
String viewer = getXWikiContext().getUser(); |
| 2472 |
4 |
try { |
| 2473 |
4 |
getXWikiContext().setUser(author); |
| 2474 |
4 |
saveDocument(comment, minorEdit); |
| 2475 |
|
} finally { |
| 2476 |
4 |
getXWikiContext().setUser(viewer); |
| 2477 |
|
} |
| 2478 |
|
} else { |
| 2479 |
1 |
java.lang.Object[] args = { author, getXWikiContext().getDoc(), this.getFullName() }; |
| 2480 |
1 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2481 |
|
"Access denied; user {0}, acting through script in document {1} cannot save document {2}", null, args); |
| 2482 |
|
} |
| 2483 |
|
} |
| 2484 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 2485 |
257 |
protected void saveDocument(String comment, boolean minorEdit) throws XWikiException... |
| 2486 |
|
{ |
| 2487 |
257 |
XWikiDocument doc = getDoc(); |
| 2488 |
|
|
| 2489 |
257 |
DocumentReference currentUserReference = this.context.getUserReference(); |
| 2490 |
|
|
| 2491 |
257 |
doc.setAuthorReference(currentUserReference); |
| 2492 |
|
|
| 2493 |
257 |
if (doc.isNew()) { |
| 2494 |
121 |
doc.setCreatorReference(currentUserReference); |
| 2495 |
|
} |
| 2496 |
257 |
getXWikiContext().getWiki().saveDocument(doc, comment, minorEdit, getXWikiContext()); |
| 2497 |
257 |
this.initialDoc = this.doc; |
| 2498 |
|
} |
| 2499 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2500 |
0 |
public com.xpn.xwiki.api.Object addObjectFromRequest() throws XWikiException... |
| 2501 |
|
{ |
| 2502 |
|
|
| 2503 |
0 |
com.xpn.xwiki.api.Object obj = |
| 2504 |
|
new com.xpn.xwiki.api.Object(getDoc().addXObjectFromRequest(getXWikiContext()), getXWikiContext()); |
| 2505 |
|
|
| 2506 |
0 |
updateAuthor(); |
| 2507 |
|
|
| 2508 |
0 |
return obj; |
| 2509 |
|
} |
| 2510 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2511 |
0 |
public com.xpn.xwiki.api.Object addObjectFromRequest(String className) throws XWikiException... |
| 2512 |
|
{ |
| 2513 |
0 |
com.xpn.xwiki.api.Object obj = new com.xpn.xwiki.api.Object( |
| 2514 |
|
getDoc().addObjectFromRequest(className, getXWikiContext()), getXWikiContext()); |
| 2515 |
|
|
| 2516 |
0 |
updateAuthor(); |
| 2517 |
|
|
| 2518 |
0 |
return obj; |
| 2519 |
|
} |
| 2520 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2521 |
0 |
public List<Object> addObjectsFromRequest(String className) throws XWikiException... |
| 2522 |
|
{ |
| 2523 |
0 |
return addObjectsFromRequest(className, ""); |
| 2524 |
|
} |
| 2525 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2526 |
0 |
public com.xpn.xwiki.api.Object addObjectFromRequest(String className, String prefix) throws XWikiException... |
| 2527 |
|
{ |
| 2528 |
0 |
com.xpn.xwiki.api.Object obj = new com.xpn.xwiki.api.Object( |
| 2529 |
|
getDoc().addObjectFromRequest(className, prefix, getXWikiContext()), getXWikiContext()); |
| 2530 |
|
|
| 2531 |
0 |
updateAuthor(); |
| 2532 |
|
|
| 2533 |
0 |
return obj; |
| 2534 |
|
} |
| 2535 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 2536 |
0 |
public List<Object> addObjectsFromRequest(String className, String prefix) throws XWikiException... |
| 2537 |
|
{ |
| 2538 |
0 |
List<BaseObject> objs = getDoc().addObjectsFromRequest(className, prefix, getXWikiContext()); |
| 2539 |
0 |
List<Object> wrapped = new ArrayList<Object>(); |
| 2540 |
0 |
for (BaseObject object : objs) { |
| 2541 |
0 |
wrapped.add(new com.xpn.xwiki.api.Object(object, getXWikiContext())); |
| 2542 |
|
} |
| 2543 |
|
|
| 2544 |
0 |
updateAuthor(); |
| 2545 |
|
|
| 2546 |
0 |
return wrapped; |
| 2547 |
|
} |
| 2548 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2549 |
0 |
public com.xpn.xwiki.api.Object updateObjectFromRequest(String className) throws XWikiException... |
| 2550 |
|
{ |
| 2551 |
0 |
com.xpn.xwiki.api.Object obj = new com.xpn.xwiki.api.Object( |
| 2552 |
|
getDoc().updateObjectFromRequest(className, getXWikiContext()), getXWikiContext()); |
| 2553 |
|
|
| 2554 |
0 |
updateAuthor(); |
| 2555 |
|
|
| 2556 |
0 |
return obj; |
| 2557 |
|
} |
| 2558 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2559 |
0 |
public List<Object> updateObjectsFromRequest(String className) throws XWikiException... |
| 2560 |
|
{ |
| 2561 |
0 |
return updateObjectsFromRequest(className, ""); |
| 2562 |
|
} |
| 2563 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 2564 |
0 |
public com.xpn.xwiki.api.Object updateObjectFromRequest(String className, String prefix) throws XWikiException... |
| 2565 |
|
{ |
| 2566 |
0 |
com.xpn.xwiki.api.Object obj = new com.xpn.xwiki.api.Object( |
| 2567 |
|
getDoc().updateObjectFromRequest(className, prefix, getXWikiContext()), getXWikiContext()); |
| 2568 |
|
|
| 2569 |
0 |
updateAuthor(); |
| 2570 |
|
|
| 2571 |
0 |
return obj; |
| 2572 |
|
} |
| 2573 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 2574 |
0 |
public List<Object> updateObjectsFromRequest(String className, String prefix) throws XWikiException... |
| 2575 |
|
{ |
| 2576 |
0 |
List<BaseObject> objs = getDoc().updateObjectsFromRequest(className, prefix, getXWikiContext()); |
| 2577 |
0 |
List<Object> wrapped = new ArrayList<Object>(); |
| 2578 |
0 |
for (BaseObject object : objs) { |
| 2579 |
0 |
wrapped.add(new com.xpn.xwiki.api.Object(object, getXWikiContext())); |
| 2580 |
|
} |
| 2581 |
|
|
| 2582 |
0 |
updateAuthor(); |
| 2583 |
|
|
| 2584 |
0 |
return wrapped; |
| 2585 |
|
} |
| 2586 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2587 |
0 |
public boolean isAdvancedContent()... |
| 2588 |
|
{ |
| 2589 |
0 |
return this.doc.isAdvancedContent(); |
| 2590 |
|
} |
| 2591 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2592 |
0 |
public boolean isProgrammaticContent()... |
| 2593 |
|
{ |
| 2594 |
0 |
return this.doc.isProgrammaticContent(); |
| 2595 |
|
} |
| 2596 |
|
|
| 2597 |
|
|
| 2598 |
|
|
| 2599 |
|
|
| 2600 |
|
@param |
| 2601 |
|
@return |
| 2602 |
|
|
| 2603 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2604 |
5 |
public boolean removeObject(Object object)... |
| 2605 |
|
{ |
| 2606 |
5 |
return getDoc().removeObject(object.getBaseObject()); |
| 2607 |
|
} |
| 2608 |
|
|
| 2609 |
|
|
| 2610 |
|
|
| 2611 |
|
|
| 2612 |
|
|
| 2613 |
|
|
| 2614 |
|
@param |
| 2615 |
|
@return |
| 2616 |
|
|
| 2617 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2618 |
1 |
public boolean removeObjects(String className)... |
| 2619 |
|
{ |
| 2620 |
1 |
return getDoc().removeObjects(className); |
| 2621 |
|
} |
| 2622 |
|
|
| 2623 |
|
|
| 2624 |
|
|
| 2625 |
|
|
| 2626 |
|
@throws |
| 2627 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2628 |
49 |
protected void deleteDocument() throws XWikiException... |
| 2629 |
|
{ |
| 2630 |
49 |
getXWikiContext().getWiki().deleteDocument(this.doc, getXWikiContext()); |
| 2631 |
49 |
this.initialDoc = this.doc; |
| 2632 |
|
} |
| 2633 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2634 |
50 |
public void delete() throws XWikiException... |
| 2635 |
|
{ |
| 2636 |
50 |
if (hasAccessLevel("delete")) { |
| 2637 |
49 |
deleteDocument(); |
| 2638 |
|
} else { |
| 2639 |
1 |
java.lang.Object[] args = { this.getFullName() }; |
| 2640 |
1 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2641 |
|
"Access denied in edit mode on document {0}", null, args); |
| 2642 |
|
} |
| 2643 |
|
} |
| 2644 |
|
|
| 2645 |
|
|
| 2646 |
|
@link |
| 2647 |
|
|
| 2648 |
|
|
| 2649 |
|
@throws |
| 2650 |
|
@since |
| 2651 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 2652 |
0 |
public void deleteAsAuthor() throws XWikiException... |
| 2653 |
|
{ |
| 2654 |
0 |
String author = this.getEffectiveScriptAuthorName(); |
| 2655 |
0 |
if (hasAccessLevel("delete", author)) { |
| 2656 |
0 |
String viewer = getXWikiContext().getUser(); |
| 2657 |
0 |
try { |
| 2658 |
0 |
getXWikiContext().setUser(author); |
| 2659 |
0 |
deleteDocument(); |
| 2660 |
|
} finally { |
| 2661 |
0 |
getXWikiContext().setUser(viewer); |
| 2662 |
|
} |
| 2663 |
|
} else { |
| 2664 |
0 |
java.lang.Object[] args = { author, getXWikiContext().getDoc(), this.getFullName() }; |
| 2665 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2666 |
|
"Access denied; user {0}, acting through script in document {1} cannot delete document {2}", null, |
| 2667 |
|
args); |
| 2668 |
|
} |
| 2669 |
|
} |
| 2670 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2671 |
0 |
public void deleteWithProgrammingRights() throws XWikiException... |
| 2672 |
|
{ |
| 2673 |
0 |
if (hasProgrammingRights()) { |
| 2674 |
0 |
deleteDocument(); |
| 2675 |
|
} else { |
| 2676 |
0 |
java.lang.Object[] args = { this.getFullName() }; |
| 2677 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2678 |
|
"Access denied with no programming rights document {0}", null, args); |
| 2679 |
|
} |
| 2680 |
|
} |
| 2681 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2682 |
0 |
public String getVersionHashCode()... |
| 2683 |
|
{ |
| 2684 |
0 |
return this.doc.getVersionHashCode(getXWikiContext()); |
| 2685 |
|
} |
| 2686 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2687 |
0 |
public int addAttachments() throws XWikiException... |
| 2688 |
|
{ |
| 2689 |
0 |
return addAttachments(null); |
| 2690 |
|
} |
| 2691 |
|
|
| |
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 10 |
Complexity Density: 0.29 |
|
| 2692 |
0 |
public int addAttachments(String fieldName) throws XWikiException... |
| 2693 |
|
{ |
| 2694 |
0 |
if (!hasAccessLevel("edit")) { |
| 2695 |
0 |
java.lang.Object[] args = { this.getFullName() }; |
| 2696 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, |
| 2697 |
|
"Access denied in edit mode on document {0}", null, args); |
| 2698 |
|
} |
| 2699 |
0 |
XWiki xwiki = getXWikiContext().getWiki(); |
| 2700 |
0 |
FileUploadPlugin fileupload = (FileUploadPlugin) xwiki.getPlugin("fileupload", getXWikiContext()); |
| 2701 |
0 |
List<FileItem> fileuploadlist = fileupload.getFileItems(getXWikiContext()); |
| 2702 |
0 |
List<XWikiAttachment> attachments = new ArrayList<XWikiAttachment>(); |
| 2703 |
|
|
| 2704 |
0 |
this.context.put("addedAttachments", attachments); |
| 2705 |
0 |
int nb = 0; |
| 2706 |
|
|
| 2707 |
0 |
if (fileuploadlist == null) { |
| 2708 |
0 |
return 0; |
| 2709 |
|
} |
| 2710 |
|
|
| 2711 |
0 |
for (FileItem item : fileuploadlist) { |
| 2712 |
0 |
String name = item.getFieldName(); |
| 2713 |
0 |
if (fieldName != null && !fieldName.equals(name)) { |
| 2714 |
0 |
continue; |
| 2715 |
|
} |
| 2716 |
0 |
if (item.isFormField()) { |
| 2717 |
0 |
continue; |
| 2718 |
|
} |
| 2719 |
0 |
byte[] data = fileupload.getFileItemData(name, getXWikiContext()); |
| 2720 |
0 |
String filename; |
| 2721 |
0 |
String fname = fileupload.getFileName(name, getXWikiContext()); |
| 2722 |
0 |
int i = fname.lastIndexOf("\\"); |
| 2723 |
0 |
if (i == -1) { |
| 2724 |
0 |
i = fname.lastIndexOf("/"); |
| 2725 |
|
} |
| 2726 |
0 |
filename = fname.substring(i + 1); |
| 2727 |
0 |
filename = filename.replaceAll("\\+", " "); |
| 2728 |
|
|
| 2729 |
0 |
if ((data != null) && (data.length > 0)) { |
| 2730 |
0 |
XWikiAttachment attachment = this.getDoc().addAttachment(filename, data, getXWikiContext()); |
| 2731 |
0 |
getDoc().saveAttachmentContent(attachment, getXWikiContext()); |
| 2732 |
|
|
| 2733 |
|
|
| 2734 |
0 |
attachments.add(attachment); |
| 2735 |
0 |
nb++; |
| 2736 |
|
} |
| 2737 |
|
} |
| 2738 |
|
|
| 2739 |
0 |
if (nb > 0) { |
| 2740 |
0 |
getXWikiContext().getWiki().saveDocument(getDoc(), getXWikiContext()); |
| 2741 |
0 |
this.initialDoc = this.doc; |
| 2742 |
|
} |
| 2743 |
|
|
| 2744 |
0 |
return nb; |
| 2745 |
|
} |
| 2746 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 2747 |
0 |
public Attachment addAttachment(String fileName, InputStream iStream)... |
| 2748 |
|
{ |
| 2749 |
0 |
try { |
| 2750 |
0 |
return new Attachment(this, this.getDoc().addAttachment(fileName, iStream, getXWikiContext()), |
| 2751 |
|
getXWikiContext()); |
| 2752 |
|
} catch (XWikiException e) { |
| 2753 |
|
|
| 2754 |
|
} catch (IOException e) { |
| 2755 |
|
|
| 2756 |
|
} finally { |
| 2757 |
0 |
updateAuthor(); |
| 2758 |
|
} |
| 2759 |
|
|
| 2760 |
0 |
return null; |
| 2761 |
|
} |
| 2762 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2763 |
0 |
public Attachment addAttachment(String fileName, byte[] data)... |
| 2764 |
|
{ |
| 2765 |
0 |
try { |
| 2766 |
0 |
return new Attachment(this, this.getDoc().addAttachment(fileName, data, getXWikiContext()), |
| 2767 |
|
getXWikiContext()); |
| 2768 |
|
} catch (XWikiException e) { |
| 2769 |
|
|
| 2770 |
|
} finally { |
| 2771 |
0 |
updateAuthor(); |
| 2772 |
|
} |
| 2773 |
|
|
| 2774 |
0 |
return null; |
| 2775 |
|
} |
| 2776 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2777 |
0 |
public boolean validate() throws XWikiException... |
| 2778 |
|
{ |
| 2779 |
0 |
return this.doc.validate(getXWikiContext()); |
| 2780 |
|
} |
| 2781 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2782 |
0 |
public boolean validate(String[] classNames) throws XWikiException... |
| 2783 |
|
{ |
| 2784 |
0 |
return this.doc.validate(classNames, getXWikiContext()); |
| 2785 |
|
} |
| 2786 |
|
|
| 2787 |
|
|
| 2788 |
|
|
| 2789 |
|
|
| 2790 |
|
|
| 2791 |
|
@return |
| 2792 |
|
|
| 2793 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2794 |
0 |
public String getValidationScript()... |
| 2795 |
|
{ |
| 2796 |
0 |
return getDoc().getValidationScript(); |
| 2797 |
|
} |
| 2798 |
|
|
| 2799 |
|
|
| 2800 |
|
|
| 2801 |
|
|
| 2802 |
|
|
| 2803 |
|
@param |
| 2804 |
|
|
| 2805 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2806 |
0 |
public void setValidationScript(String validationScript)... |
| 2807 |
|
{ |
| 2808 |
0 |
getDoc().setValidationScript(validationScript); |
| 2809 |
|
|
| 2810 |
0 |
updateAuthor(); |
| 2811 |
|
} |
| 2812 |
|
|
| 2813 |
|
|
| 2814 |
|
|
| 2815 |
|
|
| 2816 |
|
@link |
| 2817 |
|
|
| 2818 |
|
@param |
| 2819 |
|
@throws |
| 2820 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2821 |
2 |
public void rename(String newDocumentName) throws XWikiException... |
| 2822 |
|
{ |
| 2823 |
2 |
rename(getCurrentMixedDocumentReferenceResolver().resolve(newDocumentName)); |
| 2824 |
|
} |
| 2825 |
|
|
| 2826 |
|
|
| 2827 |
|
|
| 2828 |
|
|
| 2829 |
|
@link |
| 2830 |
|
|
| 2831 |
|
@param |
| 2832 |
|
@throws |
| 2833 |
|
@since |
| 2834 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
| 2835 |
2 |
public void rename(DocumentReference newReference) throws XWikiException... |
| 2836 |
|
{ |
| 2837 |
2 |
if (hasAccessLevel("delete") && this.context.getWiki().checkAccess("edit", |
| 2838 |
|
this.context.getWiki().getDocument(newReference, this.context), this.context)) { |
| 2839 |
2 |
this.getDoc().rename(newReference, getXWikiContext()); |
| 2840 |
|
} |
| 2841 |
|
} |
| 2842 |
|
|
| 2843 |
|
|
| 2844 |
|
|
| 2845 |
|
|
| 2846 |
|
|
| 2847 |
|
|
| 2848 |
|
|
| 2849 |
|
|
| 2850 |
|
|
| 2851 |
|
|
| 2852 |
|
|
| 2853 |
|
|
| 2854 |
|
|
| 2855 |
|
|
| 2856 |
|
|
| 2857 |
|
|
| 2858 |
|
@param |
| 2859 |
|
@param |
| 2860 |
|
|
| 2861 |
|
@throws |
| 2862 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
| 2863 |
0 |
public void rename(String newDocumentName, List<String> backlinkDocumentNames) throws XWikiException... |
| 2864 |
|
{ |
| 2865 |
0 |
if (hasAccessLevel("delete") && this.context.getWiki().checkAccess("edit", |
| 2866 |
|
this.context.getWiki().getDocument(newDocumentName, this.context), this.context)) { |
| 2867 |
0 |
this.getDoc().rename(newDocumentName, backlinkDocumentNames, getXWikiContext()); |
| 2868 |
|
} |
| 2869 |
|
} |
| 2870 |
|
|
| 2871 |
|
|
| 2872 |
|
@link |
| 2873 |
|
|
| 2874 |
|
|
| 2875 |
|
@param |
| 2876 |
|
@param |
| 2877 |
|
|
| 2878 |
|
@param |
| 2879 |
|
@throws |
| 2880 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 2881 |
0 |
public void rename(String newDocumentName, List<String> backlinkDocumentNames, List<String> childDocumentNames)... |
| 2882 |
|
throws XWikiException |
| 2883 |
|
{ |
| 2884 |
0 |
List<DocumentReference> backlinkDocumentReferences = new ArrayList<DocumentReference>(); |
| 2885 |
0 |
for (String backlinkDocumentName : backlinkDocumentNames) { |
| 2886 |
0 |
backlinkDocumentReferences.add(getCurrentMixedDocumentReferenceResolver().resolve(backlinkDocumentName)); |
| 2887 |
|
} |
| 2888 |
|
|
| 2889 |
0 |
List<DocumentReference> childDocumentReferences = new ArrayList<DocumentReference>(); |
| 2890 |
0 |
for (String childDocumentName : childDocumentNames) { |
| 2891 |
0 |
childDocumentReferences.add(getCurrentMixedDocumentReferenceResolver().resolve(childDocumentName)); |
| 2892 |
|
} |
| 2893 |
|
|
| 2894 |
0 |
rename(getCurrentMixedDocumentReferenceResolver().resolve(newDocumentName), backlinkDocumentReferences, |
| 2895 |
|
childDocumentReferences); |
| 2896 |
|
} |
| 2897 |
|
|
| 2898 |
|
|
| 2899 |
|
@link |
| 2900 |
|
|
| 2901 |
|
|
| 2902 |
|
@param |
| 2903 |
|
@param |
| 2904 |
|
|
| 2905 |
|
@param |
| 2906 |
|
|
| 2907 |
|
@throws |
| 2908 |
|
@since |
| 2909 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
| 2910 |
0 |
public void rename(DocumentReference newReference, List<DocumentReference> backlinkDocumentNames,... |
| 2911 |
|
List<DocumentReference> childDocumentNames) throws XWikiException |
| 2912 |
|
{ |
| 2913 |
0 |
if (hasAccessLevel("delete") && this.context.getWiki().checkAccess("edit", |
| 2914 |
|
this.context.getWiki().getDocument(newReference, this.context), this.context)) { |
| 2915 |
|
|
| 2916 |
|
|
| 2917 |
|
|
| 2918 |
|
|
| 2919 |
|
|
| 2920 |
0 |
int counter = childDocumentNames.size(); |
| 2921 |
0 |
List<String> actuallyChildren = getChildren(); |
| 2922 |
0 |
while (counter > 0) { |
| 2923 |
0 |
counter--; |
| 2924 |
0 |
if (!actuallyChildren.contains(childDocumentNames.get(counter)) |
| 2925 |
|
&& !this.context.getWiki().checkAccess("edit", |
| 2926 |
|
this.context.getWiki().getDocument(childDocumentNames.get(counter), this.context), |
| 2927 |
|
this.context)) { |
| 2928 |
0 |
return; |
| 2929 |
|
} |
| 2930 |
|
} |
| 2931 |
|
|
| 2932 |
0 |
this.getDoc().rename(newReference, backlinkDocumentNames, childDocumentNames, getXWikiContext()); |
| 2933 |
|
} |
| 2934 |
|
} |
| 2935 |
|
|
| 2936 |
|
|
| 2937 |
|
|
| 2938 |
|
|
| 2939 |
|
@param |
| 2940 |
|
@return |
| 2941 |
|
|
| |
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 2942 |
21 |
public Document getDocumentRevision(String revision)... |
| 2943 |
|
{ |
| 2944 |
21 |
try { |
| 2945 |
21 |
XWikiDocument documentRevision = this.context.getWiki().getDocument(this.doc, revision, this.context); |
| 2946 |
21 |
Document result = new Document(documentRevision, this.context); |
| 2947 |
|
|
| 2948 |
21 |
return result; |
| 2949 |
|
} catch (Exception e) { |
| 2950 |
0 |
return null; |
| 2951 |
|
} |
| 2952 |
|
} |
| 2953 |
|
|
| 2954 |
|
|
| 2955 |
|
|
| 2956 |
|
|
| 2957 |
|
@return |
| 2958 |
|
@throws |
| 2959 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2960 |
0 |
public Document getPreviousDocument() throws XWikiException... |
| 2961 |
|
{ |
| 2962 |
0 |
return getDocumentRevision(getPreviousVersion()); |
| 2963 |
|
} |
| 2964 |
|
|
| 2965 |
|
|
| 2966 |
|
@return |
| 2967 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2968 |
0 |
public boolean isMostRecent()... |
| 2969 |
|
{ |
| 2970 |
0 |
return this.doc.isMostRecent(); |
| 2971 |
|
} |
| 2972 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2973 |
20666 |
@Override... |
| 2974 |
|
public String toString() |
| 2975 |
|
{ |
| 2976 |
20664 |
return this.doc.toString(); |
| 2977 |
|
} |
| 2978 |
|
|
| 2979 |
|
|
| 2980 |
|
|
| 2981 |
|
|
| 2982 |
|
@param |
| 2983 |
|
@throws |
| 2984 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 2985 |
0 |
public boolean convertSyntax(String targetSyntaxId) throws XWikiException... |
| 2986 |
|
{ |
| 2987 |
0 |
try { |
| 2988 |
0 |
getDoc().convertSyntax(targetSyntaxId, this.context); |
| 2989 |
|
} catch (Exception ex) { |
| 2990 |
0 |
LOGGER.error( |
| 2991 |
|
"Failed to convert document [" + getPrefixedFullName() + "] to syntax [" + targetSyntaxId + "]", ex); |
| 2992 |
|
|
| 2993 |
0 |
return false; |
| 2994 |
|
} finally { |
| 2995 |
0 |
updateAuthor(); |
| 2996 |
0 |
updateContentAuthor(); |
| 2997 |
|
} |
| 2998 |
|
|
| 2999 |
0 |
return true; |
| 3000 |
|
} |
| 3001 |
|
|
| 3002 |
|
|
| 3003 |
|
|
| 3004 |
|
|
| 3005 |
|
|
| 3006 |
|
@return |
| 3007 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3008 |
416 |
public boolean isHidden()... |
| 3009 |
|
{ |
| 3010 |
416 |
return this.doc.isHidden(); |
| 3011 |
|
} |
| 3012 |
|
|
| 3013 |
|
|
| 3014 |
|
|
| 3015 |
|
|
| 3016 |
|
|
| 3017 |
|
@param |
| 3018 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3019 |
201 |
public void setHidden(boolean hidden)... |
| 3020 |
|
{ |
| 3021 |
201 |
this.doc.setHidden(hidden); |
| 3022 |
|
} |
| 3023 |
|
|
| 3024 |
|
|
| 3025 |
|
|
| 3026 |
|
|
| 3027 |
|
@link |
| 3028 |
|
@link |
| 3029 |
|
@link@link |
| 3030 |
|
@link |
| 3031 |
|
@link |
| 3032 |
|
@link |
| 3033 |
|
|
| 3034 |
|
|
| 3035 |
|
|
| 3036 |
|
|
| 3037 |
|
@link@link |
| 3038 |
|
|
| 3039 |
|
@link |
| 3040 |
|
|
| 3041 |
|
|
| 3042 |
|
|
| 3043 |
|
|
| 3044 |
|
|
| 3045 |
|
|
| 3046 |
|
@link |
| 3047 |
|
|
| 3048 |
|
|
| 3049 |
|
@since |
| 3050 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3051 |
24 |
public void dropPermissions()... |
| 3052 |
|
{ |
| 3053 |
|
|
| 3054 |
|
|
| 3055 |
24 |
final ExecutionContext context = Utils.getComponent(Execution.class).getContext(); |
| 3056 |
24 |
context.setProperty(XWikiConstant.DROPPED_PERMISSIONS, System.identityHashCode(context)); |
| 3057 |
|
} |
| 3058 |
|
|
| 3059 |
|
|
| 3060 |
|
@return |
| 3061 |
|
@link |
| 3062 |
|
@link |
| 3063 |
|
@since |
| 3064 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3065 |
0 |
public boolean isTranslation()... |
| 3066 |
|
{ |
| 3067 |
0 |
return 1 == this.getDoc().getTranslation(); |
| 3068 |
|
} |
| 3069 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 3070 |
0 |
private ContextualAuthorizationManager getAuthorizationManager()... |
| 3071 |
|
{ |
| 3072 |
0 |
if (this.authorizationManager == null) { |
| 3073 |
0 |
this.authorizationManager = Utils.getComponent(ContextualAuthorizationManager.class); |
| 3074 |
|
} |
| 3075 |
|
|
| 3076 |
0 |
return this.authorizationManager; |
| 3077 |
|
} |
| 3078 |
|
} |