public class LinkBuilder extends Object
Action objects.
FILE: MyHandler.java
public ContentItem process(SampleConfig config)
throws CartridgeHandlerException {
LinkBuilder link = config.getLink();
Action linkAction = null;
try {
linkAction= link.createAction(
navigationStateBuilder, contentSource, pathProvider));
} catch (ContentException e) {
throw new CartridgeHandlerException(e);
}
config.setAction(linkAction);
return config;
}
| Modifier and Type | Class and Description |
|---|---|
static class |
LinkBuilder.LinkType
The types of links that the LinkBuilder supports.
|
| Constructor and Description |
|---|
LinkBuilder()
Default constructor.
|
LinkBuilder(String path)
Constructs a LinkBuilder model with the specified path.
|
LinkBuilder(String path,
LinkBuilder.LinkType linkType)
Constructs a LinkBuilder model with the specified path and link type.
|
LinkBuilder(String path,
LinkBuilder.LinkType linkType,
String queryString)
Constructs a LinkBuilder model with the specified path, link type and
queryString.
|
| Modifier and Type | Method and Description |
|---|---|
Action |
createAction(NavigationStateBuilder navigationStateBuilder,
ContentSource source,
ActionPathProvider pathProvider,
SiteState siteState)
Returns an action created from the path, link type and query string
of this LinkBuilder.
|
LinkBuilder.LinkType |
getLinkType() |
String |
getPath() |
String |
getQueryString() |
void |
setLinkType(LinkBuilder.LinkType linkType)
Sets the type of this link.
|
void |
setPath(String path)
Sets the path of this
Link. |
void |
setQueryString(String query)
Sets the query string.
|
public LinkBuilder()
public LinkBuilder(String path)
public LinkBuilder(String path, LinkBuilder.LinkType linkType)
public LinkBuilder(String path, LinkBuilder.LinkType linkType, String queryString)
public String getPath()
public void setPath(String path)
Link.path - the path of the URLpublic LinkBuilder.LinkType getLinkType()
public void setLinkType(LinkBuilder.LinkType linkType)
linkType - a link typeLinkBuilder.LinkTypepublic String getQueryString()
public void setQueryString(String query)
query - a query stringpublic Action createAction(NavigationStateBuilder navigationStateBuilder, ContentSource source, ActionPathProvider pathProvider, SiteState siteState) throws ContentException
navigationStateBuilder - used to create the navigation state
for the actionsource - the content source to use for resolving content URIs. If
linkType is LinkBuilder.LinkType.ABSOLUTE, or if no path is supplied to the
LinkBuilder (via either the constructor or the setPath(java.lang.String) method),
source is not used and may be null.pathProvider - if specified, will be used to fill in the action
path components for links that have no path configured. If linkType is
LinkBuilder.LinkType.ABSOLUTE, or a path is supplied to the LinkBuilder
(via the constructor or by calling setPath(java.lang.String)), pathProvider is not
used and may be null.ContentException - If the path was not specified and the
dimensions or record IDs are not valid.Copyright © 2014, Oracle and/or its affiliates. All rights reserved.