Package org.exoplatform.wiki.utils
Class Utils
- java.lang.Object
-
- org.exoplatform.wiki.utils.Utils
-
public class Utils extends Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longcountSearchResult(WikiSearchData data)static StringescapeIllegalCharacterInName(String name)static StringescapeIllegalCharacterInQuery(String query)static HashMap<String,IDType>getACLForAdmins()static StringgetAttachmentCssClass(Attachment attachment, String append)static StringgetCurrentUser()static StringgetDefaultRestBaseURI()static StringgetDocumentURL(WikiContext wikiContext)static StringgetEmailUser(String userName)static StringgetIdentityUser(String userId)get user identity.static List<String>getListOfUserEditingPage(String pageId)Get the list of user that're editing the wiki pagestatic Map<String,WikiPageHistory>getLogOfPage(String pageId)Get the editting log of wiki pagestatic ObjectgetObjectFromParams(WikiPageParams param)static StringgetPageNameForAddingPage()static StringgetPageNameForAddingPage(String sessionId)static StringgetPageUrl(Page page)static StringgetPermanlink(WikiPageParams params, boolean hasDowmainUrl)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_pagestatic StringgetPortalName()static StringgetRestContextName()gets rest context namestatic StringgetSpacesURI(Page page)static Stack<WikiPageParams>getStackParams(Page page)static StringgetURL(String url, String verName)static StringgetWikiAppNameInSpace(String spaceId)static StringgetWikiOnChangeContent(Page page)static WikiPageParamsgetWikiPageParams(Page page)static StringgetWikiResourceBundle(String key, ClassLoader cl)Get resource bundle from given resource filestatic booleanisDescendantPage(Page page, Page parentPage)static booleanisDlpFeatureEnabled()static voidlogEditPageTime(WikiPageParams pageParams, String username, long updateTime, String draftName, boolean isNewPage)Log the edit page action of userstatic StringnormalizeUploadedFilename(String name)static voidremoveLogEditPage(WikiPageParams pageParams, String user)removes the log of user editing page.static StringvalidateWikiOwner(String wikiType, String wikiOwner)ValidatewikiOwnerdepending onwikiType.
-
-
-
Field Detail
-
SLASH
public static final String SLASH
- See Also:
- Constant Field Values
-
DOT
public static final String DOT
- See Also:
- Constant Field Values
-
SPACE
public static final String SPACE
- See Also:
- Constant Field Values
-
PAGE
public static final String PAGE
- See Also:
- Constant Field Values
-
COMPARE_REVISION
public static final String COMPARE_REVISION
- See Also:
- Constant Field Values
-
VER_NAME
public static final String VER_NAME
- See Also:
- Constant Field Values
-
WIKI_RESOUCE_BUNDLE_NAME
public static final String WIKI_RESOUCE_BUNDLE_NAME
- See Also:
- Constant Field Values
-
SPLIT_TEXT_OF_DRAFT_FOR_NEW_PAGE
public static final String SPLIT_TEXT_OF_DRAFT_FOR_NEW_PAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPortalName
public static String getPortalName()
-
getWikiResourceBundle
public static String getWikiResourceBundle(String key, ClassLoader cl)
Get resource bundle from given resource file- Parameters:
key- keycl- 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 editingusername- The name of user that editing wiki pageupdateTime- The time that this page is editeddraftName- The name of draft for this editisNewPage- 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 paramsuser- 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 parmshasDowmainUrl- if page has domain url- Returns:
- The permalink of current wiki page
- Throws:
Exception- if error occured
-
getPageNameForAddingPage
public static String getPageNameForAddingPage()
-
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)
ValidatewikiOwnerdepending onwikiType.
If wikiType isPortalConfig.GROUP_TYPE,wikiOwneris checked to removed slashes at the begin and the end point of it.- Parameters:
wikiType- the wiki typewikiOwner- 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 Stack<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:
WikiExceptionorg.suigeneris.jrcs.diff.DifferentiationFailedException
-
getEmailUser
public static String getEmailUser(String userName) throws WikiException
- Throws:
WikiException
-
countSearchResult
public static long countSearchResult(WikiSearchData data) throws Exception
- Throws:
Exception
-
getAttachmentCssClass
public static String getAttachmentCssClass(Attachment attachment, String append) throws Exception
- Throws:
Exception
-
isDlpFeatureEnabled
public static boolean isDlpFeatureEnabled()
-
getRestContextName
public static String getRestContextName()
gets rest context name- Returns:
- rest context name
-
-