Class DefaultExcelSheetService
- java.lang.Object
-
- com.hybris.backoffice.excel.template.sheet.DefaultExcelSheetService
-
- All Implemented Interfaces:
ExcelSheetService
public class DefaultExcelSheetService extends java.lang.Object implements ExcelSheetService
Default implementation ofExcelSheetService
-
-
Constructor Summary
Constructors Constructor Description DefaultExcelSheetService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.poi.ss.usermodel.SheetcreateOrGetTypeSheet(org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String typeCode)Creates a new type sheet in given workbook.org.apache.poi.ss.usermodel.SheetcreateOrGetUtilitySheet(org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String sheetName)Creates a new utility sheet in given workbook.org.apache.poi.ss.usermodel.SheetcreateTypeSheet(org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String sheetName)Creates a new sheet and adds it to given workbook.protected java.lang.StringfindAttributeDisplayNameInTypeSystemSheet(org.apache.poi.ss.usermodel.Sheet typeSystemSheet, ExcelAttribute excelAttribute)intfindColumnIndex(org.apache.poi.ss.usermodel.Sheet typeSystemSheet, org.apache.poi.ss.usermodel.Sheet sheet, ExcelAttribute excelAttribute)Finds column index based on selected attribute.java.lang.StringfindSheetNameForTypeCode(org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String typeCode)Finds sheet name for given type code.java.lang.StringfindTypeCodeForSheetName(org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String sheetName)Finds type code for given sheet name.java.util.Collection<org.apache.poi.ss.usermodel.Sheet>getSheets(org.apache.poi.ss.usermodel.Workbook workbook)Returns all sheets except utility sheets.java.util.Collection<java.lang.String>getSheetsNames(org.apache.poi.ss.usermodel.Workbook workbook)Returns all sheets names except utility sheets.voidsetAttributeNameFormatter(AttributeNameFormatter<ExcelAttributeDescriptorAttribute> attributeNameFormatter)voidsetCollectionFormatter(CollectionFormatter collectionFormatter)voidsetExcelCellService(ExcelCellService excelCellService)voidsetExcelSheetNamingStrategy(ExcelSheetNamingStrategy excelSheetNamingStrategy)voidsetExcelWorkbookService(ExcelWorkbookService excelWorkbookService)voidsetExcludedSheets(java.util.Collection<ExcelTemplateConstants.UtilitySheet> excludedSheets)voidsetHeaderRowIndex(ExcelTemplateConstants.Header headerRowIndex)voidsetTypeTemplate(ExcelTemplateConstants.UtilitySheet typeTemplate)-
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.sheet.ExcelSheetService
createEmptyRow, getSheet
-
-
-
-
Method Detail
-
getSheetsNames
public java.util.Collection<java.lang.String> getSheetsNames(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook)Description copied from interface:ExcelSheetServiceReturns all sheets names except utility sheets.- Specified by:
getSheetsNamesin interfaceExcelSheetService- Parameters:
workbook-Workbookobject which represents excel file- Returns:
- collection of sheets names
-
getSheets
public java.util.Collection<org.apache.poi.ss.usermodel.Sheet> getSheets(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook)Description copied from interface:ExcelSheetServiceReturns all sheets except utility sheets.- Specified by:
getSheetsin interfaceExcelSheetService- Parameters:
workbook-Workbookobject which represents excel file- Returns:
- collection of sheets
-
createOrGetTypeSheet
public org.apache.poi.ss.usermodel.Sheet createOrGetTypeSheet(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, @Nonnull java.lang.String typeCode)Description copied from interface:ExcelSheetServiceCreates a new type sheet in given workbook. If a sheet with given typeCode already exists, it is returned without creating an extra one.- Specified by:
createOrGetTypeSheetin interfaceExcelSheetService- Parameters:
workbook- workbook which will be extended by a new sheettypeCode- a new sheet name- Returns:
- newly created of already existed Sheet.
-
createTypeSheet
public org.apache.poi.ss.usermodel.Sheet createTypeSheet(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, @Nonnull java.lang.String sheetName)Description copied from interface:ExcelSheetServiceCreates a new sheet and adds it to given workbook.- Specified by:
createTypeSheetin interfaceExcelSheetService- Parameters:
workbook- workbook which will be extended by a new sheetsheetName- a new sheet name- Returns:
- newly created Sheet.
-
createOrGetUtilitySheet
public org.apache.poi.ss.usermodel.Sheet createOrGetUtilitySheet(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, @Nonnull java.lang.String sheetName)Description copied from interface:ExcelSheetServiceCreates a new utility sheet in given workbook. If a sheet with given name already exists, it is returned without creating an extra one.- Specified by:
createOrGetUtilitySheetin interfaceExcelSheetService- Parameters:
workbook- workbook which will be extended by a new sheetsheetName- a new sheet name.- Returns:
- newly created or already existed Sheet.
-
findColumnIndex
public int findColumnIndex(org.apache.poi.ss.usermodel.Sheet typeSystemSheet, @Nonnull org.apache.poi.ss.usermodel.Sheet sheet, ExcelAttribute excelAttribute)Description copied from interface:ExcelSheetServiceFinds column index based on selected attribute. If column doesn't exist then -1 will be returned.- Specified by:
findColumnIndexin interfaceExcelSheetService- Parameters:
typeSystemSheet- sheet which contains information about type systemsheet- sheet for current typeexcelAttribute- attribute for which column index should be found- Returns:
- column index for given selected attribute. If column doesn't exist then -1 will be returned.
-
findTypeCodeForSheetName
public java.lang.String findTypeCodeForSheetName(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String sheetName)Description copied from interface:ExcelSheetServiceFinds type code for given sheet name.- Specified by:
findTypeCodeForSheetNamein interfaceExcelSheetService- Parameters:
workbook- workbooksheetName- sheet name- Returns:
- found type code.
-
findSheetNameForTypeCode
public java.lang.String findSheetNameForTypeCode(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String typeCode)Description copied from interface:ExcelSheetServiceFinds sheet name for given type code.- Specified by:
findSheetNameForTypeCodein interfaceExcelSheetService- Parameters:
workbook- workbooktypeCode- type code- Returns:
- found type code.
-
findAttributeDisplayNameInTypeSystemSheet
protected java.lang.String findAttributeDisplayNameInTypeSystemSheet(org.apache.poi.ss.usermodel.Sheet typeSystemSheet, ExcelAttribute excelAttribute)
-
setCollectionFormatter
public void setCollectionFormatter(CollectionFormatter collectionFormatter)
-
setExcelCellService
public void setExcelCellService(ExcelCellService excelCellService)
-
setExcelSheetNamingStrategy
public void setExcelSheetNamingStrategy(ExcelSheetNamingStrategy excelSheetNamingStrategy)
-
setAttributeNameFormatter
public void setAttributeNameFormatter(AttributeNameFormatter<ExcelAttributeDescriptorAttribute> attributeNameFormatter)
-
setExcelWorkbookService
public void setExcelWorkbookService(ExcelWorkbookService excelWorkbookService)
-
setExcludedSheets
public void setExcludedSheets(java.util.Collection<ExcelTemplateConstants.UtilitySheet> excludedSheets)
-
setTypeTemplate
public void setTypeTemplate(ExcelTemplateConstants.UtilitySheet typeTemplate)
-
setHeaderRowIndex
public void setHeaderRowIndex(ExcelTemplateConstants.Header headerRowIndex)
-
-