Package org.exoplatform.wiki.utils
Class Utils
java.lang.Object
org.exoplatform.wiki.utils.Utils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Patternstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S,D> void broadcast(org.exoplatform.services.listener.ListenerService listenerService, String eventName, S source, D data) static booleancanManageNotes(String authenticatedUser, org.exoplatform.social.core.space.model.Space space, Page page) static longstatic Stringstatic Stringstatic voidextractFile(ZipInputStream zipIn, String filePath) getContentImagesIds(String content, String objectType, String objectId) static Stringstatic Stringstatic StringgetDocumentURL(WikiContext wikiContext) static StringgetEmailUser(String userName) static org.exoplatform.services.security.IdentitygetIdentity(String username) static StringgetIdentityUser(String userId) get user identity.static Map<String, WikiPageHistory> getLogOfPage(String pageId) Get the editting log of wiki pagestatic Objectstatic 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 Stringstatic Stringgets rest context namestatic Deque<WikiPageParams> getStackParams(Page page) static Stringstatic StringgetWikiOnChangeContent(Page page) static WikiPageParamsgetWikiPageParams(Page page) static StringgetWikiResourceBundle(String key, ClassLoader cl) Get resource bundle from given resource filestatic Stringstatic booleanisDescendantPage(Page page, Page parentPage) static voidlogEditPageTime(WikiPageParams pageParams, String username, long updateTime, String draftName, boolean isNewPage) Log the edit page action of userstatic StringprocessMentions(String content, org.exoplatform.social.core.space.model.Space space) static voidremoveLogEditPage(WikiPageParams pageParams, String user) removes the log of user editing page.static voidsendMentionInNoteNotification(Page note, Page originalNote, String currentUser) static StringvalidateWikiOwner(String wikiType, String wikiOwner) ValidatewikiOwnerdepending onwikiType.
-
Field Details
-
SLASH
- See Also:
-
DOT
- See Also:
-
SPACE
- See Also:
-
PAGE
- See Also:
-
NOTE_LINK
- See Also:
-
ANONYM_IDENTITY
- See Also:
-
COMPARE_REVISION
- See Also:
-
VER_NAME
- See Also:
-
WIKI_RESOUCE_BUNDLE_NAME
- See Also:
-
SPLIT_TEXT_OF_DRAFT_FOR_NEW_PAGE
- See Also:
-
NOTES_METADATA_OBJECT_TYPE
- See Also:
-
WIKI_APP_ID
- See Also:
-
PAGE_ID_KEY
- See Also:
-
PAGE_TYPE_KEY
- See Also:
-
PAGE_OWNER_KEY
- See Also:
-
MENTION_PATTERN
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
normalizeUploadedFilename
-
escapeIllegalCharacterInQuery
-
escapeIllegalCharacterInName
-
getPortalName
-
getWikiResourceBundle
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
removes the log of user editing page.- Parameters:
pageParams- wiki page paramsuser- current userName
-
getIdentityUser
get user identity.- Parameters:
userId- current userName- Returns:
- the full name of the user
-
getPermanlink
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
-
getLogOfPage
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
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
-
getDocumentURL
-
getCurrentUser
-
isDescendantPage
- Throws:
WikiException
-
getObjectFromParams
- Throws:
WikiException
-
getStackParams
- Throws:
WikiException
-
getWikiPageParams
-
getWikiOnChangeContent
public static String getWikiOnChangeContent(Page page) throws WikiException, org.suigeneris.jrcs.diff.DifferentiationFailedException - Throws:
WikiExceptionorg.suigeneris.jrcs.diff.DifferentiationFailedException
-
getEmailUser
- Throws:
WikiException
-
getURL
-
countSearchResult
- Throws:
Exception
-
getRestContextName
gets rest context name- Returns:
- rest context name
-
getPageUrl
-
unzip
- Throws:
IOException
-
extractFile
- Throws:
IOException
-
html2text
-
broadcast
public static <S,D> void broadcast(org.exoplatform.services.listener.ListenerService listenerService, String eventName, S source, D data) -
canManageNotes
-
getIdentity
-
processMentions
-
sendMentionInNoteNotification
-
getContentImagesIds
-