1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rest.internal.resources.objects; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.Collections; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
27 |
|
import org.xwiki.rest.XWikiResource; |
28 |
|
import org.xwiki.rest.internal.Utils; |
29 |
|
|
30 |
|
import com.xpn.xwiki.XWikiException; |
31 |
|
import com.xpn.xwiki.api.Document; |
32 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
33 |
|
import com.xpn.xwiki.objects.BaseObject; |
34 |
|
|
|
|
| 60% |
Uncovered Elements: 6 (15) |
Complexity: 4 |
Complexity Density: 0.4 |
|
35 |
|
public class BaseObjectsResource extends XWikiResource |
36 |
|
{ |
37 |
|
private DocumentReferenceResolver<String> currentMixedDocumentReferenceResolver = |
38 |
|
com.xpn.xwiki.web.Utils.getComponent(DocumentReferenceResolver.TYPE_STRING, "currentmixed"); |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
40 |
34 |
protected BaseObject getBaseObject(Document doc, String className, int objectNumber) throws XWikiException... |
41 |
|
{ |
42 |
34 |
XWikiDocument xwikiDocument = |
43 |
|
Utils.getXWiki(componentManager).getDocument(doc.getDocumentReference(), |
44 |
|
Utils.getXWikiContext(componentManager)); |
45 |
|
|
46 |
34 |
return xwikiDocument.getObject(className, objectNumber); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
49 |
13 |
protected List<BaseObject> getBaseObjects(Document doc) throws XWikiException... |
50 |
|
{ |
51 |
13 |
List<BaseObject> objectList = new ArrayList<BaseObject>(); |
52 |
|
|
53 |
13 |
XWikiDocument xwikiDocument = |
54 |
|
Utils.getXWiki(componentManager).getDocument(doc.getDocumentReference(), |
55 |
|
Utils.getXWikiContext(componentManager)); |
56 |
|
|
57 |
13 |
for (List<BaseObject> xwikiObjects : xwikiDocument.getXObjects().values()) { |
58 |
13 |
objectList.addAll(xwikiObjects); |
59 |
|
} |
60 |
|
|
61 |
13 |
return objectList; |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
64 |
0 |
protected List<BaseObject> getBaseObjects(Document doc, String className) throws XWikiException... |
65 |
|
{ |
66 |
0 |
XWikiDocument xwikiDocument = Utils.getXWiki(componentManager).getDocument(doc.getDocumentReference(), |
67 |
|
Utils.getXWikiContext(componentManager)); |
68 |
|
|
69 |
0 |
List<BaseObject> xwikiObjects = xwikiDocument.getXObjects(xwikiDocument.resolveClassReference(className)); |
70 |
|
|
71 |
|
|
72 |
0 |
return xwikiObjects != null ? new ArrayList<BaseObject>(xwikiObjects) : Collections.<BaseObject>emptyList(); |
73 |
|
} |
74 |
|
} |