Class Utils

java.lang.Object
org.exoplatform.wiki.utils.Utils

public class Utils extends Object
  • Field Details

  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • normalizeUploadedFilename

      public static String normalizeUploadedFilename(String name)
    • escapeIllegalCharacterInQuery

      public static String escapeIllegalCharacterInQuery(String query)
    • escapeIllegalCharacterInName

      public static String escapeIllegalCharacterInName(String name)
    • getPortalName

      public static String getPortalName()
    • getWikiResourceBundle

      public static String getWikiResourceBundle(String key, ClassLoader cl)
      Get resource bundle from given resource file
      Parameters:
      key - key
      cl - ClassLoader to load resource file
      Returns:
      The value of key in resource bundle
    • logEditPageTime

      public static void logEditPageTime(WikiPageParams pageParams, String username, long updateTime, String draftName, boolean isNewPage)
      Log the edit page action of user
      Parameters:
      pageParams - The page that has been editing
      username - The name of user that editing wiki page
      updateTime - The time that this page is edited
      draftName - The name of draft for this edit
      isNewPage - Is the wiki page a draft or not
    • removeLogEditPage

      public static void removeLogEditPage(WikiPageParams pageParams, String user)
      removes the log of user editing page.
      Parameters:
      pageParams - wiki page params
      user - current userName
    • getIdentityUser

      public static String getIdentityUser(String userId)
      get user identity.
      Parameters:
      userId - current userName
      Returns:
      the full name of the user
    • getPermanlink

      public static String getPermanlink(WikiPageParams params, boolean hasDowmainUrl) throws Exception
      Get the permalink of current wiki page
      With the current page param:
      • type = "group"
      • owner = "spaces/test_space"
      • pageId = "test_page"

      The permalink will be:
      • http://int.exoplatform.org/portal/intranet/wiki/group/spaces/test_space/test_page

      Parameters:
      params - the wiki oage parms
      hasDowmainUrl - if page has domain url
      Returns:
      The permalink of current wiki page
      Throws:
      Exception - if error occured
    • getPageNameForAddingPage

      public static String getPageNameForAddingPage()
    • getPageNameForAddingPage

      public static String getPageNameForAddingPage(String sessionId)
    • getLogOfPage

      public static Map<String,WikiPageHistory> getLogOfPage(String pageId)
      Get the editting log of wiki page
      Parameters:
      pageId - The id of wiki page to get log
      Returns:
      The editting log of wiki pgae
    • validateWikiOwner

      public static String validateWikiOwner(String wikiType, String wikiOwner)
      Validate wikiOwner depending on wikiType.
      If wikiType is PortalConfig.GROUP_TYPE, wikiOwner is checked to removed slashes at the begin and the end point of it.
      Parameters:
      wikiType - the wiki type
      wikiOwner - the wiki owner
      Returns:
      wikiOwner after validated.
    • getDefaultRestBaseURI

      public static String getDefaultRestBaseURI()
    • getDocumentURL

      public static String getDocumentURL(WikiContext wikiContext)
    • getCurrentUser

      public static String getCurrentUser()
    • isDescendantPage

      public static boolean isDescendantPage(Page page, Page parentPage) throws WikiException
      Throws:
      WikiException
    • getObjectFromParams

      public static Object getObjectFromParams(WikiPageParams param) throws WikiException
      Throws:
      WikiException
    • getStackParams

      public static Deque<WikiPageParams> getStackParams(Page page) throws WikiException
      Throws:
      WikiException
    • getWikiPageParams

      public static WikiPageParams getWikiPageParams(Page page)
    • getWikiOnChangeContent

      public static String getWikiOnChangeContent(Page page) throws WikiException, org.suigeneris.jrcs.diff.DifferentiationFailedException
      Throws:
      WikiException
      org.suigeneris.jrcs.diff.DifferentiationFailedException
    • getEmailUser

      public static String getEmailUser(String userName) throws WikiException
      Throws:
      WikiException
    • getACLForAdmins

      public static HashMap<String,IDType> getACLForAdmins()
    • getURL

      public static String getURL(String url, String verName)
    • countSearchResult

      public static long countSearchResult(WikiSearchData data) throws Exception
      Throws:
      Exception
    • getAttachmentCssClass

      public static String getAttachmentCssClass(Attachment attachment, String append) throws Exception
      Throws:
      Exception
    • getRestContextName

      public static String getRestContextName()
      gets rest context name
      Returns:
      rest context name
    • getPageUrl

      public static String getPageUrl(Page page)
    • getSpacesURI

      public static String getSpacesURI(Page page)
    • getWikiAppNameInSpace

      public static String getWikiAppNameInSpace(String spaceId)
    • unzip

      public static List<String> unzip(String zipFilePath, String folderPath) throws IOException
      Throws:
      IOException
    • extractFile

      public static void extractFile(ZipInputStream zipIn, String filePath) throws IOException
      Throws:
      IOException
    • html2text

      public static String html2text(String html)
    • broadcast

      public static <S, D> void broadcast(org.exoplatform.services.listener.ListenerService listenerService, String eventName, S source, D data)