Package de.businesscode.bcdui.wrs.export
Class AbstractExcelSheetDataWriter
- java.lang.Object
-
- de.businesscode.bcdui.wrs.export.AbstractExcelSheetDataWriter
-
- Direct Known Subclasses:
Wrq2ExcelSheetDataWriter
public abstract class AbstractExcelSheetDataWriter extends java.lang.Object
Base class for writing a Wrs or a WrsRequest to an Excel sheet
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Vector<java.lang.Integer>
colTypes
protected int
currentColIdx
protected int
currentRowIdx
protected static java.lang.String
defaultSheetName
protected org.apache.logging.log4j.Logger
log
protected java.util.Stack<java.lang.String>
pathStack
protected org.apache.poi.ss.usermodel.Sheet
sheet
protected java.lang.String
sheetName
protected int
startColIdx
protected int
startRowIdx
protected boolean
usingTemplate
protected org.apache.poi.ss.usermodel.Workbook
workbook
protected java.util.List<java.util.Map<java.lang.String,java.lang.String>>
wrsHeaderCols
-
Constructor Summary
Constructors Constructor Description AbstractExcelSheetDataWriter(org.apache.poi.ss.usermodel.Workbook workbook, java.util.Stack<java.lang.String> pathStack, boolean includeHeader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
attr(javax.xml.stream.events.StartElement element, java.lang.String attrName)
reads attributeprotected void
cleanup()
Tasks to be done after the data is insertedprotected org.apache.poi.ss.usermodel.Cell
getCellAt(int row, int col)
protected org.apache.poi.ss.usermodel.Cell
getCellAtCursor()
protected java.lang.String
getPath()
protected void
moveToNextColumn()
moves cursor to next columnprotected void
moveToNextLine()
moves 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 void
openSheet()
To be called after it is guaranteed that rnd:Wrs2Excel, if given, is already readprotected void
resetColCursor()
reset column cursor tosetStartColIdx(int)
, such asde.businesscode.bcdui.wrs.export.Wrs2Excel.WrsContainerParser#writeCell(String, Map)
would start writing with a first columnprotected void
resetRowColCursor()
protected void
resetRowColStartIdx()
resets offset indexes for row, col and resets cursorsprotected void
resetRowCursor()
reset row cursor tosetStartRowIdx(int)
, such asmoveToNextRow()
would start with a first rowprotected void
setStartColIdx(int startColIdx)
set column start index and reset column cursor to it viaresetColCursor()
protected void
setStartRowIdx(int startRowIdx)
set row start index and reset row cursor to it viaresetRowCursor()
protected javax.xml.stream.events.XMLEvent
track(javax.xml.stream.events.XMLEvent event)
call on every new eventprotected void
writeCell(java.lang.String cellValue)
write cell at current cursor applying cell type from given property-map containing attributes from wrs:Header/wrs:Columns/wrs:Cprotected void
writeHeaderCell(java.lang.String cellValue)
protected void
wrs2ExcelInfo(javax.xml.stream.events.StartElement element)
Evaluate optional information provided as a wrs:Wrs2ExcelInfo
-
-
-
Field Detail
-
workbook
protected final org.apache.poi.ss.usermodel.Workbook workbook
-
pathStack
protected final java.util.Stack<java.lang.String> pathStack
-
usingTemplate
protected final boolean usingTemplate
-
defaultSheetName
protected static final java.lang.String defaultSheetName
- See Also:
- Constant Field Values
-
sheetName
protected java.lang.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 java.util.List<java.util.Map<java.lang.String,java.lang.String>> wrsHeaderCols
-
colTypes
protected java.util.Vector<java.lang.Integer> colTypes
-
log
protected org.apache.logging.log4j.Logger log
-
-
Method Detail
-
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, 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(java.lang.String cellValue) throws de.businesscode.bcdui.wrs.export.ExcelWriterException
- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
-
writeCell
protected void writeCell(java.lang.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(javax.xml.stream.events.StartElement element)
Evaluate optional information provided as a wrs:Wrs2ExcelInfo- Parameters:
element
-
-
attr
protected java.lang.String attr(javax.xml.stream.events.StartElement element, java.lang.String attrName)
reads attribute- Parameters:
element
-attrName
-- Returns:
- empty string or attribute value
-
getPath
protected java.lang.String getPath()
-
track
protected javax.xml.stream.events.XMLEvent track(javax.xml.stream.events.XMLEvent event)
call on every new event- Parameters:
event
-
-
cleanup
protected void cleanup()
Tasks to be done after the data is inserted
-
-