A model defines the properties used in a module. It is optional. If a model is missing or a used property is not defined in it, default types will be used based on the Java type of a property.
Once defined or first used, the type of all properties is fixed. Trying to save a property with a value whose type does not match the fixed type is an error.
A module can contain any number of model files. Each model file is a model textresource YAML file.
The model YAML file must contain a single prefix element. This prefix applies to all properties defined in the model.
# The prefix of all properties in the model is 'sys'.
prefix: sys
The model YAML file can contain an instanceProperties that in turn contains any number of element.
Each element defines a property.
instanceProperties:
# The property sys_ctime.
ctime:
type: DATETIME
comment: The ctime of the main document resource file as it was on the client system.
# The property sys_mtime.
sys_mtime:
type: DATETIME
comment: The mtime of the main document resource file as it was on the client system.
# A STRING property with a difrerent name.
authority:
name: currentAuthority
# A hidden STRING property
forceOpenAuthority:
hidden: true
Each elements defines a property whose name is build using the pattern <prefix>_<id>, for example sys_ctime.
The following types can be used:
STRING, a stringINTEGER, an integer numberFLOAT, a floating point numberBOOLEAN, a boolean, true or falseDATE, a dateDATETIME, a datetimeIf no model defines the type of a property when it is first used, the type is determined by the actual type of the value. This works for STRING, INTEGER, FLOAT and BOOLEAN, if the value is taken from a JSON object. DATE and DATETIME can not be distinguised from a STRING value in a JSON object, properties using these two types should be defined in a model file.
A property can be given a name that is used instead of the <prefix>_<id> form in the query API. If no name is given, the <prefix>_<ìd> form is used to identify a property in the query API.
A property can be hidden from the query API by setting the hidden element to true. The default is false.
A property can be given a comment that is noted in the database table of property definitions.