Options as expander flags

Some features in the expanders are triggered by a complex combination of settings. This mostly occurs because in some cases a default behavior is required in the absence of an option of setting dictating it’s behavior.

Let’s take the implicit name field:

The implicit name field is added to a data element if no regular name field is defined. However, if the option nameNotWanted is defined, this field should not occur.

In terms of the model this would cause the following check in several files:

dataElement.getOption('nameNotWanted').empty and dataElement.fields.{? #this.name.equals('name') }.size == 0

To simplify this, it is possible to add extra options to the model in a preprocessing step in element-ioxml.

hasImplicitNameField

The method net.democritus.elements.DataElementTreeToComposite#defineImplicitNameFieldOption adds the options hasImplicitNameField if:

  1. the option nameNotWanted is not defined
  2. there is no field for the dataElement name ‘name’

This option can then be used to implement the ImplicitNameField feature in the expanders