By Tessa Holland 9 January 2020 Techies
An overview of how inheritance works with the codebots.
Much like the meta-model where entities can have super class or sub-classes, the bot brings this into the actual entity files. Particularly, each entity or partial entity can have one base class, which is a partial entity. A partial entity is much like an entity, except the fact that they can only be considered as an internal node in the inheritance tree.
For example, given an inheritance tree like this:
Person |__ Student |__ Domestic |__ International |__ Staff |__ Tutor |__ Lecturer
Staff would be partial entities (internal nodes), whereas
Lecturer are entities (leaves).
In term of file structure, entities and partial entities are denoted by the same naming convention, e.g.
tutor.model.ts. However, partial entities are templated as
abstract, which means they are not instantiable via
new, hence the requirement of a subclass.
At the top of the inheritance tree is an entity class called
AbstractModel which can be understood as the base class of all entities in the application. This class contains the most fundamental attributes that are guaranteed to be available in every entity, which are
iddenotes the UUID of the instance of the entity itself,
createddenotes the created date of the instance of the entity, and
modifieddenotes the modified date of the instance of the entity