public class XWikiXmlRpcApiImpl extends Object implements XWikiXmlRpcApi
Constructor and Description |
---|
XWikiXmlRpcApiImpl() |
Modifier and Type | Method and Description |
---|---|
Map |
addAttachment(String token,
Integer contentId,
Map attachmentMap,
byte[] attachmentData)
Add an attachment.
|
Map |
addComment(String token,
Map commentMap)
Add a comment.
|
Map |
addSpace(String token,
Map spaceMap)
Add a new space.
|
String |
convert(String token,
String source,
String initialSyntaxId,
String targetSyntaxId)
Converts a wiki source from a syntax to another syntax.
|
byte[] |
getAttachmentData(String token,
String pageId,
String fileName,
String versionNumber)
Get the attachment data.
|
List |
getAttachments(String token,
String pageId)
Get attachments.
|
Map |
getClass(String token,
String className)
Get a specific class.
|
List |
getClasses(String token)
Get classes.
|
Map |
getComment(String token,
String commentId)
Get a specific comment.
|
List |
getComments(String token,
String pageId) |
protected XWikiContext |
getContext() |
List<String> |
getInputSyntaxes(String token)
Gets all syntaxes supported by the rendering parsers as an input for a syntax conversion.
|
List |
getModifiedPagesHistory(String token,
Date date,
int numberOfResults,
int start,
boolean fromLatest)
Returns a list of XWikiPageHistorySummary containing all the pages that have been modified since a given date in
all their versions.
|
Map |
getObject(String token,
String pageId,
String guid)
The getObject function will return an XWikiObject where only non-null properties are included in the mapping
'field' -> 'value' In order to know all the available fields and their respective types and attributes, clients
should refer to the object's class.
|
Map |
getObject(String token,
String pageId,
String className,
Integer id)
The getObject function will return an XWikiObject where only non-null properties are included in the mapping
'field' -> 'value' In order to know all the available fields and their respective types and attributes, clients
should refer to the object's class.
|
List |
getObjects(String token,
String pageId) |
List<String> |
getOutputSyntaxes(String token)
Gets all syntaxes supported by the rendering as an output for a syntax conversion.
|
Map |
getPage(String token,
String pageId)
Retrieves a page.
|
List |
getPageHistory(String token,
String pageId)
Get revision history of a page.
|
List |
getPages(String token,
String spaceKey) |
String |
getRenderedContent(String token,
String pageId,
String syntaxId)
Gets the rendered content of an existing document.
|
Map |
getServerInfo(String token)
Get server information.
|
Map |
getSpace(String token,
String spaceKey)
Get information about a given space.
|
List |
getSpaces(String token)
Get the list of spaces.
|
String |
login(String userName,
String password)
Login.
|
Boolean |
logout(String token)
Logout.
|
Boolean |
removeAttachment(String token,
String pageId,
String fileName)
Remove attachment.
|
Boolean |
removeComment(String token,
String commentId)
Remove a comment.
|
Boolean |
removeObject(String token,
String pageId,
String className,
Integer id) |
Boolean |
removePage(String token,
String pageId)
Remove a page.
|
Boolean |
removeSpace(String token,
String spaceKey)
Removes a space by deleting every page in it.
|
String |
renderContent(String token,
String space,
String pageId,
String content)
Render a page or content in HTML.
|
String |
renderPageContent(String token,
String pageId,
String content,
String sourceSyntaxId,
String targetSyntaxId)
Renders a text in the context of a wiki page.
|
List |
search(String token,
String query,
int maxResults)
Search pages.
|
Map |
storeObject(String token,
Map objectMap)
Update the object or create a new one if it doesn't exist.
|
Map |
storeObject(String token,
Map objectMap,
boolean checkVersion)
This is a version of storeObject that fails to store the object if the current version of the page associated to
the object doesn't match the one of the object passed as parameter (i.e., the object's page has been modified
since the last getObject)
|
Map |
storePage(String token,
Map pageMap)
Store or rename a page, or create it if it doesn't exist.
|
Map |
storePage(String token,
Map pageMap,
boolean checkVersion)
This is a version of storePage that fails to store the page if the current version of the page doesn't match the
one of the page passed as parameter (i.e., the page has been modified since the last getPage)
|
protected XWikiContext getContext()
public String login(String userName, String password) throws Exception
login
in interface XWikiXmlRpcApi
Exception
- If authentication fails.public Boolean logout(String token) throws Exception
logout
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided.public Map getServerInfo(String token) throws Exception
getServerInfo
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided.public List getSpaces(String token) throws Exception
getSpaces
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided.public Map getSpace(String token, String spaceKey) throws Exception
getSpace
in interface XWikiXmlRpcApi
token
- The authentication token.spaceKey
- The space name.Exception
- An invalid token is provided or the user doesn't have enough rights to access the space.public Map addSpace(String token, Map spaceMap) throws Exception
addSpace
in interface XWikiXmlRpcApi
token
- The authentication token.spaceMap
- The map representing a Space object.Exception
- An invalid token is provided or the space cannot be created or it already exists and the user
has not the rights to modify itpublic Boolean removeSpace(String token, String spaceKey) throws Exception
removeSpace
in interface XWikiXmlRpcApi
token
- The authentication token.spaceKey
- The space name.Exception
- An invalid token is provided or there was a problem while deleting the space.public List getPages(String token, String spaceKey) throws Exception
getPages
in interface XWikiXmlRpcApi
token
- The authentication token.spaceKey
- The space name.Exception
- An invalid token is provided.public Map getPage(String token, String pageId) throws Exception
getPage
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page[?language=l&version=v&minorVersion=mv]' format.Exception
- An invalid token is provided or the user has not the right to access the page or the page does
not exist.public Map storePage(String token, Map pageMap) throws Exception
The way confluence clients rename pages is the following:
page = getPage(pageId);
page.setSpace("New space");
page.setTitle("New title");
storePage(page);
In XWiki in order to rename a page we need to change its ID, and no client written for confluence will do this. Currently the authoritative source for the page location is the ID (basically storePage ignores the space field) and changing the title will only affect the page title. However if we agree to assume that the when using XMLRPC the semantics of the page title is that of the page name in an XWiki ID, we will be able to be confluence compatible.
There are three possible cases: Let P=(id, space, title) the definition of a page. Let CP be the current page and NP the page to be stored (i.e. the page passed to storePage):1) CP=("Space.Name", "Space", "Title") NP=("Space.Name", "NewSpace", "Title") Here it is clear that the user wants to "rename" the page by moving it to another space. So we rename the page to ("NewSpace.Name", "NewSpace", "Title")
2) CP=("Space.Name", "Space", "Title") NP=("Space.Name", "NewSpace", "NewTitle"); Here it is also clear that we want to move the page to NewSpace but we have a problem about how to name the new page: NewSpace.Name or NewSpace.NewTitle? According to the assumption stated before, we rename the page and use NewTitle as the page name. The renamed page will have the NewSpace.NewTitle id. We also set the renamed page title to NewTitle.
3) CP=("Space.Name", "Space", "Title") NP=("Space.Name", "Space", "NewTitle"); Here we have an ambiguity. Does the user want to to rename the page or set its title? According to the assumption stated before we assume that the user wants to rename the page so we will rename the page to Space.NewTitle and set its title to NewTitle.
storePage
in interface XWikiXmlRpcApi
token
- The authentication token.pageMap
- A map representing the Page object to be stored.Exception
- An invalid token is provided or some data is missing or the page is locked or the user has no
right to modify the page.public Boolean removePage(String token, String pageId) throws Exception
removePage
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public List getPageHistory(String token, String pageId) throws Exception
getPageHistory
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page[?language=lang]' format.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public String renderContent(String token, String space, String pageId, String content) throws Exception
renderContent
in interface XWikiXmlRpcApi
token
- The authentication token.space
- IgnoredpageId
- The page id in the form of Space.Pagecontent
- The content to be rendered. If content == "" then the page content is rendered.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public List getComments(String token, String pageId) throws Exception
getComments
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public Map getComment(String token, String commentId) throws Exception
getComment
in interface XWikiXmlRpcApi
token
- The authentication token.commentId
- The comment id.Exception
- An invalid token is provided or if the comment cannot be retrieved. access it.public Map addComment(String token, Map commentMap) throws Exception
addComment
in interface XWikiXmlRpcApi
token
- The authentication token.commentMap
- A map representing a Comment object.Exception
- An invalid token is provided or if the user has not the right to access it.public Boolean removeComment(String token, String commentId) throws Exception
removeComment
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided or the user has not the right to access it.public List getAttachments(String token, String pageId) throws Exception
getAttachments
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public Map addAttachment(String token, Integer contentId, Map attachmentMap, byte[] attachmentData) throws Exception
addAttachment
in interface XWikiXmlRpcApi
token
- The authentication token.contentId
- IgnoredattachmentMap
- The Attachment object used to identify the page id, and attachment metadata.attachmentData
- The actual attachment data.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public byte[] getAttachmentData(String token, String pageId, String fileName, String versionNumber) throws Exception
getAttachmentData
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.versionNumber
- (Ignored)Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it or the attachment with the given fileName does not exist on the given page.public Boolean removeAttachment(String token, String pageId, String fileName) throws Exception
removeAttachment
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it or the attachment with the given fileName does not exist on the given page.public List getClasses(String token) throws Exception
getClasses
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided.public Map getClass(String token, String className) throws Exception
getClass
in interface XWikiXmlRpcApi
token
- The authentication token.className
- The class name.Exception
- An invalid token is provided or if the given class does not exist.public List getObjects(String token, String pageId) throws Exception
getObjects
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public Map getObject(String token, String pageId, String className, Integer id) throws Exception
getObject
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.className
- The class of the object.id
- The id (number) of the object.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it or no object with the given id exist in the page.public Map storeObject(String token, Map objectMap) throws Exception
storeObject
in interface XWikiXmlRpcApi
token
- The authentication token.objectMap
- A map representing the XWikiObject to be updated/created.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it.public Boolean removeObject(String token, String pageId, String className, Integer id) throws Exception
removeObject
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId in the 'Space.Page' format.id
- The object's id.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it or no object with the given id exist in the page.public List search(String token, String query, int maxResults) throws Exception
search
in interface XWikiXmlRpcApi
token
- The authentication token.query
- The string to be looked for. If it is "__ALL_PAGES__" the search will return all the page ids
available in the Wiki.Exception
- An invalid token is provided.public List getModifiedPagesHistory(String token, Date date, int numberOfResults, int start, boolean fromLatest) throws Exception
getModifiedPagesHistory
in interface XWikiXmlRpcApi
token
- date
- The starting datenumberOfResults
- The number of results to be returnedstart
- The start offset in the result setfromLatest
- True if the result set will list recent changed pages before.Exception
- An invalid token is provided.public Map storePage(String token, Map pageMap, boolean checkVersion) throws Exception
storePage
in interface XWikiXmlRpcApi
token
- pageMap
- A map representing the Page object to be stored.checkVersion
- True if the current version of the page and the one of the page passed as parameter must
match.Exception
- An invalid token is provided.public Map storeObject(String token, Map objectMap, boolean checkVersion) throws Exception
storeObject
in interface XWikiXmlRpcApi
token
- The authentication token.objectMap
- A map representing the XWikiObject to be updated/created.checkVersion
- True if the current version of the object's page and the one of the one passed as parameter
must match.Exception
- An invalid token is provided.public Map getObject(String token, String pageId, String guid) throws Exception
getObject
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The pageId.guid
- The object's guid.Exception
- An invalid token is provided or if the page does not exist or the user has not the right to
access it or no object with the given id exist in the page.public String convert(String token, String source, String initialSyntaxId, String targetSyntaxId) throws Exception
convert
in interface XWikiXmlRpcApi
token
- The authentication token.source
- The content to be converted.initialSyntaxId
- The initial syntax of the source.targetSyntaxId
- The final syntax of the returned content.Exception
- An invalid token is provided, the syntaxId is not supported, the source is invalid or the
conversion fails.public List<String> getInputSyntaxes(String token) throws Exception
getInputSyntaxes
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided or the syntax lookup fails.public List<String> getOutputSyntaxes(String token) throws Exception
getOutputSyntaxes
in interface XWikiXmlRpcApi
token
- The authentication token.Exception
- An invalid token is provided or the syntax lookup fails.public String renderPageContent(String token, String pageId, String content, String sourceSyntaxId, String targetSyntaxId) throws Exception
renderPageContent
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The id of the page.content
- The context to be rendered.sourceSyntaxId
- The syntax of the content.targetSyntaxId
- The target syntax of the rendered contentException
- If a invalid token is provided, an unsupported syntax id is given or the rendering fails.public String getRenderedContent(String token, String pageId, String syntaxId) throws Exception
getRenderedContent
in interface XWikiXmlRpcApi
token
- The authentication token.pageId
- The id of the page.syntaxId
- The target syntax of the rendered contentException
- If a invalid token is provided, an unsupported syntax id is given or the rendering fails.Copyright © 2004–2014 XWiki. All rights reserved.