Class AbstractExcelExportWorkbookDecorator

    • Constructor Detail

      • AbstractExcelExportWorkbookDecorator

        public AbstractExcelExportWorkbookDecorator()
    • Method Detail

      • decorate

        protected void decorate​(org.apache.poi.ss.usermodel.Workbook workbook,
                                java.util.Collection<ExcelClassificationAttribute> attributes,
                                java.util.Collection<ItemModel> items)
        Decorate method responsible for finding appropriate cell for given attribute and item. Then it finds appropriate translator for the attribute and fills the cell with data. It also fills the header and reference format rows for classification attributes.
        Parameters:
        workbook - workbook to work on
        attributes - collection of attributes to iterate on
        items - collection of items to iterate on
      • insertReferenceFormatIfNecessary

        protected void insertReferenceFormatIfNecessary​(org.apache.poi.ss.usermodel.Cell excelCellValue,
                                                        java.lang.String referenceFormat)
      • insertHeaderIfNecessary

        protected org.apache.poi.ss.usermodel.Cell insertHeaderIfNecessary​(org.apache.poi.ss.usermodel.Sheet sheet,
                                                                           java.lang.String headerValue)
        Inserts new header cell if row does not contain any cell with given content
        Parameters:
        sheet - container of header values
        headerValue - value to insert
        Returns:
        cell with given headerValue
      • findColumnIndexByContentOrFirstEmptyCell

        protected int findColumnIndexByContentOrFirstEmptyCell​(org.apache.poi.ss.usermodel.Row row,
                                                               java.lang.String content)
        Finds column index by comparing content of cells.
        Parameters:
        row - source of the searching
        content - content of sought column
        Returns:
        index of sought column - if column was not found then -1 is returned
      • createNewHeaderCell

        protected org.apache.poi.ss.usermodel.Cell createNewHeaderCell​(org.apache.poi.ss.usermodel.Row headerRow,
                                                                       int columnIndex,
                                                                       java.lang.String headerValue)
        Creates new header cell and inserts appropriate header value.
        Parameters:
        headerRow - row will be increased by a new column
        columnIndex - index of newly created cell
        headerValue - value of newly created cell
        Returns:
        newly created cell
      • createCellIfNecessary

        protected org.apache.poi.ss.usermodel.Cell createCellIfNecessary​(org.apache.poi.ss.usermodel.Row row,
                                                                         int columnIndex)
        Finds appropriate cell by column index and if cell does not exist then a new cell is created.
        Parameters:
        row - source of the searching
        columnIndex - index of sought column
        Returns:
        cell which is located in row passed as param and in given columnIndex
      • findRow

        protected java.util.Optional<org.apache.poi.ss.usermodel.Row> findRow​(org.apache.poi.ss.usermodel.Workbook workbook,
                                                                              ItemModel item)
        Finds appropriate row based on provided item.
        Parameters:
        workbook - exported workbook
        item - provided item
        Returns:
        found row
      • setExcelCellService

        public void setExcelCellService​(ExcelCellService excelCellService)