1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.ratings.internal; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.ratings.RatingsManager; |
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 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
39 |
|
@Component |
40 |
|
@Named(RatingsManager.RATINGS_CLASSNAME) |
41 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
42 |
|
public class RatingClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
43 |
|
{ |
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
2 |
public RatingClassDocumentInitializer()... |
48 |
|
{ |
49 |
2 |
super(XWiki.SYSTEM_SPACE, RatingsManager.RATINGS_CLASSPAGE); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
52 |
2 |
@Override... |
53 |
|
public boolean updateDocument(XWikiDocument document) |
54 |
|
{ |
55 |
2 |
boolean needsUpdate = false; |
56 |
|
|
57 |
2 |
BaseClass bclass = document.getXClass(); |
58 |
|
|
59 |
2 |
needsUpdate |= bclass.addTextField(RatingsManager.RATING_CLASS_FIELDNAME_AUTHOR, "Author", 30); |
60 |
2 |
needsUpdate |= bclass.addNumberField(RatingsManager.RATING_CLASS_FIELDNAME_VOTE, "Vote", 5, "integer"); |
61 |
2 |
needsUpdate |= bclass.addDateField(RatingsManager.RATING_CLASS_FIELDNAME_DATE, "Date"); |
62 |
2 |
needsUpdate |= bclass.addTextField(RatingsManager.RATING_CLASS_FIELDNAME_PARENT, "Parent", 30); |
63 |
|
|
64 |
2 |
needsUpdate = setClassDocumentFields(document, "XWiki Ratings Class"); |
65 |
|
|
66 |
2 |
return needsUpdate; |
67 |
|
} |
68 |
|
} |