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

RHS statements ordering changes with modify block in executable model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.37.0.Final
    • 7.36.0.Final
    • executable model
    • None
    • 2020 Week 16-18 (from Apr 13)
    • 3
    • NEW
    • NEW

      The order of statements in RHS changes with executable model when modify block is involved.

      import org.drools.modelcompiler.domain.Person;global java.util.List list;
      rule R when
        $p1 : Person(name == "John")
        $p2 : Person(name == "Paul")
      then
        list.add($p1.getAge());
        list.add($p2.getAge());
        modify($p1) { setAge($p1.getAge()+1) }
        list.add($p1.getAge());
        list.add($p2.getAge());
        modify($p2) { setAge($p2.getAge()+5) }
        list.add($p1.getAge());
        list.add($p2.getAge());
      end
      

      Below is the generated code.

      D.on(var_$p1,
          var_$p2,
          var_list).execute((org.drools.model.Drools drools, org.drools.modelcompiler.domain.Person $p1, org.drools.modelcompiler.domain.Person $p2, java.util.List list) -> {
         {
             {
                 list.add($p1.getAge());
                 list.add($p2.getAge());
                 list.add($p1.getAge());
                 list.add($p2.getAge());
                 list.add($p1.getAge());
                 list.add($p2.getAge());
                 ($p1).setAge($p1.getAge() + 1);
                 drools.update($p1,
                               mask_$p1);
                 ($p2).setAge($p2.getAge() + 5);
                 drools.update($p2,
                               mask_$p2);
             }
         }
      }));
      

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

              Created:
              Updated:
              Resolved: