Java SAP Hybris can';创建自定义横幅组件

Java SAP Hybris can';创建自定义横幅组件,java,hybris,backoffice,Java,Hybris,Backoffice,我想创建自定义横幅组件,从SimpleBannerComponent扩展而来。但在我创建它之后,它无法在Backoffice中创建,请参见下文 1) 我将此项目添加到我的*-items.xml文件中 <itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent" jaloclass="my.package.core

我想创建自定义横幅组件,从
SimpleBannerComponent
扩展而来。但在我创建它之后,它无法在Backoffice中创建,请参见下文

1) 我将此项目添加到我的
*-items.xml
文件中

<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent"
          jaloclass="my.package.core.jalo.components.PromotionBannerCMSComponent">
    <description>Promotion banner component</description>
    <deployment table="PromotionBanners" typecode="15301"/>
    <attributes>
        <attribute qualifier="code" type="java.lang.String">
            <persistence type="property"/>
            <modifiers/>
            <description>Banner name (not unique)</description>
        </attribute>
        <attribute qualifier="title" type="localized:java.lang.String">
            <description>Title</description>
            <modifiers read="true" write="true" search="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="position" type="SimpleBannerPositionEnum">
            <description>Banner position</description>
            <modifiers optional="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="altText" type="localized:java.lang.String">
            <description>Banner alt text</description>
            <modifiers optional="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="titleSecondary" type="localized:java.lang.String">
            <description>Title secondary</description>
            <persistence type="property" />
            <modifiers />
        </attribute>
        <attribute qualifier="urlLoc" type="localized:java.lang.String">
            <description>Banner url</description>
            <persistence type="property" />
            <modifiers />
        </attribute>
    </attributes>
</itemtype>

现在我甚至不能创建基本的SimpleBannerComponent,其他组件也不能。更新有什么问题吗?
我使用的是Hybris 1811.18。

我能看到的一个问题是应该删除部署表,因为最佳做法是仅在扩展通用项时提供一个部署表(当您不指定父项时,此类型将自动设置)。所以你的定义应该是这样的:

<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent"
      jaloclass="my.package.core.jalo.components.PromotionBannerCMSComponent">
<description>Promotion banner component</description>
<attributes>
    <attribute qualifier="code" type="java.lang.String">
        <persistence type="property"/>
        <modifiers/>
        <description>Banner name (not unique)</description>
    </attribute>
    <attribute qualifier="title" type="localized:java.lang.String">
        <description>Title</description>
        <modifiers read="true" write="true" search="true" initial="true"/>
        <persistence type="property"/>
    </attribute>
    <attribute qualifier="position" type="SimpleBannerPositionEnum">
        <description>Banner position</description>
        <modifiers optional="true" initial="true"/>
        <persistence type="property"/>
    </attribute>
    <attribute qualifier="altText" type="localized:java.lang.String">
        <description>Banner alt text</description>
        <modifiers optional="true" initial="true"/>
        <persistence type="property"/>
    </attribute>
    <attribute qualifier="titleSecondary" type="localized:java.lang.String">
        <description>Title secondary</description>
        <persistence type="property" />
        <modifiers />
    </attribute>
    <attribute qualifier="urlLoc" type="localized:java.lang.String">
        <description>Banner url</description>
        <persistence type="property" />
        <modifiers />
    </attribute>
</attributes>

促销横幅组件
横幅名称(非唯一)
标题
旗帜位置
横幅alt文本
职称中学
横幅url


尝试初始化系统以进行测试,以便从数据库中删除旧类型及其关联的表。

我使用1905.13测试了您的代码,它工作正常。(我需要调整包名并添加SimpleBannerPositionEnum定义)我只是在平台更新期间在命令行中执行“ant all”和“Update running system”(未选中任何扩展名)。我能够在backoffice中创建PromotionBannerCMComponent的实例


您是否尝试过初始化,看看它是否对您有效?否则,您可能需要分享有关错误/stacktrace的更多信息。

原来我有一个旧的部署表,它与此组件发生冲突,但在
ant clean all
过程中,它没有显示错误

所以我在HAC
delete中运行,其中typecode=XX(XX是在HAC中找到的类型代码),并以几乎相同的部署重新开始,除了我删除了jaloclass和部署表描述:

<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent">
    <description>Promotion banner component</description>
    <attributes>
        <attribute qualifier="code" type="java.lang.String">
            <persistence type="property"/>
            <modifiers/>
            <description>Banner name (not unique)</description>
        </attribute>
        <attribute qualifier="title" type="localized:java.lang.String">
            <description>Title</description>
            <modifiers read="true" write="true" search="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="position" type="SimpleBannerPositionEnum">
            <description>Banner position</description>
            <modifiers optional="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="altText" type="localized:java.lang.String">
            <description>Banner alt text</description>
            <modifiers optional="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="titleSecondary" type="localized:java.lang.String">
            <description>Title secondary</description>
            <persistence type="property" />
            <modifiers />
        </attribute>
        <attribute qualifier="urlLoc" type="localized:java.lang.String">
            <description>Banner url</description>
            <persistence type="property" />
            <modifiers />
        </attribute>
    </attributes>
</itemtype>

促销横幅组件
横幅名称(非唯一)
标题
旗帜位置
横幅alt文本
职称中学
横幅url

我能看到的一个问题是应该删除部署表
——这不是问题的根本原因。在本例中,只是放置一个额外的部署表需要FS查询来创建更多的联接。您是否尝试过
ant updatesystem
<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent"
      jaloclass="my.package.core.jalo.components.PromotionBannerCMSComponent">
<description>Promotion banner component</description>
<attributes>
    <attribute qualifier="code" type="java.lang.String">
        <persistence type="property"/>
        <modifiers/>
        <description>Banner name (not unique)</description>
    </attribute>
    <attribute qualifier="title" type="localized:java.lang.String">
        <description>Title</description>
        <modifiers read="true" write="true" search="true" initial="true"/>
        <persistence type="property"/>
    </attribute>
    <attribute qualifier="position" type="SimpleBannerPositionEnum">
        <description>Banner position</description>
        <modifiers optional="true" initial="true"/>
        <persistence type="property"/>
    </attribute>
    <attribute qualifier="altText" type="localized:java.lang.String">
        <description>Banner alt text</description>
        <modifiers optional="true" initial="true"/>
        <persistence type="property"/>
    </attribute>
    <attribute qualifier="titleSecondary" type="localized:java.lang.String">
        <description>Title secondary</description>
        <persistence type="property" />
        <modifiers />
    </attribute>
    <attribute qualifier="urlLoc" type="localized:java.lang.String">
        <description>Banner url</description>
        <persistence type="property" />
        <modifiers />
    </attribute>
</attributes>
<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent">
    <description>Promotion banner component</description>
    <attributes>
        <attribute qualifier="code" type="java.lang.String">
            <persistence type="property"/>
            <modifiers/>
            <description>Banner name (not unique)</description>
        </attribute>
        <attribute qualifier="title" type="localized:java.lang.String">
            <description>Title</description>
            <modifiers read="true" write="true" search="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="position" type="SimpleBannerPositionEnum">
            <description>Banner position</description>
            <modifiers optional="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="altText" type="localized:java.lang.String">
            <description>Banner alt text</description>
            <modifiers optional="true" initial="true"/>
            <persistence type="property"/>
        </attribute>
        <attribute qualifier="titleSecondary" type="localized:java.lang.String">
            <description>Title secondary</description>
            <persistence type="property" />
            <modifiers />
        </attribute>
        <attribute qualifier="urlLoc" type="localized:java.lang.String">
            <description>Banner url</description>
            <persistence type="property" />
            <modifiers />
        </attribute>
    </attributes>
</itemtype>