how to find the rule name
by Marina
Hello,
I need to know the rule name of the rule that fired in the consequence part of the rule. I tried something like the following, just trying to see if I can get it this way:
package mode.simple;
import java.lang.String;
import java.util.List;
import com.emptoris.ecm.domain.ContractRulesData;
global java.util.Set approverList;
rule "testOR_1"
dialect "java"
when
$data : ContractRulesData (sum > 500 || name matches ".*important")
then
approverList.add("approver3, approver4, Level5");
ruleName = drools.getRule().getName();
System.out.println(ruleName + " is TRUE");
end
When I'm trying to compile the rule, I'm getting the following error:
Builder errors:
Rule Compilation error : [Rule name=testOR_1, agendaGroup=MAIN, salience=0, no-loop=false]
mode/simple/Rule_testOR_1_0.java (8:391) : ruleName cannot be resolved
mode/simple/Rule_testOR_1_0.java (9:452) : ruleName cannot be resolved
java.lang.RuntimeException: Unable to compile rules file: testOR_1.drl
I must be doing something wrong here... ?
thanks!
Marina
16 years, 5 months
drools-eclipse sources?
by Markus Helbig
Hi everybody,
where can i get the sources for drools-eclipse? I remember they were
in svn but currently i can't find them there.
Cheers
Markus
16 years, 5 months
New rules in source file not loaded when application redeployed
by Keith Bennett
I am packaging my rules as a drl source file in a jar that is then
bundled in a war file that is then deployed to Tomcat. In my
implementation, the rulebase is cached the first time it is used in my
application, but when I add new rules to the source file and rebuild
my application then redeploy it on Tomcat, the new version of the
rules don't get loaded into the rulebase.
Why and how is an older version of the rules being loaded into the
rulebase when I redeploy my application in Tomcat? As FYI, I have
developed a business rules service that initializes the rulebase upon
a Spring container startup by loading the drl file from the classpath.
Is there an internal Drools static cache that is scoped to something
other than my application? The only thing I can do to load the new
rules is restart Tomcat. When I do this, the new version of the drl
source file is loaded and used, so I'm thinking the problem I'm having
is somehow related to the class loaders Tomcat uses, but I can't find
information about what Drools might be doing internally with a static
cache or something like that.
Can anyone explain what might be happening and how to configure Drools
and/or my application to get around this problem I'm having? I
definitely appreciate any help you can provide!
Keith
16 years, 5 months
Beginner question about Dynamic Beans
by fmarchioni
Hi all drools users!
I'm just learning Drools from the manual, I have a question about Dynamic
Beans. I have added PropertyChangeSupport and listeners to my Beans: I can
see that inside my rule, if I change
one property the bean.....
rule "Check Age"
salience 20
when
b : Buyer (age <18)
then
bankApp.addMessage(Messages.AGE_UNDER_18);
b.setCash(40000); // CHANGE OF PROPERTY
end
..then all rules are fired back again. Is it the correct behaviour ? is
there a way to re-evaluate only some of the Rules back again ?
thanks a lot
Francesco
--
View this message in context: http://www.nabble.com/Beginner-question-about-Dynamic-Beans-tp18232282p18...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 5 months
simple rule takes long time
by ygaurav
Hi All
I am new to drools and I am trying to see if we can use it. I have a simple
file
public class Data {
private int id =0;
public Data(int id) {
this.id = id;
}
public int getId() {
return id;
}
}
rule "Unique data"
when
data : Data()
old : Data(this != data, this.id == data.id)
then
log.log("Following data are not unique: " + data.getId() + " and " +
old.getId());
end
When I try to load 30,000 of data in memory it takes long time ( around 12
hours ) Can anybody suggests a better way of doing it.
Thanks
Gaurav
--
View this message in context: http://www.nabble.com/simple-rule-takes-long-time-tp18192098p18192098.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 5 months
Unexpected global error
by thomas kukofka
Hello,
I get this exception: Exception in thread "main" java.lang.RuntimeException:
Unexpected global [service]
That's the global declaration in the drl: global java.util.HashMap service
And ther I set teh global in teh Java-class:
HashMap<String, AIOObject> service = new HashMap<String, AIOObject>();
workingMemory.setGlobal("service", service);
Appreciate your help!
Kind Regards
Thomas
16 years, 6 months