Inheritance

Inheritance allows you to create a new meta class based on a parent one with all its attributes. A parent class may have several heirs with different attribute structures. Each heir can have its own individual set of attributes, plus attributes of the parent class.

Attributive structure

In the meta of the parent class the attributive structure is formed in such a way that each attribute can be used in any heir classes. Whereas the attributive structure in a heir class is individual for each heir class and has no influence on other classes.

Example

Parent class:

{
  "isStruct": false,
  "key": [
    "id"
  ],
  "semantic": "name",
  "name": "organization",
  "version": "",
  "caption": "Организация",
  "ancestor": null,
  "container": null,
  "creationTracker": "",
  "changeTracker": "",
  "history": 0,
  "journaling": true,
  "compositeIndexes": [],
  "properties": [

Child class:

{
  "isStruct": false,
  "key": [
    "id"
  ],
  "semantic": "",
  "name": "medicalOrg",
  "version": "",
  "caption": "Медицинская организация",
  "ancestor": "organization",
  "container": null,
  "creationTracker": "",
  "changeTracker": "",
  "history": 0,
  "journaling": true,
  "compositeIndexes": [],
  "properties": [

"id" is a unique identifier for all heirs. It is stored in the parent class.

"name" - the class has the “Name” attribute, which can be displayed in all the heirs, or in one of them. If the "name" attribute is set in the parent class, then it can be displayed in any of the heirs. But if "name" is set in the class of the heir, it is displayed only in the class in which it was set.

Сlass view:

If the abstractness criteria is set for the parent class, then it is not necessary to set the representation for it.

The class view is set for each heir separately specifying the desired attribute structure (attributes of the new class plus attributes of the parent class, if needed).

Setting the list of the heirs for creating objects by reference

Set in the meta class for the attribute of "reference"/\"collection" type after specifying the reference/collection class:

"itemsClass": "event",
"allowedSubclasses": [
        "Subclasses1",
        "Subclasses2"
      ],

itemsClass - collection for the parent class - [event]

Subclasses1 is a child class of the parent class [event], which will be displayed in the list when creating an object by reference (hereinafter you can list all the heir classes that need to be displayed in the list).

NB: If this setting is not specified, then upon creation, all child classes will be displayed in the list.

Conditions for applying the setting:

  • The attribute type is “Collection” or “Reference”;
  • For the attribute of the “Collection” or “Reference” type, the class of the collection/referece to the parent (base) class is specified (when creating an object of the reference class, a window for selecting several classes is displayed);
  • In addition to hiding the base class, when creating an object, you do not need to display all child classes in the class selection list for creating an object by reference.

Example

The parent class [Events] has several classes of heirs ([Event1], [Event3], [Event2]). In the [Project] class, there is an attribute of the “Collection” type that refers to the parent class [Event]:

{
    "namespace": "ns",
    "isStruct": false,
    "key": [],
    "semantic": "",
    "name": "project",
    "version": "",
    "caption": "Проект",
    "ancestor": "",
    "container": null,
    "creationTracker": "",
    "changeTracker": "",
    "creatorTracker": "",
    "editorTracker": "",
    "history": 0,
    "journaling": true,
    "compositeIndexes": [],
    "properties": [
      {
        "orderNumber": 80,
        "name": "event",
        "caption": "Мероприятия",
        "type": 0,
        "size": null,
        "decimals": 0,
        "allowedFileTypes": null,
        "maxFileCount": 0,
        "nullable": true,
        "readonly": false,
        "indexed": true,
        "unique": false,
        "autoassigned": false,
        "hint": null,
        "defaultValue": null,
        "refClass": "",
        "itemsClass": "event@ns",
        "allowedSubclasses": [
            "event1",
            "event2"
        ],
        "backRef": "",
        "backColl": "",
        "binding": "",
        "semantic": null,
        "selConditions": [],
        "selSorting": [],
        "selectionProvider": null,
        "indexSearch": false,
        "eagerLoading": false,
        "formula": null
      }
   ...

If the abstractness setting is set for the class, then when creating an object of the [Event] class in the collection, the selection list will display those inheritors of the [event] class that are specified in the "allowedSubclasses" property. That is, based on the example, only objects of the class “Event1” and “Event2” can be created in the “Events” collection.

Multilevel hierarchy

The child classes can inherit the set of the attributes not only from their direct parent classes but also from those that are higher in the inheritance hierarchy.

Example

[basicObj] - parent class ->> [eventBasic] - heir class of the [basicObj] class ->> [eventBlock] - heir class of the [eventBasic] class.

{
  "isStruct": false,
  "key": [
    "guid"
  ],
  "semantic": "name",
  "name": "basicObj",
  "abstract": true,
  "version": "31",
  "caption": "Учетный объект",
  "ancestor": null,
  "container": null,
  "creationTracker": "createDatet",
  "changeTracker": "modifeDate",
  "creatorTracker": "creator",
  "editorTracker": "editor",
  "history": 0,
  "journaling": true,
  "compositeIndexes": null,
  "properties": [
{
  "isStruct": false,
  "key": [
    "guid"
  ],
  "semantic": "name| ( |code| )",
  "name": "eventBasic",
  "version": "31",
  "caption": "Базовое мероприятие",
  "ancestor": "basicObj",
  "container": null,
  "creationTracker": "",
  "changeTracker": "",
  "history": 0,
  "journaling": true,
  "compositeIndexes": null,
  "abstract": true,
  "properties": [
{
  "isStruct": false,
  "key": [
    "guid"
  ],
  "semantic": "name| ( |code| )",
  "name": "eventBlock",
  "version": "31",
  "caption": "Блок мероприятий",
  "ancestor": "eventBasic",
  "container": null,
  "creationTracker": "",
  "changeTracker": "",
  "history": 0,
  "journaling": true,
  "compositeIndexes": null,
  "properties": [

The [eventBlock] heir will inherit the set of the attributes of the [basicObj]parent class, as well as the [eventBasic] heir class.