Home Reference Source
public class | source

Resource

Indirect Subclass:

Border, Graph, Link, Lyph, Material, Node, Region, Shape, Tree

The class defining common methods for all resources

Static Member Summary

Static Public Members
public static get

Model: *

Static Method Summary

Static Public Methods
public static

fromJSON(json: Object, modelClasses: Object, entitiesByID: Map<string, Resource>): Resource

Creates a Resource object from its JSON specification

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

id: *

Method Summary

Public Methods
public

assignPathProperties(modelClasses: Object)

Assign properties to the objects specified with the help of JSON path expressions in the resource 'assign' statements

public

assignPathRelationships(modelClasses: Object, entitiesByID: Map<string, Resource>)

Create relationships defined with the help of JSON path expressions in the resource 'assign' statements

public

containsMaterial(materialID: *): * | void | T

Checks if the current resource carries a material.

public

Assign properties to resources specified with the help of JSON path expressions in the resource 'interpolate' statements

public

isSubtypeOf(supertypeID: *): boolean

Checks if the current resource is derived from The method makes more sense for lyphs, but it is useful to be able to test any resource, this simplifies filtering

public

replaceIDs(modelClasses: Object, entitiesByID: Map<string, Resource>)

Replace IDs with object references

public

Waiting list keeps objects that refer to unresolved model resources.

public

syncRelationship(key: string, spec: Object, modelClasses: Object)

Synchronize a relationship field of the resource with its counterpart (auto-fill a field that is involved into a bi-directional relationship based on its partial definition, i.e., A.child = B yields B.parent = A).

public

syncRelationships(modelClasses: Object, entitiesByID: Map<string, Resource>)

Synchronize all relationship properties of the resource

public

toJSON(depth: *, initDepth: *): *

Prepare a circular resource object to be serialized in JSON.

Static Public Members

public static get Model: * source

Static Public Methods

public static fromJSON(json: Object, modelClasses: Object, entitiesByID: Map<string, Resource>): Resource source

Creates a Resource object from its JSON specification

Params:

NameTypeAttributeDescription
json Object

resource definition

modelClasses Object
  • optional

map of class names vs implementation of ApiNATOMY resources

entitiesByID Map<string, Resource>
  • optional

map of resources in the global model

Return:

Resource

ApiNATOMY resource

Public Constructors

public constructor() source

Public Members

public id: * source

Public Methods

public assignPathProperties(modelClasses: Object) source

Assign properties to the objects specified with the help of JSON path expressions in the resource 'assign' statements

Params:

NameTypeAttributeDescription
modelClasses Object

map of class names vs implementation of ApiNATOMY resources

public assignPathRelationships(modelClasses: Object, entitiesByID: Map<string, Resource>) source

Create relationships defined with the help of JSON path expressions in the resource 'assign' statements

Params:

NameTypeAttributeDescription
modelClasses Object

map of class names vs implementation of ApiNATOMY resources

entitiesByID Map<string, Resource>

map of resources in the global model

public containsMaterial(materialID: *): * | void | T source

Checks if the current resource carries a material. The method makes more sense for lyphs, but it is useful to be able to test any resource, this simplifies filtering

Params:

NameTypeAttributeDescription
materialID *

Return:

* | void | T

public interpolatePathProperties() source

Assign properties to resources specified with the help of JSON path expressions in the resource 'interpolate' statements

public isSubtypeOf(supertypeID: *): boolean source

Checks if the current resource is derived from The method makes more sense for lyphs, but it is useful to be able to test any resource, this simplifies filtering

Params:

NameTypeAttributeDescription
supertypeID *

Return:

boolean

public replaceIDs(modelClasses: Object, entitiesByID: Map<string, Resource>) source

Replace IDs with object references

Params:

NameTypeAttributeDescription
modelClasses Object

map of class names vs implementation of ApiNATOMY resources

entitiesByID Map<string, Resource>

map of resources in the global model

public reviseWaitingList(waitingList: Map<string, Array<Resource>>) source

Waiting list keeps objects that refer to unresolved model resources. When a new resource definition is found or created, all resources that referenced this resource by ID get the corresponding object reference instead

Params:

NameTypeAttributeDescription
waitingList Map<string, Array<Resource>>

associative array that maps unresolved IDs to the list of resource definitions that refer to it

public syncRelationship(key: string, spec: Object, modelClasses: Object) source

Synchronize a relationship field of the resource with its counterpart (auto-fill a field that is involved into a bi-directional relationship based on its partial definition, i.e., A.child = B yields B.parent = A).

Params:

NameTypeAttributeDescription
key string

property field that points to the related resource

spec Object

JSON schema specification of the relationship field

modelClasses Object

map of class names vs implementation of ApiNATOMY resources

public syncRelationships(modelClasses: Object, entitiesByID: Map<string, Resource>) source

Synchronize all relationship properties of the resource

Params:

NameTypeAttributeDescription
modelClasses Object

map of class names vs implementation of ApiNATOMY resources

entitiesByID Map<string, Resource>

map of resources in the global model

public toJSON(depth: *, initDepth: *): * source

Prepare a circular resource object to be serialized in JSON.

Params:

NameTypeAttributeDescription
depth *

remaining depth of nested objects in the recursive calls

initDepth *

depth of nested objects to serialize (called with depth = 0 for resource map, depth = 1 for the main model)

Return:

*