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 |
|
import org.xwiki.model.reference.LocalDocumentReference; |
27 |
|
import org.xwiki.rendering.syntax.Syntax; |
28 |
|
|
29 |
|
import com.xpn.xwiki.XWiki; |
30 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
31 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
39 |
|
@Component |
40 |
|
@Named("XWiki.RedirectClass") |
41 |
|
@Singleton |
|
|
| 76.9% |
Uncovered Elements: 3 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
42 |
|
public class RedirectClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
43 |
|
{ |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
public static final LocalDocumentReference REFERENCE = |
48 |
|
new LocalDocumentReference(XWiki.SYSTEM_SPACE, "RedirectClass"); |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
60 |
public RedirectClassDocumentInitializer()... |
54 |
|
{ |
55 |
60 |
super(REFERENCE); |
56 |
|
} |
57 |
|
|
|
|
| 70% |
Uncovered Elements: 3 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
58 |
92 |
@Override... |
59 |
|
public boolean updateDocument(XWikiDocument document) |
60 |
|
{ |
61 |
92 |
boolean needsUpdate = false; |
62 |
|
|
63 |
92 |
BaseClass bclass = document.getXClass(); |
64 |
|
|
65 |
|
|
66 |
92 |
if (!Syntax.XWIKI_2_1.equals(document.getSyntax())) { |
67 |
0 |
document.setSyntax(Syntax.XWIKI_2_1); |
68 |
0 |
needsUpdate = true; |
69 |
|
} |
70 |
|
|
71 |
92 |
needsUpdate |= bclass.addTextField("location", "Location", 30); |
72 |
|
|
73 |
92 |
needsUpdate |= setClassDocumentFields(document, "Redirect Class"); |
74 |
|
|
75 |
92 |
return needsUpdate; |
76 |
|
} |
77 |
|
} |