Class ExcelJavaTypeTranslator
- java.lang.Object
-
- com.hybris.backoffice.excel.translators.AbstractValidationAwareTranslator<T>
-
- com.hybris.backoffice.excel.translators.AbstractExcelValueTranslator<java.lang.Object>
-
- com.hybris.backoffice.excel.translators.ExcelJavaTypeTranslator
-
- All Implemented Interfaces:
ExcelValueTranslator<java.lang.Object>
,org.springframework.core.Ordered
public class ExcelJavaTypeTranslator extends AbstractExcelValueTranslator<java.lang.Object>
Translates java types like: numbers, boolean values and dates. Dates are exported in format:ExcelDateUtils.getDateTimeFormat()
. Dates are exported inExcelDateUtils.getExportTimeZone()
time zone. During import date is treated as in export time zone so it's converted back into system time zone (default is UTC).
-
-
Field Summary
-
Fields inherited from class com.hybris.backoffice.excel.translators.AbstractExcelValueTranslator
order
-
Fields inherited from class com.hybris.backoffice.excel.translators.AbstractValidationAwareTranslator
validators
-
-
Constructor Summary
Constructors Constructor Description ExcelJavaTypeTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(AttributeDescriptorModel attributeDescriptorModel)
Indicates whether the translator can handle given attribute descriptor.java.util.Optional<java.lang.Object>
exportData(java.lang.Object objectToExport)
Converts given object to value which should be put into cell of exported excel file.ExcelDateUtils
getExcelDateUtils()
ExcelFilter<AttributeDescriptorModel>
getExcelUniqueFilter()
ExcelFilter<AttributeDescriptorModel>
getMandatoryFilter()
protected ImpexValue
importDate(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)
ImpexValue
importValue(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)
Imports single value instead of whole Impex object.java.lang.String
referenceFormat(AttributeDescriptorModel attributeDescriptor)
Format how a reference should be presented.void
setExcelDateUtils(ExcelDateUtils excelDateUtils)
void
setExcelUniqueFilter(ExcelFilter<AttributeDescriptorModel> excelUniqueFilter)
void
setMandatoryFilter(ExcelFilter<AttributeDescriptorModel> mandatoryFilter)
-
Methods inherited from class com.hybris.backoffice.excel.translators.AbstractExcelValueTranslator
getOrder, getTypeService, importData, isLocalizedOfType, setOrder, setTypeService
-
Methods inherited from class com.hybris.backoffice.excel.translators.AbstractValidationAwareTranslator
getValidators, setValidators, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.hybris.backoffice.excel.translators.ExcelValueTranslator
exportData
-
-
-
-
Method Detail
-
canHandle
public boolean canHandle(AttributeDescriptorModel attributeDescriptorModel)
Description copied from interface:ExcelValueTranslator
Indicates whether the translator can handle given attribute descriptor.- Parameters:
attributeDescriptorModel
-AttributeDescriptorModel
- Returns:
- whether the translator can handle request
-
exportData
public java.util.Optional<java.lang.Object> exportData(java.lang.Object objectToExport)
Description copied from interface:ExcelValueTranslator
Converts 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.
-
importValue
public ImpexValue importValue(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)
Description copied from class:AbstractExcelValueTranslator
Imports single value instead of whole Impex object. Impex value consists of header and value.- Specified by:
importValue
in classAbstractExcelValueTranslator<java.lang.Object>
- Parameters:
attributeDescriptor
-AttributeDescriptorModel
describes attribute which should be importedimportParameters
- - contains information about language for localized field, type code, parsed parameters inserted into excel's cell.- Returns:
ImpexValue
value which should be imported
-
importDate
protected ImpexValue importDate(AttributeDescriptorModel attributeDescriptor, ImportParameters importParameters)
-
referenceFormat
public java.lang.String referenceFormat(AttributeDescriptorModel attributeDescriptor)
Description copied from interface:ExcelValueTranslator
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
-
getExcelDateUtils
public ExcelDateUtils getExcelDateUtils()
-
setExcelDateUtils
public void setExcelDateUtils(ExcelDateUtils excelDateUtils)
-
getExcelUniqueFilter
public ExcelFilter<AttributeDescriptorModel> getExcelUniqueFilter()
-
setExcelUniqueFilter
public void setExcelUniqueFilter(ExcelFilter<AttributeDescriptorModel> excelUniqueFilter)
-
getMandatoryFilter
public ExcelFilter<AttributeDescriptorModel> getMandatoryFilter()
-
setMandatoryFilter
public void setMandatoryFilter(ExcelFilter<AttributeDescriptorModel> mandatoryFilter)
-
-