Class: AnnotationBean

bean.base. AnnotationBean

Contains annotation information

Provides for non-documentation notes and annotations to be embedded in data and structure messages.

It provides optional fields for providing a Title, a Type, a URI, and any additional Text.


new AnnotationBean( [json])

Parameters:
Name Type Argument Description
json object <optional>

The json to build this object from, if none supplied, default json will be created

Extends

Methods


clone()

Return a copy of this structure

Inherited From:

getAgencyId()

Returns the Id of the Agency who is responsible for maintaining this structure

Inherited From:
Returns:

The Agency Id

Type
string

getClassType( [bean])

Get the name of the class of this object

Parameters:
Name Type Argument Default Description
bean boolean <optional>
false

If true, the word "bean" will be omitted

Inherited From:
Throws:

If the first argument is supplied but not a boolean

Type
TypeError
Returns:

Name of the class type (constructor)

Type
string
Example
let myCodelist = new CodelistBean(jsonFromServer);
myCodelist.getClassType(); // returns 'CodelistBean' 
myCodelist.getClassType(true); // returns 'Codelist' 

getGuid()

Returns a non-editable unique Identifier for this bean, for client side only.

This GUID is generated automatically on the client on construction, the GUID is completely random and will not be the same for a structure with the same URN if the physical object differes.

Inherited From:
Returns:

An immutable string containing the a unique identifier for this structure

Type
string
Example
var jsonCL = 'get JSON from server
var codelist1 = new Codelist(jsonCL);
var codelist2 = new Codelist(jsonCL);

console.log(codelist1.getUrn() === codelist2.getUrn()); //outputs true
console.log(codelist1._guid() === codelist2._guid()); //outputs false

getId()

Get the Id of this Annotation

Returns:

The id

Type
string

getMaintainableParent()

Returns the bean.base.MaintainableBean to which which this structure belongs. All structures must either be a MaintainableBean or be contained within a MaintainableBean.

If this class is a MaintainableBean, then it will return itself as MaintainableBean is the outermost container for all structures

Inherited From:
Returns:

This objects maintainable parent

Type
bean.base.MaintainableBean
Example
var annualCode = myCodeList.getItem("A");
annualCode.getMaintainableParent() // returns 'myCodeList'

getParent( [clazz])

Get the parent structure for which this structure is contained

Parameters:
Name Type Argument Description
clazz object <optional>

If supplied will walk up the parent hierarchy until the parent is of this type

Inherited From:
Returns:

The parent for this object

Type
bean.base.Bean
Example
var dsd = dimension.getParent(DataStructureBean); // note that 'DataStructureBean' is not a string but a Class

getText()

Gets the text of this Annotation.

The locale is determined by the language which is set in util.LocaleUtils.CURRENT_LANGUAGE

Returns:

an Object locale: {"locale":"locale", "value":"value"}

Type
object

getTextByLocale()

Gets the text of this Annotation for the given locale.

Returns:

text in the given locale, or null if there is no text in the given locale

Type
string

getTexts()

Gets the text of this Annotation.

Text is language-specific, this returns an array of Objects each containing a locale and a value.

Returns:

Array of Object locals: {"locale":"locale", "value":"value"}

Type
Array.<object>

getTitle()

Get the Title of this Annotation

Returns:

The title

Type
string

getType()

Get the Type of this Annotation

Type used to distinguish between Annotations designed to support various uses.

The types are not enumerated, as these can be specified by the user or creator of the annotations.

The definitions and use of annotation types should be documented by their creator.

Returns:

The type

Type
string

getUri()

Get the URI of this Annotation, the URI is used to reference additional resources

Returns:

The URI

Type
string

toString()

Returns a string that represents this Bean.

If this Bean is an bean.base.IdentifiableBean then this will output the URN, otherwise the GUID will be returned

Inherited From:
Returns:

The URN or GUID

Type
string
Example
let myCodelist = new CodelistBean(jsonFromServer);
myCodelist.toString() // returns: 'urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_FREQ(1.0)'