Domain Controller Service

1. Description

Domain Controller Service type is a regular angular service that is decorated by the averos decorator @DomainController.

The domain controller will act on the entities’ members by providing a fully customizable field values domain according to a search values criteria.

The domain controller will make it easy to implement entity Creation and Update use cases by providing a set of values that belongs to a specific domain based on a set of user criteria.

Let’s say a user would like to define a set of possible values for a specific entity member field.

One of the option is to hard code a set of predefined static values related to that field.
The other option, which turns out to be more suitable for dynamic values content, is to define a domain service and provide a service method responsible for fetching a set of apropriate target field values based on some custom criteria.
This will allow new values, that satisfy the custom input criteria, to be included in the field domain.

Averos domain controller supports either static or dynamic member domain data retrieval option, depending on the use case.

A list box showing only cities names related to a specific country, given as an input criteria, could be a typical use case into which a domain controller service bound to a field named city will be in charge of retrieving all possible cities’ values according to a given country identifier criteria.

An other example would be to retrieve data based on a relationship between two components.
Imagine a form with two input components, namely Entity and Entity Member.
As a first step, the user selects one entity from the list of available entities in the first input component named Entity. When the user selects the second component named Entity Member he should only see the list of members related to the entity that he selected in the first step.
The aim in this case is to dynamically retrieve related domain data (the list of entity members in this case) based on dynamic informations (a given updatable entity).
Likewise, any new entity member will be retrieved dynamically.

Below is a representation that depicts the example above.
Given a form that is composed of two combobox input elements named Target Entity - displays a list of entities- and Locale Identifier (displays a list of entity members).
When one entity is selected in the first combobox component Target Entity, the second combobox component Locale Identifier shoud dynamically display the list of members that belongs to that specific entity. (Excerpt from Translation Entry Creation in Averos Designer)

In the first picture, when EntityA is selected in the first component, the second component Locale Identifier brings dynamically EntityA members, namely, memberA1 and memberA2.

The second picture, shows how when EntityB is selected, the combobox component Locale Identifier dynamically updates its data and, this time, brings EntityB members, namely, memberB1, memberB2, memberB3, memberB4 and memberB5.

Dynamic domain controller data retrival could also be achieved via a call to an api.

When member values belong to a specific business domain, it’s usually more convenient and way user friendly to display the value text in the appropriate user language.
In this case a translationID record should be created accordingly for each domain value.

Currently, there is no no-code workflow for creating averos domain Controllers. Those are manually implemented like any regular angular service.
Note that a no-code workflow for DomainController will be available in next version releases.
Averos users are kept free to name their Domain controller services along with their service methods.

🚩 Domain controller service method should return an Observable that holds a list of DomainEntry.

2. Domain Controller Service Class Diagram

Below is the Averos Domain Controller Service class diagram related to a custom domain controller service.

Below is a typescript implementation of a Domain Controller service named CustomFieldDomainControllerService:

  providedIn: 'root'
export class CustomFieldDomainControllerService {
   getFieldDomain():Observable<DomainEntry[]> {} 

🚩 Field Domain Controller should be decorated with @DomainController() so that the framework would enable member domain binding and member domain metadata initialization.

🙋‍♂️ Please refer to the field value controller within the view section so that you learn more about how to bind your domain controller to entity members.