If I&#39;m not too Sauvignon-Blanced-out at the moment: the error message reads &quot;cannot be cast to a org.drools.common.EventFactHandle&quot;.<br><br>But the WM(EntryPoint) could very well do a getFactHandle( Object x ), which would succeed and give it the equivalent of the bound variable&#39;s full-fledged event.<br>
<div id=":126"><br>So, in addition to (order to be decided) testing for Date/long/event, just one more try with getFactHandle()... ?<br><br>Cheers!<br>-W<br></div><br><br><div class="gmail_quote">2010/8/13 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">   Hi Wolfgang,<div><br></div><div>   I will explain why it happens and we can discuss how to improve that (at least improving the error message).</div>
<div><br></div><div>   All temporal operators work when used against either an event, a date attribute or a long attribute (interpreted as a timestamp).</div>
<div><br></div><div>   In your example:</div><div class="im"><div><br></div><div>   Wrapper( $eventA : foo )<br>   $eventB : Bar( this after[0ms,1h] $eventA )<br><br></div></div><div>    The engine has no idea that $eventA is an event in the working memory. From the engine&#39;s point of view, it is just a &quot;foo&quot; attribute from the Wrapper fact. So it checks if event A is a Date (nope), a long (nope) and finally tries to use it as an event raising the exception you see.</div>

<div><br></div><div>    On your last example:</div><div><br></div><div>$eventA : Foo( this == $foo ) </div><div><br></div><div>    $eventA is an event in the working memory with all the internal metadata required to handle events. So, in this case, the engine knows how to deal with it.</div>

<div><br></div><div>    Suggestions on how to improve that are welcome.</div><div><br></div><div>    Edson</div><div><br><div class="gmail_quote">2010/8/13 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">According to the Fusion manual, &quot;after&quot; is used like this:<br>
<br>   $eventA : Foo(...)<br>   $eventB : Bar( this after[0ms,1h] $eventA )<br>
<br>provided Foo and Bar have @role(event). <br><br>This works.<br><br>
But, given a class Wrapper( Foo foo ), the pattern combination<br>   Wrapper( $eventA : foo )<br>   $eventB : Bar( this after[0ms,1h] $eventA )<br>results in a class cast exception at runtime, telling me that a Foo cannot be cast to a org.drools.common.EventFactHandle.<br>


<br>Working around this by doing<br>  Wrapper( $foo: foo )<br>  $eventA : Foo( this == $foo ) <br>
  $eventB : Bar( this after[0ms,1h] $eventA )<br><br>solves the problem, but is this really necessary and intentional? (The documentation doesn&#39;t even hint at such a restriction.)<br><font color="#888888"><br>-W <br>

 
</font><br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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" target="_blank">www.jboss.com</a><br>
</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>