如何重新声明核心模型属性类型而不在Hybris中扩展它

Fre*_*ded 3 hybris

默认情况下,Hybtis将CreditCardType作为强制属性.我希望通过使用redeclare=true(不使用新模型扩展它)使其成为可选项.我想知道它为什么不更新CreditCardPaymentInfo模型.我这样做

<itemtype code="CreditCardPaymentInfo" autocreate="false" generate="false" >
        <attributes>
            <attribute qualifier="type" type="CreditCardType" redeclare="true" autocreate="false" generate="true">
                <modifiers read="true" write="true" search="true" optional="true" />
                <persistence type="property"/>
            </attribute>
       </attributes>        
    </itemtype>
Run Code Online (Sandbox Code Playgroud)

我的蚂蚁构建工作正常.但是每当我更新运行系统时,Hybris都没有强制要求这个属性.

如果我用我的自定义模型扩展它并重新声明它然后它的工作,但这是我不需要的.我只是想让它成为可选而不扩展它.

我认为它可能与Impex一起,但我不知道如何.请帮忙.

Kam*_*kol 5

如果不扩展类型,则无法重新声明属性.重新声明的文件明确说明:

允许您从继承的类型重新定义属性定义.实质上,您可以使用不同类型的属性以及不同的修饰符组合,而不是超类型.

Impex到救援.您可以在之后使用impex更改属性修饰符.放置以下impex脚本

update AttributeDescriptor;enclosingType(code)[unique=true];qualifier[unique=true];optional
;CreditCardPaymentInfo;type;true
Run Code Online (Sandbox Code Playgroud)

<your-extension>/resources/impex/essentialdata-<chosse-a-name>.impex.

在每个类型系统更新(或初始化)上,此impex被执行并标记CreditCardPaymentInfo.type为可选.出于测试目的,您也可以在其中运行此脚本hac.