]
Petr Široký updated DROOLS-242:
-------------------------------
Fix Version/s: 6.2.0.Beta2
Add out-of-the-box possibility to dump DRL created from decision
tables
------------------------------------------------------------------------
Key: DROOLS-242
URL:
https://issues.jboss.org/browse/DROOLS-242
Project: Drools
Issue Type: Feature Request
Affects Versions: 6.0.0.CR2
Reporter: Petr Široký
Assignee: Petr Široký
Fix For: 6.2.0.Beta2
To get the DRL generated from decision table one has to currently use following code:
{code}
File dtable = new File("../resources/dtable.xls");
KieResources kieResources = KieServices.Factory.get().getResources();
Resource dtableResource = kieResources.newFileSystemResource(dtable);
SpreadsheetCompiler compiler = new SpreadsheetCompiler();
String drl = compiler.compile(dtableResource.getInputStream(), InputType.XLS);
{code}
It would be nice to have this functionality out-of-the-box, similarly like
'drools.dump.dir' which is used to dump the Java classes generated from DRL.
Using the 'drools.dump.dir' property seems like the best option. The name is
general enough and users would have to use/remember yet another config. property.
Looking at how the options are being used I see basically three possible solutions here
(I maybe missing some other options):
- get the value of `drools.dump.dir` manually using the ChainedProperties.
- add this config. option into DecisionTableConfiguration. This would prevent the
backwards compatibility issues when changing the DecisionTableProvider interface, but I am
not entirely sure it is the right place for this kind of config.
- pass the entire KnowledgeBuilderConfiguration object into
DecisionTableProvider.loadFromInputStream(). This seems like the best option from the
clean-code point of view, but it would mean that the DecisionTableProvider interface would
have to altered.