ODF Template Engine An easy document generation tool  built with ODFDOM Ying Chun Guo Technical Lead ODF Toolkit Software ...
Agenda <ul><li>Overview </li></ul><ul><li>Implemented with ODFDOM </li></ul><ul><li>A CDA use case </li></ul><ul><li>Exten...
<ul><li>Documents generation from template is a common requirement in many documents processing solutions. </li></ul><ul><...
Overview <ul><li>ODF Template Engine is built with ODFDOM. </li></ul><ul><li>ODF Template Engine is easily configurable an...
Implemented with ODFDOM <ul><li>Leverage ODFDOM navigation APIs to search the substitution blocks and replace them with da...
Implemented with ODFDOM <ul><li>Leverage ODFDOM table convenient APIs to create rows and cells to display repeated data. <...
A CDA use case <ul><li>Clinical documents, such as a discharge summary or progress note, are stored as CDA format in heath...
A CDA use case
A CDA use case – live demo : step 1 <ul><li>Define template and mapping file </li></ul><ul><ul><li>Lotus Symphony plugin c...
A CDA use case – live demo : step 2 <ul><li>Invoke the template engine by APIs: </li></ul>//Create OdfTemplate instance an...
Extension and configuration <ul><li>User can introduce his own modifier handler by implement interface ModifierHandler and...
Extension and configuration <ul><li>User can support his own data source and data structure by extending class DataSource ...
Summary <ul><li>ODF Template Engine is an easy document generation tool which </li></ul><ul><ul><li>doesn't depend on any ...
Thank you! [email_address]
Upcoming SlideShare
Loading in …5
×

ODF Template Engine

3,005 views

Published on

ODF template engine under ODFToolkit

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,005
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

ODF Template Engine

  1. 1. ODF Template Engine An easy document generation tool built with ODFDOM Ying Chun Guo Technical Lead ODF Toolkit Software Standards IBM Software Group 15:00-15:45 Nov 5th, 2009 @ 2009 IBM Corporation
  2. 2. Agenda <ul><li>Overview </li></ul><ul><li>Implemented with ODFDOM </li></ul><ul><li>A CDA use case </li></ul><ul><li>Extension and configuration </li></ul><ul><li>Summary </li></ul>This prensentation is for reference only, IBM does not provide any kind of warranty/guaranty to it.
  3. 3. <ul><li>Documents generation from template is a common requirement in many documents processing solutions. </li></ul><ul><li>ODF Template Engine is a tool to generate ODF documents based on template. </li></ul><ul><ul><li>A template is a fully-formatted text document with substitution blocks indicated with special delimiters. </li></ul></ul><ul><ul><li>The substitution blocks will be replaced with data from data sources. </li></ul></ul><ul><ul><li>Mappings between the substitution blocks and data are defined in XML format. </li></ul></ul>Overview
  4. 4. Overview <ul><li>ODF Template Engine is built with ODFDOM. </li></ul><ul><li>ODF Template Engine is easily configurable and extendable. </li></ul><ul><li>ODF Template Engine doesn't depend on any ODF editors. </li></ul><ul><li>ODF Template Engine focuses on server side processing. </li></ul>
  5. 5. Implemented with ODFDOM <ul><li>Leverage ODFDOM navigation APIs to search the substitution blocks and replace them with data. </li></ul>String pattern = delimiterLeftCharacter + &quot;([a-zA-Z0-9_#]+)&quot; + delimiterRightCharacter; TextNavigation search = new TextNavigation(pattern, doc); while (search.hasNext()) { TextSelection item = (TextSelection) search.getCurrentItem(); String text = item.getText(); String data = dataRender.render(text); item.replaceWith(data); }
  6. 6. Implemented with ODFDOM <ul><li>Leverage ODFDOM table convenient APIs to create rows and cells to display repeated data. </li></ul>OdfTableRow tr = (OdfTableRow) table.appendChild( new OdfTableRow(contentDom)); OdfTableCell td = (OdfTableCell) tr.appendCell( new OdfTableCell(contentDom)); td.newTextPElement().setNodeValue(values[i]);
  7. 7. A CDA use case <ul><li>Clinical documents, such as a discharge summary or progress note, are stored as CDA format in heathcare solutions. </li></ul><ul><li>If a patient wants to keep electronic versions of his/her clinical documents, there is a need to convert CDA XML documents to ODF format. </li></ul><ul><li>In this case, a discharge summary in ODF format can be generated from CDA XML document </li></ul>Note: CDA is an XML-based markup standard that specifies the structure and semantics of a clinical document for the purpose of exchange.
  8. 8. A CDA use case
  9. 9. A CDA use case – live demo : step 1 <ul><li>Define template and mapping file </li></ul><ul><ul><li>Lotus Symphony plugin can help to do it. </li></ul></ul>
  10. 10. A CDA use case – live demo : step 2 <ul><li>Invoke the template engine by APIs: </li></ul>//Create OdfTemplate instance and DataRender instance. OdfTemplate odftemp = OdfTemplate.loadTemplate( fileName , propFile ); DataRender ddf = DataRender. parseDDF ( new FileInputStream( ddfile )); //Create OdfTemplateTranslate instance and register a modifier handler OdfTemplateTranslate engine = new OdfTemplateTranslate(); HashmarkModifierHandler handler = new HashmarkModifierHandler (); engine.registerHandler(handler); //Run template engine to generate document engine.generateODF(odftemp, ddf, parentPath );
  11. 11. Extension and configuration <ul><li>User can introduce his own modifier handler by implement interface ModifierHandler and register the modifier handler in template engine. </li></ul>
  12. 12. Extension and configuration <ul><li>User can support his own data source and data structure by extending class DataSource and implementing interface DataStructure </li></ul>
  13. 13. Summary <ul><li>ODF Template Engine is an easy document generation tool which </li></ul><ul><ul><li>doesn't depend on any ODF editors; </li></ul></ul><ul><ul><li>focus on server side processing; </li></ul></ul><ul><ul><li>is easily extendable and configurable. </li></ul></ul><ul><li>ODFDOM can be leveraged to process ODF document. </li></ul><ul><ul><li>You can get more information of ODF Toolkit from ODF Toolkit Union </li></ul></ul>
  14. 14. Thank you! [email_address]

×