Hi Joel,
I think you should rather use a global for the ArrayList:
global java.util.List myList
rule "cancel_menu"
when
MegaTransferObject(other_EffectiveOrderTypeDsl != null, other_EffectiveOrderTypeDsl ==
Constants.NEW_OPEN_ORDER_TYPE)
not MegaTransferObject(orders_FkOrderStatusId != null, orders_FkOrderStatusId == Constants.PENDING_TO_BE_SUBMITTED_ORDER_STATUS)
then
myList.add(new String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL
, Constants.SERVICE_ASSURANCE_MENU_CANCEL});
end
btw - you don't need to put "and" at the end of each constraint.
cheers
Steve
this is a one of my rules...rule "cancel_menu"
when
arrayList : ArrayList()
MegaTransferObject(other_EffectiveOrderTypeDsl != null, other_EffectiveOrderTypeDsl == Constants.NEW_OPEN_ORDER_TYPE) and
not MegaTransferObject(orders_FkOrderStatusId != null, orders_FkOrderStatusId == Constants.PENDING_TO_BE_SUBMITTED_ORDER_STATUS )
then
arrayList.add(new String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL , Constants.SERVICE_ASSURANCE_MENU_CANCEL});
end
i do an assert of an empty arrayList...
when i use this arrayList : ArrayList() on the when the rule fire an error...why?
will the ArrayList be the same on all the rules (i think it will but want to make sure)Joel G. Rivera-Gonzalez
PRT
"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law----- Original Message ----
From: Kumaran S < kumaran.shanmuhan@gmail.com>
To: Joel G. Rivera-González <el_pio@yahoo.com>
Sent: Friday, January 5, 2007 5:42:01 PM
Subject: Re: [rules-users] rules questions...
getResourceAsStream(ruleDrl) expects to find a drl file based on the location represented by " ruleDrl". 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.On 1/5/07, Joel G. Rivera-González <el_pio@yahoo.com> wrote:Trying to figure out the new rule system...
but it doesnt work...
This is my rule:
package com.prtc.struts.rules
import com.prtc.db.MegaTransferObject
import java.util.ArrayList
import com.prtc.struts.Constants
rule "cancel_menu"
when
megaTO : MegaexistMegaTransferObject()
megaTO(other_EffectiveOrderTypeDsl != null) and
megaTO(other_EffectiveOrderTypeDsl == Constants.NEW_OPEN_ORDER_TYPE ) and
megaTO(orders_FkOrderStatusId != null) and
megaTO(orders_FkOrderStatusId == Constants.PENDING_TO_BE_SUBMITTED_ORDER_STATUS)
then
System.out.println("Hello");
end
part of my code:
InputStreamReader ir = new InputStreamReader(RuleBuilderMgr.class.getClassLoader().getResourceAsStream(ruleDrl)); //the null pointer is from this line.
builder.addPackageFromDrl(ir);
this is the result:
7661 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compiling com.prtc.struts.rules.Rule_cancel_menu_0
7942 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compile com.prtc.struts.rules.Rule_cancel_menu_0
8062 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compiled com.prtc.struts.rules.Rule_cancel_menu_0
8062 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compiling com.prtc.struts.rules.Rule_cancel_menu_0ConsequenceInvoker
8072 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compile com.prtc.struts.rules.Rule_cancel_menu_0ConsequenceInvoker
8092 [main] DEBUG org.apache.commons.jci.compilers.JaninoJavaCompiler - compiled com.prtc.struts.rules.Rule_cancel_menu_0ConsequenceInvoker
8102 [main] FATAL com.prtc.struts.util.ConstructServiceAssuranceTreeMenu - Exception in ShowIspServiceAssuranceAction.execute --> java.lang.NullPointerException
8102 [main] FATAL com.prtc.struts.util.ConstructServiceAssuranceTreeMenu - java.lang.NullPointerException
at com.prtc.struts.util.ConstructServiceAssuranceTreeMenu.construct(ConstructServiceAssuranceTreeMenu.java:74)
at com.prtc.lc.rules.managers.RuleTester.test1(RuleTester.java:299)
at com.prtc.lc.rules.managers.RuleTester.main(RuleTester.java:54)Joel G. Rivera-Gonzalez
PRT
"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Give me a lever long enough... Single-handed, I shall move the world!
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users