I am a beginner in the Sap Hybris. I created a new model BookComponent
from SimpleCMSComponent
<itemtypes>
<itemtype code="BookComponent" extends="SimpleCMSComponent" generate="true" autocreate="true"
jaloclass="com.training.core.jalo.BookComponent">
<description>Used to display offers on homepage</description>
<attributes>
<attribute type="localized:java.lang.String" qualifier="headrerText">
<modifiers read="true" write="true" optional="true" />
<persistence type="property" />
</attribute>
<attribute type="localized:java.lang.String" qualifier="footerText">
<modifiers read="true" write="true" optional="true" />
<persistence type="property" />
</attribute>
<attribute type="Media" qualifier="bookImage">
<modifiers read="true" write="true" optional="false" />
<persistence type="property" />
</attribute>
<attribute type="BookLinksList" qualifier="bookImageLink">
<persistence type="property" />
<description>List of CMS Link Component</description>
<modifiers read="true" write="true" />
</attribute>
</attributes>
</itemtype>
</itemtypes>
<collectiontypes>
<collectiontype code="BookLinksList"
elementtype="CMSLinkComponent"
autocreate="true" generate="true" type="list" />
</collectiontypes>
after ant all with success and update, my model is created correctly even in the database with all the attributes as we defined in trainingcore-items.xml
file.
Then I created some impex to insert my new component as following :
$contentCatalog=apparel-ukContentCatalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Staged])[default=$contentCatalog:Staged]
$productCatalog=apparelProductCatalog
$productCatalogName=Apparel Product Catalog
$productCV=catalogVersion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
$picture=media(code, $contentCV) ;
$siteResource=jar:de.hybris.platform.apparelstore.constants.ApparelstoreConstants&/apparelstore/import/sampledata/contentCatalogs/$contentCatalog
$jarResourceCms=jar:de.hybris.platform.apparelstore.constants.ApparelstoreConstants&/apparelstore/import/sampledata/cockpits/cmscockpit
$category=category(code, $productCV)
$lang=en
INSERT_UPDATE CMSLinkComponent ; $contentCV[unique=true] ; uid[unique=true] ; name ; url ; &linkRef ; &componentRef ; target(code)[default='sameWindow'] ; $category
; ; InformatiqueBookLink ; Informatique Book Link ; /InformatiqueBookLink ; InformatiqueBookLink ; InformatiqueBookLink ; ;
; ; ScienceBookLink ; Science Book Link ; /ScienceBookLink ; ScienceBookLink ; ScienceBookLink ; ;
; ; AstroBookLink ; Astro Book Link ; /AstroBookLink ; AstroBookLink ; AstroBookLink ; ;
INSERT_UPDATE Media ; $contentCV[unique=true] ; code[unique=true] ; @media[translator=de.hybris.platform.impex.jalo.media.MediaDataTranslator] ; mime[default='image/jpeg'] ; &imageRef ; folder(qualifier)[default='images'] ; altText
; ; bookMedia ; $siteResource/images/banners/homepage/books.jpeg ; ; books.jpeg ; ; books.jpeg ;
INSERT_UPDATE BookComponent ; $contentCV[unique=true] ; uid[unique=true] ; name ; headrerText[lang=$lang] ; footerText[lang=$lang] ; bookImage(code) ; &componentRef ; bookImageLink(&linkRef)
; ; bookofferComponent ; offer Component ; "Header text" ; "Footer text" ; bookMedia ; bookofferComponent ; InformatiqueBookLink,ScienceBookLink,AstroBookLink
but insertion does not pass and on the hac cosnole this message is displayed
NSERT_UPDATE BookComponent;catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog]),CatalogVersion.version[default=Staged])[default=apparel-ukContentCatalog:Staged][unique=true];uid[unique=true];name;headrerText[lang=en];footerText[lang=en];bookImage(code);&componentRef;bookImageLink(&linkRef)
,,,,Exception : line 29: cannot create BookComponent with values ItemAttributeMap[ registry: null, type: <null>, data: {bookimagelink=[8796256896060, 8796256928828, 8796256961596], uid=bookofferComponent, bookimage=bookMedia(bookMedia(8798226972702)), catalogversion=apparel-ukContentCatalog/Staged(8796093186649), headrertext={8796093055008->en=Header text}, name=offer Component, footertext={8796093055008->en=Footer text}} ] due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@113d6726]:valeurs manquantes pour [footerText, headrerText] dans le modèle BookComponentModel (<unsaved>) pour créer un nouveau BookComponent, Exception : line 3: cannot create BookComponent with values ItemAttributeMap[ registry: null, type: <null>, data: {bookimagelink=[8796256896060, 8796256928828, 8796256961596], uid=bookofferComponent, bookimage=bookMedia(bookMedia(8798226972702)), catalogversion=apparel-ukContentCatalog/Staged(8796093186649), headrertext={8796093055008->en=Header text}, name=offer Component, footertext={8796093055008->en=Footer text}} ] due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@113d6726]:valeurs manquantes pour [footerText, headrerText] dans le modèle BookComponentModel (<unsaved>) pour créer un nouveau BookComponent;;bookofferComponent;offer Component;Header text;Footer text;bookMedia;bookofferComponent;InformatiqueBookLink,ScienceBookLink,AstroBookLink
However I add all mandatory fields. Thank for you all in advance.