Fluent builder for a Metric, obtained from newMetricBuilder or QueryManager.newMetricBuilder. Configure the required properties and call build to produce the immutable Metric instance. If durationUnit is set, build also assembles the metric's MetricCacheConfig, and its MetricPrecalcConfig if precalcDataSeriesName is set.
Group: Builders
Properties
| Property | Returns | Description |
|---|---|---|
| appliesTo | Set<String> | The appliesTo identifiers configured on this builder so far. |
| dateMode | DateMode | The date mode configured on this builder so far. |
| decimals | int | The number of decimal places configured on this builder so far. |
| endDate | Date | The constant end date configured on this builder so far. |
| entityName | String | The entity name configured on this builder so far. |
| entitySelection | EntitySelection | The entity selection configured on this builder so far. |
| icon | String | The icon configured on this builder so far. |
| id | String | The metric id configured on this builder so far. |
| metricTypeId | String | The metric type id configured on this builder so far. |
| notes | String | The notes configured on this builder so far. |
| params | Map<String,String> | The calculation parameters configured on this builder so far. |
| startDate | Date | The constant start date configured on this builder so far. |
| title | String | The title configured on this builder so far. |
| unit | String | The unit label configured on this builder so far. |
| unitPosition | UnitPosition | The unit position configured on this builder so far. |
Methods
build() · precalcDurationUnit(String s) · precalcDurationMultiple(Integer s) · precalcRunAsUser(String s) · precalcEntityType(String type) · durationUnit(TimeUnit units) · ignoreDates(boolean b) · decimals(int s) · id(String s) · title(String s) · icon(String s) · metricTypeId(String s) · entitySelection(EntitySelection s) · entitySelection(String s) · entityName(String s) · dateMode(DateMode s) · startDate(Date s) · endDate(Date s) · params(Map<String,String> s) · appliesTo(Set<String> s) · notes(String s) · param(String key, String value) · appliesTo(NamedObject ob) · unit(String s) · unitPosition(UnitPosition s) · unitPosition(String s) · getId() · getTitle() · getIcon() · getDecimals() · getMetricTypeId() · getEntitySelection() · getEntityName() · getDateMode() · getStartDate() · getEndDate() · getParams() · getAppliesTo() · getNotes() · getUnit() · getUnitPosition()
build()
Returns: Metric
Builds the immutable Metric from the values configured on this builder. If durationUnit has been set, this also assembles the metric's MetricCacheConfig, and a MetricPrecalcConfig if precalcDataSeriesName is set.
precalcDurationUnit(String s)
Returns: MetricBuilder
Sets the time unit used to bucket pre-calculated data for this metric.
| Parameter | Description |
|---|---|
s | the name of a MetricCacheConfig.TimeUnit value |
precalcDurationMultiple(Integer s)
Returns: MetricBuilder
Sets how many precalcDurationUnit periods elapse between pre-calculation runs.
| Parameter | Description |
|---|---|
s | the duration multiple |
precalcRunAsUser(String s)
Returns: MetricBuilder
Sets the user the pre-calculation process runs as.
| Parameter | Description |
|---|---|
s | the username to run pre-calculation as |
precalcEntityType(String type)
Returns: MetricBuilder
Adds an entity type (an org type or group name) that this metric should be pre-calculated for.
| Parameter | Description |
|---|---|
type | the entity type to add |
durationUnit(TimeUnit units)
Returns: MetricBuilder
Sets the time unit used to bucket this metric's cache, enabling caching for this metric.
| Parameter | Description |
|---|---|
units | the cache duration unit |
ignoreDates(boolean b)
Returns: MetricBuilder
Sets whether the metric's cache ignores the requested date range.
| Parameter | Description |
|---|---|
b | true to ignore dates when reading or writing the cache |
decimals(int s)
Returns: MetricBuilder
Sets the number of decimal places the calculated value should be displayed with.
| Parameter | Description |
|---|---|
s | the number of decimal places |
id(String s)
Returns: MetricBuilder
Sets the metric's unique identifier.
| Parameter | Description |
|---|---|
s | the metric id |
title(String s)
Returns: MetricBuilder
Sets the metric's display title.
| Parameter | Description |
|---|---|
s | the title |
icon(String s)
Returns: MetricBuilder
Sets the icon shown alongside the metric, typically a font icon class name such as "fa-users".
| Parameter | Description |
|---|---|
s | the icon |
metricTypeId(String s)
Returns: MetricBuilder
Sets the id of the MetricType that calculates this metric's value.
| Parameter | Description |
|---|---|
s | the metric type id |
entitySelection(EntitySelection s)
Returns: MetricBuilder
Sets which entity this metric is calculated against.
| Parameter | Description |
|---|---|
s | the entity selection |
entitySelection(String s)
Returns: MetricBuilder
Sets which entity this metric is calculated against, given as the name of an EntitySelection value.
| Parameter | Description |
|---|---|
s | the name of an EntitySelection value |
entityName(String s)
Returns: MetricBuilder
Sets the name of the entity this metric applies to, used with the specifiedProfile and specifiedOrg entity selections.
| Parameter | Description |
|---|---|
s | the entity name |
dateMode(DateMode s)
Returns: MetricBuilder
Sets how the date range for this metric's calculation is derived.
| Parameter | Description |
|---|---|
s | the date mode |
startDate(Date s)
Returns: MetricBuilder
Sets a constant start date to use instead of the standard query dates.
| Parameter | Description |
|---|---|
s | the start date |
endDate(Date s)
Returns: MetricBuilder
Sets a constant end date to use instead of the standard query dates.
| Parameter | Description |
|---|---|
s | the end date |
params(Map<String,String> s)
Returns: MetricBuilder
Sets the additional parameters passed through to the metric type's calculation function.
| Parameter | Description |
|---|---|
s | a map of parameter name to value |
appliesTo(Set<String> s)
Returns: MetricBuilder
Sets the identifiers for what this metric is used for.
| Parameter | Description |
|---|---|
s | the set of identifiers this metric applies to |
notes(String s)
Returns: MetricBuilder
Sets free text notes about this metric.
| Parameter | Description |
|---|---|
s | the notes |
param(String key, String value)
Returns: MetricBuilder
Adds a single key and value to this metric's params map, creating the map if it does not already exist.
| Parameter | Description |
|---|---|
key | the parameter name |
value | the parameter value |
appliesTo(NamedObject ob)
Returns: MetricBuilder
Adds an identifier for the given named object to this metric's appliesTo set, formed from the object's class name and its object name.
| Parameter | Description |
|---|---|
ob | the object this metric applies to |
unit(String s)
Returns: MetricBuilder
Sets the unit label shown alongside the metric's value.
| Parameter | Description |
|---|---|
s | the unit label |
unitPosition(UnitPosition s)
Returns: MetricBuilder
Sets whether the unit label is displayed before or after the value.
| Parameter | Description |
|---|---|
s | the unit position |
unitPosition(String s)
Returns: MetricBuilder
Sets whether the unit label is displayed before or after the value, given as the name of a UnitPosition value.
| Parameter | Description |
|---|---|
s | the name of a UnitPosition value |
getId()
Returns: String
The metric id configured on this builder so far.
getTitle()
Returns: String
The title configured on this builder so far.
getIcon()
Returns: String
The icon configured on this builder so far.
getDecimals()
Returns: int
The number of decimal places configured on this builder so far.
getMetricTypeId()
Returns: String
The metric type id configured on this builder so far.
getEntitySelection()
Returns: EntitySelection
The entity selection configured on this builder so far.
getEntityName()
Returns: String
The entity name configured on this builder so far.
getDateMode()
Returns: DateMode
The date mode configured on this builder so far.
getStartDate()
Returns: Date
The constant start date configured on this builder so far.
getEndDate()
Returns: Date
The constant end date configured on this builder so far.
getParams()
Returns: Map<String,String>
The calculation parameters configured on this builder so far.
getAppliesTo()
Returns: Set<String>
The appliesTo identifiers configured on this builder so far.
getNotes()
Returns: String
The notes configured on this builder so far.
getUnit()
Returns: String
The unit label configured on this builder so far.
getUnitPosition()
Returns: UnitPosition
The unit position configured on this builder so far.