public abstract class AbstractXDocReport extends Object implements IXDocReport
IXDocReport to implement to manage docx, odt...| Modifier | Constructor and Description |
|---|---|
protected |
AbstractXDocReport() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPreprocessor(String entryName,
IXDocPreprocessor preprocessor)
Register a processor for the entry name.
|
void |
clearData(String key)
Clear data.
|
void |
convert(IContext context,
Options options,
OutputStream out)
Generate report and Convert it to another format (PDF, XHTML, etc).
|
void |
convert(Map<String,Object> contextMap,
Options options,
OutputStream out)
Generate report and Convert it to another format (PDF, XHTML, etc).
|
IContext |
createContext()
Create an empty context to register Java model.
|
IContext |
createContext(Map<String,Object> contextMap)
Create a new instance of
IContext to put the Java model. |
FieldsMetadata |
createFieldsMetadata()
Create fields metadata.
|
protected abstract IImageRegistry |
createImageRegistry(IEntryReaderProvider readerProvider,
IEntryWriterProvider writerProvider,
IEntryOutputStreamProvider outputStreamProvider)
Create an image registry.
|
protected void |
doPostprocessIfNeeded(XDocArchive outputArchive) |
void |
dump(IContext context,
DumperOptions options,
OutputStream out)
Dump
|
void |
dump(IContext context,
InputStream documentIn,
DumperOptions options,
OutputStream out)
Dump
|
void |
extractFields(FieldsExtractor extractor)
Extract declared fields which use syntax of the template egine of the report.
|
void |
extractFields(FieldsExtractor extractor,
ITemplateEngine templateEngine)
Extract declared fields which use syntax of the given template egine of the report.
|
IConverter |
getConverter(Options options)
Returns converter for the report and options.
|
<T> T |
getData(String key)
Returns custom data.
|
protected abstract String[] |
getDefaultXMLEntries()
Returns default entries which define XML document to merge with Java model with template engine for odt, docx...
|
IDumper |
getDumper(DumperOptions options)
Returns the dumper for the given options.
|
FieldsMetadata |
getFieldsMetadata()
Returns fields metadata used to manage lazy loop for table row.
|
String |
getId()
Returns the id of the
IXDocReport. |
long |
getLastModified()
Returns the last modified time when the report is loaded.
|
XDocArchive |
getOriginalDocumentArchive()
Returns the original zipped XML document (odt, docx...) and null if :
no load was done.
|
XDocArchive |
getPreprocessedDocumentArchive()
Returns the preprocessed zipped XML document (odt, docx...) and null if no load was done.
|
ITemplateEngine |
getTemplateEngine()
Returns template engine (velocity, freemarker..) to use to merge Java model with the XML files of the from
entries of the zipped XML Document (odt, docx...) defined by
getXMLEntries(). |
String[] |
getXMLEntries()
Returns XML entries which define XML document to merge with Java model with template engine.
|
boolean |
isPreprocessed()
Returns true if report was processed and false otherwise.
|
void |
load(InputStream sourceStream)
Load XML document (odt, docx...) from input stream.
|
protected void |
onAfterPreprocessing(Map<String,Object> sharedContext,
XDocArchive preprocessedArchive)
On after preprocessing.
|
protected void |
onAfterProcessTemplateEngine(IContext context,
XDocArchive outputArchive)
On after process template engine.
|
protected void |
onBeforePreprocessing(Map<String,Object> sharedContext,
XDocArchive preprocessedArchive)
On before preprocessing.
|
protected void |
onBeforeProcessTemplateEngine(IContext context,
XDocArchive outputArchive)
On before process template engine.
|
void |
preprocess()
Force the preprocessing step.
|
void |
process(IContext context,
OutputStream out)
Merge the docx, odt document with Java model from the context and register the result to the output stream.
|
void |
process(IContext context,
String entryName,
OutputStream out)
Generate report by merging Java model frm the context with XML Document (odt, docx...) preprocessed and store the
result into output stream.
|
void |
process(Map<String,Object> contextMap,
OutputStream out)
Merge the docx, odt document with Java model from the context Map and register the result to the output stream.
|
void |
process(Map<String,Object> contextMap,
String entryName,
OutputStream out)
Merge the docx, odt document with Java model from the context Map and register the entryName transformed to the
output stream.
|
protected abstract void |
registerPreprocessors()
Register preprocessors.
|
void |
removeAllPreprocessors()
Clear processor.
|
void |
removePreprocessor(String entryName)
Remove processor for the entry name.
|
void |
save(ProcessState processState,
OutputStream out)
Save original|preprocessed XML document archive in the given output stream.
|
void |
saveEntry(String entryName,
ProcessState processState,
OutputStream out)
Save original|preprocessed entryName from XML document archive in the given output stream.
|
void |
setCacheOriginalDocument(boolean cacheOriginalDocument)
Set cache or not for original document archive.
|
void |
setData(String key,
Object value)
Returns XML entries which define XML document to merge with Java model with template engine.
|
void |
setDocumentArchive(XDocArchive documentArchive)
Returns the zipped XML document (odt, docx...).
|
void |
setFieldsMetadata(FieldsMetadata fieldsMetadata)
Set fields metadata used to manage lazy loop for table row.
|
void |
setId(String id)
Set the id of the
IXDocReport. |
void |
setTemplateEngine(ITemplateEngine templateEngine)
Register template engine (velocity, freemarker..) to use to merge Java model with the XML files of the from
entries of the zipped XML Document (odt, docx...) defined by
getXMLEntries(). |
void |
setXMLEntries(String[] xmlEntries)
Set XML entries which define XML document to merge with Java model with template engine.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetKind, getMimeMappingpublic String getId()
IXDocReportIXDocReport. This id is used to cache an instance of IXDocReport with
{@link XDocReportRegistry#loadReport(InputStream) and get instance from cache withgetId in interface IXDocReportIXDocReportpublic void setId(String id)
IXDocReportIXDocReport. This id is used to cache an instance of IXDocReport with
{@link XDocReportRegistry#loadReport(InputStream) and get instance from cache withsetId in interface IXDocReportid - of the IXDocReportpublic void load(InputStream sourceStream) throws IOException, XDocReportException
IXDocReportload in interface IXDocReportsourceStream - stream of the XML Document zip (odt, docx...).IOException - when XML Document zip (odt, docx...) cannot be read.XDocReportException - when preprocessing with IXDocPreprocessor cannot be done.public void setDocumentArchive(XDocArchive documentArchive) throws IOException, XDocReportException
IXDocReportsetDocumentArchive in interface IXDocReportdocumentArchive - XDocArchive.XDocReportException - when preprocessing with IXDocPreprocessor cannot be done.IOExceptionpublic XDocArchive getOriginalDocumentArchive()
IXDocReportIXDocReport.setCacheOriginalDocument(boolean).getOriginalDocumentArchive in interface IXDocReportpublic XDocArchive getPreprocessedDocumentArchive()
IXDocReportgetPreprocessedDocumentArchive in interface IXDocReportpublic ITemplateEngine getTemplateEngine()
getXMLEntries().getTemplateEngine in interface IXDocReportpublic void setTemplateEngine(ITemplateEngine templateEngine)
getXMLEntries().setTemplateEngine in interface IXDocReportpublic void addPreprocessor(String entryName, IXDocPreprocessor preprocessor)
addPreprocessor in interface IXDocReportentryName - preprocessor - public void removePreprocessor(String entryName)
removePreprocessor in interface IXDocReportentryName - public void removeAllPreprocessors()
removeAllPreprocessors in interface IXDocReportpublic void setFieldsMetadata(FieldsMetadata fieldsMetadata)
setFieldsMetadata in interface IXDocReportpublic FieldsMetadata getFieldsMetadata()
getFieldsMetadata in interface IXDocReportpublic FieldsMetadata createFieldsMetadata()
createFieldsMetadata in interface IXDocReportpublic void preprocess()
throws XDocReportException,
IOException
IXDocReportpreprocess in interface IXDocReportXDocReportExceptionIOExceptionprotected void onBeforePreprocessing(Map<String,Object> sharedContext, XDocArchive preprocessedArchive) throws XDocReportException
sharedContext - preprocessedArchive - XDocReportExceptionprotected void onAfterPreprocessing(Map<String,Object> sharedContext, XDocArchive preprocessedArchive) throws XDocReportException
sharedContext - preprocessedArchive - XDocReportExceptionpublic String[] getXMLEntries()
public void setXMLEntries(String[] xmlEntries)
xmlEntries - public IContext createContext() throws XDocReportException
createContext in interface IXDocReportXDocReportExceptionpublic IContext createContext(Map<String,Object> contextMap) throws XDocReportException
IXDocReportIContext to put the Java model.createContext in interface IXDocReportXDocReportExceptionpublic void process(Map<String,Object> contextMap, OutputStream out) throws XDocReportException, IOException
IXDocReportprocess in interface IXDocReportout - output stream where merge must be saved.XDocReportExceptionIOExceptionpublic void process(Map<String,Object> contextMap, String entryName, OutputStream out) throws XDocReportException, IOException
IXDocReportprocess in interface IXDocReportentryName - entry nameXDocReportExceptionIOExceptionpublic void process(IContext context, OutputStream out) throws XDocReportException, IOException
IXDocReportprocess in interface IXDocReportcontext - of the Java model.out - output stream where merge must be saved.XDocReportExceptionIOExceptionpublic void process(IContext context, String entryName, OutputStream out) throws XDocReportException, IOException
process in interface IXDocReportcontext - of the Java model.entryName - entry nameXDocReportExceptionIOExceptionprotected void doPostprocessIfNeeded(XDocArchive outputArchive)
public void save(ProcessState processState, OutputStream out) throws IOException, XDocReportException
IXDocReportsave in interface IXDocReportIOExceptionXDocReportExceptionpublic void saveEntry(String entryName, ProcessState processState, OutputStream out) throws IOException, XDocReportException
IXDocReportsaveEntry in interface IXDocReportIOExceptionXDocReportExceptionpublic void extractFields(FieldsExtractor extractor) throws XDocReportException, IOException
IXDocReportextractFields in interface IXDocReportextractor - the fields extractor.XDocReportExceptionIOExceptionpublic void extractFields(FieldsExtractor extractor, ITemplateEngine templateEngine) throws XDocReportException, IOException
IXDocReportextractFields in interface IXDocReportextractor - the fields extractor.templateEngine - the template engine.XDocReportExceptionIOExceptionpublic IConverter getConverter(Options options) throws XDocConverterException
IXDocReportgetConverter in interface IXDocReportXDocConverterExceptionpublic void convert(Map<String,Object> contextMap, Options options, OutputStream out) throws XDocReportException, XDocConverterException, IOException
IXDocReportconvert in interface IXDocReportXDocReportExceptionXDocConverterExceptionIOExceptionpublic void convert(IContext context, Options options, OutputStream out) throws XDocReportException, XDocConverterException, IOException
IXDocReportconvert in interface IXDocReportXDocReportExceptionXDocConverterExceptionIOExceptionprotected void onBeforeProcessTemplateEngine(IContext context, XDocArchive outputArchive) throws XDocReportException
context - outputArchive - XDocReportExceptionprotected void onAfterProcessTemplateEngine(IContext context, XDocArchive outputArchive) throws XDocReportException
context - outputArchive - XDocReportExceptionprotected abstract String[] getDefaultXMLEntries()
public void setData(String key, Object value)
getDefaultXMLEntries() are used.setData in interface IXDocReportpublic <T> T getData(String key)
IXDocReportgetData in interface IXDocReportpublic void clearData(String key)
IXDocReportclearData in interface IXDocReportpublic void setCacheOriginalDocument(boolean cacheOriginalDocument)
IXDocReportsetCacheOriginalDocument in interface IXDocReportprotected abstract void registerPreprocessors()
public boolean isPreprocessed()
isPreprocessed in interface IXDocReportpublic long getLastModified()
getLastModified in interface IXDocReportprotected abstract IImageRegistry createImageRegistry(IEntryReaderProvider readerProvider, IEntryWriterProvider writerProvider, IEntryOutputStreamProvider outputStreamProvider)
public void dump(IContext context, DumperOptions options, OutputStream out) throws IOException, XDocReportException
IXDocReportdump in interface IXDocReportIOExceptionXDocReportExceptionpublic void dump(IContext context, InputStream documentIn, DumperOptions options, OutputStream out) throws IOException, XDocReportException
IXDocReportdump in interface IXDocReportIOExceptionXDocReportExceptionpublic IDumper getDumper(DumperOptions options) throws XDocReportException
IXDocReportgetDumper in interface IXDocReportXDocReportExceptionCopyright © 2017. All Rights Reserved.