try<br><br>global java.util.ArrayList arrayList;<br><br>or <br><br>global java.util.List arrayList;<br><br><div><span class="gmail_quote">On 1/8/07, <b class="gmail_sendername">Joel G. Rivera-González</b> <<a href="mailto:el_pio@yahoo.com">
el_pio@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
setting an <span style="font-weight: bold;">ArrayList</span> on a global value like this <span style="font-weight: bold;">workingMemory.setGlobal("arrayList", menuArray);</span> on the java code and like this on the rule
<span style="font-weight: bold;">global ArrayList arrayList;<br><span style="font-weight: bold;"><br></span></span>cause the following error: <span style="font-weight: bold;"><span style="font-weight: bold;"><br></span></span>
23304 [main] FATAL com.prtc.struts.util.ConstructServiceAssuranceTreeMenu - Exception in ShowIspServiceAssuranceAction.execute --> org.drools.rule.InvalidRulePackage: Rule Compilation error Redefinition of formal parameter "arrayList" Exception:1 errors while compiling unit "com/prtc/struts/rules/Rule_pos_baja_feature_menu_0.java"
<span class="q"><br><div> <br><br><br></div>Joel
G. Rivera-Gonzalez<br>PRT<br><br>"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law</span><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><span class="q">----- Original Message ----<br>From: Steven Williams <<a href="mailto:stevenw@objectconsulting.com.au" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
stevenw@objectconsulting.com.au</a>><br>To: Joel G. Rivera-González <<a href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">el_pio@yahoo.com</a>><br></span><div><span class="e" id="q_10ffefae346127e8_4">
Cc: drools <<a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org</a>><br>Sent: Sunday, January 7, 2007 6:00:41 PM<br>Subject: Re: Fw: [rules-users] rules questions...
<br><br>Hi Joel,<br><br>The whole point of globals is that you don't need to assert them you just set them from the calling code, ie:<br><br>workingMemory.setGlobal("myList", arrayList);<br><br>You can then use myList in your consequence.
<br><br>There is no way to use an asserted object in a consequence without binding it to a variable in one of the conditions.<br><br>cheers<br>Steve<br><br><br><div><span class="gmail_quote">On 1/8/07, <b class="gmail_sendername">
Joel G. Rivera-González</b> <<a rel="nofollow" href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">el_pio@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">ok..after playing a while with this global thing...i found out that global variables cant be asserted...<br><br>any other idea of how to use an asserted arrayList on the consequence without writing it on the conditions?
<span><br><div> </div>Joel G. Rivera-Gonzalez<br>PRT<br><br>"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law</span><div><span>
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Joel G. Rivera-González <
<a rel="nofollow" href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">el_pio@yahoo.com</a>><br>To: drools <<a rel="nofollow" href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org</a>><br>Sent: Sunday, January 7, 2007 10:48:50 AM<br>Subject: Re: Fw: [rules-users] rules questions...<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
thanks for your input...this is exactly what i was looking for !<br><br>:)<br><div> </div>Joel G. Rivera-Gonzalez<br>PRT<br><br>"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Steven Williams <
<a rel="nofollow" href="mailto:stevenw@objectconsulting.com.au" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">stevenw@objectconsulting.com.au</a>><br>To: Joel G. Rivera-González <<a rel="nofollow" href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
el_pio@yahoo.com</a>><br>Cc: <a rel="nofollow" href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org</a><br>Sent: Sunday, January 7, 2007 3:53:34 AM
<br>Subject: Re: Fw: [rules-users] rules questions...<br><br>Hi Joel,<br><br>I think you should rather use a global for the ArrayList:<br><br>global java.util.List myList<br><br>rule
"cancel_menu"<br> when<br> MegaTransferObject(other_EffectiveOrderTypeDsl != null, other_EffectiveOrderTypeDsl ==
Constants.NEW_OPEN_ORDER_TYPE)<br> not MegaTransferObject(orders_FkOrderStatusId != null, orders_FkOrderStatusId == Constants.PENDING_TO_BE_SUBMITTED_ORDER_STATUS) <br> then<br> myList.add(new String[]{
Constants.SERVICE_ASSURANCE_TREE_MENU_DSL
, Constants.SERVICE_ASSURANCE_MENU_CANCEL}); <br>end<br><br>btw - you don't need to put "and" at the end of each constraint.<br><br>cheers<br>Steve<br><br><div><span class="gmail_quote">On 1/7/07, <b class="gmail_sendername">
Joel G. Rivera-González</b> <<a rel="nofollow" href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">el_pio@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
this is a one of my rules...<br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><span style="font-weight: bold;">rule "cancel_menu"</span><br style="font-weight: bold;"><span style="font-weight: bold;">
when</span><br style="font-weight: bold;"><span style="font-weight: bold;"> arrayList : ArrayList()</span><br style="font-weight: bold;"><span style="font-weight: bold;"> MegaTransferObject(other_EffectiveOrderTypeDsl != null, other_EffectiveOrderTypeDsl ==
Constants.NEW_OPEN_ORDER_TYPE) and</span><br style="font-weight: bold;"><span style="font-weight: bold;"> not MegaTransferObject(orders_FkOrderStatusId != null, orders_FkOrderStatusId == Constants.PENDING_TO_BE_SUBMITTED_ORDER_STATUS
)</span><br style="font-weight: bold;"><span style="font-weight: bold;"> then</span><br style="font-weight: bold;"><span style="font-weight: bold;"> arrayList.add(new String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL
, Constants.SERVICE_ASSURANCE_MENU_CANCEL});</span><br style="font-weight: bold;"><span style="font-weight: bold;">end<br><br></span>i do an assert of an empty <span style="font-weight: bold;">arrayList</span>...<br>when i use this
<span style="font-weight: bold;"> arrayList : ArrayList()</span> on the <span style="font-weight: bold;">when</span> the rule fire an error...why?<br>will the ArrayList be the same on all the rules (i think it will but want to make sure)
<span><br><div> </div>Joel G.
Rivera-Gonzalez<br>PRT<br><br>"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law</span><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Kumaran S <<a rel="nofollow" href="mailto:kumaran.shanmuhan@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
kumaran.shanmuhan@gmail.com</a>><br>To: Joel G. Rivera-González <<a rel="nofollow" href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">el_pio@yahoo.com</a>><br>Sent: Friday, January 5, 2007 5:42:01 PM
<br>Subject: Re: [rules-users] rules questions...<br><br><span style="font-style: italic;">getResourceAsStream(ruleDrl) </span>expects to find a drl file based on the location represented by "<span style="font-style: italic;">
ruleDrl"<span style="font-style: italic;">.
</span> </span>It should be noted that the location should be accessible from the CLASSPATH. You could get a null pointer exception, if the location is not accessible from your CLASSPATH.<br><br><div><div><span>
<span class="gmail_quote">
On 1/5/07, <b class="gmail_sendername">Joel G. Rivera-González</b> <<a rel="nofollow" href="mailto:el_pio@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">el_pio@yahoo.com</a>> wrote:
</span></span></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span>
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Trying to figure out the new rule system...<br>but it doesnt work...<span style="font-weight: bold;"><br><br>This is my rule:</span><br>
<br>package com.prtc.struts.rules<br> <br>import com.prtc.db.MegaTransferObject<br>import java.util.ArrayList<br>import com.prtc.struts.Constants<br> <br><span style="font-style: italic;">rule "cancel_menu"</span>
<br style="font-style: italic;"><span style="font-style: italic;"> when</span><br style="font-style: italic;"><span style="font-style: italic;"> megaTO : MegaexistMegaTransferObject()</span><br style="font-style: italic;">
<span style="font-style: italic;"> megaTO(other_EffectiveOrderTypeDsl != null) and </span><br style="font-style: italic;"><span style="font-style: italic;"> megaTO(other_EffectiveOrderTypeDsl == Constants.NEW_OPEN_ORDER_TYPE
) and</span><br style="font-style: italic;"><span style="font-style: italic;"> megaTO(orders_FkOrderStatusId != null) and </span><br style="font-style: italic;"><span style="font-style: italic;"> megaTO(orders_FkOrderStatusId ==
Constants.PENDING_TO_BE_SUBMITTED_ORDER_STATUS)</span><br style="font-style: italic;"><span style="font-style: italic;"> </span><br style="font-style: italic;"><span style="font-style: italic;"> then</span><br style="font-style: italic;">
<span style="font-style: italic;"> System.out.println("Hello");</span><br style="font-style: italic;"><span style="font-style: italic;">end</span><br><br><span style="font-weight: bold;">part of my
code:<br></span><span style="font-style: italic;"> InputStreamReader ir = new InputStreamReader(RuleBuilderMgr.class.getClassLoader().getResourceAsStream(ruleDrl)); //the null pointer is from this line. </span>
<br style="font-style: italic;"><span style="font-style: italic;"> builder.addPackageFromDrl(ir);</span><span style="font-weight: bold;"><br></span><br><span style="font-weight: bold;">this is the result:</span><br>
<span style="font-style: italic;">7661 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compiling com.prtc.struts.rules.Rule_cancel_menu_0</span><br style="font-style: italic;"><span style="font-style: italic;">
7942 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compile com.prtc.struts.rules.Rule_cancel_menu_0</span><br style="font-style: italic;"><span style="font-style: italic;">8062 [main] DEBUG
org.apache.commons.jci.compilers.JaninoJavaCompiler - compiled com.prtc.struts.rules.Rule_cancel_menu_0</span><br style="font-style: italic;"><span style="font-style: italic;">8062 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler
- compiling com.prtc.struts.rules.Rule_cancel_menu_0ConsequenceInvoker</span><br style="font-style: italic;"><span style="font-style: italic;">8072 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compile
com.prtc.struts.rules.Rule_cancel_menu_0ConsequenceInvoker</span><br style="font-style: italic;"><span style="font-style: italic;">8092 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compiled com.prtc.struts.rules.Rule_cancel_menu_0ConsequenceInvoker
</span><br style="font-style: italic;"><br style="font-style: italic;"><span style="font-style: italic;">8102 [main] FATAL com.prtc.struts.util.ConstructServiceAssuranceTreeMenu - Exception in
ShowIspServiceAssuranceAction.execute --> java.lang.NullPointerException</span><br style="font-style: italic;"><span style="font-style: italic;">8102 [main] FATAL com.prtc.struts.util.ConstructServiceAssuranceTreeMenu
- java.lang.NullPointerException</span><br style="font-style: italic;"><span style="font-style: italic;"> at com.prtc.struts.util.ConstructServiceAssuranceTreeMenu.construct(ConstructServiceAssuranceTreeMenu.java:74)
</span><br style="font-style: italic;"><span style="font-style: italic;"> at com.prtc.lc.rules.managers.RuleTester.test1(RuleTester.java:299)</span><br style="font-style: italic;"><span style="font-style: italic;"> at
com.prtc.lc.rules.managers.RuleTester.main(RuleTester.java:54)</span><br><br><br><br><br><br><br><div> </div>Joel G. Rivera-Gonzalez<br>PRT<br><br>"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's
Law</div></div></span></div>
<br>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org
</a><br><a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Give me a lever long enough... Single-handed, I shall move the world!
</div><br></div></div></div><br></div></div></div>
<br>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org
</a><br><a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
<br><a rel="nofollow" href="mailto:stevenw@objectconsulting.com.au" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">stevenw@objectconsulting.com.au</a><br><a rel="nofollow" href="http://www.objectconsulting.com.au" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
www.objectconsulting.com.au</a><br><br>consulting | development | training | support
<br>our experience makes the difference
</div><br></div></div><div>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org</a><br><a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></div></div><br></div></span></div></div></div>
<br>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org
</a><br><a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
<br><a rel="nofollow" href="mailto:stevenw@objectconsulting.com.au" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">stevenw@objectconsulting.com.au</a><br><a rel="nofollow" href="http://www.objectconsulting.com.au" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
www.objectconsulting.com.au</a><br><br>consulting | development | training | support
<br>our experience makes the difference
</span></div></div><br></div></div></div>
<br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
<br><a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au</a><br><a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au</a><br><br>consulting | development | training | support
<br>our experience makes the difference