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.Inject; |
23 |
|
import javax.inject.Named; |
24 |
|
import javax.inject.Singleton; |
25 |
|
|
26 |
|
import org.xwiki.component.annotation.Component; |
27 |
|
import org.xwiki.model.reference.DocumentReference; |
28 |
|
import org.xwiki.sheet.SheetBinder; |
29 |
|
|
30 |
|
import com.xpn.xwiki.XWiki; |
31 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
32 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@Component |
41 |
|
@Named("XWiki.XWikiGroups") |
42 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
43 |
|
public class XWikiGroupsDocumentInitializer extends AbstractMandatoryDocumentInitializer |
44 |
|
{ |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@Inject |
49 |
|
@Named("class") |
50 |
|
private SheetBinder classSheetBinder; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
60 |
public XWikiGroupsDocumentInitializer()... |
56 |
|
{ |
57 |
60 |
super(XWiki.SYSTEM_SPACE, "XWikiGroups"); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
60 |
118 |
@Override... |
61 |
|
public boolean updateDocument(XWikiDocument document) |
62 |
|
{ |
63 |
118 |
boolean needsUpdate = false; |
64 |
|
|
65 |
118 |
BaseClass bclass = document.getXClass(); |
66 |
|
|
67 |
118 |
needsUpdate |= bclass.addTextField("member", "Member", 30); |
68 |
118 |
needsUpdate |= setClassDocumentFields(document, "XWiki Group Class"); |
69 |
|
|
70 |
|
|
71 |
118 |
if (this.classSheetBinder.getSheets(document).isEmpty()) { |
72 |
38 |
String wikiName = document.getDocumentReference().getWikiReference().getName(); |
73 |
38 |
DocumentReference sheet = new DocumentReference(wikiName, XWiki.SYSTEM_SPACE, "XWikiGroupSheet"); |
74 |
38 |
needsUpdate |= this.classSheetBinder.bind(document, sheet); |
75 |
|
} |
76 |
|
|
77 |
118 |
return needsUpdate; |
78 |
|
} |
79 |
|
} |