Class MediaDataTranslator
java.lang.Object
de.hybris.platform.impex.jalo.translators.AbstractSpecialValueTranslator
de.hybris.platform.impex.jalo.media.MediaDataTranslator
- All Implemented Interfaces:
SpecialValueTranslator
Special translator which allows to import data from a file to a media item or vice versa.
It holds a
It holds a
MediaDataHandler for each thread for import/export the data. So you always have to set such an
handler before using the translator.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final MediaDataHandlerGets the handler currently mapped to current thread.static final booleanvoidinit(SpecialColumnDescriptor columnDescriptor) Called once upon header creation to do some initial setup logic.performExport(Item processedItem) Called each time an item is exported using the enclosing header.voidperformImport(String cellValue, Item processedItem) Called each time a non-empty cell value has to be imported.static voidsetMediaDataHandler(MediaDataHandler handler) Sets theMediaDataHandlerfor current thread.static final voidUnsets the handler which was mapped to the current thread for import/export.voidValidates the special column definition.Methods inherited from class de.hybris.platform.impex.jalo.translators.AbstractSpecialValueTranslator
isEmpty
-
Constructor Details
-
MediaDataTranslator
public MediaDataTranslator()
-
-
Method Details
-
setMediaDataHandler
Sets theMediaDataHandlerfor current thread. This handler will be used for import/export if called by this thread.
ATTENTION: An already set handler will be overwritten.- Parameters:
handler- the handler which will be set for current thread.
-
unsetMediaDataHandler
public static final void unsetMediaDataHandler()Unsets the handler which was mapped to the current thread for import/export. -
hasHandler
public static final boolean hasHandler() -
getHandler
Gets the handler currently mapped to current thread.- Returns:
- current handler mapped to current thread
-
init
Description copied from interface:SpecialValueTranslatorCalled once upon header creation to do some initial setup logic.- Specified by:
initin interfaceSpecialValueTranslator- Overrides:
initin classAbstractSpecialValueTranslator- Parameters:
columnDescriptor- the newly created column descriptor- Throws:
HeaderValidationException- indicates that the column descriptor is not configured properly
-
validate
Description copied from interface:SpecialValueTranslatorValidates the special column definition.- Specified by:
validatein interfaceSpecialValueTranslator- Overrides:
validatein classAbstractSpecialValueTranslator- Parameters:
expr- the definition expression- Throws:
HeaderValidationException- if the expression is not valid
-
performExport
Description copied from interface:SpecialValueTranslatorCalled each time an item is exported using the enclosing header.- Specified by:
performExportin interfaceSpecialValueTranslator- Overrides:
performExportin classAbstractSpecialValueTranslator- Parameters:
processedItem- the item to export- Returns:
- the string representation of the value to export
- Throws:
ImpExException- indicates an export error
-
performImport
Description copied from interface:SpecialValueTranslatorCalled each time a non-empty cell value has to be imported.- Specified by:
performImportin interfaceSpecialValueTranslator- Overrides:
performImportin classAbstractSpecialValueTranslator- Parameters:
cellValue- the cell value stringprocessedItem- the item to import the value for- Throws:
ImpExException- indicates an import error
-