|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IXDocReport
XML Document reporting used to load XML document (odt, docx...) and generate reporting by merging it with Java data
model by using a template engine ITemplateEngine
.
To generate reporting, here steps to follow :
IXDocReport
switch the type of the document:
IXDocReport report = new fr.opensagres.xdocreport.document.docx.DocXReport();
IXDocReport report = new fr.opensagres.xdocreport.document.odt.ODTReport();
setTemplateEngine(ITemplateEngine)
to set the
template engine (Velocity, Freemarker..) to use :
report.setTemplateEngine(net.sourceforge.rtf.template.freemarker.FreemarkerTemplateEngine.DEFAULT);
report.setTemplateEngine(net.sourceforge.rtf.template.velocity.VelocityTemplateEngine.DEFAULT);
load(InputStream)
.createContext()
and put your Java model with
IContext.put(String, Object)
. For instance :
IContext context = report.createContext();
context.put("name", "word");
process(IContext, OutputStream)
. For instance :
report.process(context, new FileOutputStream(new File("myfile.odt")));
Method Summary | ||
---|---|---|
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 a new instance of IContext to put the Java model. |
|
IContext |
createContext(Map<String,Object> contextMap)
Create a new instance of IContext to put the Java model. |
|
FieldsMetadata |
createFieldsMetadata()
Create fields metadata. |
|
void |
dump(IContext context,
DumperOptions options,
OutputStream out)
Dump |
|
void |
dump(IContext context,
InputStream document,
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. |
|
|
getData(String key)
Returns custom data. |
|
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 . |
|
String |
getKind()
Returns the kind of the report (ODT, docx...). |
|
long |
getLastModified()
Returns the last modified time when the report is loaded. |
|
MimeMapping |
getMimeMapping()
Returns mime mapping switch the kind of the report (odt, docx...). |
|
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 the template engine (Velocity, Freemarker..) to use switch the syntax used in the XML document. |
|
boolean |
isPreprocessed()
Returns true if report was processed and false otherwise. |
|
void |
load(InputStream sourceStream)
Load XML document (odt, docx...) from input stream. |
|
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 outputStream)
Merge the docx, odt document with Java model from the context and register the entryName transformed to the 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 outputStream)
Merge the docx, odt document with Java model from the context Map and register the entryName transformed to the output stream. |
|
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)
Store custom data. |
|
void |
setDocumentArchive(XDocArchive documentArchive)
Returns the zipped XML document (odt, docx...). |
|
void |
setFieldsMetadata(FieldsMetadata metadata)
Set fields metadat used to manage lazy loop in table row. |
|
void |
setId(String id)
Set the id of the IXDocReport . |
|
void |
setTemplateEngine(ITemplateEngine templateEngine)
Set the template engine (Velocity, Freemarker..) to use switch the syntax used in the XML document. |
Method Detail |
---|
String getKind()
String getId()
IXDocReport
. This id is used to cache an instance of IXDocReport
with
{@link XDocReportRegistry#loadReport(InputStream) and get instance from cache with
IXDocReport
void setId(String id)
IXDocReport
. This id is used to cache an instance of IXDocReport
with
{@link XDocReportRegistry#loadReport(InputStream) and get instance from cache with
id
- of the IXDocReport
void load(InputStream sourceStream) throws IOException, XDocReportException
sourceStream
- 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.void save(ProcessState processState, OutputStream out) throws IOException, XDocReportException
out
-
IOException
XDocReportException
void saveEntry(String entryName, ProcessState processState, OutputStream out) throws IOException, XDocReportException
out
-
IOException
XDocReportException
void setDocumentArchive(XDocArchive documentArchive) throws IOException, XDocReportException
documentArchive
- XDocArchive
.
XDocReportException
- when preprocessing with IXDocPreprocessor
cannot be done.
IOException
XDocArchive getOriginalDocumentArchive()
setCacheOriginalDocument(boolean)
.
XDocArchive getPreprocessedDocumentArchive()
void setTemplateEngine(ITemplateEngine templateEngine)
templateEngine
- ITemplateEngine getTemplateEngine()
void setFieldsMetadata(FieldsMetadata metadata)
metadata
- IContext createContext() throws XDocReportException
IContext
to put the Java model.
XDocReportException
IContext createContext(Map<String,Object> contextMap) throws XDocReportException
IContext
to put the Java model.
XDocReportException
void process(IContext context, OutputStream out) throws XDocReportException, IOException
context
- of the Java model.out
- output stream where merge must be saved.
XDocReportException
IOException
void process(Map<String,Object> contextMap, OutputStream out) throws XDocReportException, IOException
context
- of the Java model.out
- output stream where merge must be saved.
XDocReportException
IOException
void process(IContext context, String entryName, OutputStream outputStream) throws XDocReportException, IOException
context
- of the Java model.entryName
- entry nameout
- output stream where merge must be saved.
XDocReportException
IOException
void process(Map<String,Object> contextMap, String entryName, OutputStream outputStream) throws XDocReportException, IOException
context
- of the Java model.entryName
- entry nameout
- output stream where merge must be saved.
XDocReportException
IOException
IConverter getConverter(Options options) throws XDocConverterException
options
-
XDocConverterException
void convert(IContext context, Options options, OutputStream out) throws XDocReportException, XDocConverterException, IOException
context
- options
- out
-
XDocReportException
XDocConverterException
IOException
void convert(Map<String,Object> contextMap, Options options, OutputStream out) throws XDocReportException, XDocConverterException, IOException
contextMap
- options
- out
-
XDocReportException
XDocConverterException
IOException
MimeMapping getMimeMapping()
void setData(String key, Object value)
key
- value
- void clearData(String key)
string
- <T> T getData(String key)
key
-
void extractFields(FieldsExtractor extractor, ITemplateEngine templateEngine) throws XDocReportException, IOException
extractor
- the fields extractor.templateEngine
- the template engine.
XDocReportException
IOException
void extractFields(FieldsExtractor extractor) throws XDocReportException, IOException
extractor
- the fields extractor.
XDocReportException
IOException
void setCacheOriginalDocument(boolean cacheOriginalDocument)
cache
- boolean isPreprocessed()
long getLastModified()
FieldsMetadata getFieldsMetadata()
FieldsMetadata createFieldsMetadata()
void addPreprocessor(String entryName, IXDocPreprocessor preprocessor)
entryName
- preprocessor
- void removePreprocessor(String entryName)
entryName
- void removeAllPreprocessors()
void preprocess() throws XDocReportException, IOException
XDocReportException
IOException
IDumper getDumper(DumperOptions options) throws XDocReportException
options
-
XDocReportException
void dump(IContext context, InputStream document, DumperOptions options, OutputStream out) throws IOException, XDocReportException
context
- kind
- options
-
IOException
XDocReportException
void dump(IContext context, DumperOptions options, OutputStream out) throws IOException, XDocReportException
context
- kind
- options
-
IOException
XDocReportException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |