ModelManager (Common API)

Overview - Common API - Client API - Admin API - Runtime API

ModelManager

Manages the Composer model files.

The structure of Resources (Assets, Transactions, Participants) is modelled in a set of Composer files. The contents of these files are managed by the ModelManager. Each Composer file has a single namespace and contains a set of asset, transaction and participant type definitions.

Composer applications load their Composer files and then call the addModelFile method to register the Composer file(s) with the ModelManager. The ModelManager parses the text of the Composer file and will make all defined types available to other Composer services, such as the Serializer (to convert instances to/from JSON) and Factory (to create instances).

Details

  • Module common

See also

Method Summary

Name Returns Description
addModelFile Object Adds a Composer file (as a string) to the ModelManager
addModelFiles Object[] Add a set of Composer files to the model manager
clearModelFiles void Remove all registered Composer files
deleteModelFile void Remove the Composer file for a given namespace
getAssetDeclarations AssetDeclaration[] Get the AssetDeclarations defined in this model manager
getConceptDeclarations ConceptDeclaration[] Get the Concepts defined in this model manager
getEnumDeclarations EnumDeclaration[] Get the EnumDeclarations defined in this model manager
getEventDeclarations EventDeclaration[] Get the EventDeclarations defined in this model manager
getNamespaces string[] Get the namespaces registered with the ModelManager
getParticipantDeclarations ParticipantDeclaration[] Get the ParticipantDeclarations defined in this model manager
getSystemTypes ClassDeclaration[] Get all class declarations from system namespaces
getTransactionDeclarations TransactionDeclaration[] Get the TransactionDeclarations defined in this model manager
updateModelFile Object Updates a Composer file (as a string) on the ModelManager
validateModelFile void Validates a Composer file (as a string) to the ModelManager

Method Details

validateModelFile

_ validateModelFile( string modelfile, string filename )_

Validates a Composer file (as a string) to the ModelManager. Composer files have a single namespace. Note that if there are dependencies between multiple files the files must be added in dependency order, or the addModelFiles method can be used to add a set of files irrespective of dependencies.

See also

Parameters

Name Type Mandatory Description
modelFile string Yes The Composer file as a string
fileName string Yes an optional file name to associate with the model file

addModelFile

Object addModelFile( string modelfile, string filename )

Adds a Composer file (as a string) to the ModelManager. Composer files have a single namespace. If a Composer file with the same namespace has already been added to the ModelManager then it will be replaced. Note that if there are dependencies between multiple files the files must be added in dependency order, or the addModelFiles method can be used to add a set of files irrespective of dependencies.

Returns

Object - The newly added model file (internal).

See also

Parameters

Name Type Mandatory Description
modelFile string Yes The Composer file as a string
fileName string Yes an optional file name to associate with the model file

updateModelFile

Object updateModelFile( string modelfile, string filename )

Updates a Composer file (as a string) on the ModelManager. Composer files have a single namespace. If a Composer file with the same namespace has already been added to the ModelManager then it will be replaced.

Returns

Object - The newly added model file (internal).

See also

Parameters

Name Type Mandatory Description
modelFile string Yes The Composer file as a string
fileName string Yes an optional file name to associate with the model file

deleteModelFile

_ deleteModelFile( string namespace )_

Remove the Composer file for a given namespace

See also

Parameters

Name Type Mandatory Description
namespace string Yes The namespace of the model file to delete.

addModelFiles

Object[] addModelFiles( modelfiles, filenames )

Add a set of Composer files to the model manager.

Returns

Object - The newly added model files (internal).

See also

Parameters

Name Type Mandatory Description
modelFiles Yes An array of Composer files as strings.
fileNames Yes An optional array of file names to associate with the model files

clearModelFiles

_ clearModelFiles( )_

Remove all registered Composer files

See also

Parameters

No parameters

getNamespaces

string[] getNamespaces( )

Get the namespaces registered with the ModelManager.

Returns

string - namespaces - the namespaces that have been registered.

See also

Parameters

No parameters

getSystemTypes

ClassDeclaration[] getSystemTypes( )

Get all class declarations from system namespaces

Returns

ClassDeclaration - the ClassDeclarations from system namespaces

See also

Parameters

No parameters

getAssetDeclarations

AssetDeclaration[] getAssetDeclarations( Boolean includesystemtype )

Get the AssetDeclarations defined in this model manager

Returns

AssetDeclaration - the AssetDeclarations defined in the model manager

See also

Parameters

Name Type Mandatory Description
includeSystemType Boolean Yes Include the decalarations of system type in returned data

getTransactionDeclarations

TransactionDeclaration[] getTransactionDeclarations( Boolean includesystemtype )

Get the TransactionDeclarations defined in this model manager

Returns

TransactionDeclaration - the TransactionDeclarations defined in the model manager

See also

Parameters

Name Type Mandatory Description
includeSystemType Boolean Yes Include the decalarations of system type in returned data

getEventDeclarations

EventDeclaration[] getEventDeclarations( Boolean includesystemtype )

Get the EventDeclarations defined in this model manager

Returns

EventDeclaration - the EventDeclaration defined in the model manager

See also

Parameters

Name Type Mandatory Description
includeSystemType Boolean Yes Include the decalarations of system type in returned data

getParticipantDeclarations

ParticipantDeclaration[] getParticipantDeclarations( Boolean includesystemtype )

Get the ParticipantDeclarations defined in this model manager

Returns

ParticipantDeclaration - the ParticipantDeclaration defined in the model manager

See also

Parameters

Name Type Mandatory Description
includeSystemType Boolean Yes Include the decalarations of system type in returned data

getEnumDeclarations

EnumDeclaration[] getEnumDeclarations( Boolean includesystemtype )

Get the EnumDeclarations defined in this model manager

Returns

EnumDeclaration - the EnumDeclaration defined in the model manager

See also

Parameters

Name Type Mandatory Description
includeSystemType Boolean Yes Include the decalarations of system type in returned data

getConceptDeclarations

ConceptDeclaration[] getConceptDeclarations( Boolean includesystemtype )

Get the Concepts defined in this model manager

Returns

ConceptDeclaration - the ConceptDeclaration defined in the model manager

See also

Parameters

Name Type Mandatory Description
includeSystemType Boolean Yes Include the decalarations of system type in returned data

Inherited methods