Class AbstractExcelSheetDataWriter

java.lang.Object
de.businesscode.bcdui.wrs.export.AbstractExcelSheetDataWriter
Direct Known Subclasses:
Wrq2ExcelSheetDataWriter

public abstract class AbstractExcelSheetDataWriter extends Object
Base class for writing a Wrs or a WrsRequest to an Excel sheet
  • Field Details

    • workbook

      protected final org.apache.poi.ss.usermodel.Workbook workbook
    • pathStack

      protected final Stack<String> pathStack
    • usingTemplate

      protected final boolean usingTemplate
    • defaultSheetName

      protected static final String defaultSheetName
      See Also:
    • sheetName

      protected String sheetName
    • startRowIdx

      protected int startRowIdx
    • startColIdx

      protected int startColIdx
    • currentColIdx

      protected int currentColIdx
    • currentRowIdx

      protected int currentRowIdx
    • sheet

      protected org.apache.poi.ss.usermodel.Sheet sheet
    • wrsHeaderCols

      protected List<Map<String,String>> wrsHeaderCols
    • colTypes

      protected Vector<Integer> colTypes
    • log

      protected org.apache.logging.log4j.Logger log
  • Constructor Details

    • AbstractExcelSheetDataWriter

      public AbstractExcelSheetDataWriter(org.apache.poi.ss.usermodel.Workbook workbook, Stack<String> pathStack, boolean includeHeader)
  • Method Details

    • openSheet

      protected void openSheet() throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      To be called after it is guaranteed that rnd:Wrs2Excel, if given, is already read
      Parameters:
      sheetName -
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • getCellAt

      protected org.apache.poi.ss.usermodel.Cell getCellAt(int row, int col)
      Returns:
      existing or created Cell at row / col
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • getCellAtCursor

      protected org.apache.poi.ss.usermodel.Cell getCellAtCursor() throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      Returns:
      existing or created Cell at cursor
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • moveToNextColumn

      protected void moveToNextColumn() throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      moves cursor to next column
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • moveToNextLine

      protected void moveToNextLine() throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      moves cursor to next row and resets column cursor via #resetColCursor(), no new row or column is inserted into excel sheet at this operation, till de.businesscode.bcdui.wrs.export.Wrs2Excel.WrsContainerParser#writeCell(String, Map)
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • resetColCursor

      protected void resetColCursor()
      reset column cursor to setStartColIdx(int) , such as de.businesscode.bcdui.wrs.export.Wrs2Excel.WrsContainerParser#writeCell(String, Map) would start writing with a first column
    • resetRowColCursor

      protected void resetRowColCursor()
    • resetRowColStartIdx

      protected void resetRowColStartIdx()
      resets offset indexes for row, col and resets cursors
    • resetRowCursor

      protected void resetRowCursor()
      reset row cursor to setStartRowIdx(int) , such as moveToNextRow() would start with a first row
    • setStartColIdx

      protected void setStartColIdx(int startColIdx)
      set column start index and reset column cursor to it via resetColCursor()
      Parameters:
      startColIdx -
    • setStartRowIdx

      protected void setStartRowIdx(int startRowIdx)
      set row start index and reset row cursor to it via resetRowCursor()
      Parameters:
      startRowIdx -
    • writeHeaderCell

      protected void writeHeaderCell(String cellValue) throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • writeCell

      protected void writeCell(String cellValue) throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      write cell at current cursor applying cell type from given property-map containing attributes from wrs:Header/wrs:Columns/wrs:C
      Parameters:
      cellValue -
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException
    • wrs2ExcelInfo

      protected void wrs2ExcelInfo(StartElement element)
      Evaluate optional information provided as a wrs:Wrs2ExcelInfo
      Parameters:
      element -
    • attr

      protected String attr(StartElement element, String attrName)
      reads attribute
      Parameters:
      element -
      attrName -
      Returns:
      empty string or attribute value
    • getPath

      protected String getPath()
    • track

      protected XMLEvent track(XMLEvent event)
      call on every new event
      Parameters:
      event -
    • cleanup

      protected void cleanup()
      Tasks to be done after the data is inserted