Package org.exoplatform.wiki.jpa
Class JPADataStorage
java.lang.Object
org.exoplatform.wiki.jpa.JPADataStorage
- All Implemented Interfaces:
DataStorage
Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com
9/8/15
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJPADataStorage(WikiDAO wikiDAO, PageDAO pageDAO, PageAttachmentDAO pageAttachmentDAO, DraftPageAttachmentDAO draftPageAttachmentDAO, DraftPageDAO draftPageDAO, PageVersionDAO pageVersionDAO, PageMoveDAO pageMoveDAO, TemplateDAO templateDAO, org.exoplatform.commons.file.services.FileService fileService, org.exoplatform.portal.config.UserACL userACL) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachmentToPage(Attachment attachment, Page page) addPageVersion(Page page, String userName) Creates a new page versionvoidaddRelatedPage(Page page, Page relatedPage) voidaddWatcherToPage(String username, Page page) createDraftPageForUser(DraftPage draftPage, String username) Creates a new draft notecreatePage(Wiki wiki, Page parentPage, Page page) createWiki(Wiki wiki) voiddeleteAttachmentOfPage(String attachmentName, Page page) voidvoiddeleteAttachmentsOfDraftPage(DraftPage draftPage) Delete attachments of target draft pagevoidDeletes a draft note by its technical id.voiddeleteDraftByName(String draftPageName) voiddeleteDraftOfPage(Page page) voiddeleteDraftOfPage(Page page, String lang) voiddeleteOrphanDraftPagesByParentPage(long parentPageId) Remove all children drafts of a parent page without existing targetvoiddeletePage(String wikiType, String wikiOwner, String pageName) voiddeleteVersionsByNoteIdAndLang(Long noteId, String lang) Deletes a list of versions of note by language.voiddeleteWatcherOfPage(String username, Page page) fetchPageEntity(Page page) Fecth Page Entity from a Page domain objectgetAttachmentsOfPage(Page page) getAttachmentsOfPage(Page page, boolean loadContent) getChildrenPageOf(Page page, boolean withDrafts, boolean withChild) Get children notes and draft notes of pagegetDraft(WikiPageParams wikiPageParams) getDraftOfPageByLang(Page page, String lang) getDraftsOfPage(Long pageId) getDraftsOfWiki(String wikiOwner, String wikiType) Gets draft pages of a given wikigetExsitedOrNewDraftPageById(String wikiType, String wikiOwner, String pageName, String username) getHelpSyntaxPage(String syntaxId, boolean fullContent, List<org.exoplatform.container.xml.ValuesParam> syntaxHelpParams, org.exoplatform.container.configuration.ConfigurationManager configurationManager) Deprecated.getHistoryOfPage(Page page) getLatestDraftOfPage(Page targetPage) Returns latest draft of given page.getLatestDraftPageByTargetPageAndLang(Long targetPageId, String lang) Retrieves latest draft of a specific page by target page id and content languageRetrieves list of available translations languages of a pagegetPageById(String id) Get a wiki page by its unique idgetPageHistoryVersionsByPageIdAndLang(Long pageId, String lang) Retrieves list of page versions by page id and langgetPageOfWikiByName(String wikiType, String wikiOwner, String pageName) Get a wiki page by its unique name in the wikigetPagesOfWiki(String wikiType, String wikiOwner) Retrieve the all pages contained in wikigetPageVersionById(long versionId) Gets page version by its given idgetParentPageOf(Page page) getPreviousNamesOfPage(Page page) getPublishedVersionByPageIdAndLang(Long pageId, String lang) Retrieves the published note page version by its id and content languagegetRelatedPage(String wikiType, String wikiOwner, String pageName) getRelatedPagesOfPage(Page page) getVersionsOfPage(Page page) getWatchersOfPage(Page page) getWikiByTypeAndOwner(String wikiType, String wikiOwner) getWikiPermission(String wikiType, String wikiOwner) 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) Check if the given note page has children or notbooleanhasDrafts(long noteId) Check if the given note page has drafts or notbooleanhasPermissionOnPage(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) voidrestoreVersionOfPage(String versionName, Page page) Restore a note from given versionorg.exoplatform.commons.utils.PageList<SearchResult> search(WikiSearchData wikiSearchData) searchTemplate(TemplateSearchData templateSearchData) updateDraftPageForUser(DraftPage draftPage, String username) Updates a draft noteupdatePage(Page page) voidupdateWikiPermission(String wikiType, String wikiOwner, List<PermissionEntry> permissionEntries)
-
Field Details
-
WIKI_TYPE_DRAFT
- See Also:
-
WIKI_FILES_NAMESPACE_NAME
- See Also:
-
WIKI_FILES_NAMESPACE_DESCRIPTION
- See Also:
-
-
Constructor Details
-
JPADataStorage
public JPADataStorage(WikiDAO wikiDAO, PageDAO pageDAO, PageAttachmentDAO pageAttachmentDAO, DraftPageAttachmentDAO draftPageAttachmentDAO, DraftPageDAO draftPageDAO, PageVersionDAO pageVersionDAO, PageMoveDAO pageMoveDAO, TemplateDAO templateDAO, org.exoplatform.commons.file.services.FileService fileService, org.exoplatform.portal.config.UserACL userACL)
-
-
Method Details
-
search
- Specified by:
searchin interfaceDataStorage
-
getWikiByTypeAndOwner
- Specified by:
getWikiByTypeAndOwnerin interfaceDataStorage- Throws:
WikiException
-
getWikisByType
- Specified by:
getWikisByTypein interfaceDataStorage- Throws:
WikiException
-
createWiki
- Specified by:
createWikiin interfaceDataStorage- Throws:
WikiException
-
createPage
- 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
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
- Specified by:
getDraftPageByIdin interfaceDataStorage- Throws:
WikiException
-
getParentPageOf
- Specified by:
getParentPageOfin interfaceDataStorage- Throws:
WikiException
-
getChildrenPageOf
public List<Page> getChildrenPageOf(Page page, boolean withDrafts, boolean withChild) 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,withChild- Check if note has child- Returns:
- children notes of page
- Throws:
WikiException
-
hasChildren
public boolean hasChildren(long noteId) Description copied from interface:DataStorageCheck if the given note page has children or not- Specified by:
hasChildrenin interfaceDataStorage- Parameters:
noteId- note page id- Returns:
- true if the given note page has children and false if not
-
hasDrafts
public boolean hasDrafts(long noteId) Description copied from interface:DataStorageCheck if the given note page has drafts or not- Specified by:
hasDraftsin interfaceDataStorage- Parameters:
noteId- note page id- Returns:
- true if the given note page has drafts and false if not
-
deletePage
- Specified by:
deletePagein interfaceDataStorage- Throws:
WikiException
-
deleteDraftOfPage
- Specified by:
deleteDraftOfPagein interfaceDataStorage- Throws:
WikiException
-
deleteAttachmentsOfDraftPage
Description copied from interface:DataStorageDelete attachments of target draft page- Specified by:
deleteAttachmentsOfDraftPagein interfaceDataStorage- Parameters:
draftPage- target draft page
-
deleteDraftOfPage
- Specified by:
deleteDraftOfPagein interfaceDataStorage- Throws:
WikiException
-
deleteDraftByName
- Specified by:
deleteDraftByNamein interfaceDataStorage- Throws:
WikiException
-
deleteDraftById
Description copied from interface:DataStorageDeletes a draft note by its technical id.- Specified by:
deleteDraftByIdin interfaceDataStorage- Parameters:
id- Id of the draft note.- Throws:
WikiException- if an error occured
-
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
- Specified by:
getRelatedPagesOfPagein interfaceDataStorage- Throws:
WikiException
-
getRelatedPage
- Specified by:
getRelatedPagein interfaceDataStorage- Throws:
WikiException
-
addRelatedPage
- Specified by:
addRelatedPagein interfaceDataStorage- Throws:
WikiException
-
getPagesOfWiki
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
- 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
-
getDraftOfPageByLang
- Specified by:
getDraftOfPageByLangin interfaceDataStorage- Throws:
WikiException
-
getDraftsOfPage
- Specified by:
getDraftsOfPagein interfaceDataStorage
-
getDraft
- Specified by:
getDraftin interfaceDataStorage- Throws:
WikiException
-
getLatestDraftOfPage
Description copied from interface:DataStorageReturns latest draft of given page.- Specified by:
getLatestDraftOfPagein interfaceDataStorage- Parameters:
targetPage-- Returns:
- latest draft of the given target page
-
createDraftPageForUser
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
Description copied from interface:DataStorageUpdates a draft note- Specified by:
updateDraftPageForUserin interfaceDataStorage- Parameters:
draftPage- The draft note to be updatedusername-- Returns:
- Updated draft note
- Throws:
WikiException
-
searchTemplate
public List<TemplateSearchResult> searchTemplate(TemplateSearchData templateSearchData) throws WikiException - Specified by:
searchTemplatein interfaceDataStorage- Throws:
WikiException
-
getAttachmentsOfPage
- Specified by:
getAttachmentsOfPagein interfaceDataStorage- Throws:
WikiException
-
getAttachmentsOfPage
- Specified by:
getAttachmentsOfPagein interfaceDataStorage- Throws:
WikiException
-
addAttachmentToPage
- Specified by:
addAttachmentToPagein interfaceDataStorage- Throws:
WikiException
-
deleteAttachmentOfPage
- 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
-
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
- Specified by:
getVersionsOfPagein interfaceDataStorage- Throws:
WikiException
-
getHistoryOfPage
- Specified by:
getHistoryOfPagein interfaceDataStorage- Throws:
WikiException
-
addPageVersion
Description copied from interface:DataStorageCreates a new page version- Specified by:
addPageVersionin interfaceDataStorage- Parameters:
page- target note pageuserName- current username- Returns:
PageVersion- Throws:
WikiException
-
restoreVersionOfPage
Description copied from interface:DataStorageRestore a note from given version- Specified by:
restoreVersionOfPagein interfaceDataStorage- Parameters:
versionName- version namepage- target note page- Returns:
PageVersion- Throws:
WikiException
-
updatePage
- Specified by:
updatePagein interfaceDataStorage- Throws:
WikiException
-
getPreviousNamesOfPage
- Specified by:
getPreviousNamesOfPagein interfaceDataStorage- Throws:
WikiException
-
getWatchersOfPage
- Specified by:
getWatchersOfPagein interfaceDataStorage- Throws:
WikiException
-
addWatcherToPage
- Specified by:
addWatcherToPagein interfaceDataStorage- Throws:
WikiException
-
deleteWatcherOfPage
- Specified by:
deleteWatcherOfPagein interfaceDataStorage- Throws:
WikiException
-
deleteAttachmentsOfDraftPage
-
fetchPageEntity
Fecth Page Entity from a Page domain object- Parameters:
page- The page domain object- Returns:
- The page entity
-
getPageHistoryVersionsByPageIdAndLang
Retrieves list of page versions by page id and lang- Specified by:
getPageHistoryVersionsByPageIdAndLangin interfaceDataStorage- Parameters:
pageId- page idlang- content language- Returns:
ListofPageHistory
-
getLatestDraftPageByTargetPageAndLang
Retrieves latest draft of a specific page by target page id and content language- Specified by:
getLatestDraftPageByTargetPageAndLangin interfaceDataStorage- Parameters:
targetPageId- target page idlang- content language- Returns:
DraftPage
-
getPublishedVersionByPageIdAndLang
Retrieves the published note page version by its id and content language- Specified by:
getPublishedVersionByPageIdAndLangin interfaceDataStorage- Parameters:
pageId- page idlang- content language- Returns:
PageVersion
-
getPageAvailableTranslationLanguages
Retrieves list of available translations languages of a page- Specified by:
getPageAvailableTranslationLanguagesin interfaceDataStorage- Parameters:
pageId- page id- Returns:
ListofString
-
deleteVersionsByNoteIdAndLang
Deletes a list of versions of note by language.- Specified by:
deleteVersionsByNoteIdAndLangin interfaceDataStorage- Parameters:
noteId- Id of the note.lang- language.- Throws:
WikiException- if an error occured
-
deleteOrphanDraftPagesByParentPage
public void deleteOrphanDraftPagesByParentPage(long parentPageId) Remove all children drafts of a parent page without existing target- Specified by:
deleteOrphanDraftPagesByParentPagein interfaceDataStorage- Parameters:
parentPageId- Note parent page id
-
getPageVersionById
Gets page version by its given id- Specified by:
getPageVersionByIdin interfaceDataStorage- Parameters:
versionId- page version id- Returns:
PageVersion
-
getDraftsOfWiki
Gets draft pages of a given wiki- Specified by:
getDraftsOfWikiin interfaceDataStorage- Parameters:
wikiOwner- wiki ownerwikiType- wiki type- Returns:
ListofDraftPage
-