Fluent builder for a JsMetricType, obtained from an app's controllerMappings.newMetricTypeBuilder(). An app configures the id, title, calculation function and applicable entity types on the builder and calls build to register the metric type with the platform.

Group: Builders

Extends: AbstractFieldsBuilder


Properties

PropertyReturnsDescription
applicableEntitiesList<MetricEntity>The applicable entity types set on this builder so far.
calcFnStringThe calculation function name configured on this builder so far.
descriptionStringThe description configured on this builder so far.
fieldsList<ExtraField>The configurable fields set on this builder so far.
idStringThe metric type id configured on this builder so far.
titleStringThe title configured on this builder so far.

Methods

build() · id(String s) · additive(boolean b) · title(String s) · description(String s) · calcFn(String s) · fields(List<ExtraField> s) · applicableEntities(List<MetricEntity> s) · applicableToOrg() · applicableToProfile() · getId() · setId(String id) · getTitle() · setTitle(String title) · getFields() · setFields(List<ExtraField> fields) · getApplicableEntities() · setApplicableEntities(List<MetricEntity> applicableEntities) · getDescription() · setDescription(String description) · getCalcFn() · setCalcFn(String calcFn)

build()

Returns: JsMetricType

Builds the JsMetricType from the values configured on this builder, and registers it against the owning app's controller mapping list while the app is still initialising.

id(String s)

Returns: JsMetricTypeBuilder

Sets the unique identifier for the metric type, used elsewhere to reference it by metricTypeId.

ParameterDescription
sthe metric type id

additive(boolean b)

Returns: JsMetricTypeBuilder

True (default) indicates that values for different periods can be added to give a total. False indicates that values cannot meaningfully be added, such as average values

ParameterDescription
btrue if values are additive across periods

title(String s)

Returns: JsMetricTypeBuilder

Sets the display title of the metric type.

ParameterDescription
sthe title

description(String s)

Returns: JsMetricTypeBuilder

Sets the descriptive text shown for metrics that use this metric type.

ParameterDescription
sthe description

calcFn(String s)

Returns: JsMetricTypeBuilder

Sets the name of the JS function that calculates the metric value. The function is called with the rule parameters, the entity, the start and end dates and a CalcContext, and must return a numeric value.

ParameterDescription
sthe name of the calculation function

fields(List<ExtraField> s)

Returns: JsMetricTypeBuilder

Sets the configurable fields that a metric using this metric type can be given values for, such as filter or grouping parameters.

ParameterDescription
sthe list of fields

applicableEntities(List<MetricEntity> s)

Returns: JsMetricTypeBuilder

Sets which entity types (profile, org, or both) a metric using this metric type can apply to.

ParameterDescription
sthe list of applicable entity types

applicableToOrg()

Returns: JsMetricTypeBuilder

Adds org to the list of entity types this metric type applies to.

applicableToProfile()

Returns: JsMetricTypeBuilder

Adds profile to the list of entity types this metric type applies to.

getId()

Returns: String

The metric type id configured on this builder so far.

setId(String id)

Returns: void

Sets the metric type id.

ParameterDescription
idthe metric type id

getTitle()

Returns: String

The title configured on this builder so far.

setTitle(String title)

Returns: void

Sets the title.

ParameterDescription
titlethe title

getFields()

Returns: List<ExtraField>

The configurable fields set on this builder so far.

setFields(List<ExtraField> fields)

Returns: void

Sets the configurable fields.

ParameterDescription
fieldsthe list of fields

getApplicableEntities()

Returns: List<MetricEntity>

The applicable entity types set on this builder so far.

setApplicableEntities(List<MetricEntity> applicableEntities)

Returns: void

Sets the applicable entity types.

ParameterDescription
applicableEntitiesthe list of applicable entity types

getDescription()

Returns: String

The description configured on this builder so far.

setDescription(String description)

Returns: void

Sets the description.

ParameterDescription
descriptionthe description

getCalcFn()

Returns: String

The calculation function name configured on this builder so far.

setCalcFn(String calcFn)

Returns: void

Sets the name of the JS function that calculates the metric value.

ParameterDescription
calcFnthe name of the calculation function
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.