cancel
Showing results for 
Search instead for 
Did you mean: 

Components list of an other component, sync fail

Former Member
0 Kudos

A component have a list of other components inside, like brandsCarouselComponent with brandItem list inside. If we change an attribute of brandItem from smartedit, brandsCarouselComponent does not recognize the change and its not posible to sync or clone all the component.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Sync

For the correct configuration of the components it is neccesary to create the component list as a relation of type one-to-many. Example:
<relation code="BenefitItemForBenefitsComponent" generate="true" localized="false" autocreate="true">
 <sourceElement qualifier="benefitItems" type="BenefitElementComponent" cardinality="many" collectiontype="list">
 <modifiers read="true" write="true" search="true" optional="true" partof="true"/>
 </sourceElement>
 <targetElement qualifier="benefitsComponent" type="BenefitsComponent" cardinality="one">
 <modifiers read="true" write="true" search="true" optional="true" />
  </targetElement>
</relation>
Also it's needed to set the following line in local.properties:
relation.BenefitItemForBenefitsComponent.markmodified=true
Before this configuration, in v1905 when child component attribute changes (smartedit) it is not neccesary to change any parent attribute.

Clone

To add deep cloning support for additional CMS item types and attributes, you can define and add new BiPredicates to the list of cmsModelCloningContextPartOfPredicates BiPredicates as follows:
   <bean id="accCmsModelCloningContextPartOfPredicates"
 depends-on="cmsModelCloningContextPartOfPredicates" parent="listMergeDirective">
 <property name="add" ref="cmsBenefitsComponentForBenefitElementComponentPredicate" />
 </bean>
  
 <alias name="defaultBenefitsComponentForBenefitElementComponentPredicate" alias="cmsBenefitsComponentForBenefitElementComponentPredicate" />
 <bean id="defaultBenefitsComponentForBenefitElementComponentPredicate" />
Bean code:
public class BenefitsComponentForBenefitElementComponentPredicate implements BiPredicate<ItemModel, String>
{
 private static final Logger LOG = Logger.getLogger(BenefitsComponentForBenefitElementComponentPredicate.class);
 @Override
 public boolean test(final ItemModel component, final String qualifier)
 {
 final boolean treatAsPartOf = (component instanceof BenefitsComponentModel)
 && qualifier.equals(BenefitsComponentModel.BENEFITITEMS);
 if (treatAsPartOf)
 {
 LOG.debug("Should treatAsPartOf for : " + component.getItemtype() + " - " + qualifier);
 }
 return treatAsPartOf;
 }
}
For more information visit: https://help.sap.com/viewer/86dd1373053a4c2da8f9885cc9fbe55d/1811/en-US/95e7d463fe704627a153685ff6a5...
Former Member
0 Kudos

Another issue too is the caché, it kind of component does not work fine with a list of components inside.