4

By default Hybtis gives CreditCardType as a mandatory attribute. I want to make it Optional by using redeclare=true (without extending it with new model). I am wondering why its not updating CreditCardPaymentInfo model. I am doing like this

<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>

My ant build is working fine. But whenever i m updating running system, Hybris is not making this attribute non mandatory.

In case if I am extending it with my custom model and re-declaring it then its working, but that's what i don't need. I just want to make it optional without extending it.

I think its possible with Impex also, but i don't know the way. Please help.

4

1 回答 1

6

您不能在不扩展类型的情况下重新声明属性。重新声明的文档清楚地说明了这一点:

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

Impex 进行救援。之后您可以使用 impex 更改属性修饰符。放置以下 impex 脚本

update AttributeDescriptor;enclosingType(code)[unique=true];qualifier[unique=true];optional
;CreditCardPaymentInfo;type;true

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

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

于 2014-08-24T09:39:30.667 回答