[jboss-user] [JBoss Seam] - how to use PropertyChangeListener on entity beans for drools

ellenzhao do-not-reply at jboss.com
Mon Jul 16 09:43:04 EDT 2007


I want to use:

  | StatefulSession ss = myRuleBase.newStatefulSession();
  | ss.setGlobal("conversationBean", this);
  | ...
  | ss.insert(entity, true);
  | ...
  | 

The true flag means the obj I inserted into the ss rule session is a dynamic object, the stateful rule session is aware of the changes of the properties of the entity. But according to Drools manual section 1.6.4.5, I must write code like this in my entity beans:


  | private final PropertyChangeSupport changes = new PropertyChangeSupport( this );
  | ...
  | public void addPropertyChangeListener(final PropertyChangeListener l) {
  |     this.changes.addPropertyChangeListener( l );
  | }
  | 
  | public void removePropertyChangeListener(final PropertyChangeListener l) {
  |     this.changes.removePropertyChangeListener( l );
  | }
  | ...
  | 
  | public void setState(final String newState) {
  |     String oldState = this.state;
  |     this.state = newState;
  |     this.changes.firePropertyChange( "state",
  |                                       oldState,
  |                                       newState );
  | }
  | 

I have a feeling that frameworks like hibernate or seam or the ejb 3 container have already some property change listeners employed for entity beans....the property change listeners do already exist, how can I make Drools share the property change listeners? Thanks!


Regards,
Ellen

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064550#4064550

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4064550



More information about the jboss-user mailing list