Class ExcelEurope1PricesTypeTranslator
java.lang.Object
com.hybris.backoffice.excel.translators.AbstractValidationAwareTranslator<T>
com.hybris.backoffice.excel.translators.AbstractExcelValueTranslator<Collection<PriceRowModel>>
com.hybris.backoffice.excel.translators.ExcelEurope1PricesTypeTranslator
- All Implemented Interfaces:
ExcelValueTranslator<Collection<PriceRowModel>>,org.springframework.core.Ordered
public class ExcelEurope1PricesTypeTranslator
extends AbstractExcelValueTranslator<Collection<PriceRowModel>>
Price translator which allows to import product prices. It utilises impex
Europe1PricesTranslator and
Europe1PricesTranslator.Europe1PriceRowTranslator to import prices.
Format: price currency:'N'|'G':user|userPriceGroup:quantity unit:[dateFrom to dateTo]:channel where:
- price currency: defines price and currency which are mandatory fields
- N|G: N stands for
Europe1PricesTranslator.NETTOand G forEurope1PricesTranslator.GROSSwhich is taken as default when not provided. - user|userPriceGroup: User or userPriceGroup for which the price is created
- quantity unit: if not defined then default quantity is 1 and unit is taken from the product but when user or userPriceGroup is given this field is mandatory
- [dateFrom to dateTo]: defines price active range. The date time should be in format
ExcelDateUtils.getDateTimeFormat(). Date is exported inExcelDateUtils.getExportTimeZone()time zone. During import dates are converted from exported time zone to system time zone. By default export/import is done in UTC - channel: defines channel in which price is valid
- 10 EUR::axel:2 pieces:[10.11.2017 12:00:00 to 15:12:2017 12:00:00]:mobile - defines price with value 10 EUR Gross for user axel with min quantity 2 pieces, active from 10.11.2017 12:00:00 to 15:12:2017 12:00:00 in mobile channel
- 20 EUR:N::3 pieces - defines price with value 20 EUR Netto for 3 pieces
- 15 EUR - defines price 15 EUR for 1 unit which will be taken from
ProductModel.getUnit()
Europe1PricesTranslator.Europe1PriceRowTranslator
- 10 EUR::axel:2 pieces:[10.11.2017 12:00:00 to 15:12:2017 12:00:00]:mobile -> axel 2 pieces = 10 EUR [10.11.2017 12:00:00,15:12:2017 12:00:00] mobile
- 20 EUR:N::3 pieces ->2 pieces = 20 EUR N
- 15 EUR -> 15 EUR
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.since 1811, not used anymore.static final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class com.hybris.backoffice.excel.translators.AbstractExcelValueTranslator
orderFields inherited from class com.hybris.backoffice.excel.translators.AbstractValidationAwareTranslator
validatorsFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadjustPriceToCurrentLocale(ImportParameters importParameters) Deprecated, for removal: This API element is subject to removal in a future version.since 1905.protected voidappendIfPresent(StringBuilder sb, String value) protected StringbuildSinglePriceImpexValue(Map<String, String> params) booleancanHandle(AttributeDescriptorModel attributeDescriptor) Indicates whether the translator can handle given attribute descriptor.exportData(Collection<PriceRowModel> objectToExport) Converts given object to value which should be put into cell of exported excel file.protected StringexportPriceRow(PriceRowModel priceRow) protected StringgetDateRange(StandardDateRange range) protected StringgetImpexDateRange(String dateRange) protected <T> StringgetValueOrEmpty(T reference, Function<T, String> valueSupplier) importValue(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters) Imports single value instead of whole Impex object.referenceFormat(AttributeDescriptorModel attributeDescriptor) Format how a reference should be presented.voidsetCommonI18NService(CommonI18NService commonI18NService) voidsetExcelDateUtils(ExcelDateUtils excelDateUtils) Methods inherited from class com.hybris.backoffice.excel.translators.AbstractExcelValueTranslator
getOrder, getTypeService, importData, isLocalizedOfType, setOrder, setTypeServiceMethods inherited from class com.hybris.backoffice.excel.translators.AbstractValidationAwareTranslator
getValidators, setValidators, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hybris.backoffice.excel.translators.ExcelValueTranslator
canHandle, exportData
-
Field Details
-
EUROPE1_PRICE_HEADER
Deprecated, for removal: This API element is subject to removal in a future version.since 1811, not used anymore. The attribute qualifier (DescriptorModel.getQualifier()) will be used as impex header value name (ImpexHeaderValue.name)- See Also:
-
PRICE_CURRENCY
- See Also:
-
NET_GROSS
- See Also:
-
USER_OR_UPG
- See Also:
-
QUANTITY_UNIT
- See Also:
-
CHANNEL
- See Also:
-
-
Constructor Details
-
ExcelEurope1PricesTypeTranslator
public ExcelEurope1PricesTypeTranslator()
-
-
Method Details
-
canHandle
Description copied from interface:ExcelValueTranslatorIndicates whether the translator can handle given attribute descriptor. This method is Recommended during importing excel file.- Parameters:
attributeDescriptor-AttributeDescriptorModel- Returns:
- whether the translator can handle request
-
exportData
Description copied from interface:ExcelValueTranslatorConverts given object to value which should be put into cell of exported excel file.- Returns:
- value which will be put into cell of exported excel file.
-
exportPriceRow
-
getDateRange
-
getValueOrEmpty
-
referenceFormat
Description copied from interface:ExcelValueTranslatorFormat 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
-
importValue
public ImpexValue importValue(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters) Description copied from class:AbstractExcelValueTranslatorImports single value instead of whole Impex object. Impex value consists of header and value.- Specified by:
importValuein classAbstractExcelValueTranslator<Collection<PriceRowModel>>- Parameters:
attributeDescriptor-AttributeDescriptorModeldescribes attribute which should be importedimportParameters- - contains information about language for localized field, type code, parsed parameters inserted into excel's cell.- Returns:
ImpexValuevalue which should be imported
-
adjustPriceToCurrentLocale
@Deprecated(since="1905", forRemoval=true) protected void adjustPriceToCurrentLocale(ImportParameters importParameters) Deprecated, for removal: This API element is subject to removal in a future version.since 1905. Not used anymore. -
buildSinglePriceImpexValue
-
appendIfPresent
-
getImpexDateRange
-
getCommonI18NService
-
setCommonI18NService
-
getExcelDateUtils
-
setExcelDateUtils
-