@ProviderType public interface ContentVariation extends Versionable
Implementations of this interface allow to access a variation of a content element through a stable API, agnostic to the underlying content structure.
Variations can be synchronized with some other element. If the implementation does not provide enhances synchronization capabilities (which it is free to do), it should synchronize with the element content.
The synchronization works by using the synchronization source, taking their content, optionally applying some rules and then updating the variation with that content.
How the synchronization source is defined and how the source content is processed is implementation specific. This API only provides means to manage the synchronization state and triggering the synchronization.
The synchronization state is represented by the SyncStatus
enumeration.
Transactional behavior: The caller is responsible for committing the respective
ResourceResolver
after calling one or more
methods that change a content fragment unless specified otherwise.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContent()
Gets the content of the variation in a suitable text representation.
|
java.lang.String |
getContentType()
Gets the MIME type of the variation.
|
java.lang.String |
getDescription()
Gets a description for the variation.
|
java.lang.String |
getName()
Gets the (technical) name of the variation.
|
SyncStatus |
getSyncStatus()
Gets the synchronization status of the variation.
|
java.lang.String |
getTitle()
Gets the (human-readable) title of the variation.
|
FragmentData |
getValue()
Gets the current value of the variation in a suitable object representation.
|
void |
setContent(java.lang.String content,
java.lang.String contentType)
Sets the content of the variation from the provided text value.
|
void |
setDescription(java.lang.String description)
Sets the current description of the variation in the provided object representation.
|
void |
setTitle(java.lang.String title)
Sets the current title of the variation in the provided object representation.
|
void |
setValue(FragmentData object)
Sets the current value of the variation in the provided object representation.
|
void |
synchronize()
Synchronizes the variation.
|
createVersion, getVersionedContent, listVersions
java.lang.String getName()
java.lang.String getTitle()
void setTitle(java.lang.String title) throws ContentFragmentException
Sets the current title of the variation in the provided object representation.
title
- The new title of the variationContentFragmentException
- if the provided value couldn't be persistedjava.lang.String getDescription()
void setDescription(java.lang.String description) throws ContentFragmentException
Sets the current description of the variation in the provided object representation.
description
- The new description of the variationContentFragmentException
- if the provided value couldn't be persistedFragmentData getValue()
Gets the current value of the variation in a suitable object representation.
Note that if you change the returned FragmentData
, you will have to
call setValue(FragmentData)
explicitly after manipulating the value.
DataType
provides additional information about how values are handled
by the system.
void setValue(FragmentData object) throws ContentFragmentException
Sets the current value of the variation in the provided object representation.
Please see DataType
for more information about what "object
representation" means.
object
- The valueContentFragmentException
- if the provided value couldn't be persisted or
doesn't match the data type of the variationjava.lang.String getContentType()
java.lang.String getContent()
void setContent(java.lang.String content, java.lang.String contentType) throws ContentFragmentException
The specified content & its MIME type must be textual. What MIME types are eventually supported is left to the implementation.
For non-textual data types (added in 1.1), a MIME type of text/plain
should be specified. The implementation is then responsible for translating the
provided text value into a suitable object representation (or throw a
ContentFragmentException
if this is not possible). How the text value is
converted into a suitable object value is left to the implementation. But it is
required that a value returned by getContent()
can successfully be
converted by setContent(String, String)
. In other words,
el.setContent(el.getContent(), el.getContentType()
must not throw a
ContentFragmentException
because of type conversion problems.
content
- The contentcontentType
- The MIME type of the contentContentFragmentException
- if the content could not be written or the provided
text could not be converted to the data type of the
underlying element correctlyjava.lang.IllegalArgumentException
- if the specified MIME type is not supported or not
a textual MIME typeSyncStatus getSyncStatus()
void synchronize() throws ContentFragmentException
Synchronizes the variation.
ContentFragmentException
- if the synchronization failedCopyright © 2010 - 2020 Adobe. All Rights Reserved