<br> Alexandre,<br><br> Thanks for letting us know.<br><br> Regards,<br> Edson<br><br><div><span class="gmail_quote">2007/5/25, A Gattiker <<a href="mailto:agattik@gmail.com">agattik@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>I have given it a try with JBoss Rules 4.0.0 and this time, both facts<br>are retracted! Congratulations for this exciting new version.<br><br>Regards,<br>Alexandre<br><br>On 5/24/07, A Gattiker <<a href="mailto:agattik@gmail.com">
agattik@gmail.com</a>> wrote:<br>> Hello,<br>><br>> I am trying to use assertLogical in combination with a<br>> WorkingMemoryEventListener in order to have business rules drive my<br>> application: if conditions, then do something; if conditions not true
<br>> anymore, then do something else.<br>><br>> However, it seems that if the rule is activated multiple times, then<br>> becomes unsupported, only one of the assertLogical'ed facts is<br>> retracted, as illustrated in the example below.
<br>><br>> Does anyone know how to get around that problem? I thought<br>> assertLogical would be an elegant solution but maybe there is a better<br>> way?<br>><br>> Kind regards<br>> Alexandre<br>>
<br>><br>> To reproduce the problem: With the JBoss Rules 3.0.6 IDE, I have<br>> started with a test project with the Eclipse Wizard and modified it as<br>> listed below. "Date" facts are used simply to ensure unequality.
<br>><br>> DRL:<br>><br>> import com.sample.DroolsTest.Message;<br>> import java.util.Date;<br>><br>> rule "Hello World"<br>> when<br>> $i : Message ( status > 4 )
<br>> then<br>> assertLogical(new Date());<br>> end<br>><br>> Java:<br>> workingMemory.addEventListener(new<br>> DebugWorkingMemoryEventListener());<br>><br>> Message message = new Message();
<br>> message.setStatus( 10 );<br>> FactHandle fh = workingMemory.assertObject( message );<br>> workingMemory.fireAllRules();<br>> Thread.sleep(2000);<br>><br>
> message.setStatus( 6 );<br>> workingMemory.modifyObject(fh, message);<br>> workingMemory.fireAllRules();<br>><br>> Thread.sleep(2000);<br>> message.setStatus
( 2 );<br>> workingMemory.modifyObject(fh, message);<br>> workingMemory.fireAllRules();<br>><br>> Output:<br>> [ObjectAsserted: handle=[fid:1:1];<br>> object=com.sample.DroolsTest$Message@629da7ee
]<br>> [ObjectAsserted: handle=[fid:2:2]; object=Thu May 24 19:19:01 CEST 2007]<br>> [ObjectModified: handle=[fid:1:3];<br>> old_object=com.sample.DroolsTest$Message@629da7ee;<br>> new_object=com.sample.DroolsTest$Message@629da7ee
]<br>> [ObjectAsserted: handle=[fid:3:4]; object=Thu May 24 19:19:03 CEST 2007]<br>> [ObjectModified: handle=[fid:1:5];<br>> old_object=com.sample.DroolsTest$Message@629da7ee;<br>> new_object=com.sample.DroolsTest$Message@629da7ee
]<br>> [ObjectRetracted: handle=[fid:3:4]; old_object=Thu May 24 19:19:03 CEST 2007]<br>><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli
<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>