Package com.wavefront.slug.chart
Class ChartSlugBuilderImpl
- java.lang.Object
-
- com.wavefront.slug.chart.ChartSlugBuilderImpl
-
- All Implemented Interfaces:
ChartSlugBuilder
public class ChartSlugBuilderImpl extends Object implements ChartSlugBuilder
Builder implementation forChartSlugBuilderusingJackson RISON Lib(https://github.com/bazaarvoice/rison).- Author:
- Yutian Wu (wyutian@vmware.com)
-
-
Constructor Summary
Constructors Constructor Description ChartSlugBuilderImpl(SlugVersion slugVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ChartSlugBuilderImpladdFocusedHost(String hostName)Add a host that is focused upon when the page loads.ChartSlugBuilderImpladdSource(String name, String query)Add a new source query to the chart.ChartSlugBuilderImpladdSource(String name, String query, boolean disabled)Add a new source query to the chart.ChartSlugBuilderImpladdSource(String name, String query, boolean disabled, String queryBuilderSerialization, boolean queryBuilderEnabled)Add a new source query to the chart.Stringbuild()Build the chart slug.StringbuildAndEncode()Deprecated.StringbuildAndEscape()Build and escape the chart slug to be used in the chart url.ChartSlugBuilderImplsetBase(int base)Sets the base of the y-axis of the chart.ChartSlugBuildersetChartAttributes(String chartSettings)Sets the chart's attributes from a JSON serialized string.ChartSlugBuildersetChartSettings(ChartSettings chartSettings)Sets the chart's settings from a ChartSettings objects.ChartSlugBuildersetChartSettings(String chartSettings)Sets the chart's settings from a JSON serialized string.ChartSlugBuilderImplsetCompare(String compare)Sets the comparison option for the entire chart.ChartSlugBuilderImplsetCustomerId(String customerId)Set the customer id for the chart.ChartSlugBuildersetDescription(String description)Sets the description of the chart.ChartSlugBuilderImplsetEnd(long endMillis)Set the end millis.ChartSlugBuilderImplsetEnd(org.joda.time.ReadableInstant instant)Set the end millis.ChartSlugBuilderImplsetGranularity(String granularity)Set the granularity of the entire chart.ChartSlugBuilderImplsetId(String id)Set the chart id.ChartSlugBuilderImplsetName(String name)Set the name of the chart.ChartSlugBuilderImplsetStart(long startMillis)Set the start millis.ChartSlugBuilderImplsetStart(org.joda.time.ReadableInstant instant)Set the start instant.ChartSlugBuilderImplsetUnits(String units)Units to use for the chart (rendered to the right of the Y-axis).
-
-
-
Constructor Detail
-
ChartSlugBuilderImpl
public ChartSlugBuilderImpl(SlugVersion slugVersion)
-
-
Method Detail
-
setCustomerId
public ChartSlugBuilderImpl setCustomerId(String customerId)
Description copied from interface:ChartSlugBuilderSet the customer id for the chart.- Specified by:
setCustomerIdin interfaceChartSlugBuilder- Parameters:
customerId- Customer Id for the chart.- Returns:
- The builder.
-
setId
public ChartSlugBuilderImpl setId(String id)
Description copied from interface:ChartSlugBuilderSet the chart id. This is technically used only when redirected from a dashboard and defaults to "chart".- Specified by:
setIdin interfaceChartSlugBuilder- Parameters:
id- The id for the chart.- Returns:
- The builder.
-
setName
public ChartSlugBuilderImpl setName(String name)
Description copied from interface:ChartSlugBuilderSet the name of the chart.- Specified by:
setNamein interfaceChartSlugBuilder- Parameters:
name- Name of the chart.- Returns:
- The builder.
-
setStart
public ChartSlugBuilderImpl setStart(long startMillis)
Description copied from interface:ChartSlugBuilderSet the start millis.- Specified by:
setStartin interfaceChartSlugBuilder- Parameters:
startMillis- Start millis.- Returns:
- The builder.
-
setStart
public ChartSlugBuilderImpl setStart(org.joda.time.ReadableInstant instant)
Description copied from interface:ChartSlugBuilderSet the start instant.- Specified by:
setStartin interfaceChartSlugBuilder- Parameters:
instant- The start instant.- Returns:
- The builder.
-
setEnd
public ChartSlugBuilderImpl setEnd(long endMillis)
Description copied from interface:ChartSlugBuilderSet the end millis.- Specified by:
setEndin interfaceChartSlugBuilder- Parameters:
endMillis- End millis.- Returns:
- The builder.
-
setEnd
public ChartSlugBuilderImpl setEnd(org.joda.time.ReadableInstant instant)
Description copied from interface:ChartSlugBuilderSet the end millis.- Specified by:
setEndin interfaceChartSlugBuilder- Parameters:
instant- The end instant.- Returns:
- The builder.
-
setGranularity
public ChartSlugBuilderImpl setGranularity(String granularity)
Description copied from interface:ChartSlugBuilderSet the granularity of the entire chart. Valid values are determined by the FE. Possible values include: "m", "h", "d" and "auto". Defaults to "auto".- Specified by:
setGranularityin interfaceChartSlugBuilder- Parameters:
granularity- The granularity to use.- Returns:
- The builder.
-
setCompare
public ChartSlugBuilderImpl setCompare(String compare)
Description copied from interface:ChartSlugBuilderSets the comparison option for the entire chart. Valid values are determined by the FE. Possible values include: "1d", "1w", "1m". Defaults to null.- Specified by:
setComparein interfaceChartSlugBuilder- Parameters:
compare- Comparison option to set for the chart.- Returns:
- The builder.
-
setUnits
public ChartSlugBuilderImpl setUnits(String units)
Description copied from interface:ChartSlugBuilderUnits to use for the chart (rendered to the right of the Y-axis).- Specified by:
setUnitsin interfaceChartSlugBuilder- Parameters:
units- Units to use for the chart.- Returns:
- The builder.
-
setBase
public ChartSlugBuilderImpl setBase(int base)
Description copied from interface:ChartSlugBuilderSets the base of the y-axis of the chart. Value must be >= 1. A value of 1 indicates that a linear y-axis should be used.- Specified by:
setBasein interfaceChartSlugBuilder- Parameters:
base- Y-axis base.- Returns:
- The builder.
-
setDescription
public ChartSlugBuilder setDescription(String description)
Description copied from interface:ChartSlugBuilderSets the description of the chart.- Specified by:
setDescriptionin interfaceChartSlugBuilder- Parameters:
description- chart description.- Returns:
- The builder.
-
setChartSettings
public ChartSlugBuilder setChartSettings(String chartSettings)
Description copied from interface:ChartSlugBuilderSets the chart's settings from a JSON serialized string.- Specified by:
setChartSettingsin interfaceChartSlugBuilder- Parameters:
chartSettings- chart settings string- Returns:
- The builder.
-
setChartSettings
public ChartSlugBuilder setChartSettings(ChartSettings chartSettings)
Description copied from interface:ChartSlugBuilderSets the chart's settings from a ChartSettings objects.- Specified by:
setChartSettingsin interfaceChartSlugBuilder- Parameters:
chartSettings- chart settings string- Returns:
- The builder.
-
setChartAttributes
public ChartSlugBuilder setChartAttributes(String chartSettings)
Description copied from interface:ChartSlugBuilderSets the chart's attributes from a JSON serialized string.- Specified by:
setChartAttributesin interfaceChartSlugBuilder- Parameters:
chartSettings- chart settings string- Returns:
- The builder.
-
addSource
public ChartSlugBuilderImpl addSource(String name, String query)
Description copied from interface:ChartSlugBuilderAdd a new source query to the chart.- Specified by:
addSourcein interfaceChartSlugBuilder- Parameters:
name- Name of the query.query- The query.- Returns:
- The builder.
-
addSource
public ChartSlugBuilderImpl addSource(String name, String query, boolean disabled)
Description copied from interface:ChartSlugBuilderAdd a new source query to the chart.- Specified by:
addSourcein interfaceChartSlugBuilder- Parameters:
name- Name of the query.query- The query.disabled- True if this query should be disabled (unchecked) in the chart.- Returns:
- The builder.
-
addSource
public ChartSlugBuilderImpl addSource(String name, String query, boolean disabled, String queryBuilderSerialization, boolean queryBuilderEnabled)
Description copied from interface:ChartSlugBuilderAdd a new source query to the chart.- Specified by:
addSourcein interfaceChartSlugBuilder- Parameters:
name- Name of the query.query- The query.disabled- True if this query should be disabled (unchecked) in the chart.queryBuilderSerialization- Serialization of the querybuilderqueryBuilderEnabled- True if the querybuilder is enabled- Returns:
- The builder.
-
addFocusedHost
public ChartSlugBuilderImpl addFocusedHost(String hostName)
Description copied from interface:ChartSlugBuilderAdd a host that is focused upon when the page loads. The chart must contain queries that yield host tags (e.g. host=abcd01 or host=*) for focusing to work.- Specified by:
addFocusedHostin interfaceChartSlugBuilder- Parameters:
hostName- Host name for series tagged by it to be focused on.- Returns:
- The builder.
-
build
public String build()
Description copied from interface:ChartSlugBuilderBuild the chart slug.- Specified by:
buildin interfaceChartSlugBuilder- Returns:
- The chart slug.
-
buildAndEscape
public String buildAndEscape()
Description copied from interface:ChartSlugBuilderBuild and escape the chart slug to be used in the chart url.- Specified by:
buildAndEscapein interfaceChartSlugBuilder
-
buildAndEncode
@Deprecated public String buildAndEncode()
Deprecated.This only works in v1 slugs, as it encodes special characters as well. So the result it generated will only be v1 slugs.- Specified by:
buildAndEncodein interfaceChartSlugBuilder
-
-