Users require a transcript when going through any interview, so that they have:
The client system running the Web Determination interview needs to be able to provide this, and also be able to define what data from the interview session is displayed in the transcript, and how it is displayed (layout).
Oracle Policy Modeling allows rulebase authors to create reports of the Web Determination interview, accessible by the user from the Summary screen. With the report links, users can view and download information transcript about the interview session as a document.
The Document Generator plugin is an Engine Session plugin to the Interview Engine that allows plugin developers to generate those documents in any document type, and also define the document layout and which session data is displayed. A Document Generator is known by the document type it provides; for example, HTML, PDF, XML and so on.
By default, Web Determinations ships with two Document Generators for HTML and PDF. For more information about using these, see the topic, Use the default Document Generator.
Multiple Document Generators can be used together during a Web Determinations interview session, allowing users to view the interview transcript in various formats. This is different to other plugins where only one plugin can be used during an interview session; for example, Data Adaptor plugins. Each Document Generator provides a specific document type, therefore it is imperative that all Document Generators registered during a Web Determinations interview, must provide unique document types.
Document Generator and the Web Determination Architecture
Developing a Document Generator for a specific project/implementation
Use the Default Document Generator
Document Generator - Pseudo Code
Document Generator - Sample Code
The following are brief descriptions of common implementation scenarios that use the Document Generator:
If there is an official paper form in use for whatever purpose, that can be filled-out online via Web Determinations. When the Web Determinations interview is complete, the Summary screen includes a download link for the form to save for your records. It is important that the downloaded form be exactly the same as the official blank paper version with the blanks filled in. The form is generated using the PDF of the blank form as a template, with the interview data filled in in the appropriate places.
This is a variation of downloading the transcript, where a client's department can choose to allow the user to email the transcript to an email address, or allow the client's department to save the transcript to a Content Management System or a database.
After an interview is completed, a client's department would like to show the citizen a summary webpage describing the outcome, a decision report on why that outcome occurred, and arbitrary summary data from the interview that the department determines to be important. This is not really different from a custom screen, but the department would like to generate the aforementioned 'complicated' summary page using simple configurable templates rather than coding up a custom screen themselves.
This section details how the Document Generator fits into the Web Determinations architecture, and how to use it in the Web Determinations environment
For a Document Generator (for example, HTMLDocumentGenerator) to be used during a Web Determinations interview, the rulebase author must first provide the user with a Document link. Document links are displayed in the Summary screen via the Oracle Policy Modeling screen authoring, and are associated with a Document Type. The Document Type (doctype) of the link must match the doctype that the Document Generator plugin provides (in this case HTML).
Assuming that a HTML Document link is available to the user in a hypothetical Web Determinations interview, the Document Generator is invoked when the user clicks on that Document link in the Summary screen. When the link is clicked, the following occurs:
Other ways in which Document Generators is used in Web Determinations is through other Introduction to Web Determinations Extensions.The Document Generator is accessible via the InterviewSession object, so only Web Determinations Extensions with access to this object or its parent object 'SessionContext' may use Document Generators.
Because document links are specific document actions that are supposed to return binary responses, only Custom Screens can be used to call a Document Generator and return its InputStream as a binary Response.
Another way of using a Document Generator InputStream is by using an Event Handler to generate a document from a Document Generator, and then using the file; for example, email it or save onto a datasource such as a filesystem or database.
The following is a piece of sample code to generate documents:
TypedInputStream document = interviewSession.getDocumentGeneratorService().generateDocument(documentType, parameters);
An event is fired when the user initiates a document generation action. This event is called 'OnGenerateDocumentEvent', and allows the event handler to override the normal document output from the Document Generator. If the event handler populates the 'replacement document' member in the event itself, Web Determinations will use the replacement document instead of the normal document output.
An IOException can be thrown by a Document Generator plugin, and this will result in an error page containing a message specific to the IOException, being displayed. For non-IO exceptions such as a connection error to a database, other standard plugin exceptions can be raised. For more information, refer to the topic, Web Determinations Extensions - Technical Details
A Document Generator plugin implements the DocumentGeneratorPlugin interface, which in turn extends the DataAdaptor interface as well as the InterviewSessionPlugin interface. When implemented, he DocumentGeneratorPlugin interface requires the following:
Method Signature |
Description |
---|---|
TypedInputStream generateDocument( InterviewSession session, DocumentGenerationParameters parameters) |
|
String getDocumentType() |
|
This section explains the various approaches on designing and developing a Document Generator plugin for a specific project/implementation.
When designing a Document Generator plugin, consider the following:
Essentially, the Document Generator plugin needs to have the following functionality:
It is important to understand the two input arguments for the DocumentGenerator method 'generateDocument()'.
The InterviewSession object is useful for the instance data provided by the user during the Web Determinations interview. The InterviewSession object can also provide the rulebase used, rulebase model data, locale, and so on. More information about the InterviewSession can be found in Web Determinations Extensions - Technical Details#About the InterviewSession
The DocumentGeneratorParameters object have the following members:
The InterviewSession object contains the important instance data provided by the user. Sample code to extract instance data in the InterviewSession can be found in Understanding the InterviewSession.
Document styling and layout can be programmed into the Document Generator plugin, or for maintainability and flexibility it can be stored in a 'template file' that is read by the Document Generator when generating the document.
Programmatic logic to control layout, styling, data, metadata, and so on, can use all the data available, but notably the rulebase model data, instance data, and the attributes in the DecisionReportTargets list