Hi All,
I am new to Drools. I am working on a project where nature of rules are
dynamic. I want to capture that rule which does not get executed. i need to
store that rule because i have to display that rule in the UI.
Here is my rule file
rule "FrontAxle:Capacity|FrontSuspension:Capacity"
when
b:Feature(featureClass.name=="FrontSuspension")
c:Feature(featureClass.name=="FrontAxle")
//eval(b.getCapacity() >= c.getCapacity())
then
System.out.println("These are compatible");
System.out.println(b.getFeatureClass().getName());
availablity.put(b.getFeatureClass().getName()+"-"+c.getFeatureClass().getName(),"12.35");
//availablity.put(b.getName()+"-"+c.getName(),new Double(b.getCapacity()));
insert(availablity);
end
rule "FrontSuspension:Type|FrontAxle:Type"
when
b:Feature(featureClass.name=="FrontSuspension")
c:Feature(featureClass.name=="FrontAxle")
not Feature(b.attributes.Type=="I Beam" &&
c.attributes.Type=="Multi Link
Air")
//NOT (FrontAxle.type = "I-Beam" AND FrontSuspension.type = "Multi-link
Air") - mounting restriction
then
System.out.println("I am in 2");
end
rule "FrontAxle:FeatureCode|FrontSuspension:Type"
when
b:Feature(featureClass.name=="FrontSuspension")
Feature(featureClass.name=="FrontAxle" && code=="002ASW")and
not
Feature(b.attributes.Type=="Multi Link Air" ||
b.attributes.Type=="Monoleaf
Spring")
//FrontAxle.featureCode = "002ASW" AND NOT (FrontSuspension.type =
"Multi-link Air" OR FrontSuspension.type = "Monoleaf Spring")
then
System.out.println("I am in 3");
end
now if these two objects named FrontAxle and FrontSuspension are compatible
then it has to meet all the 3 rules, but if any combination of these objects
does not meet one of the rule listed above then i have to store the rule for
the displaying purpose that this combination didn't meet this rule thats why
they are not compatible. any kind of help will be appreciated.
Thanks.
Show replies by date