public final class NoteResourceHelper extends Object
NoteResourceHandler
Modifier and Type | Class and Description |
---|---|
static class |
NoteResourceHelper.NoteResourceComparator
Comparator to sort note resources by their creation date in ascending order
|
Modifier and Type | Method and Description |
---|---|
static void |
buildNoteResourceAttachments(NoteData note,
NoteResource newNoteResource)
Build the attachment part of the note
|
static void |
buildNoteResourceNotifications(NoteData note,
NoteResource newNoteResource)
Build the notification part of the note
|
static NoteStoringTO |
buildNoteStoringTO(CreateNoteParameter createNoteParameter)
Get note storing transferobject
|
static NoteStoringTO |
buildNoteStoringTO(EditNoteParameter editNoteParameter)
Get note storing transferobject
|
static TagResource[] |
buildTags(Collection<TagData> tagListItems)
Build TagResources form Collection of
TagData |
static String |
checkNoteText(String text,
Boolean isHtml,
Integer maxTextLength)
Check the text of an note
|
static NoteQueryParameters |
configureQueryInstance(GetCollectionNoteParameter noteCollectionParameter,
QueryParametersParameterNameProvider nameProvider,
Locale locale)
Get query instance to filter notes
|
static NoteRenderContext |
createNoteRenderContext(Boolean filterHtml,
boolean beautifyPlainText,
javax.ws.rs.core.Request request)
Creates a suitable note render context.
|
static PageableList<NoteData> |
getPageableList(NoteQueryParameters noteQueryInstance,
NoteRenderContext renderContext)
Get a
PageableList of a NoteQueryParameters |
static void |
setToForParameterUnspecificElements(Boolean isHtml,
NoteStoringTO noteStoringTO)
Set elements of
NoteStoringTO object that are the same in create or edit method |
static List<NoteResource> |
sortAndLimitNotes(List<NoteResource> notesToSort,
Integer maxCount)
Sort the notes by date in ascending order and return a subset that contains at most maxCount
notes, starting with the oldest
|
public static void buildNoteResourceAttachments(NoteData note, NoteResource newNoteResource)
note
- note of NoteData
newNoteResource
- NoteResource
public static void buildNoteResourceNotifications(NoteData note, NoteResource newNoteResource)
note
- note of NoteData
newNoteResource
- NoteResource
public static NoteStoringTO buildNoteStoringTO(CreateNoteParameter createNoteParameter) throws IllegalRequestParameterException
createNoteParameter
- parameters to create an noteNoteStoringTO
IllegalRequestParameterException
- text value is wrongpublic static NoteStoringTO buildNoteStoringTO(EditNoteParameter editNoteParameter) throws IllegalRequestParameterException
editNoteParameter
- parameters to edit an noteNoteStoringTO
IllegalRequestParameterException
- text value is wrongpublic static TagResource[] buildTags(Collection<TagData> tagListItems)
TagData
tagListItems
- Collection of TagData
TagResource
public static String checkNoteText(String text, Boolean isHtml, Integer maxTextLength) throws IllegalRequestParameterException
text
- textContent of the notisHtml
- is content htmlmaxTextLength
- max length of text for noteIllegalRequestParameterException
- text value is wrongpublic static NoteQueryParameters configureQueryInstance(GetCollectionNoteParameter noteCollectionParameter, QueryParametersParameterNameProvider nameProvider, Locale locale)
noteCollectionParameter
- Extract context parameter needed for filternameProvider
- The name provider.locale
- locale of the current userpublic static NoteRenderContext createNoteRenderContext(Boolean filterHtml, boolean beautifyPlainText, javax.ws.rs.core.Request request)
filterHtml
- if true the content should be returned as plain textbeautifyPlainText
- if true beautifications can be applied when creating the plain text. Will be
ignored if filterHtml is false.request
- the current requestpublic static PageableList<NoteData> getPageableList(NoteQueryParameters noteQueryInstance, NoteRenderContext renderContext)
PageableList
of a NoteQueryParameters
noteQueryInstance
- the prepared query instancerenderContext
- the render context to usePageableList
public static void setToForParameterUnspecificElements(Boolean isHtml, NoteStoringTO noteStoringTO)
NoteStoringTO
object that are the same in create or edit methodisHtml
- is note text content htmlnoteStoringTO
- NoteStoringTO
public static List<NoteResource> sortAndLimitNotes(List<NoteResource> notesToSort, Integer maxCount)
notesToSort
- the notes to sortmaxCount
- parameters to get a collection of notesCopyright © 2019 Communote team. All rights reserved.