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.OrderedBase 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 booleancanHandle(AttributeDescriptorModel attributeDescriptorModel)Indicates whether the translator can handle given attribute descriptor.default booleancanHandle(AttributeDescriptorModel attributeDescriptor, ItemModel itemModel)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.ImpeximportData(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)Imports data based on provided importParameters for given attributeDescriptor.default java.lang.StringreferenceFormat(AttributeDescriptorModel attributeDescriptor)Format how a reference should be presented.ExcelValidationResultvalidate(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. This method is Recommended during importing excel file.- Parameters:
attributeDescriptorModel-AttributeDescriptorModel- Returns:
- whether the translator can handle request
-
canHandle
default boolean canHandle(AttributeDescriptorModel attributeDescriptor, ItemModel itemModel)
Indicates whether the translator can handle given attribute descriptor. This method is Recommended during exporting. During importing excel file, theitemModelwill be always null, because the item will be created by impex.- Parameters:
attributeDescriptor-AttributeDescriptorModelitemModel- instance of exporting model- 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-AttributeDescriptorModelobjectToExport-- 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 returnsImpexthanks 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:
Impexobject 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.parametersand original cell valueImportParameters.cellValueattributeDescriptor- - contains information about selected attribute for current cellcontext- - shared context which can be used as a cache- Returns:
- - validation result
-
-