Class DefaultImpexConverter
java.lang.Object
com.hybris.backoffice.excel.importing.DefaultImpexConverter
- All Implemented Interfaces:
ImpexConverter
Default service responsible for generating impex script based on
Impex object.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturns true when all values indicated as unique have not empty value.Generates impex script which contains impex header (for example INSERT_UPDATE Product;code[unique=true];name[lang=en];) and multi-lines which represent impex's data.protected StringReturns escaped string value.protected StringprepareHeaderAttribute(ImpexHeaderValue headerAttribute) Prepares single header value of impex.protected StringprepareImpexHeader(ImpexForType impexForType) Prepares first row of impex script for given type.protected StringprepareImpexRows(ImpexForType impexForType) Generates String which contains many lines represent rows for impex scripts.
-
Field Details
-
IMPEX_OPERATION_TYPE
- See Also:
-
DEFAULT_FIELD_SEPARATOR
-
DEFAULT_LINE_SEPARATOR
-
-
Constructor Details
-
DefaultImpexConverter
public DefaultImpexConverter()
-
-
Method Details
-
convert
Description copied from interface:ImpexConverterGenerates impex script which contains impex header (for example INSERT_UPDATE Product;code[unique=true];name[lang=en];) and multi-lines which represent impex's data. Lines which does not contain all unique attributes are omitted.- Specified by:
convertin interfaceImpexConverter- Parameters:
impex-- Returns:
- converted impex script. Lines which does not contain all unique attributes are omitted.
-
prepareImpexRows
Generates String which contains many lines represent rows for impex scripts. Lines which does not contain all unique attributes are omitted.- Parameters:
impexForType-ImpexForType- Returns:
- multi-lines String represents rows of impex scripts
-
getValue
Returns escaped string value. If value contains semicolon, coma, new lines then value is wrapped in double quotes. If the value is null then empty string will be returned.- Parameters:
value- which should be converted to string and escaped if needed- Returns:
- escaped value
-
areUniqueAttributesPopulated
Returns true when all values indicated as unique have not empty value.- Parameters:
row- maps containsImpexHeaderValueas keys andObjectas values.- Returns:
- true when all values indicated as unique have not empty value.
-
prepareImpexHeader
Prepares first row of impex script for given type. Example result: INSERT_UPDATE Product;code[unique=true];name[lang=en];- Parameters:
impexForType-ImpexForType- Returns:
- first row of impex script for given type.
-
prepareHeaderAttribute
Prepares single header value of impex. Example outputs: code[unique=true], name[unique=true, lang=en]- Parameters:
headerAttribute-ImpexHeaderValueconsists of header name, language and indicator whether attribute is unique- Returns:
- represents single header value
-