1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.index.tree.internal.nestedpages; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.Collections; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import javax.inject.Inject; |
27 |
|
import javax.inject.Named; |
28 |
|
import javax.inject.Provider; |
29 |
|
|
30 |
|
import org.xwiki.component.annotation.Component; |
31 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
32 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
33 |
|
import org.xwiki.model.reference.DocumentReference; |
34 |
|
|
35 |
|
import com.xpn.xwiki.XWikiContext; |
36 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
@version |
42 |
|
@since |
43 |
|
@since |
44 |
|
|
45 |
|
@Component |
46 |
|
@Named("objects") |
47 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
|
|
| 11.1% |
Uncovered Elements: 16 (18) |
Complexity: 3 |
Complexity Density: 0.2 |
|
48 |
|
public class ObjectsTreeNode extends AbstractDocumentTreeNode |
49 |
|
{ |
50 |
|
@Inject |
51 |
|
private Provider<XWikiContext> xcontextProvider; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
56 |
128 |
public ObjectsTreeNode()... |
57 |
|
{ |
58 |
128 |
super("objects"); |
59 |
|
} |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
61 |
0 |
@Override... |
62 |
|
protected List<String> getChildren(DocumentReference documentReference, int offset, int limit) throws Exception |
63 |
|
{ |
64 |
0 |
XWikiContext xcontext = this.xcontextProvider.get(); |
65 |
0 |
XWikiDocument document = xcontext.getWiki().getDocument(documentReference, xcontext); |
66 |
0 |
String serializedDocRef = this.defaultEntityReferenceSerializer.serialize(documentReference); |
67 |
0 |
List<String> classNames = new ArrayList<String>(); |
68 |
0 |
for (DocumentReference classReference : document.getXObjects().keySet()) { |
69 |
0 |
classNames.add(this.defaultEntityReferenceSerializer.serialize(classReference)); |
70 |
|
} |
71 |
0 |
Collections.sort(classNames); |
72 |
0 |
List<String> children = new ArrayList<String>(); |
73 |
0 |
for (String className : subList(classNames, offset, limit)) { |
74 |
0 |
children.add("objectsOfType:" + serializedDocRef + "/" + className); |
75 |
|
} |
76 |
0 |
return children; |
77 |
|
} |
78 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
79 |
0 |
@Override... |
80 |
|
protected int getChildCount(DocumentReference documentReference) throws Exception |
81 |
|
{ |
82 |
0 |
XWikiContext xcontext = this.xcontextProvider.get(); |
83 |
0 |
XWikiDocument document = xcontext.getWiki().getDocument(documentReference, xcontext); |
84 |
0 |
return document.getXObjects().size(); |
85 |
|
} |
86 |
|
} |