Class 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 Detail

      • WikiRestServiceImpl

        public WikiRestServiceImpl​(WikiService wikiService,
                                   NoteService noteService,
                                   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 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 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 wiki
        path - Contains the path of the wiki page
        canEdit - true if user can edit
        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

        @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 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

        @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 wiki
        offset - The offset to search
        limit - 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 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

        @RolesAllowed("users")
        public Pages getPages​(@Context
                              javax.ws.rs.core.UriInfo uriInfo,
                              String userId,
                              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 - 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,
                            String userId)
        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
        userId -
        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 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

        @RolesAllowed("users")
        public javax.ws.rs.core.Response searchData​(@Context
                                                    javax.ws.rs.core.UriInfo uriInfo,
                                                    String keyword,
                                                    int limit,
                                                    String wikiType,
                                                    String wikiOwner,
                                                    boolean favorites)
                                             throws Exception
        Return a list of title based on a searched words.
        Parameters:
        uriInfo - uriInfo
        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 - 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} instead
        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
      • 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 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
        attachmentId - Id of the attachment of the wiki page
        width - in case of an image, expected width of the image, it will keep the ratio
        Returns:
        The response with the attachment
      • 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 draft
        wikiOwner - owner of wiki to save draft
        rawPageId - name of page to save draft in encoded format
        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
        clientTime - client Time
        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

        @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 wiki
        name - Name of the emotion icon
        Returns:
        The response with the emotion icon