<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style title="owaParaStyle"><!--P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
<meta name="GENERATOR" content="MSHTML 8.00.6001.18812">
</head>
<body ocsi="x">
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">I never got an answer, any answer to this question.&nbsp; I really need to know if PropertyChangeSupport actually works.&nbsp; Is anyone out there successfully using it?</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">In one case (using &quot;modify()&quot;) I get a NPE.&nbsp; In all cases, the rules run twice unless I explicitly call &quot;update()&quot;.&nbsp; Is anyone *not* seeing this behaviour?&nbsp; Is anyone successfully using the PropertyChangeSupport mechanism
 without explicit calls to &quot;update()&quot;???</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div>
<div><font size="2" face="Tahoma">
<p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Jason Smith<br>
</span></b></p>
</font></div>
</div>
<div style="DIRECTION: ltr" id="divRpF246535">
<hr tabindex="-1">
<font size="2" face="Tahoma"><b>From:</b> Jason Smith<br>
<b>Sent:</b> Monday, November 23, 2009 12:36 PM<br>
<b>To:</b> rules-users@lists.jboss.org<br>
<b>Subject:</b> Rule runs twice without explicit call to update($fact).<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">My colleague has confirmed that this behavior has been around since Drools 4, and it continues to be a problem for Drools 5.0.1 and 5.1.0.M1, assuming it's a problem and not working as intended.</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">$fact.setPath(&quot;...&quot;) implements the correct PropertyChangeSupport mechanism for Drools.&nbsp; At least Drools is using it and responding mostly as expected.</font></div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma"></font>&nbsp;</div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">This runs once:</font></div>
<div dir="ltr"><b><font color="#960000" size="2"><font color="#960000" size="2">
<p align="left">rule</b></font></font><font size="2"> </font><font color="#008000" size="2"><font color="#008000" size="2">&quot;Constrain to owner or published to public&quot;</p>
</font></font><font size="2">
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">when</p>
</b></font></font><font size="2">
<p align="left">$fact : ListFact(</p>
<p align="left">$path : path </font><b><font color="#960000" size="2"><font color="#960000" size="2">not</b></font></font><font size="2">
</font><b><font color="#960000" size="2"><font color="#960000" size="2">matches</b></font></font><font size="2">
</font><font color="#008000" size="2"><font color="#008000" size="2">&quot;.*owner.*&quot;</font></font><font size="2">,</p>
<p align="left">noopResponse == </font><b><font color="#960000" size="2"><font color="#960000" size="2">true</p>
</b></font></font><font size="2">
<p align="left">)</p>
<p align="left">$model : Model()</p>
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">then</b></font></font><font size="2">
</p>
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">modify</b></font></font><font size="2">($fact)</p>
<p align="left">{</p>
<p align="left">setPath($fact.getPath() &#43; </font><font color="#008000" size="2"><font color="#008000" size="2">&quot;[owner]&quot;</font></font><font size="2">)</p>
<p align="left">}</p>
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">update</b></font></font><font size="2">($fact);</p>
</font><b><font color="#960000" size="2"><font color="#960000" size="2">
<p>end</p>
</b></font></font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">This runs twice:</font></div>
<div dir="ltr"><b><font color="#960000" size="2"><font color="#960000" size="2">
<p align="left">rule</b></font></font><font size="2"> </font><font color="#008000" size="2"><font color="#008000" size="2">&quot;Constrain to owner or published to public&quot;</p>
</font></font><font size="2">
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">when</p>
</b></font></font><font size="2">
<p align="left">$fact : ListFact(</p>
<p align="left">$path : path </font><b><font color="#960000" size="2"><font color="#960000" size="2">not</b></font></font><font size="2">
</font><b><font color="#960000" size="2"><font color="#960000" size="2">matches</b></font></font><font size="2">
</font><font color="#008000" size="2"><font color="#008000" size="2">&quot;.*owner.*&quot;</font></font><font size="2">,</p>
<p align="left">noopResponse == </font><b><font color="#960000" size="2"><font color="#960000" size="2">true</p>
</b></font></font><font size="2">
<p align="left">)</p>
<p align="left">$model : Model()</p>
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">then</b></font></font><font size="2">
</p>
<p align="left"></font><b><font color="#960000" size="2"><font color="#960000" size="2">modify</b></font></font><font size="2">($fact)</p>
<p align="left">{</p>
<p align="left">setPath($fact.getPath() &#43; <font color="#008000" size="2"><font color="#008000" size="2">&quot;[owner]&quot;</font></font><font size="2">)</font></font><font size="2"></p>
<p align="left">}</font><font size="2"></p>
</font><b><font color="#960000" size="2"><font color="#960000" size="2">
<p>end</p>
</b></font></font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">If I don't use modify(...) and simply change the $fact bean path property, the same thing occurs.&nbsp; If I explicitly call update($fact), the rule runs once.&nbsp; If I don't it runs twice.</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">I get &quot;/path[owner][owner]&quot; when I actually wanted &quot;/path[owner]&quot;, because it ran twice, not once.</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma"><strong>Why doe update(...) work differently from the PropertyChangeSupport mechanism???&nbsp; Shouldn't I be able to depend on Drools to run this rule only one time?</strong></font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font face="times new roman">I am, admittedly, a bit of a noob at this, but I ran this by my local Drools resident expert, and he doesn't know the answer either.</font></div>
<div dir="ltr"><font face="times new roman"></font>&nbsp;</div>
<div dir="ltr"><font face="times new roman">Thanks so much!</font></div>
<div dir="ltr"><font face="times new roman"></font>&nbsp;</div>
<div><font size="2" face="Tahoma">
<p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Jason Smith<br>
Software Engineer </span></b><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt"><br>
</span></b><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt">InfoTrust Group, Inc.</span></b></p>
<p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt"></span></b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt">500 Discovery Parkway, Suite 200</span><br>
<span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt">Superior, CO 80027</span><br>
<b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt">Office</span></b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt"> 303-627-6571<br>
<b>Fax</b> 303-666-6711</span><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: navy; FONT-SIZE: 8pt"><br>
</span><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt">Email</span></b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: navy; FONT-SIZE: 8pt">
<u><font color="#0000ff"><a href="mailto:jsmith@infotrustgroup.com">jsmith@infotrustgroup.com</a></font></u></span></p>
<p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt">WEB</span></b><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: navy; FONT-SIZE: 8pt">
</span><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: blue; FONT-SIZE: 8pt"><a href="http://www.infotrustgroup.com/" target="_blank">www.infotrustgroup.com</a></span></p>
<span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: blue; FONT-SIZE: 8pt">
<p class="MsoNormal"><i><span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 8pt">This e-mail and all information included herein do not constitute a legal agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.&nbsp; All legal
 agreements must be formulated in writing by a legal representative of INFOTRUST GROUP.&nbsp;This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.&nbsp; If you have received
 this e-mail by mistake, please inform us and destroy this e-mail and any documents it might contain.&nbsp; Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally,
 the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.&nbsp; Thank you for your cooperation.</span></i></p>
</span></font></div>
</div>
</body>
</html>