Interface NoteService

All Known Implementing Classes:
NoteServiceImpl

public interface NoteService
Provides functions for processing database with notes, including: adding, editing, removing and searching for data.
  • Method Details

    • createNote

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

      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.
      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
    • deleteNote

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

      boolean deleteNote(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, org.gatein.api.EntityNotFoundException
      Deletes a note.
      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

      boolean renameNote(String noteType, String noteOwner, String noteName, String newName, String newTitle) throws WikiException
      Renames a note.
      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

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

      boolean moveNote(WikiPageParams currentLocationParams, WikiPageParams newLocationParams, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, org.gatein.api.EntityNotFoundException
      Move a note
      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

      Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName) throws WikiException
      Gets a note by its unique name in the noteBook.
      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

      Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException
      Gets a note by its unique name in the noteBook.
      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
    • getNoteOfNoteBookByName

      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.
      Parameters:
      noteType - note type
      noteOwner - note owner
      noteName - note name
      lang - note version language
      userIdentity - user identity id
      Returns:
      Page
      Throws:
      WikiException
      IllegalAccessException
    • getNoteOfNoteBookByName

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

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

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

      DraftPage getLatestDraftOfPage(Page targetPage) throws WikiException
      Returns latest draft of given page.
      Parameters:
      targetPage -
      Returns:
      latest draft of the given page
      Throws:
      WikiException
    • getLatestDraftOfPage

      @Deprecated DraftPage getLatestDraftOfPage(Page targetPage, String username) throws WikiException
      Deprecated.
      Returns latest draft of given page.
      Parameters:
      targetPage -
      username -
      Returns:
      latest draft of the given page
      Throws:
      WikiException
    • getNoteById

      Page getNoteById(String id, org.exoplatform.services.security.Identity userIdentity) throws IllegalAccessException, WikiException
      Gets a note based on its unique id.
      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

      Page getNoteById(String id, org.exoplatform.services.security.Identity userIdentity, String source) throws IllegalAccessException, WikiException
      Gets a note based on its unique id.
      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

      Page getParentNoteOf(Page note) throws WikiException
      Get parent note of a note
      Parameters:
      note - note.
      Returns:
      The list of children notes
      Throws:
      WikiException - if an error occured
    • getChildrenNoteOf

      List<Page> getChildrenNoteOf(Page note, boolean withDrafts, boolean withChild) throws WikiException
      Get all the children notes of a note
      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
    • getChildrenNoteOf

      @Deprecated List<Page> getChildrenNoteOf(Page note, String userId, boolean withDrafts, boolean withChild) throws WikiException
      Deprecated.
      Get all the children notes of a note
      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
    • getBreadCrumb

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

      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.
      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

      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.
      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

      @Deprecated List<Page> getDuplicateNotes(Page parentNote, Wiki targetNoteBook, List<Page> resultList, String userId) throws WikiException
      Deprecated.
      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.
      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

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

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

      void removeDraftOfNote(Page page) throws WikiException
      Remove the Drafts of a note
      Parameters:
      page - Note page.
      Throws:
      WikiException - if an error occured
    • removeDraftOfNote

      @Deprecated void removeDraftOfNote(Page page, String username) throws WikiException
      Deprecated.
      Remove the Drafts of a note by username
      Parameters:
      page - Note page.
      username - username.
      Throws:
      WikiException - if an error occured
    • removeDraft

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

      void removeDraftById(String draftId) throws Exception
      Removes a draft page by its technical id.
      Parameters:
      draftId - Technical Id of the draft page.
      Throws:
      WikiException - if an error occured
      Exception
    • getVersionsHistoryOfNote

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

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

      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
      Parameters:
      note - The note
      userName - the author name
      Throws:
      WikiException - if an error occured
    • restoreVersionOfNote

      void restoreVersionOfNote(String versionName, Page note, String userName) throws WikiException
      Restores a version of a note
      Parameters:
      versionName - The name of the version to restore
      note - The note
      userName - the other name
      Throws:
      WikiException - if an error occured
    • updateNote

      Page updateNote(Page note) throws WikiException
      Update the given note.
      Parameters:
      note - Updated note
      Returns:
      updated note
      Throws:
      WikiException - if an error occured
    • updateNote

      Page updateNote(Page note, PageUpdateType type, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, org.gatein.api.EntityNotFoundException, 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, ...).
      Parameters:
      note - Updated note
      type - Type of update
      userIdentity - user Identity
      Returns:
      The updated note
      Throws:
      WikiException - if an error occure
      IllegalAccessException - if the user don't have edit rights on the note
      org.gatein.api.EntityNotFoundException - if the the note to update don't exist
      Exception
    • updateNote

      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, ...).
      Parameters:
      note - Updated note
      type - Type of update
      Returns:
      The updated note
      Throws:
      WikiException
    • getPreviousNamesOfNote

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

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

      boolean isExisting(String noteBookType, String noteBookOwner, String noteId) throws WikiException
      Check if the given note is existing
      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

      DraftPage updateDraftForExistPage(DraftPage draftNoteToUpdate, Page targetNote, String revision, long currentTimeMillis, String userName) throws WikiException
      Update draft note for an existing page
      Parameters:
      draftNoteToUpdate - The draft note to be updated
      targetNote - 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.
      currentTimeMillis -
      userName - The author name
      Returns:
      Updated draft
      Throws:
      WikiException
    • updateDraftForNewPage

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

      DraftPage createDraftForExistPage(DraftPage draftNoteToSave, Page targetNote, String revision, long currentTimeMillis, String username) throws WikiException
      Creates a draft for an existing page
      Parameters:
      draftNoteToSave - The draft note to be created
      targetNote - 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.
      currentTimeMillis -
      username - The author name
      Returns:
      Created draft
      Throws:
      WikiException
    • createDraftForNewPage

      DraftPage createDraftForNewPage(DraftPage draftNoteToSave, long currentTimeMillis, long userIdentityId) throws WikiException
      Creates a draft for a new page
      Parameters:
      draftNoteToSave - The draft note to be created
      currentTimeMillis -
      userIdentityId - user identity id
      Returns:
      Created draft
      Throws:
      WikiException
    • getChildrenNoteOf

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

      @Deprecated List<NoteToExport> getChildrenNoteOf(NoteToExport note, String userId) throws WikiException
      Deprecated.
      Return the list of children of the note to export
      Parameters:
      note - The Note to export
      userId - the current user Id
      Returns:
      the list of children of the note to export
      Throws:
      WikiException
    • getParentNoteOf

      NoteToExport getParentNoteOf(NoteToExport note) throws WikiException
      Return the Parent of the note to export
      Parameters:
      note - The Note to export
      Returns:
      the parent of the note to export
      Throws:
      WikiException
    • getNoteRenderedContent

      String getNoteRenderedContent(Page note)
      Return the content of the note to be rendred
      Parameters:
      note - The Note
      Returns:
      Content to be rendred
    • importNotes

      void importNotes(String zipLocation, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, IOException, Exception
      Import Notes from a zip file location
      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:
      WikiException - if an error occured
      IllegalAccessException - if the user don't have edit rights on the note
      IOException - if can't read zip file
      Exception
    • importNotes

      void importNotes(List<String> files, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, IOException, Exception
      Import Notes from a list of files
      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:
      WikiException - if an error occured
      IllegalAccessException - if the user don't have edit rights on the note
      IOException - if can't read files
      Exception
    • search

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

      Page getNoteByRootPermission(String wikiType, String wikiOwner, String pageId) throws WikiException
      Gets a wiki page regardless of the current user's permission.
      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
    • hasPermissionOnPage

      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
      Parameters:
      page - the wiki page object
      permissionType - permission Type
      user - the userName
      Returns:
      true if user has permissions
      Throws:
      WikiException - if an error occured
    • getNoteByIdAndLang

      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
      Parameters:
      pageId - page id
      userIdentity - user identity id
      source - source
      lang - content language
      Returns:
      Page
      Throws:
      WikiException
      IllegalAccessException
    • getNoteByIdAndLang

      Page getNoteByIdAndLang(Long pageId, String lang)
      Retrieves note page by its id and content lang
      Parameters:
      pageId - page id
      lang - content language
      Returns:
      Page
    • getPublishedVersionByPageIdAndLang

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

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

      @Deprecated List<String> getPageAvailableTranslationLanguages(Long pageId, String userId, boolean withDrafts) throws WikiException
      Deprecated.
      Retrieves list of available translations languages of a page
      Parameters:
      pageId - page id
      userId - owner username
      withDrafts - if set to true returns languages draft notes
      Returns:
      List of String
      Throws:
      WikiException
    • getLatestDraftPageByTargetPageAndLang

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

      @Deprecated DraftPage getLatestDraftPageByUserAndTargetPageAndLang(Long targetPageId, String username, String lang)
      Deprecated.
      Retrieves latest draft of a specific page by target page id and content language and owner username
      Parameters:
      targetPageId - target page id
      username - owner username
      lang - content language
      Returns:
      DraftPage
    • deleteVersionsByNoteIdAndLang

      void deleteVersionsByNoteIdAndLang(Long noteId, String lang) throws WikiException
      Deletes a list of versions of note by language.
      Parameters:
      noteId - Id of the note.
      lang - language.
      Throws:
      WikiException - if an error occured
    • deleteVersionsByNoteIdAndLang

      @Deprecated void deleteVersionsByNoteIdAndLang(Long noteId, String username, String lang) throws WikiException
      Deprecated.
      Deletes a list of versions of note by language.
      Parameters:
      noteId - Id of the note.
      username - owner username
      lang - language.
      Throws:
      WikiException - if an error occured
    • removeOrphanDraftPagesByParentPage

      void removeOrphanDraftPagesByParentPage(long parentPageId)
      Remove all children drafts of a parent page without existing target
      Parameters:
      parentPageId - Note parent page id
    • saveNoteFeaturedImage

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

      NoteFeaturedImage getNoteFeaturedImageInfo(Long noteId, String lang, boolean isDraft, String thumbnailSize, long userIdentityId) throws Exception
      Get Note featured Image by its given id
      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
    • saveNoteMetadata

      NotePageProperties saveNoteMetadata(NotePageProperties pageProperties, String lang, Long userIdentityId) throws Exception
      Save note metadata properties
      Parameters:
      pageProperties - note metadata properties to save
      lang - target version language
      userIdentityId - user identity id
      Returns:
      NotePageProperties
      Throws:
      Exception
    • removeNoteFeaturedImage

      void removeNoteFeaturedImage(Long noteId, Long featuredImageId, String lang, boolean isDraft, Long userIdentityId) throws Exception
      Removes note featured image and its related metadata property
      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
    • getPageVersionById

      PageVersion getPageVersionById(Long versionId)
      Gets page version by its given id
      Parameters:
      versionId - page version id
      Returns:
      PageVersion
    • getDraftOfPageByLang

      DraftPage getDraftOfPageByLang(WikiPageParams param, String lang) throws WikiException
      Throws:
      WikiException