Enum Types
Enum TypesEnum Type (EnumType). A specialized ValueType representing an enumerated list of fixed constant values defined within the model. allow you to create ValueTypes for which the possible values are enumerated in the model.
Enum typesEnum Type (EnumType). A specialized ValueType representing an enumerated list of fixed constant values defined within the model. are split into 2 expander bundlesExpander BundleA set of expanders sharing a repository, packaged into an expansion resource or archive.. Use the enum-type-rest-expanders if you want to integrate with the rest-expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact..
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>File 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 FieldFieldA property of a DataElement expanded to a database column and user interface input element. 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 fieldFieldA property of a DataElement expanded to a database column and user interface input element. to the new EnumType, also update the commands for the REST APIs, otherwise it will not compile.