Class WikiRestServiceImpl
- java.lang.Object
-
- org.exoplatform.wiki.service.impl.WikiRestServiceImpl
-
- All Implemented Interfaces:
org.exoplatform.services.rest.resource.ResourceContainer
public class WikiRestServiceImpl extends Object implements org.exoplatform.services.rest.resource.ResourceContainer
Wiki REST service
-
-
Constructor Summary
Constructors Constructor Description WikiRestServiceImpl(WikiService wikiService, org.exoplatform.services.resources.ResourceBundleService resourceBundleService)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AttachmentcreateAttachment(ObjectFactory objectFactory, URI baseUri, Attachment pageAttachment, Page page, String xwikiRelativeUrl, String xwikiAbsoluteUrl)PagecreatePage(ObjectFactory objectFactory, URI baseUri, URI self, Page doc)PageSummarycreatePageSummary(ObjectFactory objectFactory, URI baseUri, Page page)SpacecreateSpace(ObjectFactory objectFactory, URI baseUri, String wikiName, String spaceName, Page home)javax.ws.rs.core.ResponsegetAttachment(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId, String attachmentId, Integer width)Return an attchment attached to the wiki page.AttachmentsgetAttachments(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 pagejavax.ws.rs.core.ResponsegetEmotionIcon(javax.ws.rs.core.UriInfo uriInfo, String name)Return an emotion iconjavax.ws.rs.core.ResponsegetImage(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId, String imageId, Integer width)Deprecated.use /attachments/{wikiType}/space/{wikiOwner:.+}/page/{pageId}/{attachmentId} insteadSpacesgetLastVisitedSpaces(javax.ws.rs.core.UriInfo uriInfo, Integer offset, Integer limit)Return a list of last visited spaces by the user.PagegetPage(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId)Return a wiki page based on is uri and idPagesgetPages(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 urijavax.ws.rs.core.ResponsegetRelated(String path)Return the related pages of a Wiki pageSpacegetSpace(javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner)Return the space based on the uriSpacesgetSpaces(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.ResponsegetTreeData(String type, String path, String currentPath, Boolean canEdit, Boolean showExcerpt, String depth)Display the current tree of a wiki based on is pathjavax.ws.rs.core.ResponsegetWikiPageContent(String text)Return the wiki page content as html or wiki syntax.javax.ws.rs.core.ResponseremoveDraft(String draftName)Remove the draftjavax.ws.rs.core.ResponsesaveDraft(String wikiType, String wikiOwner, String rawPageId, 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 paramsjavax.ws.rs.core.ResponsesearchAccessibleSpaces(String keyword)javax.ws.rs.core.ResponsesearchData(javax.ws.rs.core.UriInfo uriInfo, String keyword, String wikiType, String wikiOwner)Return a list of title based on a searched words.javax.ws.rs.core.Responseupload(String wikiType, String wikiOwner, String pageId)Upload an attachment to a wiki page
-
-
-
Constructor Detail
-
WikiRestServiceImpl
public WikiRestServiceImpl(WikiService wikiService, org.exoplatform.services.resources.ResourceBundleService resourceBundleService)
-
-
Method Detail
-
getWikiPageContent
public javax.ws.rs.core.Response getWikiPageContent(String text)
Return the wiki page content as html or wiki syntax.- Parameters:
text- contain the data as html- Returns:
- the instance of javax.ws.rs.core.Response
- eXo level API
- Experimental
-
upload
@RolesAllowed("users") 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 wikiwikiOwner- Is the owner of the wikipageId- 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 canEdit, 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 wikipath- Contains the path of the wiki pagecanEdit- true if user can editcurrentPath- Contains the path of the current wiki pageshowExcerpt- Boolean to display or not the excerptdepth- Defined the depth of the children we want to display- Returns:
- List of descendants including the page itself.
-
getRelated
@RolesAllowed("users") 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
@RolesAllowed("users") 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 wikiwikiType- It can be a Portal, Group, User type of wikistart- Not usednumber- Not used- Returns:
- List of wikis by type
-
getLastVisitedSpaces
@RolesAllowed("users") 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 wikioffset- The offset to searchlimit- Limit number to search- Returns:
- List of spaces
-
getSpace
@RolesAllowed("users") 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 wikiwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wiki- Returns:
- Space related to the uri
-
getPages
@RolesAllowed("users") 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 wikiwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wikistart- Not usednumber- Not usedparentFilterExpression- parent Filter Expression- Returns:
- List of pages
-
getPage
@RolesAllowed("users") 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 wikiwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wikipageId- Id of the wiki page- Returns:
- A wiki page
-
getAttachments
@RolesAllowed("users") 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 wikiwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wikipageId- Id of the wiki pagestart- Not usednumber- Not used- Returns:
- List of attachments
-
searchData
@RolesAllowed("users") public javax.ws.rs.core.Response searchData(@Context javax.ws.rs.core.UriInfo uriInfo, String keyword, String wikiType, String wikiOwner) throws ExceptionReturn a list of title based on a searched words.- Parameters:
uriInfo- uriInfokeyword- Word to searchwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wiki- Returns:
- List of title
- Throws:
Exception- if an error occured
-
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)Deprecated.use /attachments/{wikiType}/space/{wikiOwner:.+}/page/{pageId}/{attachmentId} insteadReturn an image attach to the wiki page and keep the size ratio of it.- Parameters:
uriInfo- Uri of the wikiwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wikipageId- Id of the wiki pageimageId- Id of the image attached to the wiki pagewidth- expected width of the image, it will keep the ratio- Returns:
- The response with the image
-
getAttachment
public javax.ws.rs.core.Response getAttachment(@Context javax.ws.rs.core.UriInfo uriInfo, String wikiType, String wikiOwner, String pageId, String attachmentId, Integer width)Return an attchment attached to the wiki page. In case of an image, the width can be specified (the size ratio is kept).- Parameters:
uriInfo- Uri of the wikiwikiType- It can be a Portal, Group, User type of wikiwikiOwner- Is the owner of the wikipageId- Id of the wiki pageattachmentId- Id of the attachment of the wiki pagewidth- in case of an image, expected width of the image, it will keep the ratio- Returns:
- The response with the attachment
-
createSpace
public Space createSpace(ObjectFactory objectFactory, URI baseUri, String wikiName, String spaceName, Page home)
-
createPage
public Page createPage(ObjectFactory objectFactory, URI baseUri, URI self, Page doc) throws Exception
- Throws:
Exception
-
createPageSummary
public PageSummary createPageSummary(ObjectFactory objectFactory, URI baseUri, Page page) throws IllegalArgumentException, javax.ws.rs.core.UriBuilderException, Exception
- Throws:
IllegalArgumentExceptionjavax.ws.rs.core.UriBuilderExceptionException
-
createAttachment
public Attachment createAttachment(ObjectFactory objectFactory, URI baseUri, Attachment pageAttachment, Page page, String xwikiRelativeUrl, String xwikiAbsoluteUrl) throws Exception
- Throws:
Exception
-
searchAccessibleSpaces
@RolesAllowed("users") public javax.ws.rs.core.Response searchAccessibleSpaces(String keyword)
-
saveDraft
@RolesAllowed("users") public javax.ws.rs.core.Response saveDraft(String wikiType, String wikiOwner, String rawPageId, 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 draftwikiOwner- owner of wiki to save draftrawPageId- name of page to save draft in encoded formatpageRevision- the target revision of target pagelastDraftName- name of the draft page of last saved draft requestisNewPage- The draft for new page or nottitle- draft titlecontent- draft contentclientTime- client TimeisMarkup- content is markup or html. True if is markup.- Returns:
Responsewith 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
@RolesAllowed("users") 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
-
getEmotionIcon
public javax.ws.rs.core.Response getEmotionIcon(@Context javax.ws.rs.core.UriInfo uriInfo, String name)Return an emotion icon- Parameters:
uriInfo- Uri of the wikiname- Name of the emotion icon- Returns:
- The response with the emotion icon
-
-