Class DefaultExcelHeaderService
- java.lang.Object
-
- com.hybris.backoffice.excel.template.header.DefaultExcelHeaderService
-
- All Implemented Interfaces:
ExcelHeaderService
public class DefaultExcelHeaderService extends java.lang.Object implements ExcelHeaderService
Default implementation ofExcelHeaderService
-
-
Constructor Summary
Constructors Constructor Description DefaultExcelHeaderService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Optional<org.apache.poi.ss.usermodel.Row>findTypeSystemRowForGivenHeader(org.apache.poi.ss.usermodel.Sheet metaInformationSheet, java.lang.String typeCode, java.lang.String header)java.util.Collection<java.lang.String>getHeaderDisplayNames(org.apache.poi.ss.usermodel.Sheet sheet)Returns list of attribute display names, that is: the contents of the display name row:ExcelTemplateConstants.Header.DISPLAY_NAMEjava.util.Collection<SelectedAttribute>getHeaders(org.apache.poi.ss.usermodel.Sheet metaInformationSheet, org.apache.poi.ss.usermodel.Sheet typeSheet)Returns list of selected attributes for given sheet, based on metainformation from type system sheet.java.util.Collection<SelectedAttributeQualifier>getSelectedAttributesQualifiers(org.apache.poi.ss.usermodel.Sheet metaInformationSheet, org.apache.poi.ss.usermodel.Sheet typeSheet)Returns qualifiers of attributes which at selected in the typSheetvoidinsertAttributeHeader(org.apache.poi.ss.usermodel.Sheet sheet, ExcelAttribute excelAttribute, int columnIndex)Inserts value to the sheet's headervoidinsertAttributesHeader(org.apache.poi.ss.usermodel.Sheet sheet, java.util.Collection<? extends ExcelAttribute> excelAttributes)A shortcut forExcelHeaderService.insertAttributeHeader(Sheet, ExcelAttribute, int)It is possible to inserts all values to the header at once instead of invokingExcelHeaderService.insertAttributeHeader(Sheet, ExcelAttribute, int)for every attribute separatelyprotected AttributeDescriptorModelloadAttributeDescriptor(org.apache.poi.ss.usermodel.Row row, java.lang.String typeCode)protected java.lang.StringloadIsoCode(org.apache.poi.ss.usermodel.Row row, java.lang.String header)voidsetAttributeNameFormatter(AttributeNameFormatter<ExcelAttributeDescriptorAttribute> attributeNameFormatter)voidsetCollectionFormatter(CollectionFormatter collectionFormatter)voidsetDefaultValueIndex(ExcelTemplateConstants.Header defaultValueIndex)voidsetExcelCellService(ExcelCellService excelCellService)voidsetExcelSheetService(ExcelSheetService excelSheetService)voidsetExcelTranslatorRegistry(ExcelTranslatorRegistry excelTranslatorRegistry)voidsetHeaderRowIndex(ExcelTemplateConstants.Header headerRowIndex)voidsetReferencePatternRowIndex(ExcelTemplateConstants.Header referencePatternRowIndex)voidsetTypeService(TypeService typeService)-
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.template.header.ExcelHeaderService
getHeaderValueWithoutSpecialMarks
-
-
-
-
Method Detail
-
getHeaders
public java.util.Collection<SelectedAttribute> getHeaders(org.apache.poi.ss.usermodel.Sheet metaInformationSheet, org.apache.poi.ss.usermodel.Sheet typeSheet)
Description copied from interface:ExcelHeaderServiceReturns list of selected attributes for given sheet, based on metainformation from type system sheet.- Specified by:
getHeadersin interfaceExcelHeaderService- Parameters:
metaInformationSheet-Sheetcontains metaInformation about attributes for each type sheetstypeSheet-Sheetcontains data for given sheet- Returns:
- collection of selected attributes
-
getHeaderDisplayNames
public java.util.Collection<java.lang.String> getHeaderDisplayNames(org.apache.poi.ss.usermodel.Sheet sheet)
Description copied from interface:ExcelHeaderServiceReturns list of attribute display names, that is: the contents of the display name row:ExcelTemplateConstants.Header.DISPLAY_NAME- Specified by:
getHeaderDisplayNamesin interfaceExcelHeaderService- Parameters:
sheet- TheSheetfrom which the display names should be taken- Returns:
- List of display names for each attribute in the sheet
-
getSelectedAttributesQualifiers
public java.util.Collection<SelectedAttributeQualifier> getSelectedAttributesQualifiers(org.apache.poi.ss.usermodel.Sheet metaInformationSheet, org.apache.poi.ss.usermodel.Sheet typeSheet)
Description copied from interface:ExcelHeaderServiceReturns qualifiers of attributes which at selected in the typSheet- Specified by:
getSelectedAttributesQualifiersin interfaceExcelHeaderService- Parameters:
metaInformationSheet-Sheetcontains metaInformation about attributes for each type sheetstypeSheet-Sheetcontains data for given sheet- Returns:
- collection of selected attributes.
-
insertAttributeHeader
public void insertAttributeHeader(org.apache.poi.ss.usermodel.Sheet sheet, ExcelAttribute excelAttribute, int columnIndex)Description copied from interface:ExcelHeaderServiceInserts value to the sheet's header- Specified by:
insertAttributeHeaderin interfaceExcelHeaderService- Parameters:
sheet- where the value will be insertedexcelAttribute- a pojo which allows to retrieve value to insertcolumnIndex- index of a column for inserted value
-
insertAttributesHeader
public void insertAttributesHeader(org.apache.poi.ss.usermodel.Sheet sheet, java.util.Collection<? extends ExcelAttribute> excelAttributes)Description copied from interface:ExcelHeaderServiceA shortcut forExcelHeaderService.insertAttributeHeader(Sheet, ExcelAttribute, int)It is possible to inserts all values to the header at once instead of invokingExcelHeaderService.insertAttributeHeader(Sheet, ExcelAttribute, int)for every attribute separately- Specified by:
insertAttributesHeaderin interfaceExcelHeaderService- Parameters:
sheet- where the value will be insertedexcelAttributes- a collection of pojos which allows to retrieve value to insert
-
findTypeSystemRowForGivenHeader
protected java.util.Optional<org.apache.poi.ss.usermodel.Row> findTypeSystemRowForGivenHeader(org.apache.poi.ss.usermodel.Sheet metaInformationSheet, java.lang.String typeCode, java.lang.String header)
-
loadIsoCode
protected java.lang.String loadIsoCode(org.apache.poi.ss.usermodel.Row row, java.lang.String header)
-
loadAttributeDescriptor
protected AttributeDescriptorModel loadAttributeDescriptor(org.apache.poi.ss.usermodel.Row row, java.lang.String typeCode)
-
setAttributeNameFormatter
public void setAttributeNameFormatter(AttributeNameFormatter<ExcelAttributeDescriptorAttribute> attributeNameFormatter)
-
setTypeService
public void setTypeService(TypeService typeService)
-
setCollectionFormatter
public void setCollectionFormatter(CollectionFormatter collectionFormatter)
-
setExcelSheetService
public void setExcelSheetService(ExcelSheetService excelSheetService)
-
setExcelCellService
public void setExcelCellService(ExcelCellService excelCellService)
-
setExcelTranslatorRegistry
public void setExcelTranslatorRegistry(ExcelTranslatorRegistry excelTranslatorRegistry)
-
setHeaderRowIndex
public void setHeaderRowIndex(ExcelTemplateConstants.Header headerRowIndex)
-
setReferencePatternRowIndex
public void setReferencePatternRowIndex(ExcelTemplateConstants.Header referencePatternRowIndex)
-
setDefaultValueIndex
public void setDefaultValueIndex(ExcelTemplateConstants.Header defaultValueIndex)
-
-