Interface DAMContentFragment
-
- All Superinterfaces:
ComponentExporter
- All Known Subinterfaces:
ContentFragment
@ConsumerType public interface DAMContentFragment extends ComponentExporter
Defines the API for a DAM content fragment used by thecontent fragment component
and thecontent fragment list component
. The model provides information about the referenced content fragment and access to representations of its elements.- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DAMContentFragment.DAMContentElement
Represents a content element of a content fragment.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JSON_PN_ELEMENTS
Name of the property (in JSON export) that provides an object containing the elements of the content fragment; the keys of the object properties refer to the element namesstatic java.lang.String
JSON_PN_ELEMENTS_ORDER
Name of the property (in JSON export) that provides an array containing the names of the elements of the content fragment in the correct orderstatic java.lang.String
JSON_PN_MODEL
Name of the property (in JSON export) that provides the path to the model of the content fragment
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default @Nullable java.util.List<Resource>
getAssociatedContent()
Returns a list of resources representing the collections that are associated to this content fragment.default @Nullable java.lang.String
getDescription()
Returns the description of the content fragment.default @NotNull java.lang.String
getEditorJSON()
Returns a JSON format string containing information about this fragment.default @Nullable java.util.List<DAMContentFragment.DAMContentElement>
getElements()
Returns a list of content fragment elements.default @NotNull java.util.Map<java.lang.String,DAMContentFragment.DAMContentElement>
getExportedElements()
Returns a map of elements that are used for creating the JSON export.default @NotNull java.lang.String[]
getExportedElementsOrder()
Returns the names of the elements in the correct order.default @NotNull java.lang.String
getExportedType()
Returns the type of the resource for which the export is performed.default @NotNull java.lang.String
getName()
Returns the technical name of the content fragment.default @Nullable java.lang.String
getTitle()
Returns the title of the content fragment.default @Nullable java.lang.String
getType()
Returns the type of the content fragment.
-
-
-
Field Detail
-
JSON_PN_MODEL
static final java.lang.String JSON_PN_MODEL
Name of the property (in JSON export) that provides the path to the model of the content fragment- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
- Constant Field Values
-
JSON_PN_ELEMENTS
static final java.lang.String JSON_PN_ELEMENTS
Name of the property (in JSON export) that provides an object containing the elements of the content fragment; the keys of the object properties refer to the element names- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
- Constant Field Values
-
JSON_PN_ELEMENTS_ORDER
static final java.lang.String JSON_PN_ELEMENTS_ORDER
Name of the property (in JSON export) that provides an array containing the names of the elements of the content fragment in the correct order- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTitle
@Nullable default @Nullable java.lang.String getTitle()
Returns the title of the content fragment.- Returns:
- the title of the content fragment
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
ContentFragment.getTitle()
-
getName
@NotNull default @NotNull java.lang.String getName()
Returns the technical name of the content fragment.- Returns:
- the technical name of the content fragment
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.3.0
- See Also:
ContentFragment.getName()
-
getDescription
@Nullable default @Nullable java.lang.String getDescription()
Returns the description of the content fragment.- Returns:
- the description of the content fragment
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
ContentFragment.getDescription()
-
getType
@Nullable default @Nullable java.lang.String getType()
Returns the type of the content fragment. The type is a string that uniquely identifies the model or template of the content fragment (e.g. "my-project/models/my-model" for a structured or "/content/dam/my-cf/jcr:content/model" for a text-only content fragment).- Returns:
- the type of the content fragment
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
-
getElements
@Nullable default @Nullable java.util.List<DAMContentFragment.DAMContentElement> getElements()
Returns a list of content fragment elements. The list contains the elements whose names are specified in the propertyContentFragment.PN_ELEMENT_NAMES
(in that order, and skipping non-existing elements). IfContentFragment.PN_ELEMENT_NAMES
is not set, then all elements are returned, in the order in which they occur in the content fragment.- Returns:
- a selection or all of the content fragment's elements
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
ContentFragment.getElements()
-
getExportedElements
@NotNull default @NotNull java.util.Map<java.lang.String,DAMContentFragment.DAMContentElement> getExportedElements()
Returns a map of elements that are used for creating the JSON export. The keys of the map determine the name of the element. The value holds the Sling Model that is used for the export. The map only contains elements that are configured through the propertyContentFragment.PN_ELEMENT_NAMES
or all elements if the property is not set.- Returns:
- a map containing the elements that are subject to be exported
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
-
getExportedElementsOrder
@NotNull default @NotNull java.lang.String[] getExportedElementsOrder()
Returns the names of the elements in the correct order. The names correspond to the keys of the map returned bygetExportedElements()
.- Returns:
- Array that determines the order of the elements
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
-
getAssociatedContent
@Nullable default @Nullable java.util.List<Resource> getAssociatedContent()
Returns a list of resources representing the collections that are associated to this content fragment.- Returns:
- a list of collection resources
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
- See Also:
getAssociatedContent()
-
getExportedType
@NotNull default @NotNull java.lang.String getExportedType()
Returns the type of the resource for which the export is performed.- Specified by:
getExportedType
in interfaceComponentExporter
- Returns:
- the type of the resource
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
-
getEditorJSON
@NotNull default @NotNull java.lang.String getEditorJSON()
Returns a JSON format string containing information about this fragment.- Returns:
- JSON string
- Since:
- com.adobe.cq.wcm.core.components.models.contentfragment 1.0.0
-
-