hybris - 当我在 Hybris 中本地化枚举类型时,如何解决 java.lang.IllegalStateException?
问题描述
我在 trainingcore-items.xml 中定义了 ServiceType enumtype 和 Service itemtype。
<typegroup name="Services">
<itemtype code="Service" autocreate="true" generate="true">
<deployment typecode="23456" table="Service"/>
<attributes>
<attribute qualifier="code" type="localized:java.lang.String" autocreate="true"
generate="true">
<persistence type="property"/>
<description>Service Code</description>
<modifiers unique="true" read="true" write="true"/>
</attribute>
<attribute qualifier="serviceType" type="localized:ServiceType" autocreate="true"
generate="true">
<persistence type="property"/>
<description>Service Type</description>
<modifiers read="true" write="true"/>
</attribute>
<attribute qualifier="years" type="localized:java.lang.Integer" autocreate="true"
generate="true">
<persistence type="property"/>
<description>Service Years</description>
<modifiers read="true" write="true"/>
</attribute>
</attributes>
</itemtype>
</typegroup>
<enumtype code="ServiceType" autocreate="true" generate="true" dynamic="true">
<value code="Basic"></value>
<value code="BasicOnsite"></value>
<value code="Advanced"></value>
</enumtype>
我在适当的文件中提供了本地化值: trainingcore_locales_en.properties:
type.Service.name=Service
type.Service.code.name=code
type.Service.serviceType.name=serviceType
type.Service.years.name=years
type.ServiceType.name=ServiceType
type.ServiceType.Basic.name=Basic
type.ServiceType.BasicOnsite.name=BasicOnsite
type.ServiceType.Advanced.name=Advanced
type.ProductServiceRelation.name= ProductServiceRelation
但是当我运行 ant clean all 时,构建失败并且我得到这个错误:
java.lang.IllegalStateException: invalid descriptor Service.serviceType(localized:ServiceType):((trainingcore))::YAttributeDescriptor[trainingcore-items.xml:190(AttributeTagListener)][PROPERTY] due to missing type 'localized:ServiceType'
请帮我解决这个错误。
解决方案
这个问题与您的另一个问题有关:How to localize a custom type created in trainingcore-items.xml in Hybris?
只需更改type="localized:ServiceType"
为type="ServiceType"
就可以了。
推荐阅读
- python - 从序列化程序生成表单
- javascript - 使用 MutationObserver 用另一个 div 的内容更新 iframe 内容
- reactjs - 在条件中使用 useFormik
- javascript - 如何运行 javascript 来更改 json 方案
- python - 从上一行开始平均每三个数据帧行
- sqlite - SQLITE 执行反向全文搜索
- android - 在 android studio 中创建子包问题
- bash - 在监视命令上按 CTRL+C 后运行命令
- r - 如何根据该列的值中是否存在字符串来替换该列中某些索引处的值(使用 dplyr 并重复没有循环)?
- rust - 使用 Arc 对 Actix 状态变量中的 hashmap 数据进行可变性,但出现“&”引用错误