org.exoplatform.wiki.service.impl
Class WikiRestServiceImpl

java.lang.Object
  extended by org.exoplatform.wiki.service.impl.WikiRestServiceImpl
All Implemented Interfaces:
org.exoplatform.services.rest.resource.ResourceContainer, WikiRestService

public class WikiRestServiceImpl
extends Object
implements WikiRestService, org.exoplatform.services.rest.resource.ResourceContainer


Constructor Summary
WikiRestServiceImpl(WikiService wikiService, org.exoplatform.wiki.rendering.RenderingService renderingService)
           
 
Method Summary
 Attachment createAttachment(ObjectFactory objectFactory, URI baseUri, AttachmentImpl pageAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl)
           
 Page createPage(ObjectFactory objectFactory, URI baseUri, URI self, PageImpl doc)
           
 PageSummary createPageSummary(ObjectFactory objectFactory, URI baseUri, PageImpl doc)
           
 Space createSpace(ObjectFactory objectFactory, URI baseUri, String wikiName, String spaceName, Page home)
           
 Attachments getAttachments(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId, Integer start, Integer number)
          Return a list of attachments attached to a wiki page
 javax.ws.rs.core.Response getHelpSyntaxPage(String syntaxId, String portalUrl)
          Return the help syntax page.
 javax.ws.rs.core.Response getImage(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId, String imageId, Integer width)
          Return an image attach to the wiki page and keep the size ratio of it.
 Spaces getLastVisitedSpaces(javax.ws.rs.core.UriInfo uriInfo, Integer offset, Integer limit)
          Return a list of last visited spaces by the user.
 Page getPage(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId)
          Return a wiki page based on is uri and id
 Pages getPages(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, Integer start, Integer number, String parentFilterExpression)
          Return a list of pages related to the space and uri
 javax.ws.rs.core.Response getRelated(String path)
          Return the related pages of a Wiki page
 Space getSpace(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner)
          Return the space based on the uri
 Spaces getSpaces(javax.ws.rs.core.UriInfo uriInfo, String wikiType, Integer start, Integer number)
          Return a list of wiki based on their type.
 javax.ws.rs.core.Response getTreeData(String type, String path, String currentPath, Boolean showExcerpt, String depth)
          Display the current tree of a wiki based on is path
 javax.ws.rs.core.Response getWikiPageContent(String sessionKey, String wikiContextKey, boolean isMarkup, String data)
          Return the wiki page content as html or markup.
 javax.ws.rs.core.Response removeDraft(String draftName)
          Remove the draft
 javax.ws.rs.core.Response saveDraft(String wikiType, String wikiOwner, String pageId, String pageRevision, String lastDraftName, boolean isNewPage, long clientTime, String title, String content, String isMarkup)
          Save draft title and content for a page specified by the given page params
 javax.ws.rs.core.Response searchAccessibleSpaces(String keyword)
           
 javax.ws.rs.core.Response searchData(String keyword, String wikiType, String wikiOwner)
          Return a list of title based on a searched words.
 javax.ws.rs.core.Response upload(String wikiType, String wikiOwner, String pageId)
          Upload an attachment to a wiki page
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WikiRestServiceImpl

public WikiRestServiceImpl(WikiService wikiService,
                           org.exoplatform.wiki.rendering.RenderingService renderingService)
Method Detail

getWikiPageContent

public javax.ws.rs.core.Response getWikiPageContent(String sessionKey,
                                                    String wikiContextKey,
                                                    boolean isMarkup,
                                                    String data)
Return the wiki page content as html or markup.

Specified by:
getWikiPageContent in interface WikiRestService
Parameters:
sessionKey - key is used to retrieve the editor input value from the session.
wikiContextKey - contain the context key which contain the syntax.
isMarkup - if true then markup content is returned else html content is returned
data - contain the data as html
Returns:
the instance of javax.ws.rs.core.Response

upload

public javax.ws.rs.core.Response upload(String wikiType,
                                        String wikiOwner,
                                        String pageId)
Upload an attachment to a wiki page

Parameters:
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
pageId - Is the pageId used by the system
Returns:
the instance of javax.ws.rs.core.Response

getTreeData

public javax.ws.rs.core.Response getTreeData(String type,
                                             String path,
                                             String currentPath,
                                             Boolean showExcerpt,
                                             String depth)
Display the current tree of a wiki based on is path

Parameters:
type - It can be a Portal, Group, User type of wiki
path - Contains the path of the wiki page
currentPath - Contains the path of the current wiki page
showExcerpt - Boolean to display or not the excerpt
depth - Defined the depth of the children we want to display
Returns:
List of descendants including the page itself.

getRelated

public javax.ws.rs.core.Response getRelated(String path)
Return the related pages of a Wiki page

Parameters:
path - Contains the path of the wiki page
Returns:
List of related pages

getSpaces

public Spaces getSpaces(@Context
                        javax.ws.rs.core.UriInfo uriInfo,
                        String wikiType,
                        Integer start,
                        Integer number)
Return a list of wiki based on their type.

Parameters:
uriInfo - Uri of the wiki
wikiType - It can be a Portal, Group, User type of wiki
start - Not used
number - Not used
Returns:
List of wikis by type

getLastVisitedSpaces

public Spaces getLastVisitedSpaces(@Context
                                   javax.ws.rs.core.UriInfo uriInfo,
                                   Integer offset,
                                   Integer limit)
Return a list of last visited spaces by the user.

Parameters:
uriInfo - Uri of the wiki
offset - The offset to search
limit - Limit number to search
Returns:
List of spaces

getSpace

public Space getSpace(@Context
                      javax.ws.rs.core.UriInfo uriInfo,
                      String wikiType,
                      String wikiOwner)
Return the space based on the uri

Parameters:
uriInfo - Uri of the wiki
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
Returns:
Space related to the uri

getPages

public Pages getPages(@Context
                      javax.ws.rs.core.UriInfo uriInfo,
                      String wikiType,
                      String wikiOwner,
                      Integer start,
                      Integer number,
                      String parentFilterExpression)
Return a list of pages related to the space and uri

Parameters:
uriInfo - Uri of the wiki
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
start - Not used
number - Not used
parentFilterExpression -
Returns:
List of pages

getPage

public Page getPage(@Context
                    javax.ws.rs.core.UriInfo uriInfo,
                    String wikiType,
                    String wikiOwner,
                    String pageId)
Return a wiki page based on is uri and id

Parameters:
uriInfo - Uri of the wiki
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
pageId - Id of the wiki page
Returns:
A wiki page

getAttachments

public Attachments getAttachments(@Context
                                  javax.ws.rs.core.UriInfo uriInfo,
                                  String wikiType,
                                  String wikiOwner,
                                  String pageId,
                                  Integer start,
                                  Integer number)
Return a list of attachments attached to a wiki page

Parameters:
uriInfo - Uri of the wiki
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
pageId - Id of the wiki page
start - Not used
number - Not used
Returns:
List of attachments

searchData

public javax.ws.rs.core.Response searchData(String keyword,
                                            String wikiType,
                                            String wikiOwner)
                                     throws Exception
Return a list of title based on a searched words.

Parameters:
keyword - Word to search
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
Returns:
List of title
Throws:
Exception

getImage

public javax.ws.rs.core.Response getImage(@Context
                                          javax.ws.rs.core.UriInfo uriInfo,
                                          String wikiType,
                                          String wikiOwner,
                                          String pageId,
                                          String imageId,
                                          Integer width)
Return an image attach to the wiki page and keep the size ratio of it.

Parameters:
uriInfo - Uri of the wiki
wikiType - It can be a Portal, Group, User type of wiki
wikiOwner - Is the owner of the wiki
pageId - Id of the wiki page
imageId - Id of the image attached to the wiki page
width - expected width of the image, it will keep the ratio
Returns:
The response with the image

createSpace

public Space createSpace(ObjectFactory objectFactory,
                         URI baseUri,
                         String wikiName,
                         String spaceName,
                         Page home)

createPage

public Page createPage(ObjectFactory objectFactory,
                       URI baseUri,
                       URI self,
                       PageImpl doc)
                throws Exception
Throws:
Exception

createPageSummary

public PageSummary createPageSummary(ObjectFactory objectFactory,
                                     URI baseUri,
                                     PageImpl doc)
                              throws IllegalArgumentException,
                                     javax.ws.rs.core.UriBuilderException,
                                     Exception
Throws:
IllegalArgumentException
javax.ws.rs.core.UriBuilderException
Exception

createAttachment

public Attachment createAttachment(ObjectFactory objectFactory,
                                   URI baseUri,
                                   AttachmentImpl pageAttachment,
                                   String xwikiRelativeUrl,
                                   String xwikiAbsoluteUrl)
                            throws Exception
Throws:
Exception

getHelpSyntaxPage

public javax.ws.rs.core.Response getHelpSyntaxPage(String syntaxId,
                                                   String portalUrl)
Return the help syntax page. The syntax id have to replaced all special characters: Character '/' have to replace to "SLASH" Character '.' have to replace to "DOT" Sample: "confluence/1.0" will be replaced to "confluenceSLASH1DOT0"

Parameters:
syntaxId - The id of syntax to show in help page
portalUrl - The current portal url
Returns:
The response that contains help page

searchAccessibleSpaces

public javax.ws.rs.core.Response searchAccessibleSpaces(String keyword)

saveDraft

public javax.ws.rs.core.Response saveDraft(String wikiType,
                                           String wikiOwner,
                                           String pageId,
                                           String pageRevision,
                                           String lastDraftName,
                                           boolean isNewPage,
                                           long clientTime,
                                           String title,
                                           String content,
                                           String isMarkup)
Save draft title and content for a page specified by the given page params

Parameters:
wikiType - type of wiki to save draft
wikiOwner - owner of wiki to save draft
pageId - name of page to save draft
pageRevision - the target revision of target page
lastDraftName - name of the draft page of last saved draft request
isNewPage - The draft for new page or not
title - draft title
content - draft content
isMarkup - content is markup or html. True if is markup.
Returns:
Response with status HTTPStatus.ACCEPTED if saving process is performed successfully with status HTTPStatus.INTERNAL_ERROR if there is any unknown error in the saving process

removeDraft

public javax.ws.rs.core.Response removeDraft(String draftName)
Remove the draft

Parameters:
draftName - The name of draft to remove
Returns:
Status.OK if remove draft success HTTPStatus.INTERNAL_ERROR if there's error occur when remove draft


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.