Polymorphism and constructors

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Experience design > Advanced topics > Inheritance in data modeling >

Polymorphism and constructors

Overview

Polymorphism relies on an inheritance-based model that allows more than one entity to reuse actions and attributes defined for another entity, as described at Inheritance in data modeling, while at the same time enabling the use of a special control that leverages flexibility and adaptability.

 

Through polymorphism during execution, this special control automatically considers the whole set of entities reusing actions and attributes.

For example, while having Available exams as the base entity from which many other types of exams inherit, this control smartly presents all possibilities:

 

Inheritance_06

 

The image above presents the special control which is called the Polymorphic launcher.

This control displays an action tree applicable to the entity called Available exams (from which the entities Laboratory and Radiology extend), having the final leaf nodes represent the entities that host the possible actions to be launched (e.g Blood test, Cytology, Viral tests, Cholesterol and Triglycerides, Estrogens, XRay, Intraoral X-ray, Computed tomography).

In order to use this control for those final derived entities, you need to define constructors for them.

 

 

Constructors

A constructor allows you to define how you expect Bizagi to create new records in that entity, either whenever a new process is started, or upon submitting details in a form.

The Work Portal will display the entity and the possibility to launch it, if a constructor has been defined for it.

 

Defining constructors

In order to define a constructor for an entity, go into the Expert view and click Entities.

Locate the entity which requires a new constructor definition and right-click it to select New constructor.

Alternatively, you may select this option from the Ribbon.

 

Inheritance_07

 

Rely on the configuration wizard to define parameters for that new constructor.

 

1. Define when the constructor is applicable

The first step is to specify if this constructor applies to new processes or new records directly inputted via forms.

 

Inheritance_08

 

Notice you may select either:

Using the following process to select a process from the drop-down list or to click the Inheritance_10 icon and define the name of a new process.

 

Inheritance_11

 

Filling-out this form to select a form from the drop-down list or to click the Inheritance_10 icon and define a new form by means of the Forms designer.

 

2. Define who has access to this constructor

In this step, define which stakeholders will get access to this action.

You may either grant this action to everyone, or click Specific stakeholders to input the names of those stakeholders allowed (separating them by using Tab).

 

Inheritance_09

 

3. Define when will this constructor be available

In this step, define if this constructor will be always visible or assign a Boolean expression (based on data) that determines when this constructor should appear in a Polymorphic launcher control.

Notice you may create a new expression, by selecting Expression and clicking the Inheritance_10 icon and creating one:

 

Inheritance_12

 

Configuring the Polymorphic launcher

Once you have defined a constructor, you are set.

Using the Polymorphic launcher in a form is the final step, and it will not require any particular configuration because this control automatically takes the constructor definition for each of the items it presents.

 

For more information about this control, refer to Polymorphic launcher.

 

Considerations

Each entity can have maximum one constructor.

This means that whenever an entity has a constructor already defined, you may edit or delete that constructor by right-clicking the entity and selecting the desired option.

 

Inheritance_14