Package io.wcm.handler.link.type
Class MediaLinkType
- java.lang.Object
-
- io.wcm.handler.link.spi.LinkType
-
- io.wcm.handler.link.type.MediaLinkType
-
@Model(adaptables={org.apache.sling.api.SlingHttpServletRequest.class,org.apache.sling.api.resource.Resource.class}) @ProviderType public final class MediaLinkType extends LinkType
Default implementation ofLinkType
for media links. Media links are links to media items from media sources that implement theMediaSource
interface.
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.String
ID
Link type ID
-
Constructor Summary
Constructors Constructor Description MediaLinkType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(@NotNull java.lang.String linkRef)
Checks whether a link reference string can be handled by this link type@Nullable java.lang.String
getEditComponentResourceType()
Granite UI component resource type to be used for editing this link type's properties in edit dialog.@NotNull java.lang.String
getId()
@NotNull java.lang.String
getLabel()
java.lang.String
getPrimaryLinkRefProperty()
static @NotNull org.apache.sling.api.resource.Resource
getSyntheticLinkResource(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull java.lang.String path, @NotNull java.lang.String mediaRef)
Get synthetic link resource for this link type.boolean
hasRichTextPlugin()
Returns true if a RTE plugin is available for this link type.static boolean
isDefaultMediaContentPath(java.lang.String path)
@NotNull Link
resolveLink(@NotNull Link link)
Resolves a linkjava.lang.String
toString()
-
-
-
Field Detail
-
ID
@NotNull public static final @NotNull java.lang.String ID
Link type ID- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
@NotNull public @NotNull java.lang.String getId()
-
getLabel
@NotNull public @NotNull java.lang.String getLabel()
-
getPrimaryLinkRefProperty
public java.lang.String getPrimaryLinkRefProperty()
- Specified by:
getPrimaryLinkRefProperty
in classLinkType
- Returns:
- Name of the property in which the primary link reference is stored
-
getEditComponentResourceType
@Nullable public @Nullable java.lang.String getEditComponentResourceType()
Description copied from class:LinkType
Granite UI component resource type to be used for editing this link type's properties in edit dialog.- Overrides:
getEditComponentResourceType
in classLinkType
- Returns:
- Granite UI component resource type or null, if none is available
-
hasRichTextPlugin
public boolean hasRichTextPlugin()
Description copied from class:LinkType
Returns true if a RTE plugin is available for this link type. If not, it is not possible to select this link type in the rich text editor.- Overrides:
hasRichTextPlugin
in classLinkType
- Returns:
- true if a RTE plugin is available.
-
accepts
public boolean accepts(@NotNull @NotNull java.lang.String linkRef)
Description copied from class:LinkType
Checks whether a link reference string can be handled by this link type
-
resolveLink
@NotNull public @NotNull Link resolveLink(@NotNull @NotNull Link link)
Description copied from class:LinkType
Resolves a link- Specified by:
resolveLink
in classLinkType
- Parameters:
link
- Link metadata- Returns:
- Resolved link metadata. Never null.
-
isDefaultMediaContentPath
public static boolean isDefaultMediaContentPath(java.lang.String path)
- Parameters:
path
- Content path- Returns:
- true if Path is located below DAM default root folders.
-
getSyntheticLinkResource
@NotNull public static @NotNull org.apache.sling.api.resource.Resource getSyntheticLinkResource(@NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull @NotNull java.lang.String path, @NotNull @NotNull java.lang.String mediaRef)
Get synthetic link resource for this link type.- Parameters:
resourceResolver
- Resource resolverpath
- Resource path. Can be a non-existing path, but the path should be located somewhere within the applications content paths to make sure the handler configuration looked up via context-aware services is the expected one.mediaRef
- Media asset reference- Returns:
- Synthetic link resource
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-