Entity Master: improved support for entering properties of composite entity types (simple case)
Description
Values for entity-typed properties are entered using autocompleters, which are applicable for simple entities, compose entities and union entities. Although, it is possible to autocomplete values of all these entity type kinds, with issue #1451 introducing support for union entities, there are situations where entry of composite entities, with a key consisting of multiple entity-typed properties, would benefit from a special support.
The scope of this issue includes only composite entities, where keys are simple entity-typed properties (i.e., not composite and not union entities). In practice, these are believed to represent 99% of composite entities and supporting other variations would significantly complicate the implementation.
As a working example, let's consider composite entity VehicleModel with 2 key properties make: Make and model: Model. Entity VehicleModel is effectively a relationship between entities Make and Model. And let's further assume entity Vehicle has property vehicleModel: VehicleModel, which needs to be entered by users when creating new vehicles.
Instead of having a single autocompleter for entering vehicleModel, where autocompleted values would represent (in the worst case scenario) a cartesian product between the populations of Make and Model, it would be a lot more convenient to enter/choose a value of Make in one autocompeter and then enter/choose a value of Model in another, where value autocompletion would be context-dependent – only showing the models associated with a selected make. The relationship works both ways. And so entering model first should ensure context-dependent autocompletion of make values. In fact, if there is only one such "matching" model, it should be populated automatically upon the entry of model.
Entry of all key members should result in the population of a target property by the composite entity value, identified by the key. In our example, having Vehicle.vehicleModel.make and Vehicle.vehicleModel.model entered, should populate Vehicle.vehicleModel, if corresponding value exists. If such value does not exist, an appropriate "entity does not exist" error should be associated with property editors for Vehicle.vehicleModel.make and Vehicle.vehicleModel.model.
It is possible that Entity Master DSL may need to be enhanced with additional API to support additing key members of composite entity-typed properties to an Entity Master. This need should be evaluated as part of the implementation, especially if additional information would be required as part of master configuration. For example, instead of .addProp() there could be .addPropKey() such as .addPropKey(Vehicle_.vehicleModel().make()).asAutocompleter() and .addPropKey(Vehicle_.vehicleModel().model()).asAutocompleter(). This "key" part would carry instructions to represent corresponding property editors as editable, and ensure "composite" logic for autocompletion and property values assignment.
Value matchers for autocompletion of composite key members require separate consideration, which may potentially result in a different value matching contract with a context, carrying entered key values that should be used during autocompletion of other key properties. This part should also include support for custom value matchers in the context of autcompletion for key-members of a composite entity-typed property.
Expected outcome
Convenient context-dependent entry of values for properties of composite entity types, with key properties being simple entity types.