com.xpn.xwiki.wysiwyg.server
Class DefaultWikiService

java.lang.Object
  extended by com.xpn.xwiki.wysiwyg.server.DefaultWikiService
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, WikiService

public class DefaultWikiService
extends java.lang.Object
implements WikiService

The default implementation for WikiService.

Version:
$Id: DefaultWikiService.java 27710 2010-03-18 17:56:42Z mflorea $

Constructor Summary
DefaultWikiService()
           
 
Method Summary
 Attachment getAttachment(java.lang.String wikiName, java.lang.String spaceName, java.lang.String pageName, java.lang.String attachmentName)
          Returns attachment information from the passed parameters, testing if the passed attachment exists.
 java.util.List<Attachment> getAttachments(java.lang.String wikiName, java.lang.String spaceName, java.lang.String pageName)
          Returns all the attachments from the referred page.
 java.util.List<Attachment> getImageAttachments(java.lang.String wikiName, java.lang.String spaceName, java.lang.String pageName)
          Returns all the image attachments from the referred page.
 java.util.List<WikiPage> getMatchingPages(java.lang.String keyword, int start, int count)
          
 LinkConfig getPageLink(java.lang.String wikiName, java.lang.String spaceName, java.lang.String pageName, java.lang.String revision, java.lang.String anchor)
          Creates a page link (URL, reference) from the given parameters.
 java.util.List<java.lang.String> getPageNames(java.lang.String wikiName, java.lang.String spaceName)
          
 java.util.List<WikiPage> getRecentlyModifiedPages(int start, int count)
          
 java.util.List<java.lang.String> getSpaceNames(java.lang.String wikiName)
          
 java.util.List<java.lang.String> getVirtualWikiNames()
          
 java.lang.Boolean isMultiWiki()
          Check if the current wiki is part of a multiwiki (i.e.
protected  org.xwiki.model.reference.DocumentReference prepareDocumentReference(java.lang.String wiki, java.lang.String space, java.lang.String page)
          Gets a document reference from the passed parameters, handling the empty wiki, empty space or empty page name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWikiService

public DefaultWikiService()
Method Detail

isMultiWiki

public java.lang.Boolean isMultiWiki()
Check if the current wiki is part of a multiwiki (i.e. this is a virtual wiki).

Specified by:
isMultiWiki in interface WikiService
Returns:
true if the current wiki is a multiwiki, and false in the other case
See Also:
WikiService.isMultiWiki()

getVirtualWikiNames

public java.util.List<java.lang.String> getVirtualWikiNames()

Specified by:
getVirtualWikiNames in interface WikiService
Returns:
a list containing the names of all wikis.
See Also:
WikiService.getVirtualWikiNames()

getSpaceNames

public java.util.List<java.lang.String> getSpaceNames(java.lang.String wikiName)

Specified by:
getSpaceNames in interface WikiService
Parameters:
wikiName - the name of the wiki to search for spaces. If this is null, the current wiki will be used.
Returns:
a list of all spaces names in the specified wiki.
See Also:
WikiService.getSpaceNames(String)

getPageNames

public java.util.List<java.lang.String> getPageNames(java.lang.String wikiName,
                                                     java.lang.String spaceName)

Specified by:
getPageNames in interface WikiService
Parameters:
wikiName - the name of the wiki. Pass null if this should use the current wiki.
spaceName - the name of the space
Returns:
the list of the page names from a given space and a given wiki.
See Also:
WikiService.getPageNames(String, String)

getRecentlyModifiedPages

public java.util.List<WikiPage> getRecentlyModifiedPages(int start,
                                                         int count)

Specified by:
getRecentlyModifiedPages in interface WikiService
Parameters:
start - the start index of the list of pages to return
count - the number of pages to return
Returns:
the recently count modified pages of the current user, starting from position start
See Also:
WikiService.getRecentlyModifiedPages(int, int)

getMatchingPages

public java.util.List<WikiPage> getMatchingPages(java.lang.String keyword,
                                                 int start,
                                                 int count)

Specified by:
getMatchingPages in interface WikiService
Parameters:
keyword - the keyword to search the pages for
start - the start index of the list of pages to return
count - the number of pages to return
Returns:
the count pages whose full name or title match the keyword, starting from position start
See Also:
WikiService.getMatchingPages(String, int, int)

getPageLink

public LinkConfig getPageLink(java.lang.String wikiName,
                              java.lang.String spaceName,
                              java.lang.String pageName,
                              java.lang.String revision,
                              java.lang.String anchor)
Creates a page link (URL, reference) from the given parameters. None of them are mandatory, if one misses, it is replaced with a default value.

Specified by:
getPageLink in interface WikiService
Parameters:
wikiName - the name of the wiki to which to link
spaceName - the name of the space of the page. If this parameter is missing, it is replaced with the space of the current document in the context.
pageName - the name of the page to which to link to. If it's missing, it is replaced with "WebHome".
revision - the value for the page revision to which to link to. If this is missing, the link is made to the latest revision, the default view action for the document.
anchor - the name of the anchor type.
Returns:
the data of the link to the document, containing link url and link reference information.
See Also:
WikiService.getPageLink(String, String, String, String, String)

getAttachment

public Attachment getAttachment(java.lang.String wikiName,
                                java.lang.String spaceName,
                                java.lang.String pageName,
                                java.lang.String attachmentName)
Returns attachment information from the passed parameters, testing if the passed attachment exists. Note that the attachmentName name will be cleaned to match the attachment names cleaning rules, and the attachment reference and URL will be generated with the cleaned name. This function will be used as a method to test the correct upload of a file to a page.

Specified by:
getAttachment in interface WikiService
Parameters:
wikiName - the name of the wiki of the page the file is attached to
spaceName - the name of the space of the page the file is attached to
pageName - the name of the page the file is attached to
attachmentName - the uncleaned name of the attachment, which is to be cleaned on the server
Returns:
an Attachment containing the reference and the URL of the attachment, or null in case the attachment was not found
See Also:
WikiService.getAttachment(String, String, String, String)

prepareDocumentReference

protected org.xwiki.model.reference.DocumentReference prepareDocumentReference(java.lang.String wiki,
                                                                               java.lang.String space,
                                                                               java.lang.String page)
Gets a document reference from the passed parameters, handling the empty wiki, empty space or empty page name.

Parameters:
wiki - the wiki of the document
space - the space of the document
page - the page name of the targeted document
Returns:
the completed DocumentReference corresponding to the passed parameters, with all the missing values completed with defaults
Since:
2.2M1

getImageAttachments

public java.util.List<Attachment> getImageAttachments(java.lang.String wikiName,
                                                      java.lang.String spaceName,
                                                      java.lang.String pageName)
Returns all the image attachments from the referred page.

Specified by:
getImageAttachments in interface WikiService
Parameters:
wikiName - the name of the wiki to get images from
spaceName - the name of the space to get image attachments from
pageName - the name of the page to get image attachments from
Returns:
list of the image attachments
See Also:
WikiService.getImageAttachments(String, String, String)

getAttachments

public java.util.List<Attachment> getAttachments(java.lang.String wikiName,
                                                 java.lang.String spaceName,
                                                 java.lang.String pageName)
Returns all the attachments from the referred page.

Specified by:
getAttachments in interface WikiService
Parameters:
wikiName - the name of the wiki to get attachments from
spaceName - the name of the space to get attachments from
pageName - the name of the page to get attachments from
Returns:
list of the attachments
See Also:
WikiService.getAttachments(String, String, String)


Copyright © 2004-2010 XWiki. All Rights Reserved.