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 private static String__ATTACHMENT_CONTENT_IDENTIFIERprivate static Set<String>__AVAILABLE_ENCODINGS_FOR_RICH_TEXTprivate static Set<String>__AVAILABLE_MIME_TYPES_FOR_RICH_TEXTprotected Map<String,List<String>>_annotationsthe rich text's annotationsprotected Map<String,NamedResource>_fetchedAttachmentsthe files contained in the rich textprotected RepositoryData_folderDataThe resource's repository dataprotected Collection<String>_removedAttachmentsthe 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 private void_fetchAttachment(String filename)private void_fetchAttachments()voidaddAnnotations(String name, String... values)Add annotations to the rich textvoidaddAttachment(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 nameNamedResourcegetAttachment(String filename)Retrieves the rich text's attachment with the given name, ornullif 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 textbooleanhasAttachment(String filename)Checks if the rich text has an attachment with the given namevoidremoveAllAnnotations()Removes all rich text's annotationsvoidremoveAnnotations(String name)Removes the rich text's annotations of the given namevoidremoveAttachment(String filename)Remove an attachment from the rich textvoidremoveAttachments()Remove all the attachments from the rich textvoidsetEncoding(String encoding)Sets the encoding of the resource's datavoidsetMimeType(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, setInputStream, setLastModificationDate
-
-
-
-
Field Detail
-
__ATTACHMENT_CONTENT_IDENTIFIER
private static final String __ATTACHMENT_CONTENT_IDENTIFIER
- See Also:
- Constant Field Values
-
__AVAILABLE_MIME_TYPES_FOR_RICH_TEXT
private static final Set<String> __AVAILABLE_MIME_TYPES_FOR_RICH_TEXT
-
__AVAILABLE_ENCODINGS_FOR_RICH_TEXT
private static final Set<String> __AVAILABLE_ENCODINGS_FOR_RICH_TEXT
-
_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:ResourceSets the mime type of the resource's data- Overrides:
setMimeTypein classResource- Parameters:
mimeType- the mime type to set
-
setEncoding
public void setEncoding(String encoding)
Description copied from class:ResourceSets the encoding of the resource's data- Overrides:
setEncodingin 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
-
_fetchAttachments
private void _fetchAttachments()
-
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:
trueif the rich text has an attachment with the given name,falseotherwise
-
getAttachment
public NamedResource getAttachment(String filename)
Retrieves the rich text's attachment with the given name, ornullif there is no such attachment- Parameters:
filename- the name of the attachment to retrieve- Returns:
- the rich text's attachment with the given name
-
_fetchAttachment
private void _fetchAttachment(String filename)
-
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
-
-