Package org.exoplatform.wiki.service
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 Summary
Modifier and TypeMethodDescriptioncreateDraftForExistPage(DraftPage draftNoteToSave, Page targetNote, String revision, long currentTimeMillis, String username) Creates a draft for an existing pagecreateDraftForNewPage(DraftPage draftNoteToSave, long currentTimeMillis) Creates a draft for a new pagecreateNote(Wiki noteBook, String parentNoteName, Page note, org.exoplatform.services.security.Identity userIdentity) Create a new note in the given notebook, under the given parent note.createNote(Wiki noteBook, Page parentNote, Page note) Create a new note in the given notebook, under the given parent note.voidcreateVersionOfNote(Page note, String userName) Creates a version of a note.booleandeleteNote(String noteType, String noteOwner, String noteId) Deletes a note.booleandeleteNote(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity) getBreadCrumb(String noteType, String noteOwner, String noteId, boolean isDraftNote) Gets a list of data which is used for composing the breadcrumb.getChildrenNoteOf(NoteToExport note, String userId) Return the list of children of the note to exportgetChildrenNoteOf(Page note, String userId, boolean withDrafts, boolean withChild) Get all the children notes of a notegetDraftNoteById(String id, String userId) Gets a draft note based on its unique id.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.getLatestDraftOfPage(Page targetPage, String username) Returns latest draft of given page.getNoteById(String id) Gets a note based on its unique id.getNoteById(String id, org.exoplatform.services.security.Identity userIdentity) getNoteById(String id, org.exoplatform.services.security.Identity userIdentity, String source) getNoteByRootPermission(String wikiType, String wikiOwner, String pageId) Gets a wiki page regardless of the current user's permission.getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName) Gets a note by its unique name in the noteBook.getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity) getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity, String source) getNoteRenderedContent(Page note) Return the content of the note to be rendredgetNotesOfWiki(String noteType, String noteOwner) Retrieve the all notes contained in noteBookgetParentNoteOf(NoteToExport note) Return the Parent of the note to exportgetParentNoteOf(Page note) Get parent note of a notegetPreviousNamesOfNote(Page note) Get previous names of a notegetVersionsHistoryOfNote(Page note, String userName) Gets all the Histories of the given notebooleanhasPermissionOnPage(Page page, PermissionType permissionType, org.exoplatform.services.security.Identity user) Checks if the given user has the permission on a pagevoidimportNotes(String zipLocation, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) Import Notes from a zip file locationvoidimportNotes(List<String> files, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) Import Notes from a list if filesbooleanisExisting(String noteBookType, String noteBookOwner, String noteId) voidmoveNote(WikiPageParams currentLocationParams, WikiPageParams newLocationParams) Move a notebooleanmoveNote(WikiPageParams currentLocationParams, WikiPageParams newLocationParams, org.exoplatform.services.security.Identity userIdentity) Move a notevoidremoveDraft(String draftName) Removes a draft page by its name.voidremoveDraftOfNote(WikiPageParams param) booleanRenames a note.voidrestoreVersionOfNote(String versionName, Page note, String userName) Restores a version of a noteorg.exoplatform.commons.utils.PageList<SearchResult>search(WikiSearchData data) Searches in all wiki pages.updateDraftForExistPage(DraftPage draftNoteToUpdate, Page targetNote, String revision, long currentTimeMillis, String userName) Update draft note for an existing pageupdateDraftForNewPage(DraftPage draftNoteToUpdate, long currentTimeMillis) Update draft note for a new pageupdateNote(Page note) Update the given note.updateNote(Page note, PageUpdateType type, org.exoplatform.services.security.Identity userIdentity) Update the given note.
-
Method Details
-
createNote
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 occuredIllegalAccessException- if the user don't have edit rights to the parent note
-
deleteNote
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 - Throws:
WikiExceptionIllegalAccessExceptionorg.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 occuredIllegalAccessException- if the user don't have edit rights on the noteorg.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 - Throws:
WikiExceptionIllegalAccessException
-
getNoteOfNoteBookByName
Page getNoteOfNoteBookByName(String noteType, String noteOwner, String noteName, org.exoplatform.services.security.Identity userIdentity, String source) throws WikiException, IllegalAccessException - Throws:
WikiExceptionIllegalAccessException
-
getNoteById
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
Gets a draft note based on its unique id.- Parameters:
id- Unique id of the draft note.userId-- Returns:
- The note.
- Throws:
WikiException- if an error occuredIllegalAccessException
-
getLatestDraftOfPage
Returns latest draft of given page.- Parameters:
targetPage-username-- Returns:
- Throws:
WikiException
-
getNoteById
Page getNoteById(String id, org.exoplatform.services.security.Identity userIdentity) throws IllegalAccessException, WikiException - Throws:
IllegalAccessExceptionWikiException
-
getNoteById
Page getNoteById(String id, org.exoplatform.services.security.Identity userIdentity, String source) throws IllegalAccessException, WikiException - Throws:
IllegalAccessExceptionWikiException
-
getParentNoteOf
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, String userId, boolean withDrafts, boolean withChild) throws WikiException 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 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
-
getDuplicateNotes
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.- 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
- Throws:
WikiException
-
removeDraft
Removes a draft page by its name.- Parameters:
draftName- Name of the draft page.- Throws:
WikiException- if an error occured
-
getVersionsHistoryOfNote
Gets all the Histories of the given note- Parameters:
note- The noteuserName- the author name- Returns:
- All the histories of the note
- Throws:
WikiException- if an error occured
-
createVersionOfNote
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 noteuserName- the author name- Throws:
WikiException- if an error occured
-
restoreVersionOfNote
Restores a version of a note- Parameters:
versionName- The name of the version to restorenote- The noteuserName- the other name- Throws:
WikiException- if an error occured
-
updateNote
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 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 notetype- Type of updateuserIdentity- user Identity- Returns:
- The updated note
- Throws:
WikiException- if an error occureIllegalAccessException- if the user don't have edit rights on the noteorg.gatein.api.EntityNotFoundException- if the the note to update don't exist
-
getPreviousNamesOfNote
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
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
- 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 updatedtargetNote- The target note of the draftrevision- 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) throws WikiException Update draft note for a new page- Parameters:
draftNoteToUpdate- the draft note to be updatedcurrentTimeMillis-- 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 createdtargetNote- The target note of the draftrevision- 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) throws WikiException Creates a draft for a new page- Parameters:
draftNoteToSave- The draft note to be createdcurrentTimeMillis-- Returns:
- Created draft
- Throws:
WikiException
-
getChildrenNoteOf
Return the list of children of the note to export- Parameters:
note- The Note to exportuserId- the current user Id- Returns:
- the list of children of the note to export
- Throws:
WikiException
-
getParentNoteOf
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
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 Import Notes from a zip file location- Parameters:
zipLocation- the zip file location pathparent- The parent page where notes will be impoprtedconflict- import strategy ( can be "overwrite","replaceAll","duplicate" or "duplicate")userIdentity- current user Identity- Throws:
WikiException- if an error occuredIllegalAccessException- if the user don't have edit rights on the noteIOException- if can't read zip file
-
importNotes
void importNotes(List<String> files, Page parent, String conflict, org.exoplatform.services.security.Identity userIdentity) throws WikiException, IllegalAccessException, IOException Import Notes from a list if files- Parameters:
files- the zlist of filesparent- The parent page where notes will be impoprtedconflict- import strategy ( can be "overwrite","replaceAll","duplicate" or "duplicate")userIdentity- current user Identity- Throws:
WikiException- if an error occuredIllegalAccessException- if the user don't have edit rights on the noteIOException- if can't read files
-
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
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:
user- the userNamepage- the wiki page objectpermissionType- permission Type- Returns:
- true if user has permissions
- Throws:
WikiException- if an error occured
-