Home Manual Reference Source
import Metric from 'pvbid-sdk/src/domain/Metric.js'
public class | source

Metric

Extends:

eventemitter3~EventEmitterAdvanceEventEmitterBidEntity → Metric

Metric Class

Constructor Summary

Public Constructor
public

constructor(metricData: object, bid: Bid)

Creates an instance of Metric.

Member Summary

Public Members
public get
public set
public

bid: Bid

Reference to the bid that the metric belongs to.

public get
public get
this get was deprecated. Definition ids will become obsolete in planned data structure upgrade.

Gets the metrics's definition id.

public get
public set

Method Summary

Public Methods
public

assess()

Assess metric for changes.

public

bind()

Binds the "updated" event for all dependant bid entities.

public

Gets an array of bid entities that rely on the metric

public

Gets an array of bid entities that the metric relies on.

public

dirty()

Flags the metric and corresponding bid as dirty and to be saved.

public

exportData(alwaysIncludeConfig: boolean): object

Exports intermal metric data.

public

Get the metric assembly if it has one

public

Determines if the metric has any null dependencies

public

Determines if metric instance is dirty.

public

reset()

Resets the metric, removing any override value.

public

Adds the metric to an assembly.

public

unsetAssembly(): void

Removes any assembly reference from the metric.

Inherited Summary

From class AdvanceEventEmitter
public

Maximum number of events fired for the requester before events stop.

public

on(eventName: string, requesterId: string, callback: function)

public

onDelay(eventName: string, ms: number, requesterId: string, callback: function)

public

removeListenerByRequester(eventName: string, requesterId: string)

Removes event listeners by event and requesterId.

From class BidEntity
public get

Determine if the entity is in an assembly

public get

Gets the id of the bid entity.

public get

Gets the bid entity title.

public set

Sets the bid entity title.

public get

Gets the bid entity type.

public abstract

assess(dependency: BidEntity)

Assesses bid entity.

public

Gets an array of depndants that rely on the bid entity.

public

Gets all the dependencies that the bid entity relies on.

public

dirty()

Flags the bid entity as dirty and to be saved.

public

Exports the internal data for the bid entity.

public

Determines if bid entity relies on a null or undefined dependency value

public

async initSaveChangeLog(originalValue: *, newValue: *, valueType: *, entityProperty: *, metaData: *): *

public

Determines of bid entity is dirty.

public

Marks the bid entity as clean.

Public Constructors

public constructor(metricData: object, bid: Bid) source

Creates an instance of Metric.

Override:

BidEntity#constructor

Params:

NameTypeAttributeDescription
metricData object
bid Bid

Public Members

public get actualValue: number source

public set actualValue: number source

public bid: Bid source

Reference to the bid that the metric belongs to.

public get config: object source

public get definitionId: number source

this get was deprecated. Definition ids will become obsolete in planned data structure upgrade.

Gets the metrics's definition id.

public get value: number source

public set value: number source

Public Methods

public assess() source

Assess metric for changes.

Override:

BidEntity#assess

Emit:

assessing

fires event before assessement.

assessed

fires after assessment is complete.

updated

fires only if there has been a change.

public bind() source

Binds the "updated" event for all dependant bid entities.

public dependants(): BidEntity[] source

Gets an array of bid entities that rely on the metric

Override:

BidEntity#dependants

Return:

BidEntity[]

public dependencies(): BidEntity[] source

Gets an array of bid entities that the metric relies on.

Override:

BidEntity#dependencies

Return:

BidEntity[]

public dirty() source

Flags the metric and corresponding bid as dirty and to be saved.

Override:

BidEntity#dirty

public exportData(alwaysIncludeConfig: boolean): object source

Exports intermal metric data.

Override:

BidEntity#exportData

Params:

NameTypeAttributeDescription
alwaysIncludeConfig boolean
  • optional
  • default: false

Will include config object in export regardless of changed status.

Return:

object

public getAssembly(): Assembly | undefined source

Get the metric assembly if it has one

Return:

Assembly | undefined

public hasNullDependency(): * source

Determines if the metric has any null dependencies

Override:

BidEntity#hasNullDependency

Return:

*

public isDirty(): boolean source

Determines if metric instance is dirty.

Override:

BidEntity#isDirty

Return:

boolean

public reset() source

Resets the metric, removing any override value.

public setAssembly(assembly: Assembly | string): Assembly source

Adds the metric to an assembly.

Params:

NameTypeAttributeDescription
assembly Assembly | string

The assembly entity or an assembly ref id

Return:

Assembly

the new assembly setting

public unsetAssembly(): void source

Removes any assembly reference from the metric.

Return:

void