[rules-users] How can i create a new object in consequence part
Navdeep Kumar
nkumar at objectwave.com
Mon Oct 18 17:58:42 EDT 2010
Hi..
After execution of each rule, i want to create a new object of a particular
class and want to add that to the list. i know how to set the global list
but i am not sure whether i can create a new instance in the consequence of
the rule.
here is the rule file and description that what i am trying to do.
import java.util.Map;
global java.util.HashMap availablity;
global java.util.HashMap frontAxleAttributes;
global java.util.HashMap frontSuspensionAttributes;
global java.util.ArrayList resultState;
rule "FrontAxle:Capacity|FrontSuspension:Capacity"
dialect "mvel"
when
b:Feature(featureClass.name=="FrontSuspension")
c:Feature(featureClass.name=="FrontAxle")
eval(b.attributes.Capacity>=c.attributes.Capacity)
then
System.out.println(b.attributes.Capacity);
frontAxleAttributes.put("Capacity" ,new Double(c.attributes.Capacity));
frontSuspensionAttributes.put("Capacity", new
Double(b.attributes.Capacity));
frontAxleAttributes.put("Feature Code",b.getCode());
frontSuspensionAttributes.put("Feature Code",c.getCode());
availablity.put(b.featureClass.getName+"-"+c.getFeatureClass().getName(),new
Double(b.attributes.Capacity));
* **// i want to create a new Object of a class named AvailabilityRuleState
and want to add that in the list named resultState. *
* *
end
*//resultState is a list of AvailabilityRuleState Class. Please do check the
global declaration if that is wrong.*
will appreciate your help.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101018/81d0db6e/attachment.html
More information about the rules-users
mailing list