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
SyncStatusenumeration.Transactional behavior: The caller is responsible for committing the respective
ResourceResolverafter 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.StringgetContent()Gets the content of the variation in a suitable text representation.java.lang.StringgetContentType()Gets the MIME type of the variation.@NotNull java.util.CalendargetCreated()Gets the creation date for the variation.java.lang.StringgetDescription()Gets a description for the variation.java.lang.StringgetName()Gets the (technical) name of the variation.SyncStatusgetSyncStatus()Gets the synchronization status of the variation.java.lang.StringgetTitle()Gets the (human-readable) title of the variation.FragmentDatagetValue()Gets the current value of the variation in a suitable object representation.voidsetContent(java.lang.String content, java.lang.String contentType)Sets the content of the variation from the provided text value.voidsetDescription(java.lang.String description)Sets the current description of the variation in the provided object representation.voidsetTitle(java.lang.String title)Sets the current title of the variation in the provided object representation.voidsetValue(FragmentData object)Sets the current value of the variation in the provided object representation.voidsynchronize()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 ContentFragmentExceptionSets 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 ContentFragmentExceptionSets 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.DataTypeprovides 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
DataTypefor 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 ContentFragmentExceptionSets 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
ContentFragmentExceptionif 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 aContentFragmentExceptionbecause 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 ContentFragmentExceptionSynchronizes 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
-
-