|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.link.LinkUtil
public class LinkUtil
Utility methods for various operations necessary for link transformations and handling. This is actually a Business Facade providing an entry point to the link transformations. Hence it will be renamed to LinkManager (MAGNOLIA-4765) soon.
Field Summary | |
---|---|
static String |
DEFAULT_EXTENSION
|
static String |
DEFAULT_REPOSITORY
|
static Pattern |
EXTERNAL_LINK_PATTERN
Pattern that matches external and mailto: links. |
static Pattern |
LINK_OR_IMAGE_PATTERN
Pattern to find a link. |
static Pattern |
LINK_PATTERN
Pattern to find a link. |
static Pattern |
UUID_PATTERN
Pattern to find a magnolia formatted uuid link. |
Constructor Summary | |
---|---|
LinkUtil()
|
Method Summary | |
---|---|
static void |
addParameter(StringBuffer uri,
String name,
String value)
Appends a parameter to the given url, using ?, or & if there are already parameters in the given url. |
static String |
convertAbsoluteLinksToUUIDs(String html)
Parses provided html and transforms all the links to the magnolia format. |
static String |
convertLinksFromUUIDPattern(String str)
|
static String |
convertLinksFromUUIDPattern(String str,
LinkTransformer transformer)
Converts provided html with links in UUID pattern format to any other kind of links based on provided link transformer. |
static String |
convertUUIDtoHandle(String uuid,
String workspaceName)
Transforms a uuid to a handle beginning with a /. |
static String |
convertUUIDtoURI(String uuid,
String workspaceName)
Transforms a uuid to an uri. |
static String |
createAbsoluteLink(Content content)
Deprecated. Since 5.0 use LinkUtil.createAbsoluteLink(Node) instead. |
static String |
createAbsoluteLink(javax.jcr.Node node)
Creates absolute link including context path to the provided node and performing all URI2Repository mappings and applying locales. |
static String |
createAbsoluteLink(NodeData nodedata)
Deprecated. Since 5.0 use LinkUtil.createAbsoluteLink(Property) instead. |
static String |
createAbsoluteLink(javax.jcr.Property property)
Creates absolute link including context path for provided Property. |
static String |
createAbsoluteLink(String workspaceName,
String uuid)
Creates absolute link including context path to the provided content and performing all URI2Repository mappings and applying locales. |
static String |
createExternalLink(Content content)
Deprecated. Since 5.0 use LinkUtil.createExternalLink(Node) instead. |
static String |
createExternalLink(javax.jcr.Node node)
Creates a complete url to access given node from external systems applying all the URI2Repository mappings and locales. |
static String |
createLink(Content node)
Deprecated. Since 5.0 use LinkUtil.createLink(Node) instead. |
static String |
createLink(javax.jcr.Node node)
Creates link guessing best possible link format from current site and provided node. |
static String |
createLink(NodeData nodedata)
Deprecated. Since 5.0 use LinkUtil.createAbsoluteLink(Property) instead. |
static String |
createLink(javax.jcr.Property property)
Creates link guessing best possible link format from current site and provided Property. |
static String |
createLink(String workspaceName,
String uuid)
Creates link guessing best possible link format from current site and provided content. |
static Link |
createLinkInstance(Content node)
Deprecated. Since 5.0 use LinkUtil.createLinkInstance(Node) instead. |
static Link |
createLinkInstance(javax.jcr.Node node)
Creates Link to provided Node. |
static Link |
createLinkInstance(NodeData nodeData)
Deprecated. Since 5.0 use LinkUtil.createLinkInstance(Property) instead. |
static Link |
createLinkInstance(javax.jcr.Property property)
|
static Link |
createLinkInstance(String workspaceName,
String uuid)
Creates link to the content denoted by repository and uuid. |
static Link |
createLinkInstance(String workspaceName,
String path,
String extension,
String anchor,
String parameters)
Creates link to the content identified by the repository and path. |
static Link |
createLinkInstance(String uuid,
String workspaceName,
String fallbackHandle,
String nodeDataName,
String extension,
String anchor,
String parameters)
Creates link based on provided parameters. |
static boolean |
isExternalLinkOrAnchor(String href)
Determines whether the given link is external link or anchor (i.e. |
static boolean |
isInternalRelativeLink(String href)
Determines if the given link is internal and relative. |
static String |
makePathRelative(String url,
String absolutePath)
Make a absolute path relative. |
static String |
mapPathToRepository(String path)
Maps a path to a repository. |
static Link |
parseLink(String link)
Parses provided URI to the link. |
static Link |
parseUUIDLink(String uuidLink)
Parses UUID link pattern string and converts it into a Link object. |
static String |
toPattern(Link link)
Converts provided Link to an UUID link pattern. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Pattern EXTERNAL_LINK_PATTERN
public static final String DEFAULT_EXTENSION
public static final String DEFAULT_REPOSITORY
public static final Pattern LINK_OR_IMAGE_PATTERN
public static Pattern UUID_PATTERN
public static final Pattern LINK_PATTERN
Constructor Detail |
---|
public LinkUtil()
Method Detail |
---|
public static String convertUUIDtoHandle(String uuid, String workspaceName) throws LinkException
LinkException
public static String convertUUIDtoURI(String uuid, String workspaceName) throws LinkException
Link.getHandle()
,
this method will apply all uri to repository mappings as well as i18n.
LinkException
public static String convertAbsoluteLinksToUUIDs(String html)
html
- html code with links to be converted
public static String convertLinksFromUUIDPattern(String str, LinkTransformer transformer) throws LinkException
str
- Html with UUID linkstransformer
- Link transformer
LinkException
LinkTransformerManager
public static String convertLinksFromUUIDPattern(String str) throws LinkException
LinkException
public static boolean isInternalRelativeLink(String href)
public static boolean isExternalLinkOrAnchor(String href)
public static String makePathRelative(String url, String absolutePath)
absolutePath
- absolute pathurl
- page to be relative to
public static String mapPathToRepository(String path)
path
- URI
public static void addParameter(StringBuffer uri, String name, String value)
public static String createAbsoluteLink(NodeData nodedata) throws LinkException
nodedata
- Node data to create link for.
LinkException
AbstractI18nContentSupport
public static String createAbsoluteLink(javax.jcr.Property property) throws LinkException
property
-
LinkException
public static String createAbsoluteLink(String workspaceName, String uuid) throws javax.jcr.RepositoryException
uuid
- UUID of content to create link to.workspaceName
- Name of the repository where content is located.
javax.jcr.RepositoryException
AbstractI18nContentSupport
public static String createAbsoluteLink(Content content)
content
- content to create link to.
AbstractI18nContentSupport
public static String createAbsoluteLink(javax.jcr.Node node)
node
-
public static String createExternalLink(Content content)
public static String createExternalLink(javax.jcr.Node node)
node
- public static String createLink(Content node)
nodedata
- Node data to create link for.
AbstractI18nContentSupport
public static String createLink(javax.jcr.Node node)
node
- Node to create link for.
public static String createLink(NodeData nodedata) throws LinkException
nodedata
- Node data to create link for.
LinkException
AbstractI18nContentSupport
public static String createLink(javax.jcr.Property property) throws LinkException
property
- Property to create link for.
LinkException
public static String createLink(String workspaceName, String uuid) throws javax.jcr.RepositoryException
uuid
- UUID of content to create link to.workspaceName
- Name of the repository where content is located.
javax.jcr.RepositoryException
AbstractI18nContentSupport
public static Link createLinkInstance(Content node)
node
-
public static Link createLinkInstance(javax.jcr.Node node)
node
-
public static Link createLinkInstance(NodeData nodeData) throws LinkException
nodeData
-
LinkException
public static Link createLinkInstance(javax.jcr.Property property) throws LinkException
LinkException
public static Link createLinkInstance(String workspaceName, String uuid) throws LinkException
workspaceName
- Parent repository of the content of interest.uuid
- UUID of the content to create link to.
LinkException
public static Link createLinkInstance(String workspaceName, String path, String extension, String anchor, String parameters) throws LinkException
workspaceName
- Source repository for the content.path
- Path to the content of interest.extension
- Optional extension to be used in the linkanchor
- Optional link anchor.parameters
- Optional link parameters.
LinkException
public static Link createLinkInstance(String uuid, String workspaceName, String fallbackHandle, String nodeDataName, String extension, String anchor, String parameters) throws LinkException
Link
object,
pointing to the non existing uuid so that broken link detection tools can find it.
uuid
- UUID of the contentworkspaceName
- Content repository name.fallbackHandle
- Optional fallback content handle.nodeDataName
- Content node data name for binary data.extension
- Optional link extension.anchor
- Optional link anchor.parameters
- Optional link parameters.
LinkException
public static Link parseUUIDLink(String uuidLink) throws LinkException
uuidLink
- String containing reference to content as a UUID link pattern.
LinkException
public static Link parseLink(String link) throws LinkException
link
- URI representing path to piece of content
LinkException
public static String toPattern(Link link)
link
- Link to convert.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |