• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Traits in Drools - Rules with dynamic attributes in the object

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to write a dynamic rule engine through Drools. Means, if a new property/attribute is added to the object which will be used for evaluation, i should not need to code a new field in that DTO, and redeploy that code.

Found something trait close to that. I find 2 issues in it. Can somebody help?

1. knowledgeSession.fireAllRules() returns the number of matches to the provided object. Here it returns more than the number of rules documented in the drl.
2. whatever i do my insert (new PolypathSystem()) does not work. It keeps saying org/drools/core/factmodel/traits/test/Rule_PolyPathSystem11121790227.java (9:566) : Cannot instantiate the type PolypathSystem

Please help.
my java code looks like below. As its a test code and so the content of the drl file is hardcoded here itself



 
My, my, aren't you a big fella. Here, have a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!