public class BinaryLink extends AbstractLink
BinaryLink
class provides functionality to link to a binary
resource based on a tcm:uri. Besides validating that the Binary is
available on the Delivery System, it also makes sure that the correct name and
path are used to link to existing binaries.Constructor and Description |
---|
BinaryLink(int publicationId)
This constructor instantiates a new BinaryLink object using a publication id.
|
BinaryLink(String publicationURI)
This constructor instantiates a new BinaryLink object using a publication URI.
|
BinaryLink(String namespace,
int publicationId,
boolean relativeLink)
This constructor instantiates a new BinaryLink object using a publication id and a namespace prefix.
|
Modifier and Type | Method and Description |
---|---|
Link |
getLink(CMURI binaryComponentURI,
String variantId)
The
getLink method tries to find the location of the binary and wraps
this location in a Link object. |
Link |
getLink(String binaryComponentURI,
String anchor,
String linkText,
String linkTagAttributes,
boolean showTextOnFail)
The
getLink method tries to find the location of the binary and wraps
this location in a Link object. |
Link |
getLink(String binaryComponentURI,
String variantId,
String anchor,
String linkText,
String linkTagAttributes,
boolean showTextOnFail)
The
getLink method tries to find the location of the binary and wraps
this location in a Link object. |
Link |
getLink(String binaryComponentURI,
String variantId,
String anchor,
String linkText,
String binaryUrl,
String linkTagAttributes,
boolean showTextOnFail) |
String |
getLinkAsString(String binaryComponentURI,
String anchor,
String linkText,
String linkTagAttributes,
boolean showTextOnFail)
The
getLinkAsString method calls the getLink method to
create a link object. |
String |
getLinkAsString(String binaryComponentURI,
String variantId,
String anchor,
String linkText,
String linkTagAttributes,
boolean showTextOnFail) |
String |
getLinkAsString(String binaryComponentURI,
String variantId,
String anchor,
String linkText,
String binaryUrl,
String linkTagAttributes,
boolean showTextOnFail)
The
getLinkAsString method calls the getLink method to
create a link object. |
getBaseNamespaceId, getErrorList, getFullyQualifiedURL, getLinking, getNamespace, getNamespaceService, getPublicationId, getURL, isRelativeLink, isWrappedCacheDAO, setPublicationId
public BinaryLink(int publicationId)
publicationId
- The id of the publication in which the targeted binary is located.public BinaryLink(String namespace, int publicationId, boolean relativeLink)
namespace
- The namespace of the publication in which the targeted binary is located. tcm or ishpublicationId
- The id of the publication in which the targeted binary is located.relativeLink
- If true then the realtive URL will be returned from a Link
object
despite on linking configuration.public BinaryLink(String publicationURI)
publicationURI
- The uri of the publication in which the targeted binary is
located.public Link getLink(String binaryComponentURI, String anchor, String linkText, String linkTagAttributes, boolean showTextOnFail)
getLink
method tries to find the location of the binary and wraps
this location in a Link
object.binaryComponentURI
- The binaryComponentURI of the binary to be linked to.anchor
- The anchor on the page where the link has to be
pointing to. Use an empty String
or null
for this in normal
situations.linkText
- The linkText for the linklinkTagAttributes
- Attributes to include in the link.showTextOnFail
- Indicated if the linkText parameter should be used if the link does not
validate.public Link getLink(CMURI binaryComponentURI, String variantId)
getLink
method tries to find the location of the binary and wraps
this location in a Link
object.binaryComponentURI
- The binaryComponentURI of the binary to be linked to.variantId
- The id of the variant of the binary to be linked topublic Link getLink(String binaryComponentURI, String variantId, String anchor, String linkText, String linkTagAttributes, boolean showTextOnFail)
getLink
method tries to find the location of the binary and wraps
this location in a Link
object.binaryComponentURI
- The binaryComponentURI of the binary to be linked to.variantId
- The id of the variant of the binary to be linked toanchor
- The anchor on the page where the link has to be
pointing to. Use an empty String
or null
for this in normal
situations.linkText
- The linkText for the linklinkTagAttributes
- Attributes to include in the link.showTextOnFail
- Indicated if the linkText parameter should be used if the link does not
validate.public Link getLink(String binaryComponentURI, String variantId, String anchor, String linkText, String binaryUrl, String linkTagAttributes, boolean showTextOnFail)
public String getLinkAsString(String binaryComponentURI, String variantId, String anchor, String linkText, String binaryUrl, String linkTagAttributes, boolean showTextOnFail)
getLinkAsString
method calls the getLink
method to
create a link object. After this, it calls toString()
on this
Link
-object and returns this as a return value.binaryComponentURI
- The binaryComponentURI of the binary to be linked to.variantId
- The variant id of the binary to be linked to.anchor
- The anchor on the page where the link has to be
pointing to. Use an empty String
or null
for this in normal
situations.linkText
- The linkText for the linklinkTagAttributes
- Attributes to include in the link.showTextOnFail
- Indicated if the linkText parameter should be used if the link does not
resolve or validate.true
the linkText if it doesn't and if
showTextOnFail is false
"".public String getLinkAsString(String binaryComponentURI, String variantId, String anchor, String linkText, String linkTagAttributes, boolean showTextOnFail)
public String getLinkAsString(String binaryComponentURI, String anchor, String linkText, String linkTagAttributes, boolean showTextOnFail)
getLinkAsString
method calls the getLink
method to
create a link object. After this, it calls toString()
on this
Link
-object and returns this as a return value.binaryComponentURI
- The binaryComponentURI of the binary to be linked to.anchor
- The anchor on the page where the link has to be
pointing to. Use an empty String
or null
for this in normal
situations.linkText
- The linkText for the linklinkTagAttributes
- Attributes to include in the link.showTextOnFail
- Indicated if the linkText parameter should be used if the link does not
resolve or validate.true
the linkText if it doesn't and if
showTextOnFail is false
"".Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries