This example -
http://objectwebcon06.objectweb.org/xwiki/bin/view/XWiki/CFP?xpage=code&
<http://objectwebcon06.objectweb.org/xwiki/bin/view/XWiki/CFP?xpage=code&>
does
#set($xwiki2 = $xwiki.xWiki)
#set($context2 = $context.context)
## ID
#set ($sql = "select max(prop.value) from BaseObject as obj,
LongProperty as prop where obj.className='XWiki.CFPClass' and
prop.name='id' and obj.id=prop.id.id")
#set($id=1)
#foreach ($item in $xwiki.search($sql))
#set($id=$item.intValue() + 1)
#end
#set($newdoc = $xwiki2.getDocument("CFP.No${id}", $context2))
$xwiki2.saveDocument($newdoc, $context2)
I'm not sure exactly what you were attempting to do but maybe this
trick of getting the internal xWiki and context and using them for
saveDocument can help you. My use case also requires doing fancy
things with objects so please help out the documentation if you are
successful!
Checking the code it seems that this would be similar to $newdoc.save().
Not sure why that's not working.
Getting the internal object has 2 issues:
1) It requires programming rights so if this page is edited and saved by
someone without programming rights it'll fail
2) we are planning to completely modify the internal implementation in
the near future of xwiki so it shouldn't be used as much as possible. If
APIs are missing in the public API then we should add it there instead.
Thanks
-Vincent
On 10/18/07, *Vitantonio Messa*
<vitantonio.messa(a)coss.fi
<mailto:vitantonio.messa@coss.fi>> wrote:
Ok, thanks. I'll go and have a look.
Vito
Vincent Massol wrote:
On Oct 18, 2007, at 10:49 AM, Vitantonio Messa
wrote:
It doesn't seem to work: I still get a 0 from
this function:
$doc.getObjectNumbers("XWiki.ClassName"))
I've never done it myself but maybe someone else here can help.
You could also check if you find examples in the source code or in
the pages of XE.
-Vincent
> Vincent Massol wrote:
>> On Oct 18, 2007, at 10:35 AM, Vitantonio Messa wrote:
>>
>>> Thanks Vincent,
>>>
>>> I'll try it. If it is working, of course, I'm going to put some
>>> information on
xwiki.org <http://xwiki.org>. Thanks once again!
>> hmm seems like the $xwiki.saveDocument() api is internal only.
>>
>> You should use the $mydocument.save() API instead.
>>
>> -Vincent
>>
>>> Vincent Massol wrote:
>>>> Hi Vito,
>>>>
>>>> On Oct 18, 2007, at 10:13 AM, Vitantonio Messa wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have created my own class. In a document, I'm able to
create a
>>>>> object
>>>>> of that class, write and read fields in that object, but I
don't
>>>>> know
>>>>> how to memorize this object in the database: I was looking
on the
>>>>> developer guide on
xwiki.org
<http://xwiki.org> and I found
only this page
>>>>>
http://www.xwiki.org/xwiki/bin/view/DevGuide/DatabaseTutorial
<http://www.xwiki.org/xwiki/bin/view/DevGuide/DatabaseTutorial>
>>>> (which is
>>>> not complete, unfortunately for me).
>>>> Can anyone help me, please?
>>> Have you called $xwiki.saveDocument()?
>>>
>>> Would be nice if you could put this code snippet for creating an
>>> object using scripting on the following page:
>>>
http://www.xwiki.org/xwiki/bin/view/DevGuide/APIGuide
>>>
>>> Thanks
>>> -Vincent
> _______________________________________________
> users mailing list
> users(a)xwiki.org <mailto:users@xwiki.org>
>
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org <mailto:users@xwiki.org>
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org <mailto:users@xwiki.org>
http://lists.xwiki.org/mailman/listinfo/users
<http://lists.xwiki.org/mailman/listinfo/users>
_______________________________________________
users mailing list
users(a)xwiki.org <mailto:users@xwiki.org>
http://lists.xwiki.org/mailman/listinfo/users
<http://lists.xwiki.org/mailman/listinfo/users>
--
David Israel
cell) (408) 802-2267
_______________________________________________
users mailing list
users(a)xwiki.org <mailto:users@xwiki.org>
http://lists.xwiki.org/mailman/listinfo/users
------------------------------------------------------------------------
_______________________________________________
users mailing list
users(a)xwiki.org