$model

( documentation for Telosys generator version 4.0.0 )


Object giving access to the current model

Since : 2.0.0

Attributes and methods
.allEntites : List

Returns a list containing all the entities defined in the model
NB : has a typo, just kept for backward compatibility
use 'allEntities' instead
(!) DEPRECATED : do not use (will be removed)

.allEntities : List

Returns a list containing all the entities defined in the model

Example :
   #foreach ( $entity in $model.allEntities )
   ...
   #end
   

.databaseId : String

Returns the id of the database used to generate the model
(since ver 4 the id is a string)

.databaseName : String

Returns the name of the database used to generate the model

Since : 3.4.0

.databaseType : String

Returns the type of the database used to generate the model

Since : 3.4.0

.description : String

Returns the model description

Since : 3.3.0

.folderName : String

Returns the name of the folder where entities are located

Since : 3.3.0

.getEntityByClassName(String name) : EntityInContext

Returns the entity identified by the given name
or throws an exception if not found

Parameters :
   name : the name identifying the entity in the model (eg 'Car', 'Student', etc)

Example :
   #if ( $model.hasEntityWithClassName($entityName) )
   #set( $entity = $model.getEntityByClassName($entityName) )
   #else
   #error("No entity '$entityName' in model")
   #end
   

.getEntityByTableName(String tableName) : EntityInContext

Returns the entity identified by the given database table name
or throws an exception if not found
The table name is supposed to be unique in the model

Parameters :
   tableName : the name of the table associated with the searched entity

Example :
   #if ( $model.hasEntityWithTableName($tableName) )
   #set( $entity = $model.getEntityByTableName($tableName) )
   #end
   

.hasEntityWithClassName(String name) : boolean

Returns TRUE if the model contains an entity identified by the given class name
else FALSE

Parameters :
   name : the class name identifying the entity

Example :
   #if ( $model.hasEntityWithClassName($entityName) )
   #set( $entity = $model.getEntityByClassName($entityName) )
   #end
   

.hasEntityWithTableName(String tableName) : boolean

Returns TRUE if the model contains an entity identified by the given table name
else FALSE

Parameters :
   tableName : the name of the table associated with the searched entity

Example :
   #if ( $model.hasEntityWithTableName($tableName) )
   #set( $entity = $model.getEntityByTableName($tableName) )
   #end
   

.name : String

Returns the model name as defined by file/folder in the project directory

Since : 3.3.0

.numberOfEntities : int

Returns the number of entities defined in the model

.title : String

Returns the model title

Since : 3.3.0

.type : String

Returns the Telosys model type (DSL-MODEL, DB-MODEL, etc)

Since : 3.3.0

.version : String

Returns the Telosys model version

Since : 3.3.0