Package de.hybris.y2ysync.impex
Class PullMediaDataTranslator
- java.lang.Object
-
- de.hybris.y2ysync.impex.PullMediaDataTranslator
-
- All Implemented Interfaces:
SpecialValueTranslator
public class PullMediaDataTranslator extends java.lang.Object implements SpecialValueTranslator
Allows to transfer media data from a source platform to another target platform like this: Export: It's assembling a URL which shall be accessible be the target system. For that a 'baseURL' ImpEx property may be specified. If that's omitted the platform property 'y2ysync.home.url' will be used.INSERT_UPDATE Media; @doesntMatter[translator=de.hybris.y2ysync.impexmc.PullMediaDataTranslator, baseURL='http://public.host.url'];Import: When importing it's simply pulling the data from the previously exported URL and callsMedia.setDataFromStream(InputStream).
-
-
Constructor Summary
Constructors Constructor Description PullMediaDataTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(SpecialColumnDescriptor columnDescriptor)Called once upon header creation to do some initial setup logic.booleanisEmpty(java.lang.String cellValue)Evaluates whether or not a cell value is treated as empty.protected booleanisExport(SpecialColumnDescriptor cd)java.lang.StringperformExport(Item item)Called each time an item is exported using the enclosing header.voidperformImport(java.lang.String cellValue, Item processedItem)Called each time a non-empty cell value has to be imported.voidvalidate(java.lang.String expr)Validates the special column definition.
-
-
-
Method Detail
-
init
public void init(SpecialColumnDescriptor columnDescriptor) throws HeaderValidationException
Description copied from interface:SpecialValueTranslatorCalled once upon header creation to do some initial setup logic.- Specified by:
initin interfaceSpecialValueTranslator- Parameters:
columnDescriptor- the newly created column descriptor- Throws:
HeaderValidationException- indicates that the column descriptor is not configured properly
-
isExport
protected boolean isExport(SpecialColumnDescriptor cd)
-
validate
public void validate(java.lang.String expr) throws HeaderValidationExceptionDescription copied from interface:SpecialValueTranslatorValidates the special column definition.- Specified by:
validatein interfaceSpecialValueTranslator- Parameters:
expr- the definition expression- Throws:
HeaderValidationException- if the expression is not valid
-
performExport
public java.lang.String performExport(Item item) throws ImpExException
Description copied from interface:SpecialValueTranslatorCalled each time an item is exported using the enclosing header.- Specified by:
performExportin interfaceSpecialValueTranslator- Parameters:
item- the item to export- Returns:
- the string representation of the value to export
- Throws:
ImpExException- indicates an export error
-
performImport
public void performImport(java.lang.String cellValue, Item processedItem) throws ImpExExceptionDescription copied from interface:SpecialValueTranslatorCalled each time a non-empty cell value has to be imported.- Specified by:
performImportin interfaceSpecialValueTranslator- Parameters:
cellValue- the cell value stringprocessedItem- the item to import the value for- Throws:
ImpExException- indicates an import error
-
isEmpty
public boolean isEmpty(java.lang.String cellValue)
Description copied from interface:SpecialValueTranslatorEvaluates whether or not a cell value is treated as empty.Empty cell values are not passed to
SpecialValueTranslator.performImport(String, Item).- Specified by:
isEmptyin interfaceSpecialValueTranslator- Parameters:
cellValue- the cell value string- Returns:
trueif the cell value is empty
-
-