[jboss-svn-commits] JBL Code SVN: r34378 - labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Authoring.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jul 29 21:34:52 EDT 2010


Author: Rikkola
Date: 2010-07-29 21:34:52 -0400 (Thu, 29 Jul 2010)
New Revision: 34378

Modified:
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Authoring/Section-Decision_Tables.xml
Log:
moved dtable example to new api

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Authoring/Section-Decision_Tables.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Authoring/Section-Decision_Tables.xml	2010-07-30 01:28:02 UTC (rev 34377)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Authoring/Section-Decision_Tables.xml	2010-07-30 01:34:52 UTC (rev 34378)
@@ -738,16 +738,16 @@
 
       <para>The code to run this is simple:</para>
 
-      <programlisting role="JAVA">// First we compile the spreadsheet with the template
-// to create a whole lot of rules.
-final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
-// The data we are interested in starts at row 2, column 2 (e.g. B2)
-final String drl = converter.compile(getSpreadsheetStream(), getRulesStream(), 2, 2);
+      <programlisting role="JAVA">DecisionTableConfiguration dtableconfiguration = KnowledgeBuilderFactory.newDecisionTableConfiguration();
+dtableconfiguration.setInputType( DecisionTableInputType.XLS );
+
+KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+kbuilder.add( ResourceFactory.newClassPathResource( getSpreadsheetName(),
+                                                    getClass() ),
+              ResourceType.DTABLE,
+              dtableconfiguration );
 </programlisting>
-
-      <para>We create an ExternalSpreadsheetCompiler object and use it to merge the spreadsheet with the rules. The two
-      integer parameters indicate the column and row where the data actually starts - in our case column 2, row 2 (i.e.
-      B2).</para>
     </section>
   </section>
 </section>



More information about the jboss-svn-commits mailing list