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 consider
AbstractExcelValueTranslator-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(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.exportData(AttributeDescriptorModel attributeDescriptorModel, T objectToExport) Converts given object to value which should be put into cell of exported excel file.exportData(T objectToExport) Converts given object to value which should be put into cell of exported excel file.importData(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters) Imports data based on provided importParameters for given attributeDescriptor.default StringreferenceFormat(AttributeDescriptorModel attributeDescriptor) Format how a reference should be presented.validate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, Map<String, Object> context) Validates single cell based on parsed importParameters.Methods inherited from interface org.springframework.core.Ordered
getOrder
-
Method Details
-
canHandle
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
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
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 Optional<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
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
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, Map<String, 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
-