-
Language:
English
-
Language:
English
20.8. Salience State Example: Inserting a Dynamic Fact
// By setting dynamic to TRUE, JBoss Rules will use JavaBean // PropertyChangeListeners so you don't have to call modify or update(). final boolean dynamic = true; session.insert( fact, dynamic );
- For the engine to see and react to changes of fact properties, the application must tell the engine that changes occurred. This can be done explicitly in the rules by using the
modify
statement, or implicitly by letting the engine know that the facts implementPropertyChangeSupport
as defined by the JavaBeans specification. - The above example demonstrates how to use
PropertyChangeSupport
to avoid the need for explicitmodify
statements in the rules. - Ensure that your facts implement
PropertyChangeSupport
, the same way the classorg.drools.example.State
does.