Package org.exoplatform.wiki.jpa
Class JPADataStorage
- java.lang.Object
-
- org.exoplatform.wiki.jpa.JPADataStorage
-
- All Implemented Interfaces:
DataStorage
public class JPADataStorage extends Object implements DataStorage
Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com 9/8/15
-
-
Field Summary
Fields Modifier and Type Field Description static StringWIKI_FILES_NAMESPACE_DESCRIPTIONstatic StringWIKI_FILES_NAMESPACE_NAMEstatic StringWIKI_TYPE_DRAFT
-
Constructor Summary
Constructors Constructor Description JPADataStorage(WikiDAO wikiDAO, PageDAO pageDAO, PageAttachmentDAO pageAttachmentDAO, DraftPageAttachmentDAO draftPageAttachmentDAO, DraftPageDAO draftPageDAO, PageVersionDAO pageVersionDAO, PageMoveDAO pageMoveDAO, TemplateDAO templateDAO, EmotionIconDAO emotionIconDAO, org.exoplatform.commons.api.persistence.DataInitializer dataInitializer, org.exoplatform.commons.file.services.FileService fileService, org.exoplatform.portal.config.UserACL userACL)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAttachmentToPage(Attachment attachment, Page page)voidaddPageVersion(Page page, String userName)voidaddRelatedPage(Page page, Page relatedPage)voidaddWatcherToPage(String username, Page page)DraftPagecreateDraftPageForUser(DraftPage draftPage, String username)Creates a new draft notevoidcreateEmotionIcon(EmotionIcon emotionIcon)PagecreatePage(Wiki wiki, Page parentPage, Page page)voidcreateTemplatePage(Wiki wiki, Template template)WikicreateWiki(Wiki wiki)voiddeleteAttachmentOfPage(String attachmentName, Page page)voiddeleteAttachmentsOfDraftPage(DraftPageEntity page)voiddeleteDraftByName(String draftPageName, String username)voiddeleteDraftOfPage(Page page, String username)voiddeletePage(String wikiType, String wikiOwner, String pageName)voiddeleteTemplatePage(String wikiType, String wikiOwner, String templateName)voiddeleteWatcherOfPage(String username, Page page)PageEntityfetchPageEntity(Page page)Fecth Page Entity from a Page domain objectList<Attachment>getAttachmentsOfPage(Page page)List<Attachment>getAttachmentsOfPage(Page page, boolean loadContent)List<Page>getChildrenPageOf(Page page, String userId, boolean withDrafts)Get children notes and draft notes of pageDraftPagegetDraft(String draftName, String username)DraftPagegetDraft(WikiPageParams wikiPageParams, String username)DraftPagegetDraftPageById(String id)List<DraftPage>getDraftPagesOfUser(String username)EmotionIcongetEmotionIconByName(String emotionIconName)List<EmotionIcon>getEmotionIcons()PagegetExsitedOrNewDraftPageById(String wikiType, String wikiOwner, String pageName, String username)PagegetHelpSyntaxPage(String syntaxId, boolean fullContent, List<org.exoplatform.container.xml.ValuesParam> syntaxHelpParams, org.exoplatform.container.configuration.ConfigurationManager configurationManager)Deprecated.List<PageHistory>getHistoryOfPage(Page page)DraftPagegetLastestDraft(String username)DraftPagegetLatestDraftOfPage(Page targetPage, String username)Returns latest draft of given page.PagegetPageById(String id)Get a wiki page by its unique idPagegetPageOfWikiByName(String wikiType, String wikiOwner, String pageName)Get a wiki page by its unique name in the wikiList<Page>getPagesOfWiki(String wikiType, String wikiOwner)Retrieve the all pages contained in wikiPagegetParentPageOf(Page page)List<String>getPreviousNamesOfPage(Page page)PagegetRelatedPage(String wikiType, String wikiOwner, String pageName)List<Page>getRelatedPagesOfPage(Page page)TemplategetTemplatePage(WikiPageParams params, String templateName)Map<String,Template>getTemplates(WikiPageParams wikiPageParams)List<PageVersion>getVersionsOfPage(Page page)List<String>getWatchersOfPage(Page page)WikigetWikiByTypeAndOwner(String wikiType, String wikiOwner)List<PermissionEntry>getWikiPermission(String wikiType, String wikiOwner)List<Wiki>getWikisByType(String wikiType)booleanhasAdminPagePermission(String wikiType, String owner, org.exoplatform.services.security.Identity identity)booleanhasAdminSpacePermission(String wikiType, String owner, org.exoplatform.services.security.Identity identity)booleanhasChildren(long noteId)booleanhasPermissionOnPage(Page page, PermissionType permissionType, org.exoplatform.services.security.Identity identity)Check if the identity has the given permission type on a pagebooleanhasPermissionOnWiki(Wiki wiki, PermissionType permissionType, org.exoplatform.services.security.Identity identity)Check if the identity has the given permission type on a wikivoidmovePage(WikiPageParams currentLocationParams, WikiPageParams newLocationParams)voidremoveRelatedPage(Page page, Page relatedPage)voidrenamePage(String wikiType, String wikiOwner, String pageName, String newName, String newTitle)voidrestoreVersionOfPage(String versionName, Page page)org.exoplatform.commons.utils.PageList<SearchResult>search(WikiSearchData wikiSearchData)List<TemplateSearchResult>searchTemplate(TemplateSearchData templateSearchData)DraftPageupdateDraftPageForUser(DraftPage draftPage, String username)Updates a draft notePageupdatePage(Page page)voidupdateTemplatePage(Template template)voidupdateWikiPermission(String wikiType, String wikiOwner, List<PermissionEntry> permissionEntries)
-
-
-
Field Detail
-
WIKI_TYPE_DRAFT
public static final String WIKI_TYPE_DRAFT
- See Also:
- Constant Field Values
-
WIKI_FILES_NAMESPACE_NAME
public static final String WIKI_FILES_NAMESPACE_NAME
- See Also:
- Constant Field Values
-
WIKI_FILES_NAMESPACE_DESCRIPTION
public static final String WIKI_FILES_NAMESPACE_DESCRIPTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JPADataStorage
public JPADataStorage(WikiDAO wikiDAO, PageDAO pageDAO, PageAttachmentDAO pageAttachmentDAO, DraftPageAttachmentDAO draftPageAttachmentDAO, DraftPageDAO draftPageDAO, PageVersionDAO pageVersionDAO, PageMoveDAO pageMoveDAO, TemplateDAO templateDAO, EmotionIconDAO emotionIconDAO, org.exoplatform.commons.api.persistence.DataInitializer dataInitializer, org.exoplatform.commons.file.services.FileService fileService, org.exoplatform.portal.config.UserACL userACL)
-
-
Method Detail
-
search
public org.exoplatform.commons.utils.PageList<SearchResult> search(WikiSearchData wikiSearchData)
- Specified by:
searchin interfaceDataStorage
-
getWikiByTypeAndOwner
public Wiki getWikiByTypeAndOwner(String wikiType, String wikiOwner) throws WikiException
- Specified by:
getWikiByTypeAndOwnerin interfaceDataStorage- Throws:
WikiException
-
getWikisByType
public List<Wiki> getWikisByType(String wikiType) throws WikiException
- Specified by:
getWikisByTypein interfaceDataStorage- Throws:
WikiException
-
createWiki
public Wiki createWiki(Wiki wiki) throws WikiException
- Specified by:
createWikiin interfaceDataStorage- Throws:
WikiException
-
createPage
public Page createPage(Wiki wiki, Page parentPage, Page page) throws WikiException
- Specified by:
createPagein interfaceDataStorage- Throws:
WikiException
-
getPageOfWikiByName
public Page getPageOfWikiByName(String wikiType, String wikiOwner, String pageName) throws WikiException
Description copied from interface:DataStorageGet a wiki page by its unique name in the wiki- Specified by:
getPageOfWikiByNamein interfaceDataStorage- Parameters:
wikiType- The wiki typewikiOwner- The wiki ownerpageName- The unique name of the page in the wiki- Returns:
- The wiki page
- Throws:
WikiException- if an error occured
-
getPageById
public Page getPageById(String id) throws WikiException
Description copied from interface:DataStorageGet a wiki page by its unique id- Specified by:
getPageByIdin interfaceDataStorage- Parameters:
id- The unique id of wiki page- Returns:
- The wiki page
- Throws:
WikiException- if an error occured
-
getDraftPageById
public DraftPage getDraftPageById(String id) throws WikiException
- Specified by:
getDraftPageByIdin interfaceDataStorage- Throws:
WikiException
-
getParentPageOf
public Page getParentPageOf(Page page) throws WikiException
- Specified by:
getParentPageOfin interfaceDataStorage- Throws:
WikiException
-
getChildrenPageOf
public List<Page> getChildrenPageOf(Page page, String userId, boolean withDrafts) throws WikiException
Description copied from interface:DataStorageGet children notes and draft notes of page- Specified by:
getChildrenPageOfin interfaceDataStorage- Parameters:
page- the target page to retrieve its childrenwithDrafts- if set to true returns the children notes and draft notes- Returns:
- children notes of page
- Throws:
WikiException
-
hasChildren
public boolean hasChildren(long noteId) throws WikiException- Specified by:
hasChildrenin interfaceDataStorage- Throws:
WikiException
-
deletePage
public void deletePage(String wikiType, String wikiOwner, String pageName) throws WikiException
- Specified by:
deletePagein interfaceDataStorage- Throws:
WikiException
-
createTemplatePage
public void createTemplatePage(Wiki wiki, Template template) throws WikiException
- Specified by:
createTemplatePagein interfaceDataStorage- Throws:
WikiException
-
updateTemplatePage
public void updateTemplatePage(Template template) throws WikiException
- Specified by:
updateTemplatePagein interfaceDataStorage- Throws:
WikiException
-
deleteTemplatePage
public void deleteTemplatePage(String wikiType, String wikiOwner, String templateName) throws WikiException
- Specified by:
deleteTemplatePagein interfaceDataStorage- Throws:
WikiException
-
getTemplatePage
public Template getTemplatePage(WikiPageParams params, String templateName) throws WikiException
- Specified by:
getTemplatePagein interfaceDataStorage- Throws:
WikiException
-
getTemplates
public Map<String,Template> getTemplates(WikiPageParams wikiPageParams) throws WikiException
- Specified by:
getTemplatesin interfaceDataStorage- Throws:
WikiException
-
deleteDraftOfPage
public void deleteDraftOfPage(Page page, String username) throws WikiException
- Specified by:
deleteDraftOfPagein interfaceDataStorage- Throws:
WikiException
-
deleteDraftByName
public void deleteDraftByName(String draftPageName, String username) throws WikiException
- Specified by:
deleteDraftByNamein interfaceDataStorage- Throws:
WikiException
-
renamePage
public void renamePage(String wikiType, String wikiOwner, String pageName, String newName, String newTitle) throws WikiException
- Specified by:
renamePagein interfaceDataStorage- Throws:
WikiException
-
movePage
public void movePage(WikiPageParams currentLocationParams, WikiPageParams newLocationParams) throws WikiException
- Specified by:
movePagein interfaceDataStorage- Throws:
WikiException
-
getWikiPermission
public List<PermissionEntry> getWikiPermission(String wikiType, String wikiOwner) throws WikiException
- Specified by:
getWikiPermissionin interfaceDataStorage- Throws:
WikiException
-
updateWikiPermission
public void updateWikiPermission(String wikiType, String wikiOwner, List<PermissionEntry> permissionEntries) throws WikiException
- Specified by:
updateWikiPermissionin interfaceDataStorage- Throws:
WikiException
-
getRelatedPagesOfPage
public List<Page> getRelatedPagesOfPage(Page page) throws WikiException
- Specified by:
getRelatedPagesOfPagein interfaceDataStorage- Throws:
WikiException
-
getRelatedPage
public Page getRelatedPage(String wikiType, String wikiOwner, String pageName) throws WikiException
- Specified by:
getRelatedPagein interfaceDataStorage- Throws:
WikiException
-
addRelatedPage
public void addRelatedPage(Page page, Page relatedPage) throws WikiException
- Specified by:
addRelatedPagein interfaceDataStorage- Throws:
WikiException
-
getPagesOfWiki
public List<Page> getPagesOfWiki(String wikiType, String wikiOwner)
Description copied from interface:DataStorageRetrieve the all pages contained in wiki- Specified by:
getPagesOfWikiin interfaceDataStorage- Parameters:
wikiType- the wiki typewikiOwner- the wiki owner- Returns:
- the List pf pages of the wiki
-
removeRelatedPage
public void removeRelatedPage(Page page, Page relatedPage) throws WikiException
- Specified by:
removeRelatedPagein interfaceDataStorage- Throws:
WikiException
-
getExsitedOrNewDraftPageById
public Page getExsitedOrNewDraftPageById(String wikiType, String wikiOwner, String pageName, String username) throws WikiException
- Specified by:
getExsitedOrNewDraftPageByIdin interfaceDataStorage- Throws:
WikiException
-
getDraft
public DraftPage getDraft(WikiPageParams wikiPageParams, String username) throws WikiException
- Specified by:
getDraftin interfaceDataStorage- Throws:
WikiException
-
getLastestDraft
public DraftPage getLastestDraft(String username) throws WikiException
- Specified by:
getLastestDraftin interfaceDataStorage- Throws:
WikiException
-
getLatestDraftOfPage
public DraftPage getLatestDraftOfPage(Page targetPage, String username)
Description copied from interface:DataStorageReturns latest draft of given page.- Specified by:
getLatestDraftOfPagein interfaceDataStorage- Returns:
-
getDraft
public DraftPage getDraft(String draftName, String username) throws WikiException
- Specified by:
getDraftin interfaceDataStorage- Throws:
WikiException
-
getDraftPagesOfUser
public List<DraftPage> getDraftPagesOfUser(String username) throws WikiException
- Specified by:
getDraftPagesOfUserin interfaceDataStorage- Throws:
WikiException
-
createDraftPageForUser
public DraftPage createDraftPageForUser(DraftPage draftPage, String username) throws WikiException
Description copied from interface:DataStorageCreates a new draft note- Specified by:
createDraftPageForUserin interfaceDataStorage- Parameters:
draftPage- The draft note to be createdusername- Author name- Returns:
- Created draft note
- Throws:
WikiException
-
updateDraftPageForUser
public DraftPage updateDraftPageForUser(DraftPage draftPage, String username) throws WikiException
Description copied from interface:DataStorageUpdates a draft note- Specified by:
updateDraftPageForUserin interfaceDataStorage- Parameters:
draftPage- The draft note to be updated- Returns:
- Updated draft note
- Throws:
WikiException
-
searchTemplate
public List<TemplateSearchResult> searchTemplate(TemplateSearchData templateSearchData) throws WikiException
- Specified by:
searchTemplatein interfaceDataStorage- Throws:
WikiException
-
getAttachmentsOfPage
public List<Attachment> getAttachmentsOfPage(Page page) throws WikiException
- Specified by:
getAttachmentsOfPagein interfaceDataStorage- Throws:
WikiException
-
getAttachmentsOfPage
public List<Attachment> getAttachmentsOfPage(Page page, boolean loadContent) throws WikiException
- Specified by:
getAttachmentsOfPagein interfaceDataStorage- Throws:
WikiException
-
addAttachmentToPage
public void addAttachmentToPage(Attachment attachment, Page page) throws WikiException
- Specified by:
addAttachmentToPagein interfaceDataStorage- Throws:
WikiException
-
deleteAttachmentOfPage
public void deleteAttachmentOfPage(String attachmentName, Page page) throws WikiException
- Specified by:
deleteAttachmentOfPagein interfaceDataStorage- Throws:
WikiException
-
getHelpSyntaxPage
@Deprecated public Page getHelpSyntaxPage(String syntaxId, boolean fullContent, List<org.exoplatform.container.xml.ValuesParam> syntaxHelpParams, org.exoplatform.container.configuration.ConfigurationManager configurationManager) throws WikiException
Deprecated.- Specified by:
getHelpSyntaxPagein interfaceDataStorage- Throws:
WikiException
-
createEmotionIcon
public void createEmotionIcon(EmotionIcon emotionIcon) throws WikiException
- Specified by:
createEmotionIconin interfaceDataStorage- Throws:
WikiException
-
getEmotionIcons
public List<EmotionIcon> getEmotionIcons() throws WikiException
- Specified by:
getEmotionIconsin interfaceDataStorage- Throws:
WikiException
-
getEmotionIconByName
public EmotionIcon getEmotionIconByName(String emotionIconName) throws WikiException
- Specified by:
getEmotionIconByNamein interfaceDataStorage- Throws:
WikiException
-
hasPermissionOnPage
public boolean hasPermissionOnPage(Page page, PermissionType permissionType, org.exoplatform.services.security.Identity identity) throws WikiException
Description copied from interface:DataStorageCheck if the identity has the given permission type on a page- Specified by:
hasPermissionOnPagein interfaceDataStorage- Parameters:
page- PagepermissionType- Permission type to checkidentity- Identity of the user- Returns:
- true if the user has the given permission type on the page
- Throws:
WikiException- if an error occured
-
hasPermissionOnWiki
public boolean hasPermissionOnWiki(Wiki wiki, PermissionType permissionType, org.exoplatform.services.security.Identity identity) throws WikiException
Description copied from interface:DataStorageCheck if the identity has the given permission type on a wiki- Specified by:
hasPermissionOnWikiin interfaceDataStorage- Parameters:
wiki- WikipermissionType- Permission type to checkidentity- Identity of the user- Returns:
- true if the user has the given permission type on the wiki
- Throws:
WikiException- if an error occured
-
hasAdminSpacePermission
public boolean hasAdminSpacePermission(String wikiType, String owner, org.exoplatform.services.security.Identity identity) throws WikiException
- Specified by:
hasAdminSpacePermissionin interfaceDataStorage- Throws:
WikiException
-
hasAdminPagePermission
public boolean hasAdminPagePermission(String wikiType, String owner, org.exoplatform.services.security.Identity identity) throws WikiException
- Specified by:
hasAdminPagePermissionin interfaceDataStorage- Throws:
WikiException
-
getVersionsOfPage
public List<PageVersion> getVersionsOfPage(Page page) throws WikiException
- Specified by:
getVersionsOfPagein interfaceDataStorage- Throws:
WikiException
-
getHistoryOfPage
public List<PageHistory> getHistoryOfPage(Page page) throws WikiException
- Specified by:
getHistoryOfPagein interfaceDataStorage- Throws:
WikiException
-
addPageVersion
public void addPageVersion(Page page, String userName) throws WikiException
- Specified by:
addPageVersionin interfaceDataStorage- Throws:
WikiException
-
restoreVersionOfPage
public void restoreVersionOfPage(String versionName, Page page) throws WikiException
- Specified by:
restoreVersionOfPagein interfaceDataStorage- Throws:
WikiException
-
updatePage
public Page updatePage(Page page) throws WikiException
- Specified by:
updatePagein interfaceDataStorage- Throws:
WikiException
-
getPreviousNamesOfPage
public List<String> getPreviousNamesOfPage(Page page) throws WikiException
- Specified by:
getPreviousNamesOfPagein interfaceDataStorage- Throws:
WikiException
-
getWatchersOfPage
public List<String> getWatchersOfPage(Page page) throws WikiException
- Specified by:
getWatchersOfPagein interfaceDataStorage- Throws:
WikiException
-
addWatcherToPage
public void addWatcherToPage(String username, Page page) throws WikiException
- Specified by:
addWatcherToPagein interfaceDataStorage- Throws:
WikiException
-
deleteWatcherOfPage
public void deleteWatcherOfPage(String username, Page page) throws WikiException
- Specified by:
deleteWatcherOfPagein interfaceDataStorage- Throws:
WikiException
-
deleteAttachmentsOfDraftPage
public void deleteAttachmentsOfDraftPage(DraftPageEntity page) throws WikiException
- Throws:
WikiException
-
fetchPageEntity
public PageEntity fetchPageEntity(Page page)
Fecth Page Entity from a Page domain object- Parameters:
page- The page domain object- Returns:
- The page entity
-
-