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

executable-model doesn't resolve kcontext with mvel dialect

    XMLWordPrintable

Details

    • 2021 Week 04-06 (from Jan 25)
    • 3
    • NEW
    • NEW
    • ---
    • ---

    Description

      • When a rule uses mvel dialect and refers to "kcontext" in RHS with exec-model,
        dialect "mvel"
        when
          Integer()
        then
          result.add(kcontext.getRule().getName());
        end
        

      it cannot resolve "kcontext" hence compilation fails.

      [ERROR] Failures: 
      [ERROR]   MvelDialectTest.testKcontext:921->BaseModelTest.getKieSession:105->BaseModelTest.getKieSession:109->BaseModelTest.getKieContainer:113->BaseModelTest.getKieContainer:120->BaseModelTest.createKieBuilder:131->BaseModelTest.createKieBuilder:158 [Message [id=1, level=ERROR, path=src/main/java/defaultpkg/PDF/LambdaConsequenceDF24FCC3F13686A61CE2DA9AF55C71CF.java, line=20, column=20
         text=cannot find symbol
        symbol:   variable kcontext
        location: class defaultpkg.PDF.LambdaConsequenceDF24FCC3F13686A61CE2DA9AF55C71CF], Message [id=2, level=ERROR, path=src/main/java/defaultpkg/PDF/LambdaConsequenceDF24FCC3F13686A61CE2DA9AF55C71CF.java, line=0, column=0
         text=Java source of src/main/java/defaultpkg/PDF/LambdaConsequenceDF24FCC3F13686A61CE2DA9AF55C71CF.java in error:
      
      ...
      public enum LambdaConsequenceDF24FCC3F13686A61CE2DA9AF55C71CF implements org.drools.model.functions.Block1<java.util.List>, org.drools.model.functions.HashedExpression {
      
          ...
      
          @Override()
          public void execute(java.util.List result) throws java.lang.Exception {
              result.add(kcontext.getRule().getName());
          }
      }
      ]]
      

      Note: The same issue is found in org.drools.mvel.integrationtests.KnowledgeContextTest

      Attachments

        Issue Links

          Activity

            People

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: