1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.localization.wiki.internal; |
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.doc.XWikiDocument; |
28 |
|
import com.xpn.xwiki.internal.mandatory.AbstractMandatoryDocumentInitializer; |
29 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
37 |
|
@Component |
38 |
|
@Named(TranslationDocumentModel.TRANSLATIONCLASS_REFERENCE_STRING) |
39 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
40 |
|
public class TranslationDocumentClassInitializer extends AbstractMandatoryDocumentInitializer |
41 |
|
{ |
42 |
|
|
43 |
|
|
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
60 |
public TranslationDocumentClassInitializer()... |
46 |
|
{ |
47 |
60 |
super(TranslationDocumentModel.TRANSLATIONCLASS_REFERENCE_SPACE, |
48 |
|
TranslationDocumentModel.TRANSLATIONCLASS_REFERENCE_NAME); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
51 |
92 |
@Override... |
52 |
|
public boolean updateDocument(XWikiDocument document) |
53 |
|
{ |
54 |
92 |
boolean needsUpdate = false; |
55 |
|
|
56 |
92 |
BaseClass bclass = document.getXClass(); |
57 |
|
|
58 |
92 |
needsUpdate |= |
59 |
|
bclass.addStaticListField(TranslationDocumentModel.TRANSLATIONCLASS_PROP_SCOPE, "Scope", |
60 |
|
"GLOBAL|WIKI|USER|ON_DEMAND"); |
61 |
|
|
62 |
92 |
needsUpdate |= setClassDocumentFields(document, "Translation Document Class"); |
63 |
|
|
64 |
92 |
return needsUpdate; |
65 |
|
} |
66 |
|
} |