1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.watchlist.internal.documents; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.model.reference.LocalDocumentReference; |
27 |
|
|
28 |
|
import com.xpn.xwiki.XWiki; |
29 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
30 |
|
import com.xpn.xwiki.internal.mandatory.AbstractMandatoryDocumentInitializer; |
31 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
32 |
|
|
33 |
|
|
34 |
|
@value |
35 |
|
|
36 |
|
@version |
37 |
|
|
38 |
|
@Component |
39 |
|
@Named(WatchListJobClassDocumentInitializer.DOCUMENT_FULL_NAME) |
40 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.38 |
|
41 |
|
public class WatchListJobClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
public static final String DOCUMENT_NAME = "WatchListJobClass"; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
public static final String DOCUMENT_FULL_NAME = XWiki.SYSTEM_SPACE + "." + DOCUMENT_NAME; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
public static final LocalDocumentReference DOCUMENT_REFERENCE = new LocalDocumentReference(XWiki.SYSTEM_SPACE, |
57 |
|
DOCUMENT_NAME); |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
public static final String TEMPLATE_FIELD = "template"; |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
public static final String LAST_FIRE_TIME_FIELD = "last_fire_time"; |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
1 |
public WatchListJobClassDocumentInitializer()... |
73 |
|
{ |
74 |
1 |
super(DOCUMENT_REFERENCE); |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
1 |
@Override... |
78 |
|
protected boolean isMainWikiOnly() |
79 |
|
{ |
80 |
|
|
81 |
1 |
return true; |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
84 |
1 |
@Override... |
85 |
|
public boolean updateDocument(XWikiDocument document) |
86 |
|
{ |
87 |
1 |
boolean needsUpdate = false; |
88 |
1 |
BaseClass bclass = document.getXClass(); |
89 |
|
|
90 |
|
|
91 |
1 |
needsUpdate |= |
92 |
|
bclass.addTextField(TEMPLATE_FIELD, "Document holding the notification message template to use", 80); |
93 |
1 |
needsUpdate |= bclass.addDateField(LAST_FIRE_TIME_FIELD, "Last notifier fire time", "dd/MM/yyyy HH:mm:ss", 1); |
94 |
|
|
95 |
|
|
96 |
1 |
needsUpdate |= setClassDocumentFields(document, "XWiki WatchList Notifier Class"); |
97 |
|
|
98 |
1 |
return needsUpdate; |
99 |
|
} |
100 |
|
} |