Class Generator<In,Out>
java.lang.Object
fr.opensagres.xdocreport.document.Generator<In,Out>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoDocumentArchive(ProcessState state, String entryName, In request, Out response) protected booleandoGenerateReport(String entryName, In request, Out response) protected voiddoRedirectAfterRemoveReport(In request, Out response) protected voiddoRemoveReport(In request, Out response) Remove report from the registry.protected voiddoSaveEntry(ProcessState processState, String entryName, In request, Out response) Extract entry from a report.protected voiddoSaveReport(ProcessState processState, In request, Out response) Save document archive of the report.protected abstract voidInvoked when there is an error thrown in any part of doRequest() processing.protected StringgetConverterId(IXDocReport report, In request) Returns the converter id.protected StringgetDispatchParameter(In request) Returns dispatch parameter value.protected StringgetEntryName(In request) Returns the entry name of the report.protected fr.opensagres.xdocreport.template.formatter.FieldsMetadatagetFieldsMetadata(String reportId, In request) protected fr.opensagres.xdocreport.converter.OptionsgetOptionsConverter(IXDocReport report, In request) protected abstract OutputStreamgetOutputStream(Out response) protected abstract StringgetParameter(In request, String name) protected ProcessStategetProcessState(In request) Returns process state (original|preprocessed|generated).protected XDocReportRegistrygetRegistry(In request) Returns the XDocReport registry which load and cache document.protected IXDocReportprotected StringgetReportId(In request) Returns the id of the report.protected abstract InputStreamgetSourceStream(String reportId, In request) Returns input stream of the report to load identified withreportId.protected fr.opensagres.xdocreport.template.ITemplateEnginegetTemplateEngine(IXDocReport report, In request) protected fr.opensagres.xdocreport.template.ITemplateEnginegetTemplateEngine(In request) Returns the template engine from request and otherwise returns the default template engine.protected fr.opensagres.xdocreport.template.ITemplateEnginegetTemplateEngine(String reportId, In request) Returns the template engine to use for the report.protected StringgetTemplateEngineId(In request) Returns the template engine id from request.protected StringgetTemplateEngineKind(In request) protected StringgetTemplateEngineKind(String reportId, In request) protected booleanisCacheOriginalDocument(String reportId, In request) protected booleanisGenerateContentDisposition(String reportId, fr.opensagres.xdocreport.converter.MimeMapping mimeMapping, In request) protected IXDocReportloadReport(String reportId, XDocReportRegistry registry, In request) Load report.protected abstract voidpopulateContext(fr.opensagres.xdocreport.template.IContext context, String reportId, In request) Put the Java model in the context for the reportreportId.protected abstract voidprepareHTTPResponse(String id, fr.opensagres.xdocreport.converter.MimeMapping mimeMapping, In request, Out response) protected abstract voidprepareHTTPResponse(String reportId, String entryName, In request, Out response) protected voidprepareOptions(fr.opensagres.xdocreport.converter.Options options, IXDocReport report, String converterId, In request) voidprocessRequest(In request, Out response) Handles all requests (by default).
-
Field Details
-
REMOVE_DISPATCH
- See Also:
-
DOWNLOAD_DISPATCH
- See Also:
-
VIEW_DISPATCH
- See Also:
-
REPORT_ID_HTTP_PARAM
- See Also:
-
TEMPLATE_ENGINE_KIND_HTTP_PARAM
- See Also:
-
TEMPLATE_ENGINE_ID_HTTP_PARAM
- See Also:
-
ENTRY_NAME_HTTP_PARAM
- See Also:
-
PROCESS_STATE_HTTP_PARAM
- See Also:
-
DISPATCH_HTTP_PARAM
- See Also:
-
CONVERTER_ID_HTTP_PARAM
- See Also:
-
-
Constructor Details
-
Generator
public Generator()
-
-
Method Details
-
processRequest
Handles all requests (by default).- Parameters:
request- In object containing client requestresponse- Out object for the response- Throws:
Exception
-
doRemoveReport
Remove report from the registry.- Parameters:
request-response-- Throws:
IOException
-
doRedirectAfterRemoveReport
- Throws:
IOException
-
doDocumentArchive
protected void doDocumentArchive(ProcessState state, String entryName, In request, Out response) throws Exception - Throws:
Exception
-
doSaveReport
Save document archive of the report.- Parameters:
processState-request-response-- Throws:
IOExceptionException
-
doSaveEntry
protected void doSaveEntry(ProcessState processState, String entryName, In request, Out response) throws IOException, Exception Extract entry from a report.- Parameters:
processState-request-response-- Throws:
IOExceptionException
-
doGenerateReport
protected boolean doGenerateReport(String entryName, In request, Out response) throws Exception, IOException - Throws:
ExceptionIOException
-
getReport
protected IXDocReport getReport(In request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException - Parameters:
request-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
protected IXDocReport loadReport(String reportId, XDocReportRegistry registry, In request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
reportId-registry-request-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
isCacheOriginalDocument
-
getFieldsMetadata
-
error
Invoked when there is an error thrown in any part of doRequest() processing.
Default will send a simple HTML response indicating there was a problem.- Parameters:
request- original In from servlet container.response- Out object from servlet container.cause- Exception that was thrown by some other part of process.
-
getConverterId
Returns the converter id.- Parameters:
request-- Returns:
-
getOptionsConverter
protected fr.opensagres.xdocreport.converter.Options getOptionsConverter(IXDocReport report, In request) -
prepareOptions
protected void prepareOptions(fr.opensagres.xdocreport.converter.Options options, IXDocReport report, String converterId, In request) -
isGenerateContentDisposition
-
getDispatchParameter
Returns dispatch parameter value.- Parameters:
request-- Returns:
-
getReportId
Returns the id of the report.- Parameters:
request-- Returns:
-
getProcessState
Returns process state (original|preprocessed|generated).- Parameters:
request-- Returns:
-
getEntryName
Returns the entry name of the report.- Parameters:
request-- Returns:
-
getTemplateEngineKind
-
getTemplateEngineKind
-
getTemplateEngineId
Returns the template engine id from request.- Parameters:
request-- Returns:
-
getTemplateEngine
protected fr.opensagres.xdocreport.template.ITemplateEngine getTemplateEngine(String reportId, In request) Returns the template engine to use for the report. By default, it search if there is template id from request and otherwise returns the default template engine.- Parameters:
reportId-request-- Returns:
-
getTemplateEngine
protected fr.opensagres.xdocreport.template.ITemplateEngine getTemplateEngine(IXDocReport report, In request) -
getTemplateEngine
Returns the template engine from request and otherwise returns the default template engine.- Parameters:
request-- Returns:
-
getRegistry
Returns the XDocReport registry which load and cache document. By default the registry is a singleton. If you wish manage registry per HTTP session, override this method, create an instance per session and returns the registry instance linked to the HTTP session.- Parameters:
request-- Returns:
-
getSourceStream
protected abstract InputStream getSourceStream(String reportId, In request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Returns input stream of the report to load identified withreportId.- Parameters:
reportId- report id.request- Http servlet request context.- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
populateContext
protected abstract void populateContext(fr.opensagres.xdocreport.template.IContext context, String reportId, In request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Put the Java model in the context for the reportreportId.- Parameters:
context- XDocReport context to register Java data model.reportId- report id.request- Http servlet request context.- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
getOutputStream
- Throws:
IOException
-
getParameter
-
prepareHTTPResponse
-
prepareHTTPResponse
-