dochelper
Class DocumentDefinition

java.lang.Object
  extended by dochelper.DocumentDefinition

public class DocumentDefinition
extends java.lang.Object

The class DocumentDefinition implements one of the launch points for the DocHelper process. It holds the main elements that compose a Document : RecordSets. This class conatains a DocumentSection in order to implement output encapsulation. Since DocumentDefinition is the top most element, begining and end sections are defined within (if any) the DocumentSection object.

See Also:
DocumentSection

Field Summary
private  ResultNode _result
           
(package private)  java.lang.String name
          Name that identifies this Document Definition
private  java.util.Hashtable<java.lang.String,Processor> processors
           
protected  java.util.ArrayList<RecordSet> recordSets
           
private  java.util.ArrayList<Renderer> renderers
           
 
Constructor Summary
DocumentDefinition()
          Constructors for Document Definition
DocumentDefinition(java.lang.String name)
          Constructor to create instance.
 
Method Summary
 void addProcessor(java.lang.String key, Processor ps)
          Add a Processor for this document.
 void addRecordSet(RecordSet rs)
          Add a RecordSet to the list of RecordSets to be used to create the output Document.
 void addRenderer(Renderer r)
          Add a Renderer to the list of Renderer that will create output for this document.
 void execute()
          Execute DocumentDefinition.
 void executeProcessors()
           
 ResultNode getDocument()
           
 java.util.Hashtable<java.lang.String,Processor> getProcessors()
           
 java.util.ArrayList<RecordSet> getRecordSets()
          Return the list of RecordSets for this Document Definition.
 java.util.ArrayList<Renderer> getRenderers()
           
 void render()
          Fetches all the Renderers associated with the document and executes them passing this document's result node tree a the tree to render.
 void setDocument(ResultNode result)
          Set the root result node.
 void setRecordSets(java.util.ArrayList<RecordSet> recordSets)
          Set the list of RecordSet s to use for this DocumentDefinition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recordSets

protected java.util.ArrayList<RecordSet> recordSets

processors

private java.util.Hashtable<java.lang.String,Processor> processors

renderers

private java.util.ArrayList<Renderer> renderers

_result

private ResultNode _result

name

java.lang.String name
Name that identifies this Document Definition

Constructor Detail

DocumentDefinition

public DocumentDefinition()
Constructors for Document Definition


DocumentDefinition

public DocumentDefinition(java.lang.String name)
Constructor to create instance.

Parameters:
name -
Method Detail

getRecordSets

public java.util.ArrayList<RecordSet> getRecordSets()
Return the list of RecordSets for this Document Definition.

Returns:
ArrayList list of RecordSets.

setRecordSets

public void setRecordSets(java.util.ArrayList<RecordSet> recordSets)
Set the list of RecordSet s to use for this DocumentDefinition

Parameters:
recordSets -

addRecordSet

public void addRecordSet(RecordSet rs)
Add a RecordSet to the list of RecordSets to be used to create the output Document.

Parameters:
rs - RecordSet to add.

addProcessor

public void addProcessor(java.lang.String key,
                         Processor ps)
Add a Processor for this document.

Parameters:
ps - Processor to add.

addRenderer

public void addRenderer(Renderer r)
Add a Renderer to the list of Renderer that will create output for this document.

Parameters:
r - Renderer to add.

execute

public void execute()
Execute DocumentDefinition. This method is the main driver of DocHelper. It is expected that RecordSets defined for the DocumentDefinition are in the correct state. This method will invoke the execute method of all record sets defined for it. It DOES NOT check or guarantee that record sets wihtin it are ready for execution. The result from executing each RecordSet is the creation of a ResultNode tree that contains all nessesary info to render a document definition according to the render used.

Throws:
java.lang.Exception

render

public void render()
Fetches all the Renderers associated with the document and executes them passing this document's result node tree a the tree to render.

Throws:
java.lang.Exception

executeProcessors

public void executeProcessors()

getDocument

public ResultNode getDocument()
Returns:

setDocument

public void setDocument(ResultNode result)
Set the root result node. This represents the result of executing this DocumentDefinition.

Parameters:
result - ResultNode which is the root of the result node tree.

getProcessors

public java.util.Hashtable<java.lang.String,Processor> getProcessors()
Returns:
the processors

getRenderers

public java.util.ArrayList<Renderer> getRenderers()
Returns:
the renderers