[rules-dev] Matrix Style XLS Decision Table

Ramon Buckland ramon at thebuckland.com
Tue May 7 09:01:03 EDT 2013


Hi all,

I am looking at using the Matrix style decision tables. 
There is not a lot of documentation on these, but I have also found the spring config for them is lacking.

There is a test case here - https://github.com/droolsjbpm/drools/blob/master/drools-decisiontables/src/test/java/org/drools/decisiontable/SpreadsheetCompilerUnitTest.java

that shows really that it complies to a DRL.

The method call for building the compiler SpreadsheetCompiler.compile() takes an extra argument .. a spreadsheet listener.

        final SpreadsheetCompiler converter = new SpreadsheetCompiler();

        final String drl = converter.compile( stream,
                                              InputType.XLS,
                                              new RuleMatrixSheetListener() );

But the Spring configuration doesn't seem to support that type.. (i.e. looking at the code in the UnitTest, a "RuleMatrixSheetListener" is passed to the compile.

but the spring config won't support tat extra listener.

	<drools-spring:kbase id="kbase">
		<drools-spring:resources>
			<drools-spring:resource type="DTABLE" source="classpath:myco/matrix_ruletable.xls" >
		          <drools-spring:decisiontable-conf input-type="XLS"/>
			</drools-spring:resource>
		</drools-spring:resources>
	</drools-spring:kbase>

I am considering making a patch to support a Matrix style spreadsheet.
Which way would you suggest I head 

(a) add a new "decisionmatrixtable-conf to the schema a a new parser - because they are different
   (modify droolsjbpm-integration//drools-spring/src/main/java/org/drools/container/spring/namespace/ResourceDefinitionParser.java)
   (create a new DecisionTableConfiguration for Matrix sheets)
   
(b) add a new input type to the DecisionTable .. (XLS_MATRIX)

(c) add the ability to inject a "SheetLisner" as an optional parameter to "decisiontable-conf"

(d) other.


Something else I noted is that, when you do have a "SheetListener" passed to .compile( … ) you also cannot have a worksheetName
ie: 

     compile(stream, inputType, listener)
     compile(stream, inputType) 
     compile(stream, string)

Does that need a little uplift as well ? The assumption that (stream, string) is always an XLS doesn't seem right.

regards
Ramon


Ramon Buckland
ramon at thebuckland.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20130507/8f590b69/attachment.html 


More information about the rules-dev mailing list