The composite component is nothing but the one to many relations between two components.
For Example:
Please refer the below item changes for the above composite component
Child component :
<itemtype code="LeaderShipImageComponent" autocreate="true" generate="true" extends="CMSImageComponent">
<attributes>
<attribute qualifier="lsname"type="localized:java.lang.String">
<description>Heading</description>
<persistence type="property" />
</attribute>
<attribute qualifier="lsimage" type="Media">
<description>Tagline</description>
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
Parent component :
<itemtype code="LeaderShipComponent" autocreate="true" generate="true" extends="CMSImageComponent">
<attributes>
<attribute qualifier="heading"type="localized:java.lang.String">
<description>Heading</description>
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
Relation between parent component and child component :
<relation localized="false" code="LeaderShipToLeaderShipImageRelation">
<sourceElement qualifier="leaderShipComponent" cardinality="one" type="LeaderShipComponent"></sourceElement>
<targetElement qualifier="leaderShip" cardinality="many" type="LeaderShipImageComponent"></targetElement>
</relation>
Impex changes:
INSERT_UPDATE LeaderShipComponent;$contentCV[unique=true];uid[unique=true];name;leaderShip(uid,$contentCV);&componentRef
;;SampleLeaderShip1Component;Sample LeaderShip 1 Component;"SampleLeaderShipImageComponent1A,SampleLeaderShipImageComponent1B,SampleLeaderShipImageComponent1C,SampleLeaderShipImageComponent1D";SampleLeaderShip1Component
INSERT_UPDATE LeaderShipImageComponent;$contentCV[unique=true];uid[unique=true];name;lsname;lsrole;
;;SampleLeaderShipImageComponent1A;Sample LeaderShip Image Component 1A;Dr. Arjang Nowtash;President.;
;;SampleLeaderShipImageComponent1B;Sample LeaderShip Image Component 1B;Victor Michaud;Vice President, Ontario, Quebec, and Atlantic Canada;
;;SampleLeaderShipImageComponent1C;Sample LeaderShip Image Component 1C;Gerry Hagglund;Vice President, Manitoba;
;;SampleLeaderShipImageComponent1D;Sample LeaderShip Image Component 1D;Shahab Soltani;Vice President, Alberta;
Patent component JSP (leadershipcomponent.jsp):
<div class="container">
<div>
<h4>${component.heading}</h4>
<c:forEach items="${component.leaderShip}" var="leadership">
<cms:component component="${leadership}" />
</c:forEach>
</div>
</div>
Child component JSP (leadershipimagecomponent.jsp):
<div>
<img alt="officedesign-project-management" src="${component.lsimage.url}">
<h4>${component.lsname}</h4>
</div>
useful content
ReplyDelete