Target Domain Field JSON Object Structure


Dynamic Domain Controller

This example aims to retrieve a list of Task names having one of the following statuses : New, Opened or Pending.

The field name from the entity ToDoTask will be displayed as a combo (i.e. list) box.

When the list is opened only the task names that satisfy the previous criteria should be displayed.

The api getTasksNameDomainBasedOnStatus from the Domain service CustomFieldDomainControllerService is then requested in order to retrieve the list of possible values related to the field name from the entity ToDoTask whose status is equal to one of the following values: New, Opened, Pending.
This method should return an Observable that holds a list of DomainEntry.

Below a JSON example of a dynamic TargetFieldDomain instance.
This will result in the creation of a component of type combobox that will hold all the names of the tasks whose status is New, Opened or Pending.

{
"entityFieldName": "name",
"type": "combo",
"targetFieldDomain": 
{
"domainServiceRepository": 
 {
  "domainControllerType": "CustomFieldDomainControllerService",
  "domainControllerMethod": "getTasksNameDomainBasedOnStatus",
  "parameters": {
     "name":
	    {
		  "entityAccessor": "status",
		  "entityValue": "New, Opened, Pending",
		  "operator": "[]"
	    }
   }
  }
}
}


Static Domain Controller

In this example, a user whishes to manually update the entity ToDoTask.
Since the status member values belong to a specific domain, only those values should be available to the user at the update moment.

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.

Below is a JSON example of a static TargetFieldDomain instance whose values belong to : Closed, Active and Pending.
This will result in the creation of a component of type combobox that will hold all the domain values related to the member status.

{
  "entityFieldName": "status",
  "type": "combo",
  "targetFieldDomain": 
  {
  "defaultDomain": 				
      [
        {
          "key": "Closed",
          "value": "Closed",
          "translationID": "todotask.status.CLOSED"
        },
        {
          "key": "Active",
          "value": "Active",
          "translationID": "todotask.status.ACTIVE"
        },
        {
          "key": "Pending",
          "value": "Pending",
          "translationID": "todotask.status.PENDING"
        }
      ]
  }
}