1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.mail.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 |
|
import com.xpn.xwiki.objects.classes.TextAreaClass; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
38 |
|
@Component |
39 |
|
@Named("XWiki.Mail") |
40 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
41 |
|
public class MailMandatoryDocumentInitializer extends AbstractMandatoryDocumentInitializer |
42 |
|
{ |
43 |
|
private static final String SPACE = "XWiki"; |
44 |
|
|
45 |
|
private static final String PAGE = "Mail"; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
7 |
public MailMandatoryDocumentInitializer()... |
51 |
|
{ |
52 |
7 |
super(SPACE, PAGE); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
55 |
10 |
@Override... |
56 |
|
public boolean updateDocument(XWikiDocument document) |
57 |
|
{ |
58 |
10 |
boolean needsUpdate = false; |
59 |
|
|
60 |
10 |
BaseClass bclass = document.getXClass(); |
61 |
|
|
62 |
10 |
needsUpdate |= bclass.addTextField("subject", "Subject", 40); |
63 |
10 |
needsUpdate |= bclass.addTextField("language", "Language", 5); |
64 |
10 |
needsUpdate |= bclass.addTextAreaField("text", "Text", 80, 15, TextAreaClass.ContentType.PURE_TEXT); |
65 |
10 |
needsUpdate |= bclass.addTextAreaField("html", "HTML", 80, 15, TextAreaClass.ContentType.PURE_TEXT); |
66 |
|
|
67 |
10 |
needsUpdate |= setClassDocumentFields(document, "Mail Class"); |
68 |
|
|
69 |
10 |
return needsUpdate; |
70 |
|
} |
71 |
|
} |