Hi Jane,<br><br>The varargs feature definitely works with 5.0.1. I haven&#39;t tried 5.1.0M.<br><br>You can download the working example from <a href="http://code.google.com/p/droolsbook/">http://code.google.com/p/droolsbook/</a><br>
Download the parent-1.0-examples.zip<a href="http://droolsbook.googlecode.com/files/parent-1.0-examples.zip"></a>, extract it and see project validation in droolsBookParent/validation/src/main/resources/validation.drl. To test it you can run the unit test in droolsBookParent/validation/src/test/java/droolsbook/bank/service/impl/ValidationTest<br>
<br>You could also try to put the fuction inside the DRL itself as it is shown in validation.drl (code that is commented out)<br><br>BTW the &#39;Rules Dev List&#39; is not for these type of questions. It is meant for core developers of the Drools platform.<br>
<br>Best regards,<br>Michal<br><br><br><div class="gmail_quote">On Wed, Nov 4, 2009 at 2:44 AM, Michael Neale <span dir="ltr">&lt;<a href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
yes my point is the varargs thing probably will not work.<br>
<div><div></div><div class="h5"><br>
On Wed, Nov 4, 2009 at 4:59 AM, Jane James &lt;<a href="mailto:jane6210@yahoo.com">jane6210@yahoo.com</a>&gt; wrote:<br>
&gt;  public static void error (RuleContext kcontext, Object... context) {...}<br>
&gt;<br>
&gt; ===&gt;Object... context<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ----- Original Message ----<br>
&gt; From: Michael Neale &lt;<a href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>&gt;<br>
&gt; To: Rules Dev List &lt;<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>&gt;<br>
&gt; Sent: Mon, November 2, 2009 11:56:09 PM<br>
&gt; Subject: Re: [rules-dev] is this a bug? import function not supporting varargs?<br>
&gt;<br>
&gt; I think there are issues with java5 syntax isms - which varargs is?<br>
&gt;<br>
&gt; On Tue, Nov 3, 2009 at 2:17 PM, Jane James &lt;<a href="mailto:jane6210@yahoo.com">jane6210@yahoo.com</a>&gt; wrote:<br>
&gt;&gt; Hi guys,<br>
&gt;&gt;     I have a question regarding the import function feature in Drools<br>
&gt;&gt; 5.1.0M.<br>
&gt;&gt;<br>
&gt;&gt;     I am reading the Drools JBoss Rules 5.0 book Developer&#39;s guide by Michal<br>
&gt;&gt; Bali and tried one of the examples but somehow I couldn&#39;t get my rules work<br>
&gt;&gt; with the method that has varargs.<br>
&gt;&gt;<br>
&gt;&gt; Here&#39;s what I have (copied from page 123):<br>
&gt;&gt;<br>
&gt;&gt; public class ValidationHelper {<br>
&gt;&gt;     public static void error (RuleContext kcontext, Object... context) {<br>
&gt;&gt;         KnowledgeRuntime knowledgeRuntime = kcontext.getKnowledgeRuntime();<br>
&gt;&gt;         ValidationReport validationReport =<br>
&gt;&gt; (ValidationReport)knowledgeRuntime.getGlobal(&quot;validationReport&quot;);<br>
&gt;&gt;         ReportFactory reportFactory = (ReportFactory)<br>
&gt;&gt; knowledgeRuntime.getGlobal(&quot;reportFactory&quot;);<br>
&gt;&gt;<br>
&gt;&gt;         kcontext.insertLogical(reportFactory.createMessage(<br>
&gt;&gt;                 Message.Type.ERROR, kcontext.getRule().getName(),<br>
&gt;&gt;                 context));<br>
&gt;&gt;     }<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; then in my drools file (copied from page 42):<br>
&gt;&gt; i have<br>
&gt;&gt;<br>
&gt;&gt; import org.drools.runtime.rule.RuleContext;<br>
&gt;&gt; import function ValidationHelper.error;<br>
&gt;&gt; ...<br>
&gt;&gt; rule test<br>
&gt;&gt; when<br>
&gt;&gt;   #condition<br>
&gt;&gt; then<br>
&gt;&gt;     error(drools)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; but when I ran the test, I got error message:<br>
&gt;&gt;<br>
&gt;&gt; Exception in thread &quot;main&quot; org.drools.runtime.rule.ConsequenceException:<br>
&gt;&gt; [Error: unable to resolve method:<br>
&gt;&gt; ValidationHelper.error(org.drools.base.DefaultKnowledgeHelper)<br>
&gt;&gt; [arglength=1]]<br>
&gt;&gt;<br>
&gt;&gt; If I remove the parameter Object... context, then everything worked. But I<br>
&gt;&gt; do need the varargs here because I need my error message to be more<br>
&gt;&gt; specific.<br>
&gt;&gt;<br>
&gt;&gt; Did anyone else encounter the same problems?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; thanks!<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-dev mailing list<br>
&gt;&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Michael D Neale<br>
&gt; home: <a href="http://www.michaelneale.net" target="_blank">www.michaelneale.net</a><br>
&gt; blog: <a href="http://michaelneale.blogspot.com" target="_blank">michaelneale.blogspot.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-dev mailing list<br>
&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-dev mailing list<br>
&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;<br>
<br>
<br>
<br>
--<br>
Michael D Neale<br>
home: <a href="http://www.michaelneale.net" target="_blank">www.michaelneale.net</a><br>
blog: <a href="http://michaelneale.blogspot.com" target="_blank">michaelneale.blogspot.com</a><br>
<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
</div></div></blockquote></div><br>