View on GitHub

fj-doc-quickstart

Docs Home

QuickstartB001DocProcessFacade

version : 001

Maven dependancies :

QuickstartB001ProcessDocFacade show how to create and use a ProcessDocFacade.

DocProcessConfig can be configured to handle a chain of steps, ultimately producing a XML doc source, this source can be then used to produce the actual output document throws DocHandlerFacade

ProcessDocFacade combines the functionalities of DocHandlerFacade (seen in QuickstartA003DocHandlerFacade) to a DocProcessConfig.

HINT: In a way DocProcessConfig is similar to a servlet engine. the processing steps can be compared to a a Filter/Servlet chain, while the free marker template to a JSP.

To use standard build it free marker functions see : https://freemarker.apache.org/docs/ref_builtins.html (build int functions are always available in free marker template)

Here is a simple configuration file for DocProcessConfig:

	<chain id="config">
		<!-- 
			free marker configuration step
			param01 is the id of the configuration (every different configuration will be cached)
			properties are FreeMarker configurations params. 
		-->
		<step id="step-01" defaultBehaviour="CONTINUE"
			description="FreeMarker Configuration step, only one FreeMarker configuration instance is created for every key under 'param01'" 
			type="org.fugerit.java.doc.freemarker.config.FreeMarkerConfigStep"
			param01="QUICKSTART_CONFIG">
			<properties 
				version="2.3.30"
				path="/free_marker_quickstart"
				mode="class" 
				class="org.fugerit.java.doc.qs.facade.QuickstartDocFacade"
				exception-handler="RETHROW_HANDLER"
				log-exception="false"
				wrap-unchecked-exceptions="true"
				fallback-on-null-loop-variable="false" />
		</step>		
	</chain>

	<!--
		A chain can extends one or more other chains (in this case 'config' chain)
	-->
	<chain id="character-table" extends="config">
		<!--
			This step map attributes provided in the DocProcessContext to Free Marker Root Map.
			In this case 'characterList' attributes is mapped to an entry with the same name : characterList="characterList"
		-->
		<step id="step-data" defaultBehaviour="CONTINUE"
			description="Map items from DocContext to FreeMarker Data" 
			type="org.fugerit.java.doc.freemarker.config.FreeMarkerMapStep">		
			<properties characterList="characterList"/>		
		</step>
		<!--
			This step apply the actual free marker template and produce the static XML source.
			This XML source is then available to be rendered.
		-->					
		<step id="step-process" defaultBehaviour="CONTINUE"
			description="Apply FreeMarker template to get the full XML" 
			type="org.fugerit.java.doc.freemarker.config.FreeMarkerProcessStep"
			param01="dynamic-table-data.ftl"/>
	</chain>

Here is the freemarker template

Dynamix Doc workflow :

Dynamix Doc workflow

DocProcessConfig workflow :

DocProcessConfig workflow

ProcessDocFacade workflow :

ProcessDocFacade workflow