@Transactional(propagation=REQUIRED) public abstract class NoteManagementBase extends Object implements NoteManagement
Spring Service base class for NoteManagement
, provides access to all services and
entities referenced by this service.
NoteService
CONSTANT_MENTION_DISCUSSION_PARTICIPANTS, CONSTANT_MENTION_TOPIC_AUTHORS, CONSTANT_MENTION_TOPIC_MANAGERS, CONSTANT_MENTION_TOPIC_READERS, USER_NOTE_PROPERTY_KEY_LIKE
Constructor and Description |
---|
NoteManagementBase() |
Modifier and Type | Method and Description |
---|---|
NoteModificationResult |
createNote(NoteStoringTO noteStoringTO,
Set<String> additionalBlogNameIds)
Creates a note from the supplied transfer object.
|
void |
deleteAutosave(Long noteId)
Deletes an autosave identified by the passed ID.
|
void |
deleteNote(Long noteId,
boolean deleteSystemPosts,
boolean clientManagerCanDelete)
Deletes a user tagged post and all its comments.
|
Set<Long> |
deleteNotesOfUser(Long userId)
Delete all notes and drafts of a user.
|
List<SimpleNoteListItem> |
getCommentsOfDiscussion(Long noteId)
Returns all the notes of a discussion excluding the root note.
|
Long |
getDiscussionId(Long noteId)
Returns the ID of the discussion the note is part of.
|
DiscussionNoteData |
getNoteWithComments(Long noteId,
QueryResultConverter<SimpleNoteListItem,DiscussionNoteData> converter)
Returns a note with its comments which are ordered according to the provided converter.
|
int |
getNumberOfNotesInDiscussion(Long noteId)
Returns the number of notes in a discussion.
|
int |
getNumberOfReplies(Long noteId)
Returns the number of replies to a note.
|
protected Principal |
getPrincipal()
Gets the current
principal if one has been set, otherwise returns
null . |
protected abstract NoteModificationResult |
handleCreateNote(NoteStoringTO noteStoringTO,
Set<String> additionalBlogNameIds)
Performs the core logic for
createNote(NoteStoringTO, Set) |
protected abstract void |
handleDeleteAutosave(Long noteId)
Performs the core logic for
deleteAutosave(Long) |
protected abstract void |
handleDeleteNote(Long noteId,
boolean deleteSystemPosts,
boolean clientManagerCanDelete)
Performs the core logic for
deleteNote(Long, boolean, boolean) |
protected abstract Set<Long> |
handleDeleteNotesOfUser(Long userId)
Performs the core logic for
deleteNotesOfUser(Long) |
protected abstract List<SimpleNoteListItem> |
handleGetCommentsOfDiscussion(Long noteId)
Performs the core logic for
getCommentsOfDiscussion(Long) |
protected abstract Long |
handleGetDiscussionId(Long noteId)
Implementation of
getDiscussionId(Long) |
protected abstract DiscussionNoteData |
handleGetNoteWithComments(Long noteId,
QueryResultConverter<SimpleNoteListItem,DiscussionNoteData> converter)
Performs the core logic for
getNoteWithComments(Long, QueryResultConverter) |
protected abstract int |
handleGetNumberOfNotesInDiscussion(Long noteId)
Performs the core logic for
getNumberOfNotesInDiscussion(Long) |
protected abstract int |
handleGetNumberOfReplies(Long noteId)
Performs the core logic for
getNumberOfReplies(Long) |
protected abstract NoteModificationResult |
handleUpdateNote(NoteStoringTO noteStoringTO,
Long noteId,
Set<String> additionalBlogNameIds) |
NoteModificationResult |
updateNote(NoteStoringTO noteStoringTO,
Long noteId,
Set<String> additionalBlogNameIds)
Updates an existing note with the data of the supplied transfer object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
correctTopicOfComment, getAutosave, getNote, getNote, getNoteCount, moveToTopic, noteExists, updateFollowableItems, updateLastDiscussionCreationDate
public NoteModificationResult createNote(NoteStoringTO noteStoringTO, Set<String> additionalBlogNameIds) throws BlogNotFoundException, NoteManagementAuthorizationException, NoteStoringPreProcessorException
NoteManagement
createNote
in interface NoteManagement
noteStoringTO
- The note to create.additionalBlogNameIds
- set of blog aliases for creating crossposts. These aliases will be ignore, if the
note is a comment to another note.BlogNotFoundException
- in case the target blog does not existNoteManagementAuthorizationException
- in case the user is not authorized to create the note, for instance if he has no
write access to the target blogNoteStoringPreProcessorException
- in case one of the pre processors failedpublic void deleteAutosave(Long noteId) throws NoteManagementAuthorizationException
deleteAutosave
in interface NoteManagement
noteId
- The notes id.NoteManagementAuthorizationException
- Thrown, when it is not possible to access the note.public void deleteNote(Long noteId, boolean deleteSystemPosts, boolean clientManagerCanDelete) throws NoteManagementAuthorizationException
deleteNote
in interface NoteManagement
noteId
- Id of the note to delete.deleteSystemPosts
- If true system notes will also be deleted.clientManagerCanDelete
- If true notes will also be deleted, if the current user is a client manager.NoteManagementAuthorizationException
- Thrown, when the user is not allowed to access the note.public Set<Long> deleteNotesOfUser(Long userId) throws AuthorizationException
deleteNotesOfUser
in interface NoteManagement
userId
- ID of the user whose notes should be deletedAuthorizationException
- in case the current user is not the internal system user, the client manager or
the creator of the notespublic List<SimpleNoteListItem> getCommentsOfDiscussion(Long noteId) throws NoteNotFoundException
getCommentsOfDiscussion
in interface NoteManagement
noteId
- the ID of the note whose discussion will be evaluatedNoteNotFoundException
- in case the note does not exist@Transactional(readOnly=true) public Long getDiscussionId(Long noteId) throws NoteNotFoundException
getDiscussionId
in interface NoteManagement
noteId
- the ID of the note for which the discussion ID should be returnedNoteNotFoundException
- in case the note does not exist@Transactional(readOnly=true) public DiscussionNoteData getNoteWithComments(Long noteId, QueryResultConverter<SimpleNoteListItem,DiscussionNoteData> converter) throws NoteNotFoundException, AuthorizationException
getNoteWithComments
in interface NoteManagement
noteId
- the id of the note to retrieveconverter
- the converter to use for filling the commentsNoteNotFoundException
- if the requested note does not existAuthorizationException
- if the current user has no read access to the notepublic int getNumberOfNotesInDiscussion(Long noteId) throws NoteNotFoundException
getNumberOfNotesInDiscussion
in interface NoteManagement
noteId
- the ID of the note whose discussion will be evaluatedNoteNotFoundException
- in case the note does not exist@Transactional(readOnly=true) public int getNumberOfReplies(Long noteId) throws NoteNotFoundException
NoteManagement
getNumberOfReplies
in interface NoteManagement
noteId
- the ID of the noteNoteNotFoundException
- Thrown, when the note doesn't exist.NoteService.getNumberOfReplies(Long)
protected Principal getPrincipal()
principal
if one has been set, otherwise returns
null
.protected abstract NoteModificationResult handleCreateNote(NoteStoringTO noteStoringTO, Set<String> additionalBlogNameIds) throws BlogNotFoundException, NoteManagementAuthorizationException, NoteStoringPreProcessorException
createNote(NoteStoringTO, Set)
protected abstract void handleDeleteAutosave(Long noteId) throws NoteManagementAuthorizationException
deleteAutosave(Long)
protected abstract void handleDeleteNote(Long noteId, boolean deleteSystemPosts, boolean clientManagerCanDelete) throws NoteManagementAuthorizationException
deleteNote(Long, boolean, boolean)
protected abstract Set<Long> handleDeleteNotesOfUser(Long userId) throws AuthorizationException
deleteNotesOfUser(Long)
AuthorizationException
protected abstract List<SimpleNoteListItem> handleGetCommentsOfDiscussion(Long noteId) throws NoteNotFoundException
getCommentsOfDiscussion(Long)
noteId
- the ID of the noteNoteNotFoundException
- in case the note does not existsprotected abstract Long handleGetDiscussionId(Long noteId) throws NoteNotFoundException
getDiscussionId(Long)
noteId
- the ID of the note for which the discussion ID should be returnedNoteNotFoundException
- in case the note does not existprotected abstract DiscussionNoteData handleGetNoteWithComments(Long noteId, QueryResultConverter<SimpleNoteListItem,DiscussionNoteData> converter) throws NoteNotFoundException, AuthorizationException
getNoteWithComments(Long, QueryResultConverter)
noteId
- the id of the note to retrieveconverter
- the converter to use for filling the commentsNoteNotFoundException
- if the requested note does not existAuthorizationException
- if the current user has no read access to the noteprotected abstract int handleGetNumberOfNotesInDiscussion(Long noteId) throws NoteNotFoundException
getNumberOfNotesInDiscussion(Long)
noteId
- the ID of the noteNoteNotFoundException
- in case the note does not existsprotected abstract int handleGetNumberOfReplies(Long noteId) throws NoteNotFoundException
getNumberOfReplies(Long)
NoteNotFoundException
protected abstract NoteModificationResult handleUpdateNote(NoteStoringTO noteStoringTO, Long noteId, Set<String> additionalBlogNameIds) throws NoteNotFoundException, NoteManagementAuthorizationException, NoteStoringPreProcessorException, BlogNotFoundException
public NoteModificationResult updateNote(NoteStoringTO noteStoringTO, Long noteId, Set<String> additionalBlogNameIds) throws NoteNotFoundException, NoteManagementAuthorizationException, NoteStoringPreProcessorException, BlogNotFoundException
updateNote
in interface NoteManagement
noteStoringTO
- The note to create.noteId
- the ID of the note to updateadditionalBlogNameIds
- set of blog aliases for creating crossposts. These aliases will be ignore, if the
note is a comment to another note.NoteNotFoundException
- in case the note to update does not existNoteManagementAuthorizationException
- in case the user is not authorized to update the note, for instance if he has no
write access to the blog or is not the author of the noteNoteStoringPreProcessorException
- in case one of the pre processors failedBlogNotFoundException
- in case the target blog does not existCopyright © 2019 Communote team. All rights reserved.