<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:verdana, helvetica, sans-serif;font-size:10pt"><DIV></DIV>
<DIV>Hi ,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am trying to insert fact as&nbsp;arraylist&nbsp; and then i wanted to&nbsp;get the&nbsp;objects from the arraylist based on some condition.</DIV>
<DIV>&nbsp;</DIV>
<DIV>like&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Arryalist&lt;Product&gt; fact was inserted into working memory, I want&nbsp;to get some product from the arrylist based on condition ( productType==??).</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is there any solution for this .</DIV>
<DIV><BR>&nbsp;</DIV>Thanks<BR>Prasad Raju Sagi<BR>Mobile: 847-644-4103
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: verdana, helvetica, sans-serif"><BR>
<DIV style="FONT-SIZE: 13px; FONT-FAMILY: arial, helvetica, sans-serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Greg Barton &lt;greg_barton@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Rules Users List &lt;rules-users@lists.jboss.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, June 10, 2009 3:25:39 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [rules-users] Constaint evaluation<BR></FONT><BR><BR>Correct.&nbsp; When there are no more instantiations (a rule plus a set of objects that match the rule's conditions) on the agenda, then rule firing ceases.&nbsp; With version 5 of drools they added the ability to keep the session ready and available to react even when there are no instantiations on the agenda, but you must make a separate method call to do that. (StatefulSession.fireUntilHalt() instead of fireAllRules())<BR><BR>--- On Wed, 6/10/09, Malenfant, Andre &lt;<A href="mailto:andre.malenfant@cgi.com"
 ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>&gt; wrote:<BR><BR>&gt; From: Malenfant, Andre &lt;<A href="mailto:andre.malenfant@cgi.com" ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>&gt;<BR>&gt; Subject: RE: [rules-users] Constaint evaluation<BR>&gt; To: "Rules Users List" &lt;<A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>&gt;<BR>&gt; Date: Wednesday, June 10, 2009, 2:55 PM<BR>&gt; Ok, so now I understand that the<BR>&gt; "immutable" is really a concept but not necessarily<BR>&gt; "enforced". So, the rule conditions get evaluated each time<BR>&gt; the working memory is updated (and not globals) and rules<BR>&gt; for which the conditions are true at each evaluation will<BR>&gt; fire. The execution of the rules will end when there is no<BR>&gt; more rules for which the conditions are true. Am I correct?<BR>&gt; <BR>&gt; Thanks<BR>&gt;
 <BR>&gt; -----Original Message-----<BR>&gt; From: <A href="mailto:rules-users-bounces@lists.jboss.org" ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A><BR>&gt; [mailto:<A href="mailto:rules-users-bounces@lists.jboss.org" ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>]<BR>&gt; On Behalf Of Greg Barton<BR>&gt; Sent: Wednesday, June 10, 2009 3:49 PM<BR>&gt; To: Rules Users List<BR>&gt; Subject: RE: [rules-users] Constaint evaluation<BR>&gt; <BR>&gt; <BR>&gt; The ideas is that objects in working memory are those that<BR>&gt; meant to be tracked: their changes are made visible to the<BR>&gt; rules via the insert/update/retract methods.&nbsp; A global<BR>&gt; is not in working memory, so it's changes cannot be<BR>&gt; tracked.&nbsp; You can change the contents of a global all<BR>&gt; day long and the rules would never be notified.<BR>&gt; <BR>&gt; It's a similar concept
 to threads and<BR>&gt; synchronization.&nbsp; You can have unsynchronized access to<BR>&gt; member variables in a class when in a multithreaded<BR>&gt; environment, but the results are unpredictable.&nbsp;<BR>&gt; Likewise, you can use globals in conditions, and change the<BR>&gt; value of the global as you go, but the results are<BR>&gt; unpredictable.&nbsp; <BR>&gt; <BR>&gt; --- On Wed, 6/10/09, Malenfant, Andre &lt;<A href="mailto:andre.malenfant@cgi.com" ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>&gt;<BR>&gt; wrote:<BR>&gt; <BR>&gt; &gt; From: Malenfant, Andre &lt;<A href="mailto:andre.malenfant@cgi.com" ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>&gt;<BR>&gt; &gt; Subject: RE: [rules-users] Constaint evaluation<BR>&gt; &gt; To: "Kris Verlaenen" &lt;<A href="mailto:Kris.Verlaenen@cs.kuleuven.be" ymailto="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>&gt;<BR>&gt; &gt; Cc:
 "Rules Users List" &lt;<A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>&gt;<BR>&gt; &gt; Date: Wednesday, June 10, 2009, 2:20 PM<BR>&gt; &gt; Thanks Kris,<BR>&gt; &gt; <BR>&gt; &gt; I will try with code constraints.<BR>&gt; &gt; <BR>&gt; &gt; But on the globals subject, I read in the<BR>&gt; documentation<BR>&gt; &gt; that one should not use a global in a rule. I have<BR>&gt; trouble<BR>&gt; &gt; understanding why. I don't think drools clones the<BR>&gt; global<BR>&gt; &gt; object (might not be possible anyway). If my rule<BR>&gt; &gt; consequences change the state of a global (this usage<BR>&gt; is<BR>&gt; &gt; considered valid as per the documentation as well)<BR>&gt; then what<BR>&gt; &gt; is the harm of using it in a condition? I could<BR>&gt; understand<BR>&gt; &gt; with immutable objects like String but...<BR>&gt; &gt; <BR>&gt; &gt; I can change my code to insert that global
 in the<BR>&gt; working<BR>&gt; &gt; memory but I would like to understand why I should do<BR>&gt; so...<BR>&gt; &gt; And if I do and the state of that object is changed by<BR>&gt; a<BR>&gt; &gt; consequence of my rules, I have to call update? For<BR>&gt; the same<BR>&gt; &gt; reason? I guess I am trying to understand the<BR>&gt; underlying<BR>&gt; &gt; mechanism.<BR>&gt; &gt; <BR>&gt; &gt; Thanks<BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; -----Original Message-----<BR>&gt; &gt; From: Kris Verlaenen [mailto:<A href="mailto:Kris.Verlaenen@cs.kuleuven.be" ymailto="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>]<BR>&gt; &gt; <BR>&gt; &gt; Sent: Wednesday, June 10, 2009 11:38 AM<BR>&gt; &gt; To: Rules Users List; Malenfant, Andre<BR>&gt; &gt; Cc: Rules Users List<BR>&gt; &gt; Subject: Re: [rules-users] Constaint evaluation<BR>&gt; &gt; <BR>&gt; &gt; It depends on what type of constraint you are using.<BR>&gt; &gt; <BR>&gt; &gt; If you
 are using a rule constraint, that constraint<BR>&gt; will be<BR>&gt; &gt; evaluated<BR>&gt; &gt; just the same as normal rules.&nbsp; This means that the<BR>&gt; &gt; constraints are<BR>&gt; &gt; evaluated when data is inserted / updated /<BR>&gt; removed.&nbsp;<BR>&gt; &gt; Note that, if you<BR>&gt; &gt; want to make sure the engine is using up-to-date<BR>&gt; &gt; information, you must<BR>&gt; &gt; notify the engine (using update) when you change the<BR>&gt; data<BR>&gt; &gt; in the working<BR>&gt; &gt; memory.&nbsp; Also note that globals are considered<BR>&gt; &gt; immutable.&nbsp; You should<BR>&gt; &gt; never write rules that depend on the state of a global<BR>&gt; and<BR>&gt; &gt; where the<BR>&gt; &gt; global can be changed.<BR>&gt; &gt; <BR>&gt; &gt; If you are using code constraints, the constraint is<BR>&gt; &gt; evaluated at the<BR>&gt; &gt; point the code constraint is reached.<BR>&gt; &gt; <BR>&gt; &gt; Kris<BR>&gt; &gt; <BR>&gt; &gt;
 Quoting "Malenfant, Andre" &lt;<A href="mailto:andre.malenfant@cgi.com" ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>&gt;:<BR>&gt; &gt; <BR>&gt; &gt; &gt; I have some trouble understanding how conditions<BR>&gt; and<BR>&gt; &gt; constraints are<BR>&gt; &gt; &gt; evaluated:<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; I have a rule flow split node with constraints on<BR>&gt; a<BR>&gt; &gt; global object.<BR>&gt; &gt; &gt; The split node always takes the same path like if<BR>&gt; the<BR>&gt; &gt; constraints are<BR>&gt; &gt; &gt; evaluated at the beginning of the execution of<BR>&gt; the<BR>&gt; &gt; process and not<BR>&gt; &gt; &gt; when the process flow reaches that split node.<BR>&gt; What I<BR>&gt; &gt; would expect is<BR>&gt; &gt; &gt; that the split node constraints takes into<BR>&gt; account the<BR>&gt; &gt; state of the<BR>&gt; &gt; &gt; global object as modified by previous rules in<BR>&gt; the<BR>&gt; &gt; flow.<BR>&gt; &gt; &gt;
 <BR>&gt; &gt; &gt; Am I right to think that rules conditions and<BR>&gt; split<BR>&gt; &gt; nodes constraints<BR>&gt; &gt; &gt; are evaluated only when inserting/updating<BR>&gt; objects in<BR>&gt; &gt; the working<BR>&gt; &gt; &gt; memory? The documentation is not really useful<BR>&gt; (unless<BR>&gt; &gt; I haven't<BR>&gt; &gt; &gt; found the appropriate one).<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Thanks<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; André<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; -----Original Message-----<BR>&gt; &gt; &gt; From: <A href="mailto:rules-users-bounces@lists.jboss.org" ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A><BR>&gt; &gt; &gt; [mailto:<A href="mailto:rules-users-bounces@lists.jboss.org" ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>]<BR>&gt; &gt; On Behalf Of Malenfant,<BR>&gt; &gt; &gt; Andre<BR>&gt; &gt; &gt; Sent: Wednesday, June 10,
 2009 11:07 AM<BR>&gt; &gt; &gt; To: Kris Verlaenen<BR>&gt; &gt; &gt; Cc: Rules Users List<BR>&gt; &gt; &gt; Subject: RE: [rules-users] Globals in ruleflow<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Thanks for trying this for me...<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; As it turns out, while I was creating a test<BR>&gt; sample<BR>&gt; &gt; for you I<BR>&gt; &gt; &gt; realized<BR>&gt; &gt; &gt; that my ruleflow was not loading properly and I<BR>&gt; forgot<BR>&gt; &gt; to check for<BR>&gt; &gt; &gt; errors on the builder. Now it works.<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Still, the behavior is strange. If my rule<BR>&gt; doesn't<BR>&gt; &gt; load and even<BR>&gt; &gt; &gt; though<BR>&gt; &gt; &gt; my DRL loaded, my globals were not available.<BR>&gt; Since<BR>&gt; &gt; the DRL declared<BR>&gt; &gt; &gt; the<BR>&gt; &gt; &gt; same globals it should not have given me that<BR>&gt; error.<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Thanks<BR>&gt; &gt; &gt; <BR>&gt; &gt;
 &gt; -----Original Message-----<BR>&gt; &gt; &gt; From: Kris Verlaenen [mailto:<A href="mailto:Kris.Verlaenen@cs.kuleuven.be" ymailto="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>]<BR>&gt; &gt; <BR>&gt; &gt; &gt; Sent: Tuesday, June 09, 2009 5:51 PM<BR>&gt; &gt; &gt; To: Rules Users List; Malenfant, Andre<BR>&gt; &gt; &gt; Cc: Rules Users List<BR>&gt; &gt; &gt; Subject: Re: [rules-users] Globals in ruleflow<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Andre,<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; There should be no problem in using the same<BR>&gt; global in<BR>&gt; &gt; both your<BR>&gt; &gt; &gt; rules<BR>&gt; &gt; &gt; and processes.<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; I have tried a simple example as you described<BR>&gt; but<BR>&gt; &gt; have not been able<BR>&gt; &gt; &gt; to<BR>&gt; &gt; &gt; reproduce the problem.&nbsp; Could you send me a<BR>&gt; &gt; self-contained example<BR>&gt; &gt; &gt; that<BR>&gt; &gt; &gt; shows the
 issue?<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Kris<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Quoting "Malenfant, Andre" &lt;<A href="mailto:andre.malenfant@cgi.com" ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>&gt;:<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; I am experimenting with rule flows and I get<BR>&gt; the<BR>&gt; &gt; following error:<BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; Unexpected global [myglobal]<BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; When calling setGlobal on the session.<BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; This code works without the workflow<BR>&gt; (globals<BR>&gt; &gt; declared in the drl)<BR>&gt; &gt; &gt; &gt; but<BR>&gt; &gt; &gt; &gt; fails when I include the rule flow. I<BR>&gt; declared<BR>&gt; &gt; the same globals in<BR>&gt; &gt; &gt; &gt; the<BR>&gt; &gt; &gt; &gt; rule flow in the header section.<BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt;<BR>&gt;
 _______________________________________________<BR>&gt; &gt; &gt; &gt; rules-users mailing list<BR>&gt; &gt; &gt; &gt; <A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; &gt; &gt; &gt; <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; _______________________________________________<BR>&gt; &gt; &gt; rules-users mailing list<BR>&gt; &gt; &gt; <A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; &gt; &gt; <A href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; _______________________________________________<BR>&gt; &gt; &gt; rules-users mailing list<BR>&gt; &gt; &gt; <A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; &gt; &gt; <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; &gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; Disclaimer: <A href="http://www.kuleuven.be/cwis/email_disclaimer.htm" target=_blank>http://www.kuleuven.be/cwis/email_disclaimer.htm</A><BR>&gt; &gt; <BR>&gt; &gt; _______________________________________________<BR>&gt; &gt; rules-users mailing list<BR>&gt; &gt; <A href="mailto:rules-users@lists.jboss.org"
 ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; &gt; <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; &gt; <BR>&gt; <BR>&gt; <BR>&gt; &nbsp; &nbsp; &nbsp; <BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; rules-users mailing list<BR>&gt; <A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; rules-users mailing list<BR>&gt; <A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; <A href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; <BR><BR><BR>&nbsp; &nbsp; &nbsp; <BR><BR>_______________________________________________<BR>rules-users mailing list<BR><A href="mailto:rules-users@lists.jboss.org" ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></DIV></DIV></div><br>

      </body></html>