Skip to Content

How to handle part-of relation data received through hot folder

If we are receiving a part-of relation data from input csv, how the conversion happens using hot folder concept?

For example, if the input is received as two files Customers.csv CustomerAddresses.csv

How do you perform documentID references between customers and customer addresses as they will be converted into two different impex files using converters.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2015 at 10:04 AM

    Hi Elango

    The Hot folder basically is a folder that have a config properties and this configuration is the one that discard one Impex from another. So basically is a template for an Impex.

    The best way to discard which impex are you going to use is to create in the configuration a mapping with the name of your Csv.

    Something like this for the "Customer.csv"

    First create your Bean that contain the Impex header

     <bean id="myTestConverter" class="de.hybris.platform.acceleratorservices.dataimport.batch.converter.impl.DefaultImpexConverter">
             <property name="header">
                 <value> INSERT_UPDATE Customer
                 </value>
             </property>
             <property name="impexRow">
                 <value> "Parameters"</value>
             </property>
             <property name="type" value="Customer"/>
         </bean>
    
    

    Then Create the Mapping

     <bean id="myTestConverterMapping"         class="de.hybris.platform.acceleratorservices.dataimport.batch.converter.mapping.impl.DefaultConverterMapping"
               p:mapping="Customer"
               p:converter-ref="myTestConverter"/>
    
    

    After you had Imported your Customers, you could add the address (in the same way creating a bean that contain the impex header in the configuration of your hot folder).

    Be aware that the Address is a partof Item of Costumer, that means that belongs to the customer and the reference is dynamic and is builded updating the customer (assigning the address to the customer). For that reason you have to make 2 headers in the same bean for the hot folder configuration

    Example, assuming that you already have inserted this customer "Elango"

     UPDATE customer;uid[unique=true];defaultshipmentAddress( &addrID );defaultpaymentaddress( &addrID )
     ;Elango;a2;a1
     INSERT_UPDATE address;streetname[unique=true];country(isocode);&addrID;owner( Customer.uid )
     ;payment address ireland;IE;a1;Elango
     ;shipping address ireland;IE;a2;Elango
    
    

    I hope that could solve your issue

    Best regards

    JC

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2015 at 03:15 PM

    Hi Elango

    Well, yes you should extend the "DefaultImpexConverter" in order to process both of the Impex headers in the same of your configuration. The method you should override is the method called convert(...).

    Don't worry about the mapping because the mapping only will call the bean you have configured with the double header so that is not going to cause you any problem.

    I strongly recommend you to try the impex header in the hAC and optimize it the the best possible for your purpose.

    I hope this helps

    Best Regards

    JC

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2016 at 07:18 AM

    Hi Juan,

    If both customer and address data is coming from same file then how can we import by using hotfolders?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Unfortunately is not possible with the OOTB hot folder configuration because the address is a part-of attribute and this kind of attributes requite 2 impex headers as i explain before. This actually the main limitation of hot folder. Basically one header to "instantiate or load" the customer (owner) and the second one to manipulate the part of attribute. This means that you may create a bean that contain 2 headers, which as far as i know, you can only achieve it by extending the DefaultImpexConverter class and do it by yourself.

      For your case i recommend you using the import cockpit.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.