... |
... |
@@ -34,12 +34,14 @@ |
34 |
34 |
1. Last, the XClass for which the mapping has been written should be set as containing a custom mapping. Unfortunately there's currently no way to set this using the XWiki Enterprise UI so you'll have to set it programmatically. The following Groovy snippet will do the trick (Remember that for Groovy code to be executed, the page that contains the code should be saved by a user having the programming right allowed on that document). Note that this could also be done in a Java component.((( |
35 |
35 |
{{code}} |
36 |
36 |
{{groovy}} |
|
37 |
+import java.util.*; |
|
38 |
+ |
37 |
37 |
classDoc = xwiki.getDocument("Mailing.MailingMemberClass") |
38 |
38 |
classDoc2 = classDoc.document |
39 |
39 |
println "Before: " |
40 |
40 |
println classDoc2.xWikiClass.customMapping |
41 |
41 |
classDoc2.xWikiClass.setCustomMapping("internal") |
42 |
|
-xwiki.xWiki.saveDocument(classDoc2, xcontext.context) |
|
44 |
+xwiki.xWiki.saveDocument(classDoc2, context.context) |
43 |
43 |
classDoc = xwiki.getDocument("Mailing.MailingMemberClass") |
44 |
44 |
println " After: " |
45 |
45 |
println classDoc2.xWikiClass.customMapping |