[xwiki-users] Adding custom object usinf groovy or velocity
Following velocity allows to create simpe xwiki document: #set ($mydoc = $xwiki.getDocument("Sandbox.Test1")) $mydoc.setContent("sdfsdf") $mydoc.save() But How can I create custom object? http://hans.gerwitz.com/projects/snipsnap-to-xwiki shows some ideas but I can't make it working for me. Another (awkward) way would be executing external curl command. How can I do this? Thanks, Valdis
Hi, On Feb 18, 2010, at 7:33 PM, Valdis Vītoliņš wrote:
Following velocity allows to create simpe xwiki document: #set ($mydoc = $xwiki.getDocument("Sandbox.Test1")) $mydoc.setContent("sdfsdf") $mydoc.save()
But How can I create custom object?
http://hans.gerwitz.com/projects/snipsnap-to-xwiki shows some ideas but I can't make it working for me.
Another (awkward) way would be executing external curl command. How can I do this?
you can check this example: http://code.xwiki.org/xwiki/bin/view/Snippets/RestoreXWikiAllGroupSnippet -Vincent
Try this: #set($newObj = $doc.newObject("SpaceName.ClassName")) ## creates a new object #set($ok = $newObj.set("PropName", $propValue)) ## sets a property in the new object #set($ok = $doc.save()) ## save the document, and the new object On Thu, Feb 18, 2010 at 8:33 PM, Valdis Vītoliņš <valdis.vitolins@odo.lv>wrote:
Following velocity allows to create simpe xwiki document: #set ($mydoc = $xwiki.getDocument("Sandbox.Test1")) $mydoc.setContent("sdfsdf") $mydoc.save()
But How can I create custom object?
http://hans.gerwitz.com/projects/snipsnap-to-xwiki shows some ideas but I can't make it working for me.
Another (awkward) way would be executing external curl command. How can I do this?
Thanks, Valdis _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Flavius Olaru
Many thanks, that works! Valdis
Try this:
#set($newObj = $doc.newObject("SpaceName.ClassName")) ## creates a new object #set($ok = $newObj.set("PropName", $propValue)) ## sets a property in the new object #set($ok = $doc.save()) ## save the document, and the new object
On Thu, Feb 18, 2010 at 8:33 PM, Valdis Vītoliņš <valdis.vitolins@odo.lv> wrote:
Following velocity allows to create simpe xwiki document: #set ($mydoc = $xwiki.getDocument("Sandbox.Test1")) $mydoc.setContent("sdfsdf") $mydoc.save()
But How can I create custom object?
http://hans.gerwitz.com/projects/snipsnap-to-xwiki shows some ideas but I can't make it working for me.
Another (awkward) way would be executing external curl command. How can I do this?
Thanks, Valdis _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Flavius Olaru
participants (3)
-
Flavius Olaru -
Valdis Vītoliņš -
Vincent Massol