1
votes

How to add new attribute for CSV file and how/where to update the code of the hot-folder process?

2

2 Answers

5
votes

In the Hybris Hot Folder principle, we convert a CSV file to an ImpEx file using the specific header that can be configured using Spring Integration logic.

Files to update/configure:

To specify/add/update the configuration of your Hot Folder logic/header look for a file named something like hot-folder-spring.xml in the hot-folder custom extension.

What to add :

Add your attribute in the ImpEx header of your type located in hot-folder configuration file, something like :

<bean id="myTypeConverter" class="de.hybris.platform.acceleratorservices.dataimport.batch.converter.impl.DefaultImpexConverter">
    <property name="header">
        <value># ImpEx for Importing MyType objects into $CATALOG$
            $catalog=$CATALOG$
            #% impex.setLocale(Locale.ENGLISH);
            INSERT_UPDATE MyType;code[unique=true];myAttribute[translator=com.dataimport.batch.converter.MyAttributeTranslator]// translator if need
        </value>
    </property>
    <property name="impexRow">
        <value>;{+0};{+1}</value> //{+1} = the number 1 is the position of the column of your attribute value {+csv-attribute-column-position}
    </property>
</bean>

Note:

Hot Folder, is a folder from which data can be automatically imported into the platform by simply placing the data inside of the folder.

Data are CSV files that can be converted to ImpEx files

2
votes

There is a hybris Trail you can follow which explains in detail which steps need to be undertaken for a hot folder configuration:

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

You can see how to define filenames, directories, time intervals and so on.