Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-242

Add out-of-the-box possibility to dump DRL created from decision tables

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 6.2.0.Beta2
    • 6.0.0.CR2
    • None
    • None

      To get the DRL generated from decision table one has to currently use following 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);
      

      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.

            psiroky_jira Petr Široký (Inactive)
            psiroky_jira Petr Široký (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: