3. New issues

Compared to dealing with a functional association, as discussed in the previous chapter, we now have to deal with the following new technical issues:

  1. In the model code we now have to take care of multi-valued reference properties that require implementing

    1. an add and a remove method, such as addAuthor and removeAuthor, as well as a setter method for assigning a set of object references with the help of the add method, possibly converting ID references to object references; all three methods may need to check cardinality constraints, if there are any;

    2. a class-level check operation, such as checkAuthor, which has to invoke the corresponding check...AsIdRef method of the property's range class for checking the property's implicit referential integrity constraint;

    3. converting a collection of object references to a collection of ID references in the object-to-storage conversion function toJSON.

  2. In the user interface ("view") code we now have to take care of

    1. showing information about a set of associated objects in the property's column of the table view of the Retrieve/list all use case; the simplest approach is showing a comma-separated list of ID references, possibly combined with corresponding names; alternatively, HTML lists can be rendered in the property's table data cells;

    2. allowing to select a set of associated objects from a list of all existing instances of the property's range class in the Create and Update use cases.

    The last issue, allowing to select a set of associated objects from a list of all instances of some class, can, in general, not be solved with the help of an HTML multiple-select form control because of its poor usability. Whenever the set of selectable options is greater than a certain threshold (defined by the number of options that can be seen on the screen without scrolling), the multiple-select element is no longer usable, and an alternative multi-selection widget has to be used.