Package de.businesscode.bcdui.wrs.export
Class AbstractExcelSheetDataWriter
java.lang.Object
de.businesscode.bcdui.wrs.export.AbstractExcelSheetDataWriter
- Direct Known Subclasses:
Wrq2ExcelSheetDataWriter
Base class for writing a Wrs or a WrsRequest to an Excel sheet
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected static final Stringprotected org.apache.logging.log4j.Loggerprotected org.apache.poi.ss.usermodel.Sheetprotected Stringprotected intprotected intprotected final booleanprotected final org.apache.poi.ss.usermodel.Workbook -
Constructor Summary
ConstructorsConstructorDescriptionAbstractExcelSheetDataWriter(org.apache.poi.ss.usermodel.Workbook workbook, Stack<String> pathStack, boolean includeHeader) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringattr(StartElement element, String attrName) reads attributeprotected voidcleanup()Tasks to be done after the data is insertedprotected org.apache.poi.ss.usermodel.CellgetCellAt(int row, int col) protected org.apache.poi.ss.usermodel.Cellprotected StringgetPath()protected voidmoves cursor to next columnprotected voidmoves cursor to next row and resets column cursor via #resetColCursor(), no new row or column is inserted into excel sheet at this operation, tillde.businesscode.bcdui.wrs.export.Wrs2Excel.WrsContainerParser#writeCell(String, Map)protected voidTo be called after it is guaranteed that rnd:Wrs2Excel, if given, is already readprotected voidreset column cursor tosetStartColIdx(int), such asde.businesscode.bcdui.wrs.export.Wrs2Excel.WrsContainerParser#writeCell(String, Map)would start writing with a first columnprotected voidprotected voidresets offset indexes for row, col and resets cursorsprotected voidreset row cursor tosetStartRowIdx(int), such asmoveToNextRow()would start with a first rowprotected voidsetStartColIdx(int startColIdx) set column start index and reset column cursor to it viaresetColCursor()protected voidsetStartRowIdx(int startRowIdx) set row start index and reset row cursor to it viaresetRowCursor()protected XMLEventcall on every new eventprotected voidwrite cell at current cursor applying cell type from given property-map containing attributes from wrs:Header/wrs:Columns/wrs:Cprotected voidwriteHeaderCell(String cellValue) protected voidwrs2ExcelInfo(StartElement element) Evaluate optional information provided as a wrs:Wrs2ExcelInfo
-
Field Details
-
workbook
protected final org.apache.poi.ss.usermodel.Workbook workbook -
pathStack
-
usingTemplate
protected final boolean usingTemplate -
defaultSheetName
- See Also:
-
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
-
colTypes
-
log
protected org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
AbstractExcelSheetDataWriter
-
-
Method Details
-
openSheet
protected void openSheet() throws de.businesscode.bcdui.wrs.export.ExcelWriterExceptionTo 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.ExcelWriterExceptionmoves cursor to next column- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
-
moveToNextLine
protected void moveToNextLine() throws de.businesscode.bcdui.wrs.export.ExcelWriterExceptionmoves cursor to next row and resets column cursor via #resetColCursor(), no new row or column is inserted into excel sheet at this operation, tillde.businesscode.bcdui.wrs.export.Wrs2Excel.WrsContainerParser#writeCell(String, Map)- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
-
resetColCursor
protected void resetColCursor()reset column cursor tosetStartColIdx(int), such asde.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 tosetStartRowIdx(int), such asmoveToNextRow()would start with a first row -
setStartColIdx
protected void setStartColIdx(int startColIdx) set column start index and reset column cursor to it viaresetColCursor()- Parameters:
startColIdx-
-
setStartRowIdx
protected void setStartRowIdx(int startRowIdx) set row start index and reset row cursor to it viaresetRowCursor()- 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
Evaluate optional information provided as a wrs:Wrs2ExcelInfo- Parameters:
element-
-
attr
reads attribute- Parameters:
element-attrName-- Returns:
- empty string or attribute value
-
getPath
-
track
call on every new event- Parameters:
event-
-
cleanup
protected void cleanup()Tasks to be done after the data is inserted
-