apache / incubator-kie-kogito-runtimes

Kogito Runtimes - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
538 stars 208 forks source link

kogito-quarkus: modify() multiple properties #746

Closed antoniomacri closed 3 years ago

antoniomacri commented 4 years ago

Hope this is the correct project to address this issue.

I'm using the Quarkus extension.

If I have:

modify($evaluation) {
    setPropA(true);
    setPropB(10);
}

it is compiled into:

{
   ($evaluation).setPropB(10);
   drools.update($evaluation,
                 mask_$evaluation);
}

If I use two modify()s, it turns into:

{
   ($evaluation).setPropA(true);
   drools.update($evaluation,
                 mask_$evaluation);
}
{
   ($evaluation).setPropB(10);
   drools.update($evaluation,
                 mask_$evaluation);
}

However in both cases the bitmask is defined on a single property:

final BitMask mask_$evaluation = BitMask.getPatternMask(DomainClassesMetadata76FC63AECA4701...Metadata_INSTANCE,
                                                                                          "propA");

Is there any chance to support modifying muliple properties at once?

mariofusco commented 3 years ago

According to drools drl syntax you're writing that modify block mistakenly. The setters should be separated by a comma like in

modify($evaluation) {
    setPropA(true),
    setPropB(10)
}

I agree that the fact that kogito is taking care of only one of the 2 statements instead of emitting a compile time error is misleading. I will fix this.