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.doc.XWikiDocument; |
29 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
30 |
|
import com.xpn.xwiki.objects.classes.TextAreaClass.EditorType; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
38 |
|
@Component |
39 |
|
@Named("XWiki.XWikiComments") |
40 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
41 |
|
public class XWikiCommentsDocumentInitializer extends AbstractMandatoryDocumentInitializer |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
60 |
public XWikiCommentsDocumentInitializer()... |
47 |
|
{ |
48 |
60 |
super(XWiki.SYSTEM_SPACE, "XWikiComments"); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
51 |
101 |
@Override... |
52 |
|
public boolean updateDocument(XWikiDocument document) |
53 |
|
{ |
54 |
101 |
boolean needsUpdate = false; |
55 |
|
|
56 |
101 |
BaseClass bclass = document.getXClass(); |
57 |
|
|
58 |
101 |
needsUpdate |= bclass.addTextField("author", "Author", 30); |
59 |
101 |
needsUpdate |= bclass.addTextAreaField("highlight", "Highlighted Text", 40, 2); |
60 |
101 |
needsUpdate |= bclass.addNumberField("replyto", "Reply To", 5, "integer"); |
61 |
101 |
needsUpdate |= bclass.addDateField("date", "Date"); |
62 |
|
|
63 |
|
|
64 |
101 |
needsUpdate |= bclass.addTextAreaField("comment", "Comment", 40, 5, EditorType.TEXT); |
65 |
|
|
66 |
101 |
needsUpdate |= setClassDocumentFields(document, "XWiki Comment Class"); |
67 |
|
|
68 |
101 |
return needsUpdate; |
69 |
|
} |
70 |
|
} |