Enum Types
Enum Types are an experimental extension of the elements
metamodel.
They allow you to create ValueTypes for which the possible values are enumerated in the model.
Enum-types are split into 2 expander bundles. Use the enum-type-rest-expanders
if you want to integrate with the rest-expanders.
Defining EnumType
EnumTypes are defined in a Component.
In the Component model directory, add your EnumType models under valueTypes
.
E.g. this describes a FileChangeType enum:
<valueType name="FileChangeType" type="enumTypeElements::EnumType">
<packageName>org.normalizedsystems.quests</packageName>
<values>
<enumValueType name="ADD">
<description>File was created</description>
</enumValueType>
<enumValueType name="MODIFY">
<description>File was updated</description>
</enumValueType>
<enumValueType name="DELETE">
<description>Files was removed</description>
</enumValueType>
<enumValueType name="RENAME">
<description>File was moved or renamed</description>
</enumValueType>
<enumValueType name="COPY">
<description>File is a copy from another file</description>
</enumValueType>
</values>
</valueType>
The ValueType can then be used as target for ValueField#type
:
<field name="changeType">
<valueField>
<type name="FileChangeType"/>
</valueField>
</field>
You can use the defaultValue
option on a Field to define one of the enums as initial value:
<field name="changeType">
<valueField>
<type name="FileChangeType"/>
</valueField>
<options>
<defaultValue>MODIFY</defaultValue>
</options>
</field>
Known Issues
- When changing a field to the new EnumType, also update the commands for the REST APIs, otherwise it will not compile.
- You will have to use at least version
1.15.9
of the micro-radiant, otherwise your project will not be able to load.
Missing Integrations
- Angular-expanders
- Knockout UI