Package org.ametys.cms.data
Class RichText
- java.lang.Object
-
- org.ametys.cms.data.Resource
-
- org.ametys.cms.data.RichText
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,List<String>>
_annotations
the rich text's annotationsprotected Map<String,NamedResource>
_fetchedAttachments
the files contained in the rich textprotected RepositoryData
_folderData
The resource's repository dataprotected Collection<String>
_removedAttachments
the files contained in the rich text-
Fields inherited from class org.ametys.cms.data.Resource
_buffer, _encoding, _lastModificationDate, _mimeType, _repositoryData, _tmpFile
-
-
Constructor Summary
Constructors Constructor Description RichText()
Default constructorRichText(RepositoryData richTextData, RepositoryData folderData)
Constructor to use when reading the rich text from the repository
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotations(String name, String... values)
Add annotations to the rich textvoid
addAttachment(NamedResource attachment)
Adds an attachment to the rich textMap<String,List<String>>
getAllAnnotations()
Retrieves the rich text's annotationsList<String>
getAnnotations(String name)
Retrieves the rich text's annotations of the given nameNamedResource
getAttachment(String filename)
Retrieves the rich text's attachment with the given name, ornull
if there is no such attachmentCollection<String>
getAttachmentNames()
Retrieves the names of the rich text's attachmentsCollection<NamedResource>
getAttachments()
Retrieves the rich text's attachmentsCollection<NamedResource>
getFetchedAttachments()
Retrieves the attachments that have already been fetchedCollection<String>
getRemovedAttachments()
Retrieves 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
removeAllAnnotations()
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
removeAttachments()
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 data-
Methods inherited from class org.ametys.cms.data.Resource
closeOutputStream, getEncoding, getInputStream, getLastModificationDate, getLength, getMimeType, getOutputStream, getRepositoryData, setInputStream, setLastModificationDate
-
-
-
-
Field Detail
-
_annotations
protected Map<String,List<String>> _annotations
the rich text's annotations
-
_folderData
protected RepositoryData _folderData
The resource's repository data
-
_fetchedAttachments
protected Map<String,NamedResource> _fetchedAttachments
the files contained in the rich text
-
_removedAttachments
protected Collection<String> _removedAttachments
the files contained in the rich text
-
-
Constructor Detail
-
RichText
public RichText()
Default constructor
-
RichText
public RichText(RepositoryData richTextData, RepositoryData folderData)
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 Detail
-
setMimeType
public void setMimeType(String mimeType)
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
public void setEncoding(String encoding)
Description copied from class:Resource
Sets the encoding of the resource's data- Overrides:
setEncoding
in classResource
- Parameters:
encoding
- the encoding to set
-
getAllAnnotations
public Map<String,List<String>> getAllAnnotations()
Retrieves the rich text's annotations- Returns:
- the rich text's annotations
-
getAnnotations
public List<String> getAnnotations(String name)
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
public void addAnnotations(String name, String... values)
Add annotations to the rich text- Parameters:
name
- the name of the annotations to addvalues
- annotations to add
-
removeAllAnnotations
public void removeAllAnnotations()
Removes all rich text's annotations
-
removeAnnotations
public void removeAnnotations(String name)
Removes the rich text's annotations of the given name- Parameters:
name
- the name of the annotations to remove
-
getAttachmentNames
public Collection<String> getAttachmentNames()
Retrieves the names of the rich text's attachments- Returns:
- the names of the rich text's attachments
-
getAttachments
public Collection<NamedResource> getAttachments()
Retrieves the rich text's attachments- Returns:
- the rich text's attachments
-
getFetchedAttachments
public Collection<NamedResource> getFetchedAttachments()
Retrieves the attachments that have already been fetched- Returns:
- the fetched attachments
-
getRemovedAttachments
public Collection<String> getRemovedAttachments()
Retrieves the names of the removed attachments of the rich text- Returns:
- the names of the removed attachments
-
hasAttachment
public boolean hasAttachment(String filename)
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
public NamedResource getAttachment(String filename)
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
public void addAttachment(NamedResource attachment)
Adds an attachment to the rich text- Parameters:
attachment
- the attachment to add
-
removeAttachment
public void removeAttachment(String filename)
Remove an attachment from the rich text- Parameters:
filename
- the name of the attachment to remove
-
removeAttachments
public void removeAttachments()
Remove all the attachments from the rich text
-
-