Class AbstractExcelImportWorkbookDecorator
- java.lang.Object
-
- com.hybris.backoffice.excel.importing.AbstractExcelImportWorkbookDecorator
-
- All Implemented Interfaces:
ExcelImportWorkbookDecorator
,ExcelImportWorkbookValidationAwareDecorator
,org.springframework.core.Ordered
- Direct Known Subclasses:
DefaultExcelImportClassificationWorkbookDecorator
public abstract class AbstractExcelImportWorkbookDecorator extends java.lang.Object implements ExcelImportWorkbookValidationAwareDecorator
Abstract class for import workbook decorator. This class provides utility methods for finding appropriate attributes, importing parameters and merging impexes.
-
-
Constructor Summary
Constructors Constructor Description AbstractExcelImportWorkbookDecorator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Impex
convertToImpex(ExcelAttribute excelAttribute, ImportParameters importParameters, ExcelImportContext excelImportContext)
Converts given excel attribute and import parameters into impex object.void
decorate(ExcelImportResult excelImportResult)
DecoratesImpex
object.protected java.util.Optional<java.lang.Integer>
findColumnIndex(org.apache.poi.ss.usermodel.Row headerRow, java.lang.String content)
protected abstract java.util.Collection<ExcelAttribute>
getExcelAttributes(org.apache.poi.ss.usermodel.Sheet sheet)
Finds appropriate attributes for given decorator implementation.ExcelAttributeTranslatorRegistry
getExcelAttributeTranslatorRegistry()
ExcelCellService
getExcelCellService()
ExcelHeaderService
getExcelHeaderService()
ExcelSheetService
getExcelSheetService()
int
getOrder()
ParserRegistry
getParserRegistry()
void
setExcelAttributeTranslatorRegistry(ExcelAttributeTranslatorRegistry excelAttributeTranslatorRegistry)
void
setExcelCellService(ExcelCellService excelCellService)
void
setExcelHeaderService(ExcelHeaderService excelHeaderService)
void
setExcelSheetService(ExcelSheetService excelSheetService)
void
setParserRegistry(ParserRegistry parserRegistry)
void
setValidators(java.util.List<ExcelAttributeValidator<? extends ExcelAttribute>> validators)
java.util.List<ExcelValidationResult>
validate(org.apache.poi.ss.usermodel.Workbook workbook)
java.util.List<ExcelValidationResult>
validate(org.apache.poi.ss.usermodel.Workbook workbook, java.util.Set<java.lang.String> mediaContentEntries)
Uses lists ofExcelAttributeValidator
to validategiven workbook.
-
-
-
Method Detail
-
validate
public java.util.List<ExcelValidationResult> validate(org.apache.poi.ss.usermodel.Workbook workbook)
- Specified by:
validate
in interfaceExcelImportWorkbookValidationAwareDecorator
- Parameters:
workbook
-- Returns:
-
validate
public java.util.List<ExcelValidationResult> validate(org.apache.poi.ss.usermodel.Workbook workbook, java.util.Set<java.lang.String> mediaContentEntries)
Description copied from interface:ExcelImportWorkbookValidationAwareDecorator
Uses lists ofExcelAttributeValidator
to validategiven workbook.- Specified by:
validate
in interfaceExcelImportWorkbookValidationAwareDecorator
- Parameters:
workbook
- which represents excel filemediaContentEntries
- - list of media entries- Returns:
- collection of validation results
-
decorate
public void decorate(@Nonnull ExcelImportResult excelImportResult)
Description copied from interface:ExcelImportWorkbookDecorator
DecoratesImpex
object.- Specified by:
decorate
in interfaceExcelImportWorkbookDecorator
- Parameters:
excelImportResult
- - import result which contains workbook and transformedImpex
object.
-
getExcelAttributes
protected abstract java.util.Collection<ExcelAttribute> getExcelAttributes(org.apache.poi.ss.usermodel.Sheet sheet)
Finds appropriate attributes for given decorator implementation.- Parameters:
sheet
-- Returns:
- collection of excel's attributes
-
convertToImpex
protected Impex convertToImpex(ExcelAttribute excelAttribute, ImportParameters importParameters, ExcelImportContext excelImportContext)
Converts given excel attribute and import parameters into impex object.- Parameters:
excelAttribute
-importParameters
-excelImportContext
-- Returns:
- Impex object for given cell
-
findColumnIndex
protected java.util.Optional<java.lang.Integer> findColumnIndex(org.apache.poi.ss.usermodel.Row headerRow, java.lang.String content)
-
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
getParserRegistry
public ParserRegistry getParserRegistry()
-
setParserRegistry
public void setParserRegistry(ParserRegistry parserRegistry)
-
getExcelAttributeTranslatorRegistry
public ExcelAttributeTranslatorRegistry getExcelAttributeTranslatorRegistry()
-
setExcelAttributeTranslatorRegistry
public void setExcelAttributeTranslatorRegistry(ExcelAttributeTranslatorRegistry excelAttributeTranslatorRegistry)
-
setValidators
public void setValidators(java.util.List<ExcelAttributeValidator<? extends ExcelAttribute>> validators)
-
getExcelSheetService
public ExcelSheetService getExcelSheetService()
-
setExcelSheetService
public void setExcelSheetService(ExcelSheetService excelSheetService)
-
getExcelHeaderService
public ExcelHeaderService getExcelHeaderService()
-
setExcelHeaderService
public void setExcelHeaderService(ExcelHeaderService excelHeaderService)
-
getExcelCellService
public ExcelCellService getExcelCellService()
-
setExcelCellService
public void setExcelCellService(ExcelCellService excelCellService)
-
-