Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 理解Hybris中的Impex语法语句_Java_Spring Mvc_Hybris - Fatal编程技术网

Java 理解Hybris中的Impex语法语句

Java 理解Hybris中的Impex语法语句,java,spring-mvc,hybris,Java,Spring Mvc,Hybris,您好,我正在尝试学习Hybris,因为我没有访问Wiki站点的权限,所以我很难理解代码背后的基础知识。请有人帮我理解以下关于主页中文本“欢迎访问主页”的Impex声明 下面代码中的问题是:;事实上,我还有更多,但不想增加负担,但如果你们能在弹劾声明的大部分基础上帮助我,我将非常感激 1) 在某些地方使用多个分号,为什么? 2) 什么是uid? 3) 似乎在starts中定义的参数值在每条语句中的两个分号(;;)后开始,请告诉我我是正确的 INSERT_UPDATE CMSParagraphCom

您好,我正在尝试学习Hybris,因为我没有访问Wiki站点的权限,所以我很难理解代码背后的基础知识。请有人帮我理解以下关于主页中文本“欢迎访问主页”的Impex声明

下面代码中的问题是:;事实上,我还有更多,但不想增加负担,但如果你们能在弹劾声明的大部分基础上帮助我,我将非常感激

1) 在某些地方使用多个分号,为什么?
2) 什么是uid?
3) 似乎在starts中定义的参数值在每条语句中的两个分号(;;)后开始,请告诉我我是正确的

INSERT_UPDATE CMSParagraphComponent;$contentCV[unique=true];uid[unique=true];name;&componentRef;;;;content;
;;welcomeInfoComponent;Welcome information;welcomeInfoComponent;;;;welcome to home page;

INSERT_UPDATE ContentSlotName;name[unique=true];template(uid,$contentCV)[unique=true][default='LandingPage2Template'];validComponentTypes(code);compTypeGroup(code)
;welcomeInfo;;;wide

INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;active
;;welcomeInfoSlot;welcome info slot;true

INSERT_UPDATE ContentSlotForTemplate;$contentCV[unique=true];uid[unique=true];position[unique=true];pageTemplate(uid,$contentCV)[unique=true][default='LandingPage2Template'];contentSlot(uid,$contentCV)[unique=true];allowOverwrite
;;WelcomeInfo-LandingPage2;welcomeInfo;;welcomeInfoSlot;true

INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];cmsComponents(uid,$contentCV)
;;welcomeInfoSlot;welcomeInfoComponent
什么是uid

uid是在CMSItem中定义为唯一的属性。大多数CMS项目都扩展了CMSItem。因此,您必须为Impex中的所有记录提供唯一的值。此外,uid还用于将CMSItem声明为目录感知

<itemtype code="CMSItem" jaloclass="de.hybris.platform.cms2.jalo.contents.CMSItem" extends="GenericItem" autocreate="true"
    generate="true" abstract="true">
    <custom-properties>
        <property name="catalogItemType">
            <value>java.lang.Boolean.TRUE</value>
        </property>
        <property name="catalogVersionAttributeQualifier">
            <value>"catalogVersion"</value>
        </property>
        <property name="uniqueKeyAttributeQualifier">
            <value>"uid"</value>
        </property>
    </custom-properties>
    <attributes>
        <attribute qualifier="uid" generate="true" autocreate="true" type="java.lang.String">
            <persistence type="property" />
            <modifiers optional="false" unique="true" />
        </attribute>
        <attribute qualifier="name" generate="true" autocreate="true" type="java.lang.String">
            <persistence type="property" />
        </attribute>
        <attribute qualifier="catalogVersion" type="CatalogVersion">
            <modifiers optional="false" unique="true" />
            <persistence type="property" />
        </attribute>
    </attributes>
</itemtype>
这里

  • 插入\u更新是您的impex模式
  • CMSParagraphComponent是ItemType
  • 然后你必须把;(分号),它只是值分隔符。从这里可以开始声明属性/列名(例如uid、name等)以及修饰符(例如[unique=true])
  • 现在,您的值应该位于第一行中定义的列下方(作为标题调用)。对于某些列,您不需要声明值,或者您想声明空值,那么您只需将其保留为空,就像我们对$contentCV
  • 这里是$contentCV是提供catalogVersion属性值的宏,它主要在文件顶部定义。在导入过程中,将解析这些宏,并用宏值替换宏名称。因此,我们将值保留为空,因为我们不需要为每个值行指定其值
在某些地方使用多个分号,为什么

为了文件的可读性,您可以在头中放置任意多的分号,在值行中放置相同的分号。如果您删除那些额外的即使你的弹劾会运行

INSERT_UPDATE CMSParagraphComponent ; $contentCV[unique=true] ; uid[unique=true]     ; name                ; &componentRef        ;  content              ;  
                                    ;                         ; welcomeInfoComponent ; Welcome information ; welcomeInfoComponent ;  welcome to home page ;  

感谢您的回复,这对理解代码非常有帮助。最后一个问题,&componentRef标记的用途是什么?
&componentRef
用于创建引用。这样您就可以在其他itemType中使用该引用。在这里您可以看到参考
welcomeInfoComponent
在最后一行(ContentSlot)中用于将您的组件与ContentSlot绑定(
welcomeInfoSlot
),我看到您在这里就StackOverflow问了很多问题,但没有接受任何答案。请查看此“”并为SO社区贡献力量
INSERT_UPDATE CMSParagraphComponent ; $contentCV[unique=true] ; uid[unique=true]     ; name                ; &componentRef        ;  content              ;  
                                    ;                         ; welcomeInfoComponent ; Welcome information ; welcomeInfoComponent ;  welcome to home page ;