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.ClassPropertyReference; |
34 |
|
import org.xwiki.model.reference.DocumentReference; |
35 |
|
|
36 |
|
import com.xpn.xwiki.XWikiContext; |
37 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@version |
43 |
|
@since |
44 |
|
@since |
45 |
|
|
46 |
|
@Component |
47 |
|
@Named("classProperties") |
48 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
|
|
| 13.3% |
Uncovered Elements: 13 (15) |
Complexity: 3 |
Complexity Density: 0.25 |
|
49 |
|
public class ClassPropertiesTreeNode extends AbstractDocumentTreeNode |
50 |
|
{ |
51 |
|
@Inject |
52 |
|
private Provider<XWikiContext> xcontextProvider; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
128 |
public ClassPropertiesTreeNode()... |
58 |
|
{ |
59 |
128 |
super("classProperties"); |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
62 |
0 |
@Override... |
63 |
|
protected List<String> getChildren(DocumentReference documentReference, int offset, int limit) throws Exception |
64 |
|
{ |
65 |
0 |
XWikiContext xcontext = this.xcontextProvider.get(); |
66 |
0 |
XWikiDocument document = xcontext.getWiki().getDocument(documentReference, xcontext); |
67 |
0 |
List<String> properties = new ArrayList<String>(document.getXClass().getPropertyList()); |
68 |
0 |
Collections.sort(properties); |
69 |
0 |
List<String> children = new ArrayList<String>(); |
70 |
0 |
for (String property : subList(properties, offset, limit)) { |
71 |
0 |
children.add(serialize(new ClassPropertyReference(property, documentReference))); |
72 |
|
} |
73 |
0 |
return children; |
74 |
|
} |
75 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
76 |
0 |
@Override... |
77 |
|
protected int getChildCount(DocumentReference documentReference) throws Exception |
78 |
|
{ |
79 |
0 |
XWikiContext xcontext = this.xcontextProvider.get(); |
80 |
0 |
XWikiDocument document = xcontext.getWiki().getDocument(documentReference, xcontext); |
81 |
0 |
return document.getXClass().getPropertyList().size(); |
82 |
|
} |
83 |
|
} |