Class Utils


  • public class Utils
    extends Object
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • 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
      • getListOfUserEditingPage

        public static List<String> getListOfUserEditingPage​(String pageId)
        Get the list of user that're editing the wiki page
        Parameters:
        pageId - The id of wiki page
        Returns:
        The list of user that're editing this wiki page
      • 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()
      • getCurrentUser

        public static String getCurrentUser()
      • getWikiOnChangeContent

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

        public static boolean isDlpFeatureEnabled()
      • 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)
      • html2text

        public static String html2text​(String html)