Class DefaultExcelSheetService

java.lang.Object
com.hybris.backoffice.excel.template.sheet.DefaultExcelSheetService
All Implemented Interfaces:
ExcelSheetService

public class DefaultExcelSheetService extends Object implements ExcelSheetService
Default implementation of ExcelSheetService
  • Constructor Details

    • DefaultExcelSheetService

      public DefaultExcelSheetService()
  • Method Details

    • getSheetsNames

      public Collection<String> getSheetsNames(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook)
      Description copied from interface: ExcelSheetService
      Returns all sheets names except utility sheets.
      Specified by:
      getSheetsNames in interface ExcelSheetService
      Parameters:
      workbook - Workbook object which represents excel file
      Returns:
      collection of sheets names
    • getSheets

      public Collection<org.apache.poi.ss.usermodel.Sheet> getSheets(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook)
      Description copied from interface: ExcelSheetService
      Returns all sheets except utility sheets.
      Specified by:
      getSheets in interface ExcelSheetService
      Parameters:
      workbook - Workbook object 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 String typeCode)
      Description copied from interface: ExcelSheetService
      Creates 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:
      createOrGetTypeSheet in interface ExcelSheetService
      Parameters:
      workbook - workbook which will be extended by a new sheet
      typeCode - 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 String sheetName)
      Description copied from interface: ExcelSheetService
      Creates a new sheet and adds it to given workbook.
      Specified by:
      createTypeSheet in interface ExcelSheetService
      Parameters:
      workbook - workbook which will be extended by a new sheet
      sheetName - 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 String sheetName)
      Description copied from interface: ExcelSheetService
      Creates 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:
      createOrGetUtilitySheet in interface ExcelSheetService
      Parameters:
      workbook - workbook which will be extended by a new sheet
      sheetName - 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: ExcelSheetService
      Finds column index based on selected attribute. If column doesn't exist then -1 will be returned.
      Specified by:
      findColumnIndex in interface ExcelSheetService
      Parameters:
      typeSystemSheet - sheet which contains information about type system
      sheet - sheet for current type
      excelAttribute - 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 String findTypeCodeForSheetName(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, String sheetName)
      Description copied from interface: ExcelSheetService
      Finds type code for given sheet name.
      Specified by:
      findTypeCodeForSheetName in interface ExcelSheetService
      Parameters:
      workbook - workbook
      sheetName - sheet name
      Returns:
      found type code.
    • findSheetNameForTypeCode

      public String findSheetNameForTypeCode(@WillNotClose org.apache.poi.ss.usermodel.Workbook workbook, String typeCode)
      Description copied from interface: ExcelSheetService
      Finds sheet name for given type code.
      Specified by:
      findSheetNameForTypeCode in interface ExcelSheetService
      Parameters:
      workbook - workbook
      typeCode - type code
      Returns:
      found type code.
    • findAttributeDisplayNameInTypeSystemSheet

      protected String findAttributeDisplayNameInTypeSystemSheet(org.apache.poi.ss.usermodel.Sheet typeSystemSheet, ExcelAttribute excelAttribute, String typeCode)
    • 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(Collection<ExcelTemplateConstants.UtilitySheet> excludedSheets)
    • setTypeTemplate

      public void setTypeTemplate(ExcelTemplateConstants.UtilitySheet typeTemplate)
    • setHeaderRowIndex

      public void setHeaderRowIndex(ExcelTemplateConstants.Header headerRowIndex)