In the RHS of a rule one can use either an "update" or "modify" block
to notify Drools that a fact has changed. In the Java API for 5.5.0 Final, I can call
StatefulKnowledgeSession.update(factHandle, object) to update a fact handle with an
object. However, there's no complementary StatefulKnowledgeSession.modify method. Is
there a way to get modify's property-reactive functionality through the API? That is,
can Java code update fact objects and then inform Drools that only certain properties have
been changed? This capability would allow just the rules that reference those properties
to be reevaluated, unlike update, which causes all the rules that reference the Java class
to be reevaluated.
There is a CommandFactory.newModify method, but the
JavaDoc<http://docs.jboss.org/drools/release/5.5.0.Final/knowledge-api...
has no explanatory text. I explored the source to understand how this is used, and it
appears that it is meant to be passed a list of Setter objects that contain literal bean
property names and string values which are then dynamically interpreted by MVEL. It might
be possible to use this in a pinch, but it seems a rather roundabout way to update an
object that the code can access directly.
Thanks,
Tom