Class: DataStructureBean

bean.datastructure. DataStructureBean

Represents a DataStructure


new DataStructureBean( [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:

getAgency(callback)

Resolves and returns the Agency who is responsible for maintaining this structure

Parameters:
Name Type Description
callback function

the callback function which should accept the Agency as a parameter argument

Inherited From:
Returns:

The Agency ID

Type
string
Example
maint.getAgency(onAgencyResponse);

function onAgencyResponse(acy) {
  console.log(acy.getName());
}

getAgencyId()

Returns the Id of the Agency that is responsible for maintaining this structure.

Inherited From:
Returns:

the Agency ID

Type
string

getAnnotations()

Returns an array of bean.base.AnnotationBean for this structure, or an empty array if there are none

Inherited From:
Returns:

Array of AnnotationBean's for this Object

Type
Array.<bean.base.AnnotationBean>

getAnnotationsWithTitle(title)

Returns an array of bean.base.AnnotationBean with the given title, or an empty array if none exist

Parameters:
Name Type Description
title string

the title to of the Annotation

Inherited From:
Returns:

Array of Annotation beans

Type
Array.<bean.base.AnnotationBean>

getAnnotationsWithType(type)

Returns an array of bean.base.AnnotationBean with the given type, or an empty array if none exist

Parameters:
Name Type Description
type string

the type to of the Annotation

Inherited From:
Returns:

Array of Annotation beans

Type
Array.<bean.base.AnnotationBean>

getAttribute(id)

Get an Attribute within this DSD by Id

Parameters:
Name Type Description
id string

The Id of the Attribute you want to obtain

Returns:

the Attribute

Type
bean.datastructure.AttributeBean | null

getAttributeList()

Get the Attribute List in this DSD

Returns:

The Attribute List

Type
bean.datastructure.AttributeListBean

getAttributes()

Get all Attributes

Returns:

An array of all Attributes

Type
Array.<bean.datastructure.AttributeBean>

getChildIdentifiables()

returns an array of child identifiable objects

Overrides:
Returns:

an array of Components. these could be DimensionBean, AttributeBean, PrimaryMeasureBean etc..

Type
Array.<bean.datastructure.ComponentBean>

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' 

getComponentById(id)

Get any component in this DSD by its Id

Parameters:
Name Type Description
id string

The Id of the component you want to obtain

Returns:

The component. this could be DimensionBean, AttributeBean, PrimaryMeasureBean etc..

Type
bean.datastructure.ComponentBean | null

getComponents()

Returns an array of all components, DimensionBean, AttributeBean and PrimaryMeasureBean

Returns:

An array of components

Type
Array.<bean.datastructure.ComponentBean>

getComponentsByConcept(conceptUrn)

Returns true if the DSD references the concept with the given URN

Parameters:
Name Type Description
conceptUrn string

The concept URN to check with

Returns:

array of components that reference the concept urn. These could be DimensionBean, AttributeBean, PrimaryMeasureBean etc..

Type
Array.<bean.datastructure.ComponentBean>

getCrossReferencingStructures()

Returns an array of IdentifiableBean structures that reference this structure

Inherited From:
Returns:

bean.base.IdentifiableBean[] structures which reference this Identifiable


getDataflows()

returns an array of DataflowBean objects which reference this data structure

Returns:

an array of Dataflows, or an empty array if no dataflows reference this data structure

Type
Array.<bean.datastructure.DataflowBean>

getDatasetAttributes()

Get all Attributes attached to the dataset, or an empty array if no attributes are attached to the dataset

Returns:

An array of all Attributes attached to dataset

Type
Array.<bean.datastructure.AttributeBean>

getDescription()

Get the Description of this structure.

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

Inherited From:
Returns:

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

Type
object

getDescriptionByLocale(locale)

Get the Description by locale

Parameters:
Name Type Description
locale string

The locale

Inherited From:
Returns:

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

Type
object

getDescriptions()

Get the descriptions for this Structure for each of the locales which hold a descriptions value

Inherited From:
Returns:

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

Type
Array.<object>

getDimension(id)

Get a Dimension within this DSD with the give Id

Parameters:
Name Type Description
id string

The Id of the Dimension to obtain

Returns:

The Dimension or null if no Dimension exists with the given id

Type
bean.datastructure.DimensionBean | null

getDimensions()

Get an array of all Dimensions

Returns:

An array of all Dimensions

Type
Array.<bean.datastructure.DimensionBean>

getEndDate(format)

Returns the end date of this maintainable artifact, returns null if there is no endDate.

If format is false or not provided, the date is represented as the number of milliseconds since 1970

Parameters:
Name Type Description
format boolean

if true then the date will be formatted as a ISO 8601 string

Inherited From:
Returns:

The end date

Type
number
Example
var endData = new Date(maint.getEndDate())

getFullId()

Returns the full id of this structure, e.g if it is a cateogry it will be the id of the category and all the parent categories

Inherited From:
Returns:

The full id

Type
string

getFullIdPath(includeDifferentTypes)

Returns a period separated id of this identifiable, starting from the non-maintainable top-level ancestor to this identifiable.

For example, if this is "Category A" as a child of "Category AA", then this method will return AA.A (note the category scheme id is not present in this identifier).

Returns null if this is a maintainable bean.

Parameters:
Name Type Description
includeDifferentTypes boolean

if true will recurse all the way back up the tree regardless of ancestor types, up to the maintainable level.
If false, will stop at the first occurrence of an ancestor who's getClassType() is not equal to getClassType().

Inherited From:
Returns:

The full id

Type
string

getGroup(groupId)

Gets the group with the given id

Parameters:
Name Type Description
groupId string

The id of the group

Returns:

THe GroupBean that matches the id

Type
bean.datastructure.GroupBean | null

getGroupAttributes()

Get all Attributes to the group, or an empty array if no attributes are attached to the group

Returns:

An array of all Attributes

Type
Array.<bean.datastructure.AttributeBean>

getGroups()

Return all the groups in this DSD

Returns:

An array of GroupBeans

Type
Array.<bean.datastructure.GroupBean>

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 Structure

Inherited From:
Returns:

The ID

Type
string

getIdentifiables(type)

Returns an array of Identifiables of a given type

Parameters:
Name Type Description
type Bean

any Structure type

Inherited From:
Returns:

The Structure

Type
*
Example
var allDimensions = dsd.getIdentifiables("DimensionBean")

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'

getMeasureList()

Get the Measure List from this DSD

Returns:

The measure list

Type
bean.datastructure.MeasureListBean

getMetadata(callBack)

Retrieves all of the associated Metadata.ReferenceMetadata for this structure

Parameters:
Name Type Description
callBack IdentifiableBean~MetadatCallBack

a callback for complete

Inherited From:

getMetadataDefs()

Returns an array of @see Metadata.ReferenceMetadataLink, or an empty array if there are none

Inherited From:

getName()

Get the name of this structure in a specific locale.

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

Inherited From:
Returns:

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

Type
object

getNameByLocale(locale)

Get the name by locale provided

Parameters:
Name Type Description
locale string

The locale

Inherited From:
Returns:

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

Type
object

getNames()

Get the names for this Structure for each of the locales which hold a name value

Inherited From:
Returns:

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

Type
Array.<object>

getObservationAttributes()

Get all Attributes to the observation, or an empty array if no attributes are attached to the observation

Returns:

An array of all Attributes

Type
Array.<bean.datastructure.AttributeBean>

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

getPrimaryMeasure()

Get the PrimaryMeasure

Returns:

The PrimaryMeasure

Type
bean.datastructure.PrimaryMeasureBean

getSeriesAttributes()

Get all Attributes attached to the series, or an empty array if no attributes are attached to the series

Returns:

An array of all Attributes attached to series

Type
Array.<bean.datastructure.AttributeBean>

getServiceURL()

Get the service URL of this structure

Inherited From:
Returns:

The URL

Type
string

getStartDate(format)

Returns the start date of this maintainable artifact, returns null if there is no startDate

If format is false or not provided, the date is represented as the number of milliseconds since 1970

Parameters:
Name Type Description
format boolean

if true then the date will be formatted as a ISO 8601 string

Inherited From:
Returns:

The start date

Type
number
Example
var startData = new Date(maint.getStartDate())

getTimeDimension()

Get the Time Dimension from this DSD

Returns:

The time Dimension

Type
bean.datastructure.DimensionBean

getUri()

Returns the URI for this component, returns null if there is no URI.

URI describes where additional information can be found for this structure.

This is relevant if bean.base.MaintainableBean#isStub is true as the URI will reference the full structure.

Inherited From:
Returns:

The URI

Type
string

getUrn()

Returns the URN for this component.

The URN is unique to this instance and is a computable generated value based on other attributes set within the component.

Inherited From:
Returns:

The URN

Type
string

getVersion()

Returns the version of this maintainable artifact, default version is 1.0

Version is a integer value with period '.' separators between integers, for example 1.2.3.19

Inherited From:
Returns:

The version

Type
string

hasAnnotations()

Returns true if there are at least one annotation on this bean

Inherited From:
Returns:
Type
boolean

hasAnnotationsWithType(title)

Returns true if this has annotations with the given title

Parameters:
Name Type Description
title string

the title to of the Annotation

Inherited From:
Returns:

true if annotations exist with the given title

Type
boolean

hasChildren()

Returns true if this IdentifiableBean has any child IdentifiableBean

Inherited From:
Returns:

true if this class has Child IdentifiableBean

Type
boolean

hasMetadata()

Returns true if this structure has any Metadata.ReferenceMetadata associated with it, if so the #getMetadataDefs can be used to return the Definitions for each linked report, and #getMetadata
can be used to retrieve all the Metadata.ReferenceMetadata

Inherited From:
Returns:

true if has Reference Metadata

Type
boolean

hasTimeDimension()

returns true if this DSD has a time Dimension

Returns:

if there is a Dimension on this dsd

Type
boolean

isDraft()

If this structure is marked as a draft, this will return true. Drafts are only seen by the agency the structure belongs to.

Inherited From:
Returns:

if this is a draft

Type
boolean

isFinal()

Return true if this is a final structure

Inherited From:
Returns:

true if final

Type
boolean

isStub()

Returns true if this structure is a stub, if it is then it will not contain any composite structures.

A stub is a lightweight representation of the Maintainable structure, without all the content, for example a Codelist without all the Codes.

Inherited From:
Returns:

true if stub

Type
boolean

loadFromStub()

If #isStub returns true, this method can be used to load the full structure from the server, this is a synchronous call

Inherited From:

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)'