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

Worksheet ignored when creating package description for decision table

    XMLWordPrintable

Details

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

    Description

      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;
        }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: