Interface ExcelValueTranslator<T>
-
- Type Parameters:
T
- class which is supported by given translator
- All Superinterfaces:
org.springframework.core.Ordered
- All Known Implementing Classes:
AbstractCatalogVersionAwareTranslator
,AbstractExcelMediaImportTranslator
,AbstractExcelValueTranslator
,AbstractValidationAwareTranslator
,ExcelBaseProductTypeTranslator
,ExcelCatalogVersionTypeTranslator
,ExcelEnumTypeTranslator
,ExcelEurope1PricesTypeTranslator
,ExcelGenericReferenceTranslator
,ExcelJavaTypeTranslator
,ExcelMediaCollectionImportTranslator
,ExcelMediaCollectionUrlTranslator
,ExcelMediaImportTranslator
,ExcelMediaUrlTranslator
,ExcelProductSupercategoriesTypeTranslator
public interface ExcelValueTranslator<T> extends org.springframework.core.Ordered
Base excel translator interface. In case of importing excel, when a translator will be returned just single value and creation of additional entries (for example creating part-of entries: product - price row, ect.) is not required, then considerAbstractExcelValueTranslator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
canHandle(AttributeDescriptorModel attributeDescriptorModel)
Indicates whether the translator can handle given attribute descriptor.default java.util.Optional<java.lang.Object>
exportData(AttributeDescriptorModel attributeDescriptorModel, T objectToExport)
Converts given object to value which should be put into cell of exported excel file.java.util.Optional<java.lang.Object>
exportData(T objectToExport)
Converts given object to value which should be put into cell of exported excel file.Impex
importData(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)
Imports data based on provided importParameters for given attributeDescriptor.default java.lang.String
referenceFormat(AttributeDescriptorModel attributeDescriptor)
Format how a reference should be presented.ExcelValidationResult
validate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, java.util.Map<java.lang.String,java.lang.Object> context)
Validates single cell based on parsed importParameters.
-
-
-
Method Detail
-
canHandle
boolean canHandle(AttributeDescriptorModel attributeDescriptorModel)
Indicates whether the translator can handle given attribute descriptor.- Parameters:
attributeDescriptorModel
-AttributeDescriptorModel
- Returns:
- whether the translator can handle request
-
exportData
java.util.Optional<java.lang.Object> exportData(T objectToExport)
Converts given object to value which should be put into cell of exported excel file.- Parameters:
objectToExport
-- Returns:
- value which will be put into cell of exported excel file.
-
exportData
default java.util.Optional<java.lang.Object> exportData(AttributeDescriptorModel attributeDescriptorModel, T objectToExport)
Converts given object to value which should be put into cell of exported excel file.- Parameters:
attributeDescriptorModel
-AttributeDescriptorModel
objectToExport
-- Returns:
- value which will be put into cell of exported excel file.
-
importData
Impex importData(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)
Imports data based on provided importParameters for given attributeDescriptor. The method returnsImpex
thanks to that it is possible to creating additional entries ( or example creating part-of entries: product - price row, ect.)- Parameters:
attributeDescriptor
- describes attribute which should be importedimportParameters
- contains information about language for localized field, type code, parsed parameters inserted into excel's cell.- Returns:
Impex
object which is representation of impex script.
-
referenceFormat
default java.lang.String referenceFormat(AttributeDescriptorModel attributeDescriptor)
Format how a reference should be presented. Usually references consist of a few fields indicated as unique. Therefore all unique attributes should be included in the format. Example reference format: "catalog:version"- Parameters:
attributeDescriptor
-AttributeDescriptorModel
- Returns:
- Format how a reference should be presented
-
validate
ExcelValidationResult validate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, java.util.Map<java.lang.String,java.lang.Object> context)
Validates single cell based on parsed importParameters. If cell has reference format then parsed values are available inImportParameters.parameters
. Otherwise the value of cell can be obtained byImportParameters.cellValue
.- Parameters:
importParameters
- - contains information about parsed cell value (for reference format)ImportParameters.parameters
and original cell valueImportParameters.cellValue
attributeDescriptor
- - contains information about selected attribute for current cellcontext
- - shared context which can be used as a cache- Returns:
- - validation result
-
-