Class NoteServiceImpl

java.lang.Object
org.exoplatform.wiki.service.impl.NoteServiceImpl
All Implemented Interfaces:
NoteService

public class NoteServiceImpl extends Object implements NoteService
  • Field Details

  • Constructor Details

    • NoteServiceImpl

      public NoteServiceImpl(DataStorage dataStorage, org.exoplatform.services.cache.CacheService cacheService, WikiService wikiService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, io.meeds.social.cms.service.CMSService cmsService, org.exoplatform.services.listener.ListenerService listenerService, org.exoplatform.commons.file.services.FileService fileService, org.exoplatform.upload.UploadService uploadService, org.exoplatform.social.metadata.MetadataService metadataService, org.exoplatform.services.thumbnail.ImageThumbnailService imageThumbnailService, org.exoplatform.social.attachment.AttachmentService attachmentService)
  • Method Details

    • createNote

      public Page createNote(Wiki noteBook, String parentNoteName, Page note, org.exoplatform.services.security.Identity userIdentity, boolean importMode, boolean broadcast) throws WikiException, IllegalAccessException
      Create a new note in the given notebook, under the given parent note.
      Specified by:
      createNote in interface NoteService
      Parameters:
      noteBook - Notebook object.
      parentNoteName - parent note name.
      note - the note object to create.
      userIdentity - user Identity.
      importMode - true if the creation is without timestamp for import mode.
      broadcast - broadcast the note creation event if true
      Returns:
      The new note.
      Throws:
      WikiException - if an error occured
      IllegalAccessException - if the user don't have edit rights to the parent note
    • createNote

      public Page createNote(Wiki noteBook, String parentNoteName, Page note, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException
      Create a new note in the given notebook, under the given parent note.
      Specified by:
      createNote in interface NoteService
      Parameters:
      noteBook - Notebook object.
      parentNoteName - parent note name.
      note - the note object to create.
      userIdentity - user Identity.
      Returns:
      The new note.
      Throws:
      WikiException - if an error occured
      IllegalAccessException - if the user don't have edit rights to the parent note
    • createNote

      public Page createNote(Wiki noteBook, String parentNoteName, Page note, org.exoplatform.services.security.Identity userIdentity, boolean broadcast) throws WikiException, IllegalAccessException
      Description copied from interface: NoteService
      Create a new note in the given notebook, under the given parent note.
      Specified by:
      createNote in interface NoteService
      Parameters:
      noteBook - Notebook object.
      parentNoteName - parent note name.
      note - the note object to create.
      userIdentity - user Identity.
      broadcast - broadcast the note creation event if true.
      Returns:
      The new note.
      Throws:
      WikiException - if an error occured
      IllegalAccessException - if the user don't have edit rights to the parent note
    • createNote

      public Page createNote(Wiki noteBook, Page parentPage, Page note) throws WikiException
      Create a new note in the given notebook, under the given parent note.
      Specified by:
      createNote in interface NoteService
      Parameters:
      noteBook - Notebook object.
      parentPage - parent note.
      note - the note to create.
      Returns:
      The new note.
      Throws:
      WikiException - if an error occured
    • createNote

      public Page createNote(Wiki noteBook, Page parentPage, Page note, boolean broadcast) throws WikiException
      Create a new note in the given notebook, under the given parent note.
      Specified by:
      createNote in interface NoteService
      Parameters:
      noteBook - Notebook object.
      parentPage - parent note.
      note - the note to create.
      broadcast - broadcast the note creation event
      Returns:
      The new note.
      Throws:
      WikiException - if an error occured
    • updateNote

      public Page updateNote(Page note) throws WikiException
      Update the given note.
      Specified by:
      updateNote in interface NoteService
      Parameters:
      note - Updated note
      Returns:
      updated note
      Throws:
      WikiException - if an error occured
    • updateNote

      public Page updateNote(Page note, PageUpdateType type, org.exoplatform.services.security.Identity userIdentity) throws Exception
      Update the given note. This does not automatically create a new version. If a new version must be created it should be explicitly done by calling createVersionOfNote(). The second parameter is the type of update done (title only, content only, both, move, ...).
      Specified by:
      updateNote in interface NoteService
      Parameters:
      note - Updated note
      type - Type of update
      userIdentity - user Identity
      Returns:
      The updated note
      Throws:
      Exception
    • updateNote

      public Page updateNote(Page note, PageUpdateType type, org.exoplatform.services.security.Identity userIdentity, boolean broadcast) throws Exception
      Update the given note. This does not automatically create a new version. If a new version must be created it should be explicitly done by calling createVersionOfNote(). The second parameter is the type of update done (title only, content only, both, move, ...).
      Specified by:
      updateNote in interface NoteService
      Parameters:
      note - Updated note
      type - Type of update
      userIdentity - user Identity
      broadcast - broadcast the update note event if true
      Returns:
      The updated note
      Throws:
      Exception
    • updateNote

      public Page updateNote(Page note, PageUpdateType type) throws WikiException
      Update the given note. This does not automatically create a new version. If a new version must be created it should be explicitly done by calling createVersionOfNote(). The second parameter is the type of update done (title only, content only, both, move, ...).
      Specified by:
      updateNote in interface NoteService
      Parameters:
      note - Updated note
      type - Type of update
      Returns:
      The updated note
      Throws:
      WikiException
    • deleteNote

      public boolean deleteNote(String noteType, String noteOwner, String noteName) throws WikiException
      Deletes a note.
      Specified by:
      deleteNote in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The NoteBook owner.
      noteName - Id of the note.
      Returns:
      "True" if deleting the note is successful, or "false" if not.
      Throws:
      WikiException - if an error occured
    • deleteNote

      public boolean deleteNote(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, org.gatein.api.EntityNotFoundException
      Deletes a note.
      Specified by:
      deleteNote in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The NoteBook owner.
      noteName - Name of the note.
      userIdentity - User identity deleting the note.
      Returns:
      "True" if deleting the note is successful, or "false" if not.
      Throws:
      WikiException - if an error occured
      IllegalAccessException
      org.gatein.api.EntityNotFoundException
    • renameNote

      public boolean renameNote(String noteType, String noteOwner, String noteName, String newName, String newTitle) throws WikiException
      Renames a note.
      Specified by:
      renameNote in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The NoteBook owner.
      noteName - Old name of the note.
      newName - New name of the note.
      newTitle - New title of the note.
      Returns:
      "True" if renaming the note is successful, or "false" if not.
      Throws:
      WikiException - if an error occured
    • moveNote

      public void moveNote(WikiPageParams currentLocationParams, WikiPageParams newLocationParams) throws WikiException
      Move a note
      Specified by:
      moveNote in interface NoteService
      Parameters:
      currentLocationParams - The current location of the note.
      newLocationParams - The new location of the note.
      Throws:
      WikiException - if an error occured
    • moveNote

      public boolean moveNote(WikiPageParams currentLocationParams, WikiPageParams newLocationParams, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, org.gatein.api.EntityNotFoundException
      Move a note
      Specified by:
      moveNote in interface NoteService
      Parameters:
      currentLocationParams - The current location of the note.
      newLocationParams - The new location of the note.
      userIdentity - The user Identity to check permissions.
      Returns:
      "True" if moving the note is successful, or "false" if not.
      Throws:
      WikiException - if an error occured
      IllegalAccessException - if the user don't have edit rights on the note
      org.gatein.api.EntityNotFoundException - if the the note to move don't exist
    • getNoteOfNoteBookByName

      public Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName) throws WikiException
      Gets a note by its unique name in the noteBook.
      Specified by:
      getNoteOfNoteBookByName in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The NoteBook owner.
      noteName - Id of the note.
      Returns:
      The note if the current user has the read permission. Otherwise, it is "null".
      Throws:
      WikiException - if an error occured
    • getNoteOfNoteBookByName

      public Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity, String source) throws IllegalAccessException, WikiException
      Retrieves a note by note type, owner and name.
      Specified by:
      getNoteOfNoteBookByName in interface NoteService
      Parameters:
      noteType - note type
      noteOwner - note owner
      noteName - note name
      userIdentity - user identity id
      Returns:
      Page
      Throws:
      IllegalAccessException
      WikiException
    • getNoteOfNoteBookByName

      public Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, String lang, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException
      Retrieves a note by note type, owner, name and lang.
      Specified by:
      getNoteOfNoteBookByName in interface NoteService
      Parameters:
      noteType - note type
      noteOwner - note owner
      noteName - note name
      lang - note version language
      userIdentity - user identity id
      Returns:
      Page
      Throws:
      WikiException
      IllegalAccessException
    • getNoteOfNoteBookByName

      public Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity) throws IllegalAccessException, WikiException
      Gets a note by its unique name in the noteBook.
      Specified by:
      getNoteOfNoteBookByName in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The NoteBook owner.
      noteName - Id of the note.
      userIdentity - User identity getting the note.
      Returns:
      The note if the current user has the read permission. Otherwise, it is "null".
      Throws:
      WikiException - if an error occured
      IllegalAccessException
    • getNoteById

      public Page getNoteById(String id) throws WikiException
      Gets a note based on its unique id.
      Specified by:
      getNoteById in interface NoteService
      Parameters:
      id - Unique id of the note.
      Returns:
      The note.
      Throws:
      WikiException - if an error occured
    • getDraftNoteById

      public DraftPage getDraftNoteById(String id, String userId) throws WikiException, IllegalAccessException
      Gets a draft note based on its unique id.
      Specified by:
      getDraftNoteById in interface NoteService
      Parameters:
      id - Unique id of the draft note.
      userId - user id
      Returns:
      The note.
      Throws:
      WikiException - if an error occured
      IllegalAccessException
    • getLatestDraftOfPage

      public DraftPage getLatestDraftOfPage(Page targetPage) throws WikiException
      Returns latest draft of given page.
      Specified by:
      getLatestDraftOfPage in interface NoteService
      Parameters:
      targetPage -
      Returns:
      latest draft of the given page
      Throws:
      WikiException
    • getLatestDraftOfPage

      public DraftPage getLatestDraftOfPage(Page targetPage, String username) throws WikiException
      Returns latest draft of given page.
      Specified by:
      getLatestDraftOfPage in interface NoteService
      Parameters:
      targetPage -
      username -
      Returns:
      latest draft of the given page
      Throws:
      WikiException
    • getNoteById

      public Page getNoteById(String id, org.exoplatform.services.security.Identity userIdentity) throws IllegalAccessException, WikiException
      Gets a note based on its unique id.
      Specified by:
      getNoteById in interface NoteService
      Parameters:
      id - Unique id of the note.
      userIdentity - user identity id getting the note
      Returns:
      The note.
      Throws:
      WikiException - if an error occured
      IllegalAccessException
    • getNoteById

      public Page getNoteById(String id, org.exoplatform.services.security.Identity userIdentity, String source) throws IllegalAccessException, WikiException
      Gets a note based on its unique id.
      Specified by:
      getNoteById in interface NoteService
      Parameters:
      id - Unique id of the note.
      userIdentity - user identity id getting the note
      source - the source of the note
      Returns:
      The note.
      Throws:
      WikiException - if an error occured
      IllegalAccessException
    • getParentNoteOf

      public Page getParentNoteOf(Page note) throws WikiException
      Get parent note of a note
      Specified by:
      getParentNoteOf in interface NoteService
      Parameters:
      note - note.
      Returns:
      The list of children notes
      Throws:
      WikiException - if an error occured
    • getParentNoteOf

      public NoteToExport getParentNoteOf(NoteToExport note) throws WikiException
      Return the Parent of the note to export
      Specified by:
      getParentNoteOf in interface NoteService
      Parameters:
      note - The Note to export
      Returns:
      the parent of the note to export
      Throws:
      WikiException
    • getChildrenNoteOf

      public List<Page> getChildrenNoteOf(Page note, boolean withDrafts, boolean withChild) throws WikiException
      Get all the children notes of a note
      Specified by:
      getChildrenNoteOf in interface NoteService
      Parameters:
      note - note.
      withDrafts - if set to true returns the children notes and draft notes
      Returns:
      The list of children notes
      Throws:
      WikiException - if an error occured
    • hasChildren

      public boolean hasChildren(long pageId)
      Check if the given note page has children or not
      Specified by:
      hasChildren in interface NoteService
      Parameters:
      pageId - note page id
      Returns:
      true if the given note page has children and false if not
    • hasDrafts

      public boolean hasDrafts(long pageId)
      Check if the given note page has drafts or not
      Specified by:
      hasDrafts in interface NoteService
      Parameters:
      pageId - note page id
      Returns:
      true if the given note page has drafts and false if not
    • getChildrenNoteOf

      public List<Page> getChildrenNoteOf(Page note, String userId, boolean withDrafts, boolean withChild) throws WikiException
      Get all the children notes of a note
      Specified by:
      getChildrenNoteOf in interface NoteService
      Parameters:
      note - note.
      userId -
      withDrafts - if set to true returns the children notes and draft notes
      Returns:
      The list of children notes
      Throws:
      WikiException - if an error occured
    • getChildrenNoteOf

      public List<NoteToExport> getChildrenNoteOf(NoteToExport note) throws WikiException
      Return the list of children of the note to export
      Specified by:
      getChildrenNoteOf in interface NoteService
      Parameters:
      note - The Note to export
      Returns:
      the list of children of the note to export
      Throws:
      WikiException
    • getChildrenNoteOf

      public List<NoteToExport> getChildrenNoteOf(NoteToExport note, String userId) throws WikiException
      Return the list of children of the note to export
      Specified by:
      getChildrenNoteOf in interface NoteService
      Parameters:
      note - The Note to export
      userId - the current user Id
      Returns:
      the list of children of the note to export
      Throws:
      WikiException
    • getBreadCrumb

      public List<BreadcrumbData> getBreadCrumb(String noteType, String noteOwner, String noteName, boolean isDraftNote) throws WikiException, IllegalAccessException
      Gets a list of data which is used for composing the breadcrumb.
      Specified by:
      getBreadCrumb in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The owner.
      noteName - Id of the note to which the breadcrumb points.
      isDraftNote -
      Returns:
      The list of data.
      Throws:
      WikiException - if an error occured
      IllegalAccessException
    • getBreadCrumb

      public List<BreadcrumbData> getBreadCrumb(String noteType, String noteOwner, String noteName, String lang, org.exoplatform.services.security.Identity userIdentity, boolean isDraftNote) throws WikiException, IllegalAccessException
      Gets a list of data which is used for composing the breadcrumb.
      Specified by:
      getBreadCrumb in interface NoteService
      Parameters:
      noteType - It can be Portal, Group, or User.
      noteOwner - The owner.
      lang - lang to be used to get translated titles.
      userIdentity - Current user identity.
      isDraftNote -
      Returns:
      The list of data.
      Throws:
      WikiException - if an error occured
      IllegalAccessException
    • getDuplicateNotes

      public List<Page> getDuplicateNotes(Page parentNote, Wiki targetNoteBook, List<Page> resultList) throws WikiException
      Checks if a note and its children are duplicated with ones in the target NoteBook or not, then gets a list of duplicated notes if any.
      Specified by:
      getDuplicateNotes in interface NoteService
      Parameters:
      parentNote - The note to check.
      targetNoteBook - The target NoteBook to check.
      resultList - The list of duplicated notes.
      Returns:
      The list of duplicated notes.
      Throws:
      WikiException - if an error occured
    • getDuplicateNotes

      public List<Page> getDuplicateNotes(Page parentNote, Wiki targetNoteBook, List<Page> resultList, String userId) throws WikiException
      Checks if a note and its children are duplicated with ones in the target NoteBook or not, then gets a list of duplicated notes if any.
      Specified by:
      getDuplicateNotes in interface NoteService
      Parameters:
      parentNote - The note to check.
      targetNoteBook - The target NoteBook to check.
      resultList - The list of duplicated notes.
      userId -
      Returns:
      The list of duplicated notes.
      Throws:
      WikiException - if an error occured
    • removeDraftOfNote

      public void removeDraftOfNote(WikiPageParams param) throws WikiException
      Remove the all Drafts of a note
      Specified by:
      removeDraftOfNote in interface NoteService
      Parameters:
      param - Note location params.
      Throws:
      WikiException - if an error occured
    • removeDraftOfNote

      public void removeDraftOfNote(Page page, String username) throws WikiException
      Remove the Drafts of a note by username
      Specified by:
      removeDraftOfNote in interface NoteService
      Parameters:
      page - Note page.
      username - username.
      Throws:
      WikiException - if an error occured
    • removeDraftOfNote

      public void removeDraftOfNote(Page page) throws WikiException
      Remove the Drafts of a note
      Specified by:
      removeDraftOfNote in interface NoteService
      Parameters:
      page - Note page.
      Throws:
      WikiException - if an error occured
    • getDraftOfPageByLang

      public DraftPage getDraftOfPageByLang(WikiPageParams param, String lang) throws WikiException
      Specified by:
      getDraftOfPageByLang in interface NoteService
      Throws:
      WikiException
    • removeDraftOfNote

      public void removeDraftOfNote(WikiPageParams param, String lang) throws Exception
      Remove the Drafts of a note by language
      Specified by:
      removeDraftOfNote in interface NoteService
      Parameters:
      param - Note location params.
      lang - draft lang.
      Throws:
      Exception - if an error occured
    • removeDraft

      public void removeDraft(String draftName) throws WikiException
      Removes a draft page by its name.
      Specified by:
      removeDraft in interface NoteService
      Parameters:
      draftName - Name of the draft page.
      Throws:
      WikiException - if an error occured
    • removeDraftById

      public void removeDraftById(String draftId) throws Exception
      Removes a draft page by its technical id.
      Specified by:
      removeDraftById in interface NoteService
      Parameters:
      draftId - Technical Id of the draft page.
      Throws:
      Exception
    • getVersionsHistoryOfNote

      public List<PageHistory> getVersionsHistoryOfNote(Page note, String userName) throws WikiException
      Gets all the Histories of the given note
      Specified by:
      getVersionsHistoryOfNote in interface NoteService
      Parameters:
      note - The note
      userName - the author name
      Returns:
      All the histories of the note
      Throws:
      WikiException - if an error occured
    • createVersionOfNote

      public void createVersionOfNote(Page note, String userName, boolean broadcast) throws WikiException
      Creates a version of a note. This method only tag the current note data as a new version, it does not update the note data
      Specified by:
      createVersionOfNote in interface NoteService
      Parameters:
      note - The note
      userName - the author name
      broadcast - broadcast version update event
      Throws:
      WikiException - if an error occured
    • createVersionOfNote

      public void createVersionOfNote(Page note, String userName) throws WikiException
      Creates a version of a note. This method only tag the current note data as a new version, it does not update the note data
      Specified by:
      createVersionOfNote in interface NoteService
      Parameters:
      note - The note
      userName - the author name
      Throws:
      WikiException - if an error occured
    • restoreVersionOfNote

      public void restoreVersionOfNote(String versionName, Page note, String userName) throws WikiException
      Restores a version of a note
      Specified by:
      restoreVersionOfNote in interface NoteService
      Parameters:
      versionName - The name of the version to restore
      note - The note
      userName - the other name
      Throws:
      WikiException - if an error occured
    • getPreviousNamesOfNote

      public List<String> getPreviousNamesOfNote(Page note) throws WikiException
      Get previous names of a note
      Specified by:
      getPreviousNamesOfNote in interface NoteService
      Parameters:
      note - The note
      Returns:
      List of all the previous names of the note
      Throws:
      WikiException - if an error occured
    • getNotesOfWiki

      public List<Page> getNotesOfWiki(String noteType, String noteOwner)
      Retrieve the all notes contained in noteBook
      Specified by:
      getNotesOfWiki in interface NoteService
      Parameters:
      noteType - the notebook Type It can be Portal, Group, or User.
      noteOwner - the notebook owner
      Returns:
      List of pages
    • isExisting

      public boolean isExisting(String noteBookType, String noteBookOwner, String noteId) throws WikiException
      Check if the given note is existing
      Specified by:
      isExisting in interface NoteService
      Parameters:
      noteBookType - the notebook Type It can be Portal, Group, or User.
      noteBookOwner - the notebook owner
      noteId - the note id
      Returns:
      true if the note is existing
      Throws:
      WikiException
    • updateDraftForExistPage

      public DraftPage updateDraftForExistPage(DraftPage draftNoteToUpdate, Page targetPage, String revision, long clientTime, String username) throws WikiException
      Update draft note for an existing page
      Specified by:
      updateDraftForExistPage in interface NoteService
      Parameters:
      draftNoteToUpdate - The draft note to be updated
      targetPage - The target note of the draft
      revision - The revision which is used for creating the draft page. If "null", this will be the last revision.
      clientTime -
      username - The author name
      Returns:
      Updated draft
      Throws:
      WikiException
    • updateDraftForNewPage

      public DraftPage updateDraftForNewPage(DraftPage draftNoteToUpdate, long clientTime, long userIdentityId) throws WikiException
      Update draft note for a new page
      Specified by:
      updateDraftForNewPage in interface NoteService
      Parameters:
      draftNoteToUpdate - the draft note to be updated
      clientTime -
      userIdentityId - user identity id
      Returns:
      Updated draft
      Throws:
      WikiException
    • createDraftForExistPage

      public DraftPage createDraftForExistPage(DraftPage draftPage, Page targetPage, String revision, long clientTime, String username) throws WikiException
      Creates a draft for an existing page
      Specified by:
      createDraftForExistPage in interface NoteService
      Parameters:
      draftPage - The draft note to be created
      targetPage - The target note of the draft
      revision - The revision which is used for creating the draft page. If "null", this will be the last revision.
      clientTime -
      username - The author name
      Returns:
      Created draft
      Throws:
      WikiException
    • createDraftForNewPage

      public DraftPage createDraftForNewPage(DraftPage draftPage, long clientTime, long userIdentityId) throws WikiException
      Creates a draft for a new page
      Specified by:
      createDraftForNewPage in interface NoteService
      Parameters:
      draftPage - The draft note to be created
      clientTime -
      userIdentityId - user identity id
      Returns:
      Created draft
      Throws:
      WikiException
    • hasPermissionOnPage

      public boolean hasPermissionOnPage(Page page, PermissionType permissionType, org.exoplatform.services.security.Identity user) throws WikiException
      Checks if the given user has the permission on a page
      Specified by:
      hasPermissionOnPage in interface NoteService
      Parameters:
      page - the wiki page object
      permissionType - permission Type
      user - the userName
      Returns:
      true if user has permissions
      Throws:
      WikiException - if an error occured
    • getNoteByRootPermission

      public Page getNoteByRootPermission(String wikiType, String wikiOwner, String pageId) throws WikiException
      Gets a wiki page regardless of the current user's permission.
      Specified by:
      getNoteByRootPermission in interface NoteService
      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
    • getNoteRenderedContent

      public String getNoteRenderedContent(Page note)
      Return the content of the note to be rendred
      Specified by:
      getNoteRenderedContent in interface NoteService
      Parameters:
      note - The Note
      Returns:
      Content to be rendred
    • importNotes

      public void importNotes(String zipLocation, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) throws Exception
      Import Notes from a zip file location
      Specified by:
      importNotes in interface NoteService
      Parameters:
      zipLocation - the zip file location path
      parent - The parent page where notes will be impoprted
      conflict - import strategy ( can be "overwrite","replaceAll","duplicate" or "duplicate")
      userIdentity - current user Identity
      Throws:
      Exception
    • importNotes

      public void importNotes(List<String> files, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) throws Exception
      Import Notes from a list of files
      Specified by:
      importNotes in interface NoteService
      Parameters:
      files - the list of files
      parent - The parent page where notes will be imported
      conflict - import strategy ( can be "overwrite","replaceAll","duplicate" or "duplicate")
      userIdentity - current user Identity
      Throws:
      Exception
    • search

      public org.exoplatform.commons.utils.PageList<SearchResult> search(WikiSearchData data) throws WikiException
      Searches in all wiki pages.
      Specified by:
      search in interface NoteService
      Parameters:
      data - The data to search.
      Returns:
      Search results.
      Throws:
      WikiException - if an error occured if an error occured
    • getNoteByIdAndLang

      public Page getNoteByIdAndLang(Long pageId, org.exoplatform.services.security.Identity userIdentity, String source, String lang) throws WikiException, IllegalAccessException
      Retrieves note page by its id and content lang
      Specified by:
      getNoteByIdAndLang in interface NoteService
      Parameters:
      pageId - page id
      userIdentity - user identity id
      source - source
      lang - content language
      Returns:
      Page
      Throws:
      WikiException
      IllegalAccessException
    • getNoteByIdAndLang

      public Page getNoteByIdAndLang(Long pageId, String lang)
      Description copied from interface: NoteService
      Retrieves note page by its id and content lang
      Specified by:
      getNoteByIdAndLang in interface NoteService
      Parameters:
      pageId - page id
      lang - content language
      Returns:
      Page
    • getPublishedVersionByPageIdAndLang

      public PageVersion getPublishedVersionByPageIdAndLang(Long pageId, String lang)
      Retrieves published note version page by its page id and content lang
      Specified by:
      getPublishedVersionByPageIdAndLang in interface NoteService
      Parameters:
      pageId - page id
      lang - content language
      Returns:
      PageVersion
    • getPageAvailableTranslationLanguages

      public List<String> getPageAvailableTranslationLanguages(Long pageId, boolean withDrafts) throws WikiException
      Retrieves list of available translations languages of a page
      Specified by:
      getPageAvailableTranslationLanguages in interface NoteService
      Parameters:
      pageId - page id
      withDrafts - if set to true returns languages draft notes
      Returns:
      List of String
      Throws:
      WikiException
    • getPageAvailableTranslationLanguages

      public List<String> getPageAvailableTranslationLanguages(Long pageId, String userId, boolean withDrafts) throws WikiException
      Retrieves list of available translations languages of a page
      Specified by:
      getPageAvailableTranslationLanguages in interface NoteService
      Parameters:
      pageId - page id
      userId - owner username
      withDrafts - if set to true returns languages draft notes
      Returns:
      List of String
      Throws:
      WikiException
    • getVersionsHistoryOfNoteByLang

      public List<PageHistory> getVersionsHistoryOfNoteByLang(Page note, String userName, String lang) throws WikiException
      Retrieves the history version of given note by language
      Specified by:
      getVersionsHistoryOfNoteByLang in interface NoteService
      Parameters:
      note - the target note id
      userName - user name
      lang - content language
      Returns:
      List of PageHistory
      Throws:
      WikiException
    • getLatestDraftPageByTargetPageAndLang

      public DraftPage getLatestDraftPageByTargetPageAndLang(Long targetPageId, String lang)
      Retrieves latest draft of a specific page by target page id and content language
      Specified by:
      getLatestDraftPageByTargetPageAndLang in interface NoteService
      Parameters:
      targetPageId - target page id
      lang - content language
      Returns:
      DraftPage
    • getLatestDraftPageByUserAndTargetPageAndLang

      public DraftPage getLatestDraftPageByUserAndTargetPageAndLang(Long targetPageId, String username, String lang)
      Retrieves latest draft of a specific page by target page id and content language and owner username
      Specified by:
      getLatestDraftPageByUserAndTargetPageAndLang in interface NoteService
      Parameters:
      targetPageId - target page id
      username - owner username
      lang - content language
      Returns:
      DraftPage
    • deleteVersionsByNoteIdAndLang

      public void deleteVersionsByNoteIdAndLang(Long noteId, String lang, boolean broadcast) throws Exception
      Deletes a list of versions of note by language.
      Specified by:
      deleteVersionsByNoteIdAndLang in interface NoteService
      Parameters:
      noteId - Id of the note.
      lang - language.
      broadcast - : broadcast delete event or not
      Throws:
      Exception
    • deleteVersionsByNoteIdAndLang

      public void deleteVersionsByNoteIdAndLang(Long noteId, String lang) throws Exception
      Deletes a list of versions of note by language.
      Specified by:
      deleteVersionsByNoteIdAndLang in interface NoteService
      Parameters:
      noteId - Id of the note.
      lang - language.
      Throws:
      Exception
    • deleteVersionsByNoteIdAndLang

      public void deleteVersionsByNoteIdAndLang(Long noteId, String userName, String lang) throws Exception
      Deletes a list of versions of note by language.
      Specified by:
      deleteVersionsByNoteIdAndLang in interface NoteService
      Parameters:
      noteId - Id of the note.
      userName - owner username
      lang - language.
      Throws:
      Exception
    • getDraftsOfWiki

      public List<DraftPage> getDraftsOfWiki(String wikiOwner, String wikiType, String wikiHome)
      Gets draft pages of a given wiki
      Specified by:
      getDraftsOfWiki in interface NoteService
      Parameters:
      wikiOwner - wiki owner
      wikiType - wiki type
      wikiHome - wiki home page
      Returns:
      List of DraftPage
    • removeOrphanDraftPagesByParentPage

      public void removeOrphanDraftPagesByParentPage(long parentPageId)
      Description copied from interface: NoteService
      Remove all children drafts of a parent page without existing target
      Specified by:
      removeOrphanDraftPagesByParentPage in interface NoteService
      Parameters:
      parentPageId - Note parent page id
    • saveNoteFeaturedImage

      public Long saveNoteFeaturedImage(Page note, NoteFeaturedImage featuredImage) throws Exception
      Saves Note featured Image
      Specified by:
      saveNoteFeaturedImage in interface NoteService
      Parameters:
      note - target note page
      featuredImage - Note featured image
      Returns:
      saved featured image ID
      Throws:
      Exception
    • getNoteFeaturedImageInfo

      public NoteFeaturedImage getNoteFeaturedImageInfo(Long noteId, String lang, boolean isDraft, String thumbnailSize, long userIdentityId) throws Exception
      Get Note featured Image by its given id
      Specified by:
      getNoteFeaturedImageInfo in interface NoteService
      Parameters:
      noteId - Note id
      lang - note version language
      isDraft - is target not a draft
      thumbnailSize - featured image thumbnail size
      userIdentityId - user identity id
      Returns:
      NoteFeaturedImage
      Throws:
      Exception
    • removeNoteFeaturedImage

      public void removeNoteFeaturedImage(Long noteId, Long featuredImageId, String lang, boolean isDraft, Long userIdentityId) throws Exception
      Removes note featured image and its related metadata property
      Specified by:
      removeNoteFeaturedImage in interface NoteService
      Parameters:
      noteId - target note id
      featuredImageId - featured image id
      lang - target version language
      isDraft - is the target note a draft
      userIdentityId - user identity id
      Throws:
      Exception
    • saveNoteMetadata

      public NotePageProperties saveNoteMetadata(NotePageProperties notePageProperties, String lang, Long userIdentityId) throws Exception
      Save note metadata properties
      Specified by:
      saveNoteMetadata in interface NoteService
      Parameters:
      notePageProperties - note metadata properties to save
      lang - target version language
      userIdentityId - user identity id
      Returns:
      NotePageProperties
      Throws:
      Exception
    • getPageVersionById

      public PageVersion getPageVersionById(Long versionId)
      Gets page version by its given id
      Specified by:
      getPageVersionById in interface NoteService
      Parameters:
      versionId - page version id
      Returns:
      PageVersion
    • postUpdatePageVersionLanguage

      public void postUpdatePageVersionLanguage(String versionPageId)
    • postDeletePageVersionLanguage

      public void postDeletePageVersionLanguage(PageVersion pageVersion)
    • 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
    • postOpenByTree

      public void postOpenByTree(String wikiType, String wikiOwner, String pageId, Page page) throws WikiException
      Throws:
      WikiException
    • postOpenByBreadCrumb

      public void postOpenByBreadCrumb(String wikiType, String wikiOwner, String pageId, Page page) throws WikiException
      Throws:
      WikiException
    • markNoteAsViewed

      public void markNoteAsViewed(Page note, org.exoplatform.services.security.Identity userIdentity)
      Description copied from interface: NoteService
      Mark note as viewed by user
      Specified by:
      markNoteAsViewed in interface NoteService
      Parameters:
      note - target note
    • invalidateCache

      protected void invalidateCache(Page page)
    • invalidateCachesOfPageTree

      protected void invalidateCachesOfPageTree(Page note) throws WikiException
      Throws:
      WikiException
    • invalidateAttachmentCache

      protected void invalidateAttachmentCache(Page note)