组件 ="base" 的自定义标签提供程序在后台不工作

Custom Label Provider not working in Backoffice for component="base"

SAP 商务 1811

我已经为我的自定义项目类型之一创建了一个自定义标签提供程序并将其应用于 component="base" 但它在 Backoffice 中不起作用。

CustomLabelProvider- 在 backoffice/src 文件夹中创建

public class CustomLabelProvider implements LabelProvider<CustomABCModel>
{  
    @Override
    public String getLabel(final CustomABCModel model)
    {
        // some custom logic
        return label;
    }

    @Override
    public String getDescription(final CustomABCModel model)
    {
       return getLabel(model);
    }

    @Override
    public String getIconPath(final CustomABCModel model)
    {
       return null;
    }
}

mybackoffice-后台-spring.xml

<bean id="customLabelProvider" class="com.hybris.backoffice.labels.impl.CustomLabelProvider"/>

mybackoffice-后台-config.xml

<context type="CustomABC" component="base" merge-by="type">
    <y:base>
        <y:labels>
            <y:labels beanId="customLabelProvider"/>
        </y:labels>
    </y:base>
</context>

我已完成所有步骤,但不知何故无法正常工作。 Backoffice 中未显示标签。

任何关于这里出了什么问题的帮助?

Labels 标签不能有下标签 labels,这是 Labels 标签的相关 xsd 结构:

<xs:complexType name="labels">
        <xs:all>
            <xs:element name="label" type="xs:string" minOccurs="0"/>
            <xs:element name="shortLabel" type="xs:string" minOccurs="0"/>
            <xs:element name="description" type="xs:string" minOccurs="0"/>
            <xs:element name="iconPath" type="xs:string" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="beanId" type="xs:string"/>
</xs:complexType>

所以您可能想这样做:

<context type="CustomABC" component="base" merge-by="type">
    <y:base>
        <y:labels beanId="customLabelProvider"/>
    </y:base>
</context>

标签分组不正确 XSD。

<context type="CustomABC" component="base" merge-by="type" parent="GenericItem">
        <y:base>
            <y:labels beanId="customLabelProvider"/>
        </y:base>
</context>