-
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
modifystatement, or implicitly by letting the engine know that the facts implementPropertyChangeSupportas defined by the JavaBeans specification. - The above example demonstrates how to use
PropertyChangeSupportto avoid the need for explicitmodifystatements in the rules. - Ensure that your facts implement
PropertyChangeSupport, the same way the classorg.drools.example.Statedoes.