Infohub JS API
Loading...
Searching...
No Matches
cnObject Class Reference

Description

Base Class for nodes/objects on COLNEO infohub.


Uses the infohub GOM (Generic Object Model) JSON notation.

Since
1.0, 07.2026
Examples
C:/xampp/htdocs/InfohubJsApi/src/tools/ApiResponse.js.
Inheritance diagram for cnObject:
Catalogue Contact CoordinationModel Node Project

Public Member Functions

Construction

 constructor ()

Convenience properties

get className ()
get id ()
get shortid ()
get name ()
set name (value)

Serialization and diagnostics

 setFromJson (obj_as_json, members=null)
 getAsJson (members=null)
 dump (prefix='')
 toJSON ()

Identity and naming

 getId ()
 getShortId ()
 getName ()
 setName (n)

Data and property access

 get (key, defaultValue={})
get info ()
get properties ()
 getPropertyValue (typeid, defaultValue=null)
 setPropertyValue (typeid, value)

Function Documentation

◆ className()

get className ( )

◆ constructor()

constructor ( )
Since
08.2025, jh

◆ dump()

dump ( prefix = '')

Print current object to console.

Returns
{void}

◆ get()

get ( key,
defaultValue = {} )

Retrieves a top-level member of the internal #_data object by key.

Common keys include: "info", "properties", "geometry", etc.

Parameters
{string}key - The name of the member to retrieve.
{*}[defaultValue={}] - Value returned if the key does not exist.
Returns
{*} The value of the specified member, or the defaultValue if missing.

◆ getAsJson()

getAsJson ( members = null)

Get object as JSON in COLNEO Generic Object Model format (cnGOM).

Parameters
{Array|null}members Take only members into account, if null use all members.

Example:

o.getAsJson( [ 'info' , 'properties' ] )
Returns
{object} Object as JSON in GOM format (Generic Object Model)

◆ getId()

getId ( )

Get ID.

Returns
{string|null} Object ID, null if object is empty
Since
1.0, 09.2025, jh

◆ getName()

getName ( )

Get 'info.object_name'.

Returns
info.object_name

◆ getPropertyValue()

getPropertyValue ( typeid,
defaultValue = null )

Retrieves the value of a property from the internal json object.

Parameters
{string}typeid - The property key to retrieve.
{*}[defaultValue=null] - A fallback value returned if the property does not exist.
Returns
{*} The property value if found, otherwise the defaultValue.

◆ getShortId()

getShortId ( )

Retrieves the short object ID from the internal json object.

Returns
{string|null} The short ID if available, otherwise null.
Since
1.0, 09.2025, jh

◆ id()

get id ( )

Global unique ID.

◆ info()

get info ( )

◆ name() [1/2]

get name ( )

◆ name() [2/2]

set name ( value)

◆ properties()

get properties ( )

◆ setFromJson()

setFromJson ( obj_as_json,
members = null )

Set object from JSON in COLNEO Generic Object Model (GOM) format.

Parameters
{object}obj_as_data
{Array|null}members Take only members into account, if null use all members.

◆ setName()

setName ( n)

Set info.object_name.

Parameters
{string}n Set object_name to n

◆ setPropertyValue()

setPropertyValue ( typeid,
value )

Set the property value to this object.


Value is not syncronised with infohub.

Parameters
{string}typeid
{any}value

◆ shortid()

get shortid ( )

Node ID / Short ID.

◆ toJSON()

toJSON ( )

standard function used by JSON.stringify().

This way JSON.stringify gives us all the info and properties of the object.

Returns
json representation of this object