Package org.ametys.cms.data
Class RichText
java.lang.Object
org.ametys.cms.data.Resource
org.ametys.cms.data.RichText
CLass representing a rich text
-
Field Summary
Modifier and TypeFieldDescriptionthe rich text's annotationsprotected Map<String,
NamedResource> the files contained in the rich textprotected RepositoryData
The resource's repository dataprotected Collection<String>
the files contained in the rich textFields inherited from class org.ametys.cms.data.Resource
_buffer, _encoding, _lastModificationDate, _mimeType, _repositoryData, _tmpFile
-
Constructor Summary
ConstructorDescriptionRichText()
Default constructorRichText
(RepositoryData richTextData, RepositoryData folderData) Constructor to use when reading the rich text from the repository -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotations
(String name, String... values) Add annotations to the rich textvoid
addAttachment
(NamedResource attachment) Adds an attachment to the rich textRetrieves the rich text's annotationsgetAnnotations
(String name) Retrieves the rich text's annotations of the given namegetAttachment
(String filename) Retrieves the rich text's attachment with the given name, ornull
if there is no such attachmentRetrieves the names of the rich text's attachmentsRetrieves the rich text's attachmentsRetrieves the attachments that have already been fetchedRetrieves the names of the removed attachments of the rich textboolean
hasAttachment
(String filename) Checks if the rich text has an attachment with the given namevoid
Removes all rich text's annotationsvoid
removeAnnotations
(String name) Removes the rich text's annotations of the given namevoid
removeAttachment
(String filename) Remove an attachment from the rich textvoid
Remove all the attachments from the rich textvoid
setEncoding
(String encoding) Sets the encoding of the resource's datavoid
setMimeType
(String mimeType) Sets the mime type of the resource's dataMethods inherited from class org.ametys.cms.data.Resource
closeOutputStream, getEncoding, getInputStream, getLastModificationDate, getLength, getMimeType, getOutputStream, getRepositoryData, setInputStream, setLastModificationDate
-
Field Details
-
_annotations
the rich text's annotations -
_folderData
The resource's repository data -
_fetchedAttachments
the files contained in the rich text -
_removedAttachments
the files contained in the rich text
-
-
Constructor Details
-
RichText
public RichText()Default constructor -
RichText
Constructor to use when reading the rich text from the repository- Parameters:
richTextData
- the repository data containing the rich text's datafolderData
- the repository data containing the folder's data
-
-
Method Details
-
setMimeType
Description copied from class:Resource
Sets the mime type of the resource's data- Overrides:
setMimeType
in classResource
- Parameters:
mimeType
- the mime type to set
-
setEncoding
Description copied from class:Resource
Sets the encoding of the resource's data- Overrides:
setEncoding
in classResource
- Parameters:
encoding
- the encoding to set
-
getAllAnnotations
Retrieves the rich text's annotations- Returns:
- the rich text's annotations
-
getAnnotations
Retrieves the rich text's annotations of the given name- Parameters:
name
- the name of the annotations to retrieve- Returns:
- the rich text's annotations of the given name
-
addAnnotations
Add annotations to the rich text- Parameters:
name
- the name of the annotations to addvalues
- annotations to add
-
removeAllAnnotations
Removes all rich text's annotations -
removeAnnotations
Removes the rich text's annotations of the given name- Parameters:
name
- the name of the annotations to remove
-
getAttachmentNames
Retrieves the names of the rich text's attachments- Returns:
- the names of the rich text's attachments
-
getAttachments
Retrieves the rich text's attachments- Returns:
- the rich text's attachments
-
getFetchedAttachments
Retrieves the attachments that have already been fetched- Returns:
- the fetched attachments
-
getRemovedAttachments
Retrieves the names of the removed attachments of the rich text- Returns:
- the names of the removed attachments
-
hasAttachment
Checks if the rich text has an attachment with the given name- Parameters:
filename
- the name of the attachment- Returns:
true
if the rich text has an attachment with the given name,false
otherwise
-
getAttachment
Retrieves the rich text's attachment with the given name, ornull
if there is no such attachment- Parameters:
filename
- the name of the attachment to retrieve- Returns:
- the rich text's attachment with the given name
-
addAttachment
Adds an attachment to the rich text- Parameters:
attachment
- the attachment to add
-
removeAttachment
Remove an attachment from the rich text- Parameters:
filename
- the name of the attachment to remove
-
removeAttachments
Remove all the attachments from the rich text
-