Class WikiServiceImpl

java.lang.Object
org.exoplatform.wiki.service.impl.WikiServiceImpl
All Implemented Interfaces:
WikiService

public class WikiServiceImpl extends Object implements WikiService
  • Field Details

  • Constructor Details

    • WikiServiceImpl

      public WikiServiceImpl(org.exoplatform.portal.config.UserACL userACL, DataStorage dataStorage, org.exoplatform.services.cache.CacheService cacheService, org.exoplatform.services.organization.OrganizationService orgService)
  • Method Details

    • getRenderingCache

      public org.exoplatform.services.cache.ExoCache<Integer,MarkupData> getRenderingCache()
    • getPageLinksMap

      public Map<WikiPageParams,List<WikiPageParams>> getPageLinksMap()
    • addComponentPlugin

      public void addComponentPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
      Configuration
      Specified by:
      addComponentPlugin in interface WikiService
      Parameters:
      plugin - The component plugin to be registered.
    • getPageListeners

      public List<PageWikiListener> getPageListeners()
      Description copied from interface: WikiService
      Gets listeners of all wiki pages that are registered into the Wiki service.
      Specified by:
      getPageListeners in interface WikiService
      Returns:
      The list of listeners.
    • getAttachmentListeners

      public List<AttachmentWikiListener> getAttachmentListeners()
      Description copied from interface: WikiService
      Gets attachment listeners that are registered into the Wiki service.
      Specified by:
      getAttachmentListeners in interface WikiService
      Returns:
      The list of attachment listeners.
    • getWikiWebappUri

      public String getWikiWebappUri()
      Description copied from interface: WikiService
      Gets a Wiki webapp URI.
      Specified by:
      getWikiWebappUri in interface WikiService
      Returns:
      The Wiki webapp URI.
    • getDefaultWikiSyntaxId

      public String getDefaultWikiSyntaxId()
      Description copied from interface: WikiService
      Gets Id of a default Wiki syntax.
      Specified by:
      getDefaultWikiSyntaxId in interface WikiService
      Returns:
      The Id.
    • getWikiByTypeAndOwner

      public Wiki getWikiByTypeAndOwner(String wikiType, String owner) throws WikiException
      Wiki
      Specified by:
      getWikiByTypeAndOwner in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      owner - The Wiki owner.
      Returns:
      The Wiki.
      Throws:
      WikiException - if an error occured
    • getWikisByType

      public List<Wiki> getWikisByType(String wikiType) throws WikiException
      Description copied from interface: WikiService
      Gets all wikis of the given type
      Specified by:
      getWikisByType in interface WikiService
      Parameters:
      wikiType - Type of wiki
      Returns:
      Wikis of the given type
      Throws:
      WikiException - if an error occured
    • getOrCreateUserWiki

      public Wiki getOrCreateUserWiki(String username) throws WikiException
      Description copied from interface: WikiService
      Gets a user Wiki. If it does not exist, the new one will be created.
      Specified by:
      getOrCreateUserWiki in interface WikiService
      Parameters:
      username - Name of the user.
      Returns:
      The user Wiki.
      Throws:
      WikiException - if an error occured
    • getWikiPermission

      public List<PermissionEntry> getWikiPermission(String wikiType, String wikiOwner) throws WikiException
      Description copied from interface: WikiService
      Gets a list of Wiki permissions based on its type and owner.
      Specified by:
      getWikiPermission in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      wikiOwner - The Wiki owner.
      Returns:
      The list of Wiki permissions.
      Throws:
      WikiException - if an error occured if an error occured
    • updateWikiPermission

      public void updateWikiPermission(String wikiType, String wikiOwner, List<PermissionEntry> permissionEntries) throws WikiException
      Description copied from interface: WikiService
      Adds a list of permissions to Wiki.
      Specified by:
      updateWikiPermission in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      wikiOwner - The Wiki owner.
      permissionEntries - The list of permissions.
      Throws:
      WikiException - if an error occured if an error occured
    • getWikiDefaultPermissions

      public List<PermissionEntry> getWikiDefaultPermissions(String wikiType, String wikiOwner) throws WikiException
      Description copied from interface: WikiService
      Gets a list of Wiki default permissions.
      Specified by:
      getWikiDefaultPermissions in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      wikiOwner - The Wiki owner.
      Returns:
      The list of Wiki default permissions.
      Throws:
      WikiException - if an error occured
    • getWikiById

      public Wiki getWikiById(String wikiId) throws WikiException
      Description copied from interface: WikiService
      Gets a Wiki by its Id.
      Specified by:
      getWikiById in interface WikiService
      Parameters:
      wikiId - The Wiki Id.
      Returns:
      The Wiki.
      Throws:
      WikiException - if an error occured
    • getWikiNameById

      public String getWikiNameById(String wikiId) throws WikiException
      Description copied from interface: WikiService
      Gets a Wiki name by its Id.
      Specified by:
      getWikiNameById in interface WikiService
      Parameters:
      wikiId - The Wiki Id.
      Returns:
      The Wiki name.
      Throws:
      WikiException - if an error occured
    • createWiki

      public Wiki createWiki(String wikiType, String owner) throws WikiException
      Description copied from interface: WikiService
      Creates a wiki with the given type and owner
      Specified by:
      createWiki in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      owner - The Wiki owner.
      Returns:
      Wiki created
      Throws:
      WikiException - if an error occured
    • invalidateAttachmentCache

      protected void invalidateAttachmentCache(Page page)
    • getAttachmentsOfPage

      public List<Attachment> getAttachmentsOfPage(Page page) throws WikiException
      Attachment
      Specified by:
      getAttachmentsOfPage in interface WikiService
      Parameters:
      page - The wiki page
      Returns:
      The attachments of the page
      Throws:
      WikiException - if an error occured if an error occured
    • getAttachmentsOfPage

      public List<Attachment> getAttachmentsOfPage(Page page, boolean loadContent) throws WikiException
      Description copied from interface: WikiService
      Gets attachments of the given page, and allow to load their attachment content by setting loadContent to true
      Specified by:
      getAttachmentsOfPage in interface WikiService
      Parameters:
      page - The wiki page
      loadContent - treue if need to load the attachement content
      Returns:
      The attachments of the page
      Throws:
      WikiException - if an error occured if an error occured
    • getNbOfAttachmentsOfPage

      public int getNbOfAttachmentsOfPage(Page page) throws WikiException
      Description copied from interface: WikiService
      Get the number of attachment of the given page
      Specified by:
      getNbOfAttachmentsOfPage in interface WikiService
      Parameters:
      page - The wiki page
      Returns:
      The number of attachments of the page
      Throws:
      WikiException - if an error occured if an error occured
    • getAttachmentOfPageByName

      public Attachment getAttachmentOfPageByName(String attachmentName, Page page) throws WikiException
      Description copied from interface: WikiService
      Get a attachment of a the given page by name, without loading its content
      Specified by:
      getAttachmentOfPageByName in interface WikiService
      Parameters:
      attachmentName - The name of the attachment
      page - The wiki page
      Returns:
      Attachment
      Throws:
      WikiException - if an error occured if an error occured
    • getAttachmentOfPageByName

      public Attachment getAttachmentOfPageByName(String attachmentName, Page page, boolean loadContent) throws WikiException
      Description copied from interface: WikiService
      Get a attachment of a the given page by name, and allow to load the attachment content by setting loadContent to true
      Specified by:
      getAttachmentOfPageByName in interface WikiService
      Parameters:
      attachmentName - The name of the attachment
      page - The wiki page
      loadContent - true to load the attachment content
      Returns:
      attachement
      Throws:
      WikiException - if an error occured if an error occured
    • addAttachmentToPage

      public void addAttachmentToPage(Attachment attachment, Page page) throws WikiException
      Description copied from interface: WikiService
      Add the given attachment to the given page
      Specified by:
      addAttachmentToPage in interface WikiService
      Parameters:
      attachment - The attachment to add
      page - The wiki page
      Throws:
      WikiException - if an error occured if an error occured
    • deleteAttachmentOfPage

      public void deleteAttachmentOfPage(String attachmentId, Page page) throws WikiException
      Description copied from interface: WikiService
      Deletes the given attachment of the given page
      Specified by:
      deleteAttachmentOfPage in interface WikiService
      Parameters:
      attachmentId - Id of the attachment
      page - The wiki page
      Throws:
      WikiException - if an error occured
    • searchSpaces

      public List<SpaceBean> searchSpaces(String keyword) throws WikiException
      Spaces
      Specified by:
      searchSpaces in interface WikiService
      Parameters:
      keyword - The keyword to search for spaces.
      Returns:
      The list of spaces matching with the keyword.
      Throws:
      WikiException - if an error occured
    • hasAdminSpacePermission

      public boolean hasAdminSpacePermission(String wikiType, String owner) throws WikiException
      Description copied from interface: WikiService
      Checks if the current user has the admin permission on a space or not.
      Specified by:
      hasAdminSpacePermission in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      owner - Owner of the space.
      Returns:
      The returned value is "true" if the current user has the admin permission on the space, or "false" if not.
      Throws:
      WikiException - if an error occured
    • getSpaceNameByGroupId

      public String getSpaceNameByGroupId(String groupId)
      Description copied from interface: WikiService
      Gets a space name by a given group Id.
      Specified by:
      getSpaceNameByGroupId in interface WikiService
      Parameters:
      groupId - The group Id.
      Returns:
      The space name.
    • postUpdatePage

      public void postUpdatePage(String wikiType, String wikiOwner, String pageId, Page page, PageUpdateType wikiUpdateType) throws WikiException
      Throws:
      WikiException
    • postAddPage

      public void postAddPage(String wikiType, String wikiOwner, String pageId, Page page) throws WikiException
      Throws:
      WikiException
    • postDeletePage

      public void postDeletePage(String wikiType, String wikiOwner, String pageId, Page page) throws WikiException
      Throws:
      WikiException
    • addAttachment

      public void addAttachment(Attachment attachment, Page page) throws WikiException
      Throws:
      WikiException
    • deleteAttachment

      public void deleteAttachment(String attachmentId, Page page) throws WikiException
      Throws:
      WikiException
    • getWikiPageParams

      public WikiPageParams getWikiPageParams(BreadcrumbData data)
      Description copied from interface: WikiService
      Gets parameters of a wiki page based on the data stored in the breadcrumb.
      Specified by:
      getWikiPageParams in interface WikiService
      Parameters:
      data - The data in the breadcrumb that identifies the wiki page.
      Returns:
      The parameters identifying the wiki page.
    • hasAdminPagePermission

      public boolean hasAdminPagePermission(String wikiType, String owner) throws WikiException
      Description copied from interface: WikiService
      Checks if the current user has the admin permission on a wiki page.
      Specified by:
      hasAdminPagePermission in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      owner - Owner of the wiki page.
      Returns:
      "True" if the current user has the admin permission on the wiki page, or "false" if not.
      Throws:
      WikiException - if an error occured
    • getPageOfWikiByName

      public Page getPageOfWikiByName(String wikiType, String wikiOwner, String pageName) throws WikiException
      Description copied from interface: WikiService
      Gets a wiki page by its unique name in the wiki.
      Specified by:
      getPageOfWikiByName in interface WikiService
      Parameters:
      wikiType - It can be Portal, Group, or User.
      wikiOwner - The Wiki owner.
      pageName - Id of the wiki page.
      Returns:
      The wiki page if the current user has the read permission. Otherwise, it is "null".
      Throws:
      WikiException - if an error occured if an error occured
    • hasPermissionOnWiki

      public boolean hasPermissionOnWiki(Wiki wiki, PermissionType permissionType, org.exoplatform.services.security.Identity user) throws WikiException
      Description copied from interface: WikiService
      Check if the identity has the given permission type on a wiki
      Specified by:
      hasPermissionOnWiki in interface WikiService
      Parameters:
      wiki - Wiki
      permissionType - Permission type to check
      user - Identity of the user
      Returns:
      true if the user has the given permission type on the wiki
      Throws:
      WikiException - if an error occured