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

Worksheet ignored when creating package description for decision table

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 7.54.0.Final
    • decision tables
    • None
    • 2021 Week 19-21 (from May 10)
    • Undefined
    • NEW
    • NEW

      The configured worksheet is ignored when creating package description for decision table.

      This means that the rules for the decision template are always created from the first sheet in the XLS spreadsheet instead of the specified sheet.

      I think the code in this method --> DecisionTableProviderImpl.loadFromInputStreamWithTemplates needs to become:

        public List<String> loadFromInputStreamWithTemplates(Resource resource,
            DecisionTableConfiguration configuration) {
          List<String> drls = new ArrayList<String>( configuration.getRuleTemplateConfigurations().size() );
          ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
          for ( RuleTemplateConfiguration template : configuration.getRuleTemplateConfigurations() ) {
            try {
              if ( StringUtils.isEmpty( configuration.getWorksheetName() ) ) {
                drls.add(converter.compile(resource.getInputStream(),
                    template.getTemplate().getInputStream(),
                    InputType.getInputTypeFromDecisionTableInputType(configuration.getInputType()),
                    template.getRow(),
                    template.getCol()));
              } else {
                drls.add(converter.compile(resource.getInputStream(),
                    configuration.getWorksheetName(),
                    template.getTemplate().getInputStream(),
                    InputType.getInputTypeFromDecisionTableInputType(configuration.getInputType()),
                    template.getRow(),
                    template.getCol()));
              }
            } catch (IOException e) {
              logger.error( "Cannot open " + template.getTemplate(), e );
            }
          }
          return drls;
        }
      

              mfusco@redhat.com Mario Fusco
              evantoli Evan Toli (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: