Default Value Plug-ins

The DomainDefault interface is used to define default values for domains where no default value is available. The main methods in this interface are listed as follows.

For more information about these methods, see the Cúram Javadoc documentation for this interface.

  • getAssumedDefault()

    This method is used to get the default value that will be assumed when a user clears a field on a form and submits no value.

  • getDisplayedDefault()

    This method is used to get the default value that should be displayed when an input field has no initial value to display.

From the methods listed above, we can see there are two types of default value: the value assumed when no value is available to send to the application server, and the value displayed when no initial value has been defined for a form field on an application page. The two default values are often the same, but there are some cases where they need to be different.

The assumed default value is needed when a form is submitted and the form data contains no value for a field that was not defined to be mandatory. The web client never submits null data values to the application server, so it must assume some value for the field and then submit that. The assumed value is nearly always intuitive: zero for any kind of number, an empty string for any string value, or a zero date or date-time for such values. The actual assumed default values used in the Cúram application are listed in Default value plug-ins.

The displayed default value is needed when a form field has not been initialized with any other value (as is usual on forms used to create new entities). The UIM FIELD element has a USE_DEFAULT attribute that defaults to true, so, unless that attribute is set to false, the displayed default value may be used. The displayed default value for numbers and strings is usually the same as that used as the assumed default value, but for dates and times, the current date and time is used instead of the zero date and time. Like the assumed default values, the displayed default values are likely to be sufficient for most applications, so you are unlikely to need to customize them.

There is also a third source for default values: there is a domain definition option for a default value supported in the UML model. However, if no such option is set, it is the plug-in's displayed default value that is used as a fallback, so the two can be treated in the same way. If only the displayed default value needs to be customized, it is easier to do this using the UML domain definition option rather than writing and configuring a new plug-in class, but the assumed default value can only be modified via a plug-in.

The default code used for values in a code-table domain is controlled via the application's code-table administration interface. You should not attempt to control it programmatically.