]
Luca Molteni moved RHDM-1581 to DROOLS-5958:
--------------------------------------------
Component/s: executable model
(was: BRE)
Docs QE Status: NEW
Key: DROOLS-5958 (was: RHDM-1581)
QE Status: NEW
Affects Version/s: (was: 7.5.0.GA)
(was: 7.6.0.GA)
(was: 7.5.1.GA)
(was: 7.7.0.GA)
(was: 7.8.0.GA)
(was: 7.7.1.GA)
(was: 7.9.0.GA)
(was: 7.8.1.GA)
Workflow: GIT Pull Request workflow (was: CDW with docs v1)
Project: Drools (was: Red Hat Decision Manager)
Order of statements described in rule action part does not keep after
model generation in executable model.
-----------------------------------------------------------------------------------------------------------
Key: DROOLS-5958
URL:
https://issues.redhat.com/browse/DROOLS-5958
Project: Drools
Issue Type: Bug
Components: executable model
Reporter: Luca Molteni
Assignee: Luca Molteni
Priority: Major
Labels: support
Attachments: reproducer_model_compiler_14a.zip
Building a rule written in MVEL dialect like (*1) in executable rule model, the order of
the statements described in action ({{then}}) part of the rule changes after model
generation like (\*2). The generated code looks like that all statements outside the
{{modify}} blocks come first, followed by all statements inside the {{modify}} blocks, and
finally {{update}} statements for the modified properties are called together. The
original order of the statements in action part should keep after model generation.
(\*1)
{noformat}
package com.example.reproducer
dialect "mvel"
rule "rule14a"
when
$manufacturer : Manufacturer()
$model : Model( manufacturer == $manufacturer )
$car : Car( model == $model )
then
System.out.println("***** Action of rule14a");
modify($model) {
count = $model.count + 1
}
System.out.println("$model = " + $model + ", count = " +
$model.count);
modify($manufacturer) {
totalCount = $manufacturer.totalCount + 1
}
System.out.println("$manufacturer = " + $manufacturer + ",
totalCount = " + $manufacturer.totalCount);
end
{noformat}
(\*2) {{LambdaConsequence<_hash_>.java}} generated from the action ({{then}}) part
of the rule.
{noformat}
@Override()
public void execute(org.drools.model.Drools drools, com.example.reproducer.Model
$model, com.example.reproducer.Manufacturer $manufacturer) throws java.lang.Exception {
System.out.println("***** Action of rule14a");
System.out.println("$model = " + $model + ", count = " +
$model.getCount());
System.out.println("$manufacturer = " + $manufacturer + ",
totalCount = " + $manufacturer.getTotalCount());
$model.setCount($model.getCount() + 1);
$manufacturer.setTotalCount($manufacturer.getTotalCount() + 1);
drools.update($model, mask_$model);
drools.update($manufacturer, mask_$manufacturer);
}
{noformat}