[xwiki-devs] Some questions about the XWiki API...
Hi everybody, I am finishing the XMLRPC interface but I am stuck on some points... I still haven't found the way to do this so I am asking here to the API gurus that surely have the solutions I am looking for: 1) I don't know how to retrieve the list of language IDs that are configured in the "xwiki/bin/admin/XWiki/XWikiPreferences" in the Parameters/Languages field. I would need this for knowing what are the "available" languages in a XWiki instance. 2) I cannot understand how to create a new "translated document". Currently I do Document doc = xwiki.getDocument(pageId); doc = doc.getTranslatedDocument(language); Now, if a translation for the given language is not *already* available, getTranslatedDocument returns the same document returned by getDocument (i.e., the default translation). But here I would like to "create" the new translated document that does not yet exist. Basically I am looking for something semantically equivalent to getDocument that creates a page if it doesn't already exist. 3) Removing an attachment seems impossible without switching from the API to the low-level functions. In order to remove an attachment I tried to do this: Document doc = xwiki.getDocument(pageId); Attachment xwikiAttachment = doc.getAttachment(fileName); doc.getDocument().deleteAttachment(xwikiAttachment.getAttachment(), xWikiContext); but xwikiAttachment.getAttachment() returns null, and this happens when the hasProgrammingRights() check fails. The same user is able to delete attachments via web, but I cannot understand how to mimic the same functionality by having the API as the entry point. Sorry if these are trivial questions but, as I said before, I am stuck and looping :) Thanks. Cheers, Fabio
On 2 avr. 08, at 01:00, Fabio Mancinelli wrote:
Hi everybody,
I am finishing the XMLRPC interface but I am stuck on some points...
I reply to myself because I've solved the issues (translations and attachments) by bypassing the XWiki user's API and using directly the low-level API. The following one is still open, so if you have a hint tell me, otherwise I will try to figure it out later :)
1) I don't know how to retrieve the list of language IDs that are configured in the "xwiki/bin/admin/XWiki/XWikiPreferences" in the Parameters/Languages field. I would need this for knowing what are the "available" languages in a XWiki instance.
Thanks. Cheers, Fabio
participants (1)
-
Fabio Mancinelli