
@Named @Dependent public class ExcelUserModelItemWriter extends ExcelItemReaderWriterBase implements javax.batch.api.chunk.ItemWriter
javax.batch.api.chunk.ItemWriter for Excel files. This implementation is currently based
on Apache POI user model API, and in-memory content generation. For large data set that may cause memory issue,
consider using ExcelStreamingItemWriter.ExcelUserModelItemReader,
ExcelItemReaderWriterBase,
ExcelStreamingItemWriter| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
outputStream |
protected Integer |
templateHeaderRow
The row number (0-based) of the header in the template sheet.
|
protected String |
templateResource
The resource of an existing Excel file or template file to be used as a base for generating output Excel.
|
protected int |
templateSheetIndex
The sheet index (0-based) in the template file to be used for generating output Excel.
|
protected String |
templateSheetName
The sheet name in the template file to be used for generating output Excel.
|
protected String |
writeMode
Valid writeMode for this writer class is
CsvProperties.OVERWRITE and CsvProperties.FAIL_IF_EXISTS. |
beanType, currentRowNum, header, sheet, sheetName, workbookcustomDataTypeModules, customDeserializers, customSerializers, deserializationFeatures, jsonFactory, jsonFactoryFeatures, jsonFactoryLookup, mapperFeatures, objectMapper, serializationFeaturesNEW_LINE, resource, skipBeanValidation| Constructor and Description |
|---|
ExcelUserModelItemWriter() |
| Modifier and Type | Method and Description |
|---|---|
Serializable |
checkpointInfo() |
void |
close() |
protected void |
createCell(org.apache.poi.ss.usermodel.Row row,
int columnIndex,
Object val) |
protected org.apache.poi.ss.usermodel.Workbook |
createWorkbook(InputStream templateInputStream)
Creates the workbook for this writer.
|
void |
open(Serializable checkpoint) |
void |
writeItems(List<Object> items) |
getCellStringValuesinitJsonFactory, initJsonFactoryAndObjectMapper, registerModulegetInputStream, getOutputStream, getValidator, validate@Inject protected String writeMode
CsvProperties.OVERWRITE and CsvProperties.FAIL_IF_EXISTS.@Inject protected String templateResource
ItemReaderWriterBase.resource.@Inject protected String templateSheetName
templateResource is
specified but this property is not specified, templateSheetIndex is used instead.@Inject protected int templateSheetIndex
@Inject protected Integer templateHeaderRow
ExcelItemReaderWriterBase.header property is provided in
job xml file, then this property is ignored. Otherwise, it is used to retrieve header values.protected OutputStream outputStream
public void open(Serializable checkpoint) throws Exception
open in interface javax.batch.api.chunk.ItemWriterExceptionpublic void writeItems(List<Object> items) throws Exception
writeItems in interface javax.batch.api.chunk.ItemWriterExceptionpublic Serializable checkpointInfo() throws Exception
checkpointInfo in interface javax.batch.api.chunk.ItemWriterExceptionpublic void close()
throws Exception
close in interface javax.batch.api.chunk.ItemWriterExceptionprotected org.apache.poi.ss.usermodel.Workbook createWorkbook(InputStream templateInputStream) throws IOException, org.apache.poi.openxml4j.exceptions.InvalidFormatException
templateInputStream - java.io.InputStream for the template excel file, if anyIOExceptionorg.apache.poi.openxml4j.exceptions.InvalidFormatExceptionCopyright © 2015 JBoss by Red Hat. All rights reserved.