public class DefaultExcelImportService extends java.lang.Object implements ExcelImportService
Impex based on excel file represented by Workbook object. In order
to generating impex script, we can pass the cellValidation of {#importData} to ImpexConverter.convert(Impex).| Modifier and Type | Class and Description |
|---|---|
protected static class |
DefaultExcelImportService.CellValidationMetaData
POJO which contains cell validation meta data
|
| Modifier and Type | Field and Description |
|---|---|
static int |
FIRST_DATA_ROW_INDEX |
static java.lang.String |
MULTIVALUE_SEPARATOR
Deprecated.
since 1808 - Use
ImportParameters.MULTIVALUE_SEPARATOR |
| Constructor and Description |
|---|
DefaultExcelImportService() |
| Modifier and Type | Method and Description |
|---|---|
Impex |
convertToImpex(Workbook workbook)
Transforms excel workbook into
Impex object. |
protected boolean |
findFirstNotBlankCell(Row row) |
protected ImportParameters |
findImportParameters(SelectedAttribute selectedAttribute,
java.lang.String cellValue,
java.lang.String typeCode,
java.lang.String entryRef)
Parses cell's value taking into account reference pattern and default values (which are located in the second and
third row).
|
protected java.util.List<java.lang.String> |
generateDocumentRefs(java.lang.Integer rowsCount)
In order to simplify cross-reference imports, impex allows to use document reference.
|
protected Impex |
generateImpexForSheet(Sheet typeSystemSheet,
Sheet typeSheet)
Generates impex for given sheet
|
protected java.lang.String |
getAttributeDisplayName(SelectedAttribute attribute) |
DisplayNameAttributeNameFormatter |
getDisplayNameAttributeNameFormatter() |
ExcelCellService |
getExcelCellService() |
ExcelHeaderService |
getExcelHeaderService() |
ExcelSheetService |
getExcelSheetService() |
ExcelTemplateService |
getExcelTemplateService()
Deprecated.
since 1808
|
ExcelTranslatorRegistry |
getExcelTranslatorRegistry() |
ExcelValidationEngineAwareValidator |
getExcelValidationEngineAwareValidator() |
ExcelWorkbookService |
getExcelWorkbookService() |
ParserRegistry |
getParserRegistry() |
java.util.List<WorkbookValidator> |
getWorkbookValidators() |
protected boolean |
hasRowCorrectData(Row row) |
protected void |
insertDocumentReferences(Impex mainImpex,
java.lang.String typeCode,
java.util.List<java.lang.String> entriesRef)
In order to simplify cross-reference imports, impex allows to use document reference.
|
protected void |
mergeWithRowValidation(java.util.Map<java.lang.Integer,ExcelValidationResult> rowsValidation,
java.lang.Integer rowIndex,
ExcelValidationResult cellValidation) |
protected ExcelWorksheet |
populate(Sheet typeSystemSheet,
Sheet typeSheet) |
protected ExcelWorkbook |
populate(Workbook workbook) |
protected void |
populateHeaderMetadata(ValidationMessage header,
DefaultExcelImportService.CellValidationMetaData metaData) |
protected void |
populateRows(Sheet typeSheet,
ExcelWorksheet excelWorksheet,
java.util.List<java.lang.String> entriesRef,
SelectedAttribute selectedAttribute,
int columnIndex) |
protected ValidationMessage |
prepareValidationHeader(DefaultExcelImportService.CellValidationMetaData metaData) |
void |
setDisplayNameAttributeNameFormatter(DisplayNameAttributeNameFormatter displayNameAttributeNameFormatter) |
void |
setExcelCellService(ExcelCellService excelCellService) |
void |
setExcelHeaderService(ExcelHeaderService excelHeaderService) |
void |
setExcelSheetService(ExcelSheetService excelSheetService) |
void |
setExcelTemplateService(ExcelTemplateService excelTemplateService)
Deprecated.
since 1808
|
void |
setExcelTranslatorRegistry(ExcelTranslatorRegistry excelTranslatorRegistry) |
void |
setExcelValidationEngineAwareValidator(ExcelValidationEngineAwareValidator excelValidationEngineAwareValidator) |
void |
setExcelWorkbookService(ExcelWorkbookService excelWorkbookService) |
void |
setParserRegistry(ParserRegistry parserRegistry) |
void |
setWorkbookValidators(java.util.List<WorkbookValidator> workbookValidators) |
protected java.util.List<ExcelValidationResult> |
validate(ExcelWorksheet excelWorksheet,
java.util.Map<java.lang.String,java.lang.Object> context) |
java.util.List<ExcelValidationResult> |
validate(Workbook workbook)
Validates a workbook.
|
java.util.List<ExcelValidationResult> |
validate(Workbook workbook,
java.util.Set<java.lang.String> mediaContentEntries)
Validates a workbook.
|
protected java.util.Optional<ExcelValidationResult> |
validateCell(ExcelValueTranslator translator,
DefaultExcelImportService.CellValidationMetaData metaData) |
protected java.util.Optional<ExcelValidationResult> |
validateExcelFileOrigin(Workbook workbook) |
protected java.util.List<ExcelValidationResult> |
validateWorkbook(Workbook workbook) |
@Deprecated public static final java.lang.String MULTIVALUE_SEPARATOR
ImportParameters.MULTIVALUE_SEPARATORpublic static final int FIRST_DATA_ROW_INDEX
public Impex convertToImpex(Workbook workbook)
Impex object. It takes into account all sheets included in excel file.convertToImpex in interface ExcelImportServiceworkbook - Workbook object which represents excel fileImpex object which represents data from the workbookpublic java.util.List<ExcelValidationResult> validate(Workbook workbook, java.util.Set<java.lang.String> mediaContentEntries)
ExcelImportServicevalidate in interface ExcelImportServiceworkbook - workbook to validate.mediaContentEntries - set of entries names inside media content attached to the excel file. Null if media is not attached.public java.util.List<ExcelValidationResult> validate(Workbook workbook)
ExcelImportServicevalidate in interface ExcelImportServiceworkbook - workbook to validate.protected java.util.Optional<ExcelValidationResult> validateExcelFileOrigin(Workbook workbook)
protected java.util.List<ExcelValidationResult> validateWorkbook(Workbook workbook)
protected ExcelWorkbook populate(Workbook workbook)
protected ExcelWorksheet populate(Sheet typeSystemSheet, Sheet typeSheet)
protected void populateRows(Sheet typeSheet,
ExcelWorksheet excelWorksheet,
java.util.List<java.lang.String> entriesRef,
SelectedAttribute selectedAttribute,
int columnIndex)
protected boolean hasRowCorrectData(Row row)
protected boolean findFirstNotBlankCell(Row row)
protected java.util.List<ExcelValidationResult> validate(ExcelWorksheet excelWorksheet, java.util.Map<java.lang.String,java.lang.Object> context)
protected void mergeWithRowValidation(java.util.Map<java.lang.Integer,ExcelValidationResult> rowsValidation, java.lang.Integer rowIndex, ExcelValidationResult cellValidation)
protected java.lang.String getAttributeDisplayName(SelectedAttribute attribute)
protected java.util.Optional<ExcelValidationResult> validateCell(ExcelValueTranslator translator, DefaultExcelImportService.CellValidationMetaData metaData)
protected ValidationMessage prepareValidationHeader(DefaultExcelImportService.CellValidationMetaData metaData)
protected void populateHeaderMetadata(ValidationMessage header, DefaultExcelImportService.CellValidationMetaData metaData)
protected Impex generateImpexForSheet(Sheet typeSystemSheet, Sheet typeSheet)
typeSystemSheet - - sheet contains metainformation about type codestypeSheet - - sheet contains data for given type codeImpex generated impex objectprotected void insertDocumentReferences(Impex mainImpex, java.lang.String typeCode, java.util.List<java.lang.String> entriesRef)
mainImpex - Impex - represents impex for currently processing workbooktypeCode - - type code of currently processing sheetentriesRef - - list of generated document referencesprotected java.util.List<java.lang.String> generateDocumentRefs(java.lang.Integer rowsCount)
rowsCount - - indicates how many document references should be generated.protected ImportParameters findImportParameters(SelectedAttribute selectedAttribute, java.lang.String cellValue, java.lang.String typeCode, java.lang.String entryRef)
selectedAttribute - SelectedAttribute - Information about selected attribute: its isoCode (for localized values),
referencePattern for references and attributeDescriptorcellValue - - Original cell's value represented as StringtypeCode - - Type code of current sheetImportParameters Converted import parameters, merged with default values@Deprecated public ExcelTemplateService getExcelTemplateService()
@Deprecated public void setExcelTemplateService(ExcelTemplateService excelTemplateService)
public ExcelTranslatorRegistry getExcelTranslatorRegistry()
public void setExcelTranslatorRegistry(ExcelTranslatorRegistry excelTranslatorRegistry)
public java.util.List<WorkbookValidator> getWorkbookValidators()
public void setWorkbookValidators(java.util.List<WorkbookValidator> workbookValidators)
public ExcelValidationEngineAwareValidator getExcelValidationEngineAwareValidator()
public void setExcelValidationEngineAwareValidator(ExcelValidationEngineAwareValidator excelValidationEngineAwareValidator)
public ParserRegistry getParserRegistry()
public void setParserRegistry(ParserRegistry parserRegistry)
public ExcelWorkbookService getExcelWorkbookService()
public void setExcelWorkbookService(ExcelWorkbookService excelWorkbookService)
public ExcelSheetService getExcelSheetService()
public void setExcelSheetService(ExcelSheetService excelSheetService)
public ExcelCellService getExcelCellService()
public void setExcelCellService(ExcelCellService excelCellService)
public ExcelHeaderService getExcelHeaderService()
public void setExcelHeaderService(ExcelHeaderService excelHeaderService)
public DisplayNameAttributeNameFormatter getDisplayNameAttributeNameFormatter()
public void setDisplayNameAttributeNameFormatter(DisplayNameAttributeNameFormatter displayNameAttributeNameFormatter)
Copyright © 2018 SAP SE. All Rights Reserved.