Interface ContentVariation
-
- All Superinterfaces:
Versionable
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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.@NotNull java.util.Calendar
getCreated()
Gets the creation date for 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.-
Methods inherited from interface com.adobe.cq.dam.cfm.Versionable
createVersion, getVersionedContent, listVersions
-
-
-
-
Method Detail
-
getName
java.lang.String getName()
Gets the (technical) name of the variation.- Returns:
- The name of the variation
-
getTitle
java.lang.String getTitle()
Gets the (human-readable) title of the variation.- Returns:
- The title of the variation
-
setTitle
void setTitle(java.lang.String title) throws ContentFragmentException
Sets the current title of the variation in the provided object representation.
- Parameters:
title
- The new title of the variation- Throws:
ContentFragmentException
- if the provided value couldn't be persisted
-
getDescription
java.lang.String getDescription()
Gets a description for the variation.- Returns:
- The description
-
setDescription
void setDescription(java.lang.String description) throws ContentFragmentException
Sets the current description of the variation in the provided object representation.
- Parameters:
description
- The new description of the variation- Throws:
ContentFragmentException
- if the provided value couldn't be persisted
-
getValue
FragmentData 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 callsetValue(FragmentData)
explicitly after manipulating the value.DataType
provides additional information about how values are handled by the system.- Returns:
- The value
- Since:
- 1.1
-
setValue
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.- Parameters:
object
- The value- Throws:
ContentFragmentException
- if the provided value couldn't be persisted or doesn't match the data type of the variation- Since:
- 1.1
-
getContentType
java.lang.String getContentType()
Gets the MIME type of the variation.- Returns:
- The MIME type; refers to some text format
-
getContent
java.lang.String getContent()
Gets the content of the variation in a suitable text representation.- Returns:
- The content of the variation (in a text representation)
-
setContent
void setContent(java.lang.String content, java.lang.String contentType) throws ContentFragmentException
Sets the content of the variation from the provided text value.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 bygetContent()
can successfully be converted bysetContent(String, String)
. In other words,el.setContent(el.getContent(), el.getContentType()
must not throw aContentFragmentException
because of type conversion problems.- Parameters:
content
- The contentcontentType
- The MIME type of the content- Throws:
ContentFragmentException
- 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 type
-
getSyncStatus
SyncStatus getSyncStatus()
Gets the synchronization status of the variation.- Returns:
- The synchronization state of the provided variation
-
synchronize
void synchronize() throws ContentFragmentException
Synchronizes the variation.
- Throws:
ContentFragmentException
- if the synchronization failed
-
getCreated
@NotNull @NotNull java.util.Calendar getCreated()
Gets the creation date for the variation.- Returns:
- the creation date for the variation
-
-