1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.internal.mandatory; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
|
27 |
|
import com.xpn.xwiki.XWiki; |
28 |
|
import com.xpn.xwiki.XWikiConstant; |
29 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
30 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
31 |
|
import com.xpn.xwiki.objects.classes.StaticListClass; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
39 |
|
@Component |
40 |
|
@Named("XWiki.TagClass") |
41 |
|
@Singleton |
|
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
42 |
|
public class TagClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
43 |
|
{ |
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
60 |
public TagClassDocumentInitializer()... |
48 |
|
{ |
49 |
60 |
super(XWiki.SYSTEM_SPACE, "TagClass"); |
50 |
|
} |
51 |
|
|
|
|
| 72.7% |
Uncovered Elements: 3 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
52 |
92 |
@Override... |
53 |
|
public boolean updateDocument(XWikiDocument document) |
54 |
|
{ |
55 |
92 |
boolean needsUpdate = false; |
56 |
|
|
57 |
92 |
BaseClass bclass = document.getXClass(); |
58 |
|
|
59 |
92 |
needsUpdate |= |
60 |
|
bclass.addStaticListField(XWikiConstant.TAG_CLASS_PROP_TAGS, "Tags", 30, true, true, "", "input", "|,"); |
61 |
92 |
StaticListClass tagClass = (StaticListClass) bclass.get(XWikiConstant.TAG_CLASS_PROP_TAGS); |
62 |
92 |
if (!tagClass.isRelationalStorage()) { |
63 |
0 |
tagClass.setRelationalStorage(true); |
64 |
0 |
needsUpdate = true; |
65 |
|
} |
66 |
92 |
needsUpdate |= setClassDocumentFields(document, "XWiki Tag Class"); |
67 |
|
|
68 |
92 |
return needsUpdate; |
69 |
|
} |
70 |
|
} |