sap-commerce-cloudhybris-data-hub

Why by enumtype dynamic="false" is set to false?


Why by enumtype dynamic="false" is set to false? And when should I set it to "true"?

<enumtype code="MyEnumType" generate="true" autocreate="true" dynamic="false">
    <value code="NONE" />
    <value code="ONE" />
</enumtype>

Solution

  • In simple words, I can say static enum(dynamic="false", default value) is generated as the Java enum. In which list of values can only be changed during compilation time by changing the items.xml. In case of the dynamic enum(dynamic="true") we can change(add/remove) its values at runtime using hmc or Impex.


    Static Enum:

        <enumtype code="FixedValueType" autocreate="true" generate="true">
            <value code="value1"/>
            <value code="value2"/>
        </enumtype>
    

    Dynamic Enum:

        <enumtype code="OrderStatus" autocreate="true" generate="true" dynamic="true">
            <value code="CREATED"/>
            <value code="ON_VALIDATION"/>
            <value code="COMPLETED"/>
            <value code="CANCELLED"/>
        </enumtype>
    

    more about hybris enum