我有一个名为InoLocation的项目,它有一个名为'InoLocationType‘的枚举类型。此枚举类型包含3个值: COUNTRY、CITY、COUNTY。存在将城市和县导入到此项类型的impexes。在items.xml上,我创建了一个名为'cities‘的属性,它的类型是InoLocation。
默认情况下,'cities‘返回所有枚举类型。我想过滤这些枚举,只是在后台显示城市类型。
有可能吗?
<enumtypes>
<enumtype code="InoLocationType" >
<value code="COUNTRY"></value>
<value code="CITY"></value>
<value code="COUNTY"></value>
</enumtype>
</enumtypes>
<itemtypes>
<itemtype generate="true"
code="InoLocation"
jaloclass="com.inomera.hybris.custom.location.jalo.InoLocation"
extends="GenericItem"
autocreate="true">
<deployment table="ino_location" typecode="11115"/>
<attributes>
<attribute qualifier="code" type="java.lang.String">
<description>City's Plate Code</description>
<modifiers initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="name" type="java.lang.String">
<description>Location Name</description>
<modifiers initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="parent" type="InoLocation">
<description>Selected location's parent location</description>
<modifiers read="true" write="true" search="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="type" type="InoLocationType">
<description>Location Type</description>
<modifiers initial="true"/>
<persistence type="property"/>
</attribute>
</attributes>
</itemtype>
</itemtypes>
Cities label,Cities label opened
还有一件事,
这些屏幕来自backoffice,它们作为模型返回,我希望它们返回它们的'name‘属性。
发布于 2018-06-27 23:32:18
您可以使用下面的代码片段在后台中仅提供"CITY“。
<attribute qualifier="type" type="InoLocationType">
<description>Location Type</description>
<defaultvalue>em().getEnumerationValue("InoLocationType", "CITY")</defaultvalue>
<modifiers optional="false" read="true" write="false"/>
<persistence type="property"/>
</attribute>这将启用属性类型的默认值为“城市”,并且该属性作为不可更改的属性存在。
希望这能有所帮助!
发布于 2018-12-25 01:09:16
考虑一下availableValuesProvider编辑器参数:
<wz:property qualifier="cities">
<wz:editor-parameter>
<wz:name>availableValuesProvider</wz:name>
<wz:value>onlyWhatIWantToDisplayProvider</wz:value>
</wz:editor-parameter>
</wz:property>onlyWhatIWantToDisplayProvider是ReferenceEditorSearchFacade的一个实现,您必须将其声明为spring bean。
https://stackoverflow.com/questions/51061274
复制相似问题