cancel
Showing results for 
Search instead for 
Did you mean: 

customerConverter and customerPopulator problem

Former Member
0 Kudos
334

In this trail link

https://wiki.hybris.com/pages/viewpage.action?pageId=294094311

we come across a stage wherein we add customerInternalpopulator to customerConverter list

Then why isn't the customerPopulator added in same way to customerConverter as above, but is done as in code snippet shown from commerfacades-spring.xml(line 590 to 607) below

 <alias name="defaultCustomerConverter" alias="customerConverter"/>
         <bean id="defaultCustomerConverter" parent="abstractPopulatingConverter">
     <property name="targetClass" value="de.hybris.platform.commercefacades.user.data.CustomerData"/>
             <property name="populators">
                 <list>
                     <ref bean="customerPopulator"/>
                 </list>
             </property>
         </bean>
     <alias name="defaultCustomerPopulator" alias="customerPopulator"/>
     <bean id="defaultCustomerPopulator"
             class="de.hybris.platform.commercefacades.user.converters.populator.CustomerPopulator">
         <property name="currencyConverter" ref="currencyConverter"/>
         <property name="languageConverter" ref="languageConverter"/>
         <property name="customerNameStrategy" ref="customerNameStrategy"/>
     </bean>  

Let me summarise ....why isn't it like this??

 <bean id="customerPopulator" class="de.hybris.platform.commercefacades.user.converters.populator.CustomerPopulator"/>
    
    <bean parent="modifyPopulatorList">
    <property name="list" ref="customerConverter"/>
    <property name="add" ref="customerPopulator"/>
    </bean>








Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi @Jack ,

The modifyPopulatorList is used whenever we need to add a custom populator to an existing converter (list), without re-declaring the converter in our custom-spring.xml

So, in commercefacades-spring.xml, the customerPopulator and customerConverter are declared for the first time, so to add the customerPopulator as a list into the customerConverter, we need to define as below:

 <property name="populators">
                  <list>
                      <ref bean="customerPopulator"/>
                  </list>
              </property>

But, in the customerInternalpopulator case, we have add this into the existing converter, w/o re-declaring the converter. So, we use the below code:

    <bean parent="modifyPopulatorList">
         <property name="list" ref="customerConverter"/>
         <property name="add"  ref="customerInternalPopulator"/>
     </bean>
Former Member
0 Kudos

Thanks for ur response Sourav...So basically both the code snippets above are doing the same , but top one is adding a populator to a newly created list, whereas the bottom one is adding populator to an existing list...Correct me if my perspective is wrong :)

Former Member
0 Kudos

Yes Jack, this also helps us to not to redeclare the converter for adding the new populator.

Former Member
0 Kudos

Thanks and Brilliant as always!!! :)

Answers (0)