Class WikiServiceImpl
- java.lang.Object
-
- org.exoplatform.wiki.service.impl.WikiServiceImpl
-
- All Implemented Interfaces:
WikiService,org.picocontainer.Startable
public class WikiServiceImpl extends Object implements WikiService, org.picocontainer.Startable
-
-
Field Summary
Fields Modifier and Type Field Description static StringATT_CACHE_NAMEstatic StringCACHE_NAMEstatic StringUPLOAD_LIMIT_PARAMETER_NAMEstatic StringWIKI_TYPE_DRAFT
-
Constructor Summary
Constructors Constructor Description WikiServiceImpl(org.exoplatform.container.configuration.ConfigurationManager configManager, org.exoplatform.portal.config.UserACL userACL, DataStorage dataStorage, org.exoplatform.services.cache.CacheService cacheService, org.exoplatform.services.organization.OrganizationService orgService, org.exoplatform.container.xml.InitParams initParams)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttachment(Attachment attachment, Page page)voidaddAttachmentToPage(Attachment attachment, Page page)Add the given attachment to the given pagevoidaddComponentPlugin(org.exoplatform.container.component.ComponentPlugin plugin)ConfigurationvoidaddEmotionIconsPlugin(WikiEmotionIconsPlugin plugin)Adds a Wiki emotion icons as plugin.voidaddPageLink(WikiPageParams param, WikiPageParams entity)Add a link between 2 pagesvoidaddRelatedPage(WikiPageParams orginaryPageParams, WikiPageParams relatedPageParams)Adds a related page to the current wiki page.voidaddWatcherToPage(String username, Page page)Add the given user as watcher of the wiki pagevoidaddWikiTemplatePagePlugin(WikiTemplatePagePlugin plugin)Adds a Wiki template as plugin.booleancanModifyPagePermission(Page currentPage, String currentUser)Check if the given user can update the pagebooleancanPublicAndRetrictPage(Page currentPage, String currentUser)Check if the given user can public or restrict the pageDraftPagecreateDraftForExistPage(DraftPage draftPage, Page targetPage, String revision, long clientTime)Creates a draft page for a wiki page which is specified by a given param object.DraftPagecreateDraftForNewPage(DraftPage draftPage, Page parentPage, long clientTime)Creates a draft page for a new wiki page whose parent is specified by a given param object.voidcreateEmotionIcon(EmotionIcon emotionIcon)Creates a emotion iconPagecreatePage(Wiki wiki, String parentPageName, Page page)PagevoidcreateTemplatePage(Wiki wiki, Template template)TemplatevoidcreateVersionOfPage(Page page)Creates a version of a page.WikicreateWiki(String wikiType, String owner)Creates a wiki with the given type and ownervoiddeleteAttachment(String attachmentId, Page page)voiddeleteAttachmentOfPage(String attachmentId, Page page)Deletes the given attachment of the given pagebooleandeletePage(String wikiType, String wikiOwner, String pageName, String userId)Deletes a wiki page.voiddeleteTemplatePage(String wikiType, String wikiOwner, String templateName)Deletes a Wiki template.voiddeleteWatcherOfPage(String username, Page page)Delete a user as watcher of the given pageList<AttachmentWikiListener>getAttachmentListeners()Gets attachment listeners that are registered into the Wiki service.AttachmentgetAttachmentOfPageByName(String attachmentName, Page page)Get a attachment of a the given page by name, without loading its contentAttachmentgetAttachmentOfPageByName(String attachmentName, Page page, boolean loadContent)Get a attachment of a the given page by name, and allow to load the attachment content by setting loadContent to trueList<Attachment>getAttachmentsOfPage(Page page)AttachmentList<Attachment>getAttachmentsOfPage(Page page, boolean loadContent)Gets attachments of the given page, and allow to load their attachment content by setting loadContent to trueList<BreadcrumbData>getBreadcumb(String wikiType, String wikiOwner, String pageId)Gets a list of data which is used for composing the breadcrumb.List<Page>getChildrenPageOf(Page page, String userId, boolean withDrafts)Get all the children pages of a wiki pageStringgetDefaultWikiSyntaxId()Gets Id of a default Wiki syntax.DraftPagegetDraft(String draftName)Gets a draft page by its name.org.exoplatform.commons.diff.DiffResultgetDraftChanges(DraftPage draftPage)Gets the changes between the draft page and the target pageDraftPagegetDraftOfPage(Page page)Gets a draft page of a wiki page which is specified by a given param object.DraftPagegetDraftPageById(String id)Gets a wiki draft page based on its unique id.List<DraftPage>getDraftsOfUser(String username)Gets a list of draft pages belonging to a given user.List<Page>getDuplicatePages(Page parentPage, Wiki targetWiki, List<Page> resultList, String userId)Checks if a page and its children are duplicated with ones in the target Wiki or not, then gets a list of duplicated pages if any.longgetEditPageLivingTime()Get the living time of edited pageEmotionIcongetEmotionIconByName(String name)Gets an emotion icon by nameList<EmotionIcon>getEmotionIcons()Gets all the emotion iconsPagegetExsitedOrNewDraftPageById(String wikiType, String wikiOwner, String pageId)DraftPagegetHelpSyntaxPage(String syntaxId, boolean fullContent)Gets a Help wiki page based on a given syntax Id.DraftPagegetLastestDraft()Gets the last created draft of a wiki page.intgetNbOfAttachmentsOfPage(Page page)Get the number of attachment of the given pageWikigetOrCreateUserWiki(String username)Gets a user Wiki.PagegetPageById(String id)Gets a wiki page based on its unique id.PagegetPageByRootPermission(String wikiType, String wikiOwner, String pageId)Gets a wiki page regardless of the current user's permission.Map<WikiPageParams,List<WikiPageParams>>getPageLinksMap()List<PageWikiListener>getPageListeners()Gets listeners of all wiki pages that are registered into the Wiki service.PagegetPageOfWikiByName(String wikiType, String wikiOwner, String pageName)Gets a wiki page by its unique name in the wiki.StringgetPageRenderedContent(Page page)Get renderd content of a pageList<Page>getPagesOfWiki(String wikiType, String wikiOwner)Retrieve the all pages contained in wikiPagegetParentPageOf(Page page)Get parent page of a wiki pageList<String>getPreviousNamesOfPage(Page page)Get previous names of a pagePagegetRelatedPage(String wikiType, String wikiOwner, String pageId)Gets a related page of a wiki page which is specified by a given Id.List<Page>getRelatedPagesOfPage(Page page)Gets a list of related pages based on a given param.org.exoplatform.services.cache.ExoCache<Integer,MarkupData>getRenderingCache()longgetSaveDraftSequenceTime()Gets an interval which specifies the periodical auto-saving for pages in Wiki.StringgetSpaceNameByGroupId(String groupId)Gets a space name by a given group Id.TemplategetTemplatePage(WikiPageParams params, String templateId)Gets a Wiki template.Map<String,Template>getTemplates(WikiPageParams params)Gets a map of wiki templates based on a given params object.intgetUploadLimit()PageVersiongetVersionOfPageByName(String versionName, Page page)Gets a specific version by name of the given pageList<PageVersion>getVersionsOfPage(Page page)Gets all the versions of the given pageList<String>getWatchersOfPage(Page page)WatchWikigetWikiById(String wikiId)Gets a Wiki by its Id.WikigetWikiByTypeAndOwner(String wikiType, String owner)WikiList<PermissionEntry>getWikiDefaultPermissions(String wikiType, String wikiOwner)Gets a list of Wiki default permissions.StringgetWikiNameById(String wikiId)Gets a Wiki name by its Id.WikiPageParamsgetWikiPageParams(BreadcrumbData data)Gets parameters of a wiki page based on the data stored in the breadcrumb.List<PermissionEntry>getWikiPermission(String wikiType, String wikiOwner)Gets a list of Wiki permissions based on its type and owner.List<Wiki>getWikisByType(String wikiType)Gets all wikis of the given typeStringgetWikiWebappUri()Gets a Wiki webapp URI.booleanhasAdminPagePermission(String wikiType, String owner)Checks if the current user has the admin permission on a wiki page.booleanhasAdminSpacePermission(String wikiType, String owner)Checks if the current user has the admin permission on a space or not.booleanhasPermissionOnPage(Page page, PermissionType permissionType, org.exoplatform.services.security.Identity user)Checks if the given user has the permission on a pagebooleanhasPermissionOnWiki(Wiki wiki, PermissionType permissionType, org.exoplatform.services.security.Identity user)Check if the identity has the given permission type on a wikiprotected voidinvalidateAttachmentCache(Page page)protected voidinvalidateCache(Page page)protected voidinvalidateCachesOfPageTree(Page page, String userId)Invalidate all caches of a page and all its descendantsbooleanisDraftOutDated(DraftPage draftPage)Check if a draft page is outdatedbooleanisExisting(String wikiType, String wikiOwner, String pageId)Checks if a wiki page exists or not.booleanmovePage(WikiPageParams currentLocationParams, WikiPageParams newLocationParams)Move a wiki PagevoidpostAddPage(String wikiType, String wikiOwner, String pageId, Page page)voidpostDeletePage(String wikiType, String wikiOwner, String pageId, Page page)voidpostUpdatePage(String wikiType, String wikiOwner, String pageId, Page page, PageUpdateType wikiUpdateType)voidremoveDraft(String draftName)Removes a draft page by its name.voidremoveDraftOfPage(WikiPageParams param)Removes a draft page of a wiki page which is specified by the wiki page param.voidremoveRelatedPage(WikiPageParams orginaryPageParams, WikiPageParams relatedPageParams)Removes a related page of the current wiki page.booleanrenamePage(String wikiType, String wikiOwner, String pageName, String newName, String newTitle)Renames a wiki page.voidrestoreVersionOfPage(String versionName, Page page)Restores a version of a pageorg.exoplatform.commons.utils.PageList<SearchResult>search(WikiSearchData data)Searches in all wiki pages.List<SpaceBean>searchSpaces(String keyword)SpacesList<TemplateSearchResult>searchTemplate(TemplateSearchData data)Searches in all templates.voidstart()voidstop()voidupdatePage(Page page, PageUpdateType updateType)Update the given page.voidupdateTemplate(Template template)Modifies an existing wiki template.voidupdateWikiPermission(String wikiType, String wikiOwner, List<PermissionEntry> permissionEntries)Adds a list of permissions to Wiki.
-
-
-
Field Detail
-
WIKI_TYPE_DRAFT
public static final String WIKI_TYPE_DRAFT
- See Also:
- Constant Field Values
-
CACHE_NAME
public static final String CACHE_NAME
- See Also:
- Constant Field Values
-
ATT_CACHE_NAME
public static final String ATT_CACHE_NAME
- See Also:
- Constant Field Values
-
UPLOAD_LIMIT_PARAMETER_NAME
public static String UPLOAD_LIMIT_PARAMETER_NAME
-
-
Constructor Detail
-
WikiServiceImpl
public WikiServiceImpl(org.exoplatform.container.configuration.ConfigurationManager configManager, org.exoplatform.portal.config.UserACL userACL, DataStorage dataStorage, org.exoplatform.services.cache.CacheService cacheService, org.exoplatform.services.organization.OrganizationService orgService, org.exoplatform.container.xml.InitParams initParams)
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()
- Specified by:
stopin interfaceorg.picocontainer.Startable
-
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:
addComponentPluginin interfaceWikiService- Parameters:
plugin- The component plugin to be registered.
-
addWikiTemplatePagePlugin
public void addWikiTemplatePagePlugin(WikiTemplatePagePlugin plugin)
Description copied from interface:WikiServiceAdds a Wiki template as plugin.- Specified by:
addWikiTemplatePagePluginin interfaceWikiService- Parameters:
plugin- The wiki template plugin to be added.
-
addEmotionIconsPlugin
public void addEmotionIconsPlugin(WikiEmotionIconsPlugin plugin)
Description copied from interface:WikiServiceAdds a Wiki emotion icons as plugin.- Specified by:
addEmotionIconsPluginin interfaceWikiService- Parameters:
plugin- The wiki emotion icons plugin to be added.
-
getPageListeners
public List<PageWikiListener> getPageListeners()
Description copied from interface:WikiServiceGets listeners of all wiki pages that are registered into the Wiki service.- Specified by:
getPageListenersin interfaceWikiService- Returns:
- The list of listeners.
-
getAttachmentListeners
public List<AttachmentWikiListener> getAttachmentListeners()
Description copied from interface:WikiServiceGets attachment listeners that are registered into the Wiki service.- Specified by:
getAttachmentListenersin interfaceWikiService- Returns:
- The list of attachment listeners.
-
getWikiWebappUri
public String getWikiWebappUri()
Description copied from interface:WikiServiceGets a Wiki webapp URI.- Specified by:
getWikiWebappUriin interfaceWikiService- Returns:
- The Wiki webapp URI.
-
getDefaultWikiSyntaxId
public String getDefaultWikiSyntaxId()
Description copied from interface:WikiServiceGets Id of a default Wiki syntax.- Specified by:
getDefaultWikiSyntaxIdin interfaceWikiService- Returns:
- The Id.
-
getSaveDraftSequenceTime
public long getSaveDraftSequenceTime()
Description copied from interface:WikiServiceGets an interval which specifies the periodical auto-saving for pages in Wiki.- Specified by:
getSaveDraftSequenceTimein interfaceWikiService- Returns:
- The interval. Its default value is 30 seconds.
-
getEditPageLivingTime
public long getEditPageLivingTime()
Description copied from interface:WikiServiceGet the living time of edited page- Specified by:
getEditPageLivingTimein interfaceWikiService- Returns:
- The living time of edited page
-
getWikiByTypeAndOwner
public Wiki getWikiByTypeAndOwner(String wikiType, String owner) throws WikiException
Wiki- Specified by:
getWikiByTypeAndOwnerin interfaceWikiService- 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:WikiServiceGets all wikis of the given type- Specified by:
getWikisByTypein interfaceWikiService- 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:WikiServiceGets a user Wiki. If it does not exist, the new one will be created.- Specified by:
getOrCreateUserWikiin interfaceWikiService- 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:WikiServiceGets a list of Wiki permissions based on its type and owner.- Specified by:
getWikiPermissionin interfaceWikiService- 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:WikiServiceAdds a list of permissions to Wiki.- Specified by:
updateWikiPermissionin interfaceWikiService- 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:WikiServiceGets a list of Wiki default permissions.- Specified by:
getWikiDefaultPermissionsin interfaceWikiService- 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:WikiServiceGets a Wiki by its Id.- Specified by:
getWikiByIdin interfaceWikiService- 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:WikiServiceGets a Wiki name by its Id.- Specified by:
getWikiNameByIdin interfaceWikiService- 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:WikiServiceCreates a wiki with the given type and owner- Specified by:
createWikiin interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.owner- The Wiki owner.- Returns:
- Wiki created
- Throws:
WikiException- if an error occured
-
createPage
public Page createPage(Wiki wiki, String parentPageName, Page page) throws WikiException
Page- Specified by:
createPagein interfaceWikiService- Parameters:
wiki- It can be Portal, Group, or User.parentPageName- Name of the parent wiki page.page- wiki page object to create.- Returns:
- The new wiki page.
- Throws:
WikiException- if an error occured if an error occured
-
getPageOfWikiByName
public Page getPageOfWikiByName(String wikiType, String wikiOwner, String pageName) throws WikiException
Description copied from interface:WikiServiceGets a wiki page by its unique name in the wiki.- Specified by:
getPageOfWikiByNamein interfaceWikiService- 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
-
getPageById
public Page getPageById(String id) throws WikiException
Description copied from interface:WikiServiceGets a wiki page based on its unique id.- Specified by:
getPageByIdin interfaceWikiService- Parameters:
id- Unique id of the wiki page.- Returns:
- The wiki page.
- Throws:
WikiException- if an error occured if an error occured
-
getDraftPageById
public DraftPage getDraftPageById(String id) throws WikiException
Description copied from interface:WikiServiceGets a wiki draft page based on its unique id.- Specified by:
getDraftPageByIdin interfaceWikiService- Parameters:
id- Unique id of the wiki page.- Returns:
- The wiki draft page.
- Throws:
WikiException- if an error occured if an error occured
-
getPageByRootPermission
public Page getPageByRootPermission(String wikiType, String wikiOwner, String pageId) throws WikiException
Description copied from interface:WikiServiceGets a wiki page regardless of the current user's permission.- Specified by:
getPageByRootPermissionin interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageId- Id of the wiki page.- Returns:
- The wiki page.
- Throws:
WikiException- if an error occured if an error occured
-
getParentPageOf
public Page getParentPageOf(Page page) throws WikiException
Description copied from interface:WikiServiceGet parent page of a wiki page- Specified by:
getParentPageOfin interfaceWikiService- Parameters:
page- Wiki page.- Returns:
- The list of children pages
- Throws:
WikiException- if an error occured
-
getChildrenPageOf
public List<Page> getChildrenPageOf(Page page, String userId, boolean withDrafts) throws WikiException
Description copied from interface:WikiServiceGet all the children pages of a wiki page- Specified by:
getChildrenPageOfin interfaceWikiService- Parameters:
page- Wiki page.withDrafts- if set to true returns the children notes and draft notes- Returns:
- The list of children pages
- Throws:
WikiException- if an error occured
-
deletePage
public boolean deletePage(String wikiType, String wikiOwner, String pageName, String userId) throws WikiException
Description copied from interface:WikiServiceDeletes a wiki page.- Specified by:
deletePagein interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageName- Id of the wiki page.- Returns:
- "True" if deleting the wiki page is successful, or "false" if not.
- Throws:
WikiException- if an error occured if an error occured
-
renamePage
public boolean renamePage(String wikiType, String wikiOwner, String pageName, String newName, String newTitle) throws WikiException
Description copied from interface:WikiServiceRenames a wiki page.- Specified by:
renamePagein interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageName- Old name of the wiki page.newName- New name of the wiki page.newTitle- New title of the wiki page.- Returns:
- "True" if renaming the wiki page is successful, or "false" if not.
- Throws:
WikiException- if an error occured if an error occured
-
movePage
public boolean movePage(WikiPageParams currentLocationParams, WikiPageParams newLocationParams) throws WikiException
Description copied from interface:WikiServiceMove a wiki Page- Specified by:
movePagein interfaceWikiService- Parameters:
currentLocationParams- The current location of the wiki page.newLocationParams- The new location of the wiki page.- Returns:
- "True" if moving the wiki page is successful, or "false" if not.
- Throws:
WikiException- if an error occured if an error occured
-
getPageRenderedContent
public String getPageRenderedContent(Page page)
Description copied from interface:WikiServiceGet renderd content of a page- Specified by:
getPageRenderedContentin interfaceWikiService- Parameters:
page- The wiki page- Returns:
- The rendered content
-
addPageLink
public void addPageLink(WikiPageParams param, WikiPageParams entity)
Description copied from interface:WikiServiceAdd a link between 2 pages- Specified by:
addPageLinkin interfaceWikiService- Parameters:
param- First pageentity- Second page
-
invalidateCache
protected void invalidateCache(Page page)
-
invalidateAttachmentCache
protected void invalidateAttachmentCache(Page page)
-
invalidateCachesOfPageTree
protected void invalidateCachesOfPageTree(Page page, String userId) throws WikiException
Invalidate all caches of a page and all its descendants- Parameters:
page- root pageuserId-- Throws:
WikiException- if an error occured
-
getRelatedPage
public Page getRelatedPage(String wikiType, String wikiOwner, String pageId) throws WikiException
Description copied from interface:WikiServiceGets a related page of a wiki page which is specified by a given Id.- Specified by:
getRelatedPagein interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageId- Id of the wiki page.- Returns:
- The related wiki page.
- Throws:
WikiException- if an error occured if an error occured
-
isExisting
public boolean isExisting(String wikiType, String wikiOwner, String pageId) throws WikiException
Description copied from interface:WikiServiceChecks if a wiki page exists or not.- Specified by:
isExistingin interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageId- Id of the wiki page.- Returns:
- The returned value is "true" if the page exists, or "false" if not.
- Throws:
WikiException- if an error occured
-
search
public org.exoplatform.commons.utils.PageList<SearchResult> search(WikiSearchData data) throws WikiException
Description copied from interface:WikiServiceSearches in all wiki pages.- Specified by:
searchin interfaceWikiService- Parameters:
data- The data to search.- Returns:
- Search results.
- Throws:
WikiException- if an error occured if an error occured
-
getHelpSyntaxPage
public Page getHelpSyntaxPage(String syntaxId, boolean fullContent) throws WikiException
Description copied from interface:WikiServiceGets a Help wiki page based on a given syntax Id.- Specified by:
getHelpSyntaxPagein interfaceWikiService- Parameters:
syntaxId- Id of the syntax.fullContent- true to get the full help page content, false to get an excerpt- Returns:
- The Help wiki page.
- Throws:
WikiException- if an error occured
-
getEmotionIcons
public List<EmotionIcon> getEmotionIcons() throws WikiException
Description copied from interface:WikiServiceGets all the emotion icons- Specified by:
getEmotionIconsin interfaceWikiService- Returns:
- All the emotion icons
- Throws:
WikiException- if an error occured
-
getEmotionIconByName
public EmotionIcon getEmotionIconByName(String name) throws WikiException
Description copied from interface:WikiServiceGets an emotion icon by name- Specified by:
getEmotionIconByNamein interfaceWikiService- Parameters:
name- The name of the emotion icon- Returns:
- The emotion icon
- Throws:
WikiException- if an error occured
-
getDuplicatePages
public List<Page> getDuplicatePages(Page parentPage, Wiki targetWiki, List<Page> resultList, String userId) throws WikiException
Description copied from interface:WikiServiceChecks if a page and its children are duplicated with ones in the target Wiki or not, then gets a list of duplicated pages if any.- Specified by:
getDuplicatePagesin interfaceWikiService- Parameters:
parentPage- The page to check.targetWiki- The target Wiki to check.resultList- The list of duplicated wiki pages.- Returns:
- The list of duplicated wiki pages.
- 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:WikiServiceCheck if the identity has the given permission type on a wiki- Specified by:
hasPermissionOnWikiin interfaceWikiService- Parameters:
wiki- WikipermissionType- Permission type to checkuser- Identity of the user- Returns:
- true if the user has the given permission type on the wiki
- Throws:
WikiException- if an error occured
-
hasPermissionOnPage
public boolean hasPermissionOnPage(Page page, PermissionType permissionType, org.exoplatform.services.security.Identity user) throws WikiException
Description copied from interface:WikiServiceChecks if the given user has the permission on a page- Specified by:
hasPermissionOnPagein interfaceWikiService- Parameters:
page- the wiki page objectpermissionType- permission Typeuser- the userName- Returns:
- true if user has permissions
- Throws:
WikiException- if an error occured
-
canModifyPagePermission
public boolean canModifyPagePermission(Page currentPage, String currentUser) throws WikiException
Description copied from interface:WikiServiceCheck if the given user can update the page- Specified by:
canModifyPagePermissionin interfaceWikiService- Parameters:
currentPage- The page to updatecurrentUser- The user that needs to update the page- Returns:
- true if the user can update the page
- Throws:
WikiException- if an error occured
-
canPublicAndRetrictPage
public boolean canPublicAndRetrictPage(Page currentPage, String currentUser) throws WikiException
Description copied from interface:WikiServiceCheck if the given user can public or restrict the page- Specified by:
canPublicAndRetrictPagein interfaceWikiService- Parameters:
currentPage- page to checkcurrentUser- user to chck permissions- Returns:
- true if the current user has EditPage permission or admin page or admin space
- Throws:
WikiException- if an error occured
-
getVersionsOfPage
public List<PageVersion> getVersionsOfPage(Page page) throws WikiException
Description copied from interface:WikiServiceGets all the versions of the given page- Specified by:
getVersionsOfPagein interfaceWikiService- Parameters:
page- The wiki page- Returns:
- All the versions of the page
- Throws:
WikiException- if an error occured
-
getVersionOfPageByName
public PageVersion getVersionOfPageByName(String versionName, Page page) throws WikiException
Description copied from interface:WikiServiceGets a specific version by name of the given page- Specified by:
getVersionOfPageByNamein interfaceWikiService- Parameters:
versionName- The name of the versionpage- The wiki page- Returns:
- The version of the wiki page
- Throws:
WikiException- if an error occured
-
createVersionOfPage
public void createVersionOfPage(Page page) throws WikiException
Description copied from interface:WikiServiceCreates a version of a page. This method only tag the current page data as a new version, it does not update the page data- Specified by:
createVersionOfPagein interfaceWikiService- Parameters:
page- The wiki page- Throws:
WikiException- if an error occured
-
restoreVersionOfPage
public void restoreVersionOfPage(String versionName, Page page) throws WikiException
Description copied from interface:WikiServiceRestores a version of a page- Specified by:
restoreVersionOfPagein interfaceWikiService- Parameters:
versionName- The name of the version to restorepage- The wiki page- Throws:
WikiException- if an error occured
-
updatePage
public void updatePage(Page page, PageUpdateType updateType) throws WikiException
Description copied from interface:WikiServiceUpdate the given page. This does not automatically create a new version. If a new version must be created it should be explicitly done by calling createVersionOfPage(). The second parameter is the type of update done (title only, content only, both, move, ...).- Specified by:
updatePagein interfaceWikiService- Parameters:
page- Updated pageupdateType- Type of update- Throws:
WikiException- if an error occured
-
getPreviousNamesOfPage
public List<String> getPreviousNamesOfPage(Page page) throws WikiException
Description copied from interface:WikiServiceGet previous names of a page- Specified by:
getPreviousNamesOfPagein interfaceWikiService- Parameters:
page- The wiki page- Returns:
- List of all the previous names of the page
- Throws:
WikiException- if an error occured
-
createTemplatePage
public void createTemplatePage(Wiki wiki, Template template) throws WikiException
Template- Specified by:
createTemplatePagein interfaceWikiService- Parameters:
wiki- Wiki of the templatetemplate- The params object which is used for creating the new Wiki template.- Throws:
WikiException- if an error occured if an error occured
-
getTemplatePage
public Template getTemplatePage(WikiPageParams params, String templateId) throws WikiException
Description copied from interface:WikiServiceGets a Wiki template.- Specified by:
getTemplatePagein interfaceWikiService- Parameters:
params- The params object which is used for creating the Wiki template.templateId- Id of the wiki template.- Returns:
- The wiki template.
- Throws:
WikiException- if an error occured if an error occured
-
getTemplates
public Map<String,Template> getTemplates(WikiPageParams params) throws WikiException
Description copied from interface:WikiServiceGets a map of wiki templates based on a given params object.- Specified by:
getTemplatesin interfaceWikiService- Parameters:
params- The params object which is used for getting the wiki templates.- Returns:
- The map of wiki templates.
- Throws:
WikiException- if an error occured
-
searchTemplate
public List<TemplateSearchResult> searchTemplate(TemplateSearchData data) throws WikiException
Description copied from interface:WikiServiceSearches in all templates.- Specified by:
searchTemplatein interfaceWikiService- Parameters:
data- The data to search.- Returns:
- Search results.
- Throws:
WikiException- if an error occured if an error occured
-
updateTemplate
public void updateTemplate(Template template) throws WikiException
Description copied from interface:WikiServiceModifies an existing wiki template.- Specified by:
updateTemplatein interfaceWikiService- Parameters:
template- The updated wiki template.- Throws:
WikiException- if an error occured
-
deleteTemplatePage
public void deleteTemplatePage(String wikiType, String wikiOwner, String templateName) throws WikiException
Description copied from interface:WikiServiceDeletes a Wiki template.- Specified by:
deleteTemplatePagein interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.templateName- Name of the Wiki template.- Throws:
WikiException- if an error occured if an error occured
-
addRelatedPage
public void addRelatedPage(WikiPageParams orginaryPageParams, WikiPageParams relatedPageParams) throws WikiException
Description copied from interface:WikiServiceAdds a related page to the current wiki page.- Specified by:
addRelatedPagein interfaceWikiService- Parameters:
orginaryPageParams- The params object of the current wiki page.relatedPageParams- The params object of the related page.- Throws:
WikiException- if an error occured
-
getRelatedPagesOfPage
public List<Page> getRelatedPagesOfPage(Page page) throws WikiException
Description copied from interface:WikiServiceGets a list of related pages based on a given param.- Specified by:
getRelatedPagesOfPagein interfaceWikiService- Parameters:
page- The wiki page.- Returns:
- The list of related pages.
- Throws:
WikiException- if an error occured
-
removeRelatedPage
public void removeRelatedPage(WikiPageParams orginaryPageParams, WikiPageParams relatedPageParams) throws WikiException
Description copied from interface:WikiServiceRemoves a related page of the current wiki page.- Specified by:
removeRelatedPagein interfaceWikiService- Parameters:
orginaryPageParams- The params object of the current wiki page.relatedPageParams- The params object of the related page.- Throws:
WikiException- if an error occured
-
getExsitedOrNewDraftPageById
public Page getExsitedOrNewDraftPageById(String wikiType, String wikiOwner, String pageId) throws WikiException
Draft- Specified by:
getExsitedOrNewDraftPageByIdin interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageId- Id of the wiki page.- Returns:
- The wiki page or its draft.
- Throws:
WikiException- if an error occured if an error occured
-
createDraftForNewPage
public DraftPage createDraftForNewPage(DraftPage draftPage, Page parentPage, long clientTime) throws WikiException
Description copied from interface:WikiServiceCreates a draft page for a new wiki page whose parent is specified by a given param object.- Specified by:
createDraftForNewPagein interfaceWikiService- Parameters:
draftPage- The draft objectparentPage- The parent wiki page.clientTime- The time of client when the draft page is saved.- Returns:
- The draft page.
- Throws:
WikiException- if an error occured if the draft page cannot be created.
-
createDraftForExistPage
public DraftPage createDraftForExistPage(DraftPage draftPage, Page targetPage, String revision, long clientTime) throws WikiException
Description copied from interface:WikiServiceCreates a draft page for a wiki page which is specified by a given param object.- Specified by:
createDraftForExistPagein interfaceWikiService- Parameters:
draftPage- The draft objecttargetPage- The target wiki page.revision- The revision which is used for creating the draft page. If "null", this will be the last revision.clientTime- The time of client when the draft page is saved.- Returns:
- The draft page.
- Throws:
WikiException- if an error occured if the draft page cannot be created.
-
getDraftOfPage
public DraftPage getDraftOfPage(Page page) throws WikiException
Description copied from interface:WikiServiceGets a draft page of a wiki page which is specified by a given param object.- Specified by:
getDraftOfPagein interfaceWikiService- Parameters:
page- The wiki page.- Returns:
- The draft page, or "null" if the draft page does not exist.
- Throws:
WikiException- if an error occured
-
getLastestDraft
public DraftPage getLastestDraft() throws WikiException
Description copied from interface:WikiServiceGets the last created draft of a wiki page.- Specified by:
getLastestDraftin interfaceWikiService- Returns:
- The last draft.
- Throws:
WikiException- if an error occured
-
getDraft
public DraftPage getDraft(String draftName) throws WikiException
Description copied from interface:WikiServiceGets a draft page by its name.- Specified by:
getDraftin interfaceWikiService- Parameters:
draftName- Name of the draft page.- Returns:
- The draft page, or "null" if it does not exist.
- Throws:
WikiException- if an error occured
-
removeDraftOfPage
public void removeDraftOfPage(WikiPageParams param) throws WikiException
Description copied from interface:WikiServiceRemoves a draft page of a wiki page which is specified by the wiki page param.- Specified by:
removeDraftOfPagein interfaceWikiService- Parameters:
param- The param object of the wiki page param.- Throws:
WikiException- if an error occured
-
removeDraft
public void removeDraft(String draftName) throws WikiException
Description copied from interface:WikiServiceRemoves a draft page by its name.- Specified by:
removeDraftin interfaceWikiService- Parameters:
draftName- Name of the draft page.- Throws:
WikiException- if an error occured
-
getDraftsOfUser
public List<DraftPage> getDraftsOfUser(String username) throws WikiException
Description copied from interface:WikiServiceGets a list of draft pages belonging to a given user.- Specified by:
getDraftsOfUserin interfaceWikiService- Parameters:
username- Name of the user.- Returns:
- The list of draft pages.
- Throws:
WikiException- if an error occured
-
isDraftOutDated
public boolean isDraftOutDated(DraftPage draftPage) throws WikiException
Description copied from interface:WikiServiceCheck if a draft page is outdated- Specified by:
isDraftOutDatedin interfaceWikiService- Parameters:
draftPage- the draft page object- Returns:
- true if the draft is outdated
- Throws:
WikiException- if an error occured
-
getDraftChanges
public org.exoplatform.commons.diff.DiffResult getDraftChanges(DraftPage draftPage) throws WikiException
Description copied from interface:WikiServiceGets the changes between the draft page and the target page- Specified by:
getDraftChangesin interfaceWikiService- Parameters:
draftPage- the draft page object- Returns:
- list of changes
- Throws:
WikiException- if an error occured
-
getAttachmentsOfPage
public List<Attachment> getAttachmentsOfPage(Page page) throws WikiException
Attachment- Specified by:
getAttachmentsOfPagein interfaceWikiService- 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:WikiServiceGets attachments of the given page, and allow to load their attachment content by setting loadContent to true- Specified by:
getAttachmentsOfPagein interfaceWikiService- Parameters:
page- The wiki pageloadContent- 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:WikiServiceGet the number of attachment of the given page- Specified by:
getNbOfAttachmentsOfPagein interfaceWikiService- 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:WikiServiceGet a attachment of a the given page by name, without loading its content- Specified by:
getAttachmentOfPageByNamein interfaceWikiService- Parameters:
attachmentName- The name of the attachmentpage- 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:WikiServiceGet a attachment of a the given page by name, and allow to load the attachment content by setting loadContent to true- Specified by:
getAttachmentOfPageByNamein interfaceWikiService- Parameters:
attachmentName- The name of the attachmentpage- The wiki pageloadContent- 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:WikiServiceAdd the given attachment to the given page- Specified by:
addAttachmentToPagein interfaceWikiService- Parameters:
attachment- The attachment to addpage- 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:WikiServiceDeletes the given attachment of the given page- Specified by:
deleteAttachmentOfPagein interfaceWikiService- Parameters:
attachmentId- Id of the attachmentpage- The wiki page- Throws:
WikiException- if an error occured
-
getWatchersOfPage
public List<String> getWatchersOfPage(Page page) throws WikiException
Watch- Specified by:
getWatchersOfPagein interfaceWikiService- Parameters:
page- The wiki page- Returns:
- liste of watchers
- Throws:
WikiException- if an error occured
-
addWatcherToPage
public void addWatcherToPage(String username, Page page) throws WikiException
Description copied from interface:WikiServiceAdd the given user as watcher of the wiki page- Specified by:
addWatcherToPagein interfaceWikiService- Parameters:
username- Username of the user to add as watcherpage- The wiki page- Throws:
WikiException- if an error occured
-
deleteWatcherOfPage
public void deleteWatcherOfPage(String username, Page page) throws WikiException
Description copied from interface:WikiServiceDelete a user as watcher of the given page- Specified by:
deleteWatcherOfPagein interfaceWikiService- Parameters:
username- Username of the user to delete as watcherpage- The wiki page- Throws:
WikiException- if an error occured
-
searchSpaces
public List<SpaceBean> searchSpaces(String keyword) throws WikiException
Spaces- Specified by:
searchSpacesin interfaceWikiService- 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:WikiServiceChecks if the current user has the admin permission on a space or not.- Specified by:
hasAdminSpacePermissionin interfaceWikiService- 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:WikiServiceGets a space name by a given group Id.- Specified by:
getSpaceNameByGroupIdin interfaceWikiService- 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
-
getBreadcumb
public List<BreadcrumbData> getBreadcumb(String wikiType, String wikiOwner, String pageId) throws WikiException
Description copied from interface:WikiServiceGets a list of data which is used for composing the breadcrumb.- Specified by:
getBreadcumbin interfaceWikiService- Parameters:
wikiType- It can be Portal, Group, or User.wikiOwner- The Wiki owner.pageId- Id of the wiki page to which the breadcrumb points.- Returns:
- The list of data.
- Throws:
WikiException- if an error occured if an error occured
-
getWikiPageParams
public WikiPageParams getWikiPageParams(BreadcrumbData data)
Description copied from interface:WikiServiceGets parameters of a wiki page based on the data stored in the breadcrumb.- Specified by:
getWikiPageParamsin interfaceWikiService- 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:WikiServiceChecks if the current user has the admin permission on a wiki page.- Specified by:
hasAdminPagePermissionin interfaceWikiService- 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
-
createEmotionIcon
public void createEmotionIcon(EmotionIcon emotionIcon) throws WikiException
Description copied from interface:WikiServiceCreates a emotion icon- Specified by:
createEmotionIconin interfaceWikiService- Parameters:
emotionIcon- The emotion icon to add- Throws:
WikiException- if an error occured
-
getUploadLimit
public int getUploadLimit()
- Specified by:
getUploadLimitin interfaceWikiService- Returns:
- Upload limit for Wiki Attachment
-
getPagesOfWiki
public List<Page> getPagesOfWiki(String wikiType, String wikiOwner)
Description copied from interface:WikiServiceRetrieve the all pages contained in wiki- Specified by:
getPagesOfWikiin interfaceWikiService- Parameters:
wikiType- the wiki typewikiOwner- the wiki owner- Returns:
- List of pages
-
-