<div><br></div> I think there is a fundamental misunderstanding in the use you are trying to do with custom operators. Custom operators are supposed to be used to correlate 2 values, that may be lists, but not do "search" in the working memory, as that would be extremely inefficient. If you need to process sets of facts, then you probably need an accumulate function, not an operator...<div>
<br></div><div> Can you clarify what kind of operator are you trying to implement?</div><div><br></div><div> Edson<br><br><div class="gmail_quote">2011/6/10 Martin, Matthias <span dir="ltr"><<a href="mailto:martin@adesso.de">martin@adesso.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="white" lang="DE" link="blue" vlink="purple"><div><p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#1F497D">Exactly! I need to iterate over a bunch of objects/facts in the Working Memory.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;color:windowtext">Von:</span></b><span style="font-size:10.0pt;color:windowtext"> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>Im Auftrag von </b>Vincent Legendre<br>
<b>Gesendet:</b> Freitag, 10. Juni 2011 12:04<br><b>An:</b> Rules Users List<br><b>Betreff:</b> Re: [rules-users] Custom-Operator - No access to FactHandles?</span></p></div></div><div><div></div><div class="h5"><p class="MsoNormal">
</p><p class="MsoNormal">And why not accessing the object itself directly ?<br>Because the evaluation of one object field depends on others objects in WM ?<br><br>Le 10/06/2011 11:54, Martin, Matthias a écrit : </p><p class="MsoNormal">
<span lang="EN-US">Hello,</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">some of our custom operators need to access already inserted facts at runtime. Therefore we extended <b>org.drools.base.BaseEvaluator</b>. The provide methods, i. e. </span></p>
<p class="MsoNormal" style="line-height:200%"><b><span lang="EN-US">public boolean evaluate(InternalWorkingMemory workingMemory, InternalReadAccessor extractor, Object object, FieldValue value)</span></b><span lang="EN-US">, state, amongst others, a parameter “workingMemory” of type <b>org.drools.common.InternalWorkingMemory</b>. </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US">When calling <b>workingMemory.getObjects()</b> we receive a “UnsupportedOperationException”. The question is whether it is possible to access facts in a KnwoledgeSession at runtime or not. Alternatively we could provide the objects in question as globals and call workingMemory.getGlobal(), but that seems to me like somewhat bad architecture. </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US"> </span></p><p class="MsoNormal" style="line-height:200%"><span lang="EN-US">Any suggestions are welcome.</span></p><p class="MsoNormal" style="line-height:200%">
<span lang="EN-US">Many thanks,</span></p><p class="MsoNormal" style="line-height:200%"><span lang="EN-US">-Matthias</span></p><p class="MsoNormal"> </p><pre> </pre><pre> </pre><pre>_______________________________________________</pre>
<pre>rules-users mailing list</pre><pre><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a></pre><pre><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">-- <br>
</span><span style="font-size:13.5pt">Vincent LEGENDRE</span><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br></span><i><span style="font-size:8.5pt">Consultant Sénior</span></i><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
</span><span style="font-size:4.5pt;font-family:"Times New Roman","serif""><br></span><span style="font-size:9.0pt">EURODECISION</span><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
</span><span style="font-size:9.0pt">9A rue de la Porte de Buc 78000 VERSAILLES<br>Tél. : +33 (0)1 39 07 12 40<br>Direct : +33 (0)1 39 07 26 16<br><a href="http://www.eurodecision.com" target="_blank">www.eurodecision.com</a></span><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
<a href="http://www.eurodecision.com/" target="_blank"><span style="text-decoration:none"><img border="0" width="206" height="66" src="cid:image001.gif@01CC276B.CDDE3EA0" alt="EURODECISION"></span></a></span></p></div></div>
</div></div></div><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>