setting an ArrayList on a global value like this
workingMemory.setGlobal("arrayList", menuArray); on the java code and like this
on the rule global ArrayList arrayList;
cause the following error:
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"
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: Steven Williams <stevenw(a)objectconsulting.com.au>
To: Joel G. Rivera-González <el_pio(a)yahoo.com>
Cc: drools <rules-users(a)lists.jboss.org>
Sent: Sunday, January 7, 2007 6:00:41 PM
Subject: Re: Fw: [rules-users] rules questions...
Hi Joel,
The whole point of globals is that you don't need to assert them you just set them
from the calling code, ie:
workingMemory.setGlobal("myList", arrayList);
You can then use myList in your consequence.
There is no way to use an asserted object in a consequence without binding it to a
variable in one of the conditions.
cheers
Steve
On 1/8/07,
Joel G. Rivera-González <el_pio(a)yahoo.com> wrote:
ok..after playing a while with this global thing...i found out that global variables cant
be asserted...
any other idea of how to use an asserted arrayList on the consequence without writing it
on the conditions?
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: Joel G. Rivera-González <
el_pio(a)yahoo.com>
To: drools <
rules-users(a)lists.jboss.org>
Sent: Sunday, January 7, 2007 10:48:50 AM
Subject: Re: Fw: [rules-users] rules questions...
thanks for your input...this is exactly what i was looking for !
:)
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: Steven Williams <
stevenw(a)objectconsulting.com.au>
To: Joel G. Rivera-González <
el_pio(a)yahoo.com>
Cc: rules-users(a)lists.jboss.org
Sent: Sunday, January 7, 2007 3:53:34 AM
Subject: Re: Fw: [rules-users] rules questions...
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
On 1/7/07,
Joel G. Rivera-González <el_pio(a)yahoo.com> wrote:
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(a)gmail.com>
To: Joel G. Rivera-González <el_pio(a)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(a)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(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference