apache / incubator-kie-kogito-examples

Kogito examples - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
260 stars 388 forks source link

Kogito Bug when using Declared Types and/or Traits #145

Open carlosthe19916 opened 4 years ago

carlosthe19916 commented 4 years ago

I've been trying to use Kogito and Quarkus but I ended up not being able to use all the features that Drools gives. I'm not sure where to raise this bug so I'll start reporting it here:

To reproduce the error you only need to add a declared type inside a .drl file like this example: https://github.com/carlosthe19916/quarkus-quickstarts/blob/patch-1/kogito-quickstart/src/main/resources/org/acme/kogito/person-rules.drl#L6

Is this a problem that can be solved by adding some configuration or is it a bug? Is it possible to add an example using those features?

Note: I also reported this problem in https://github.com/quarkusio/quarkus-quickstarts/issues/488

evacchi commented 4 years ago

Hi @carlosthe19916

carlosthe19916 commented 4 years ago

@evacchi Thank you very much for the link provided, it helped a lot.

evacchi commented 4 years ago

interesting. You can obtain the same behaviour by creating two classes and have a constructor or factory method on the enriched one that copies over the values from the first. If you also need the polymorphic features of traits, you should be able to simulate it through inheritance or interfaces (an EnrichedPerson may extend an Person or you could implement an EnrichedPerson interface)

evacchi commented 4 years ago

PS: you can also get in touch with us through https://groups.google.com/forum/#!forum/kogito-development

rafaeltuelho commented 3 years ago

I hit this same issue today using Kogito 1.6.0.Final. Interesting that the Kogito docs use the DRL declare statement for defining Fact Types for all drools rules examples...

By the way, the workaround pointed in the post does not work...