[rules-users] Rule refiring issue !

abhinay_agarwal abhinay_agarwal at infosys.com
Thu Jul 12 07:31:30 EDT 2012


this is the exact code :

rule "Not Threshold Rule"
salience -3
agenda-group "default"
no-loop
//lock-on-active true
dialect "mvel"
    when
    	$a : AccountStatusVO() 
             $h : HashMap(!(this["Aggregate_Balance"]<=50000))
    then
             drools.setFocus("customer");
     	drools.getWorkingMemory().clearAgendaGroup("default");
end

rule "Primary Customer"
salience 1
agenda-group "customer"
no-loop
dialect "mvel" 
	when
		$i : Individual()
		$h : HashMap()
		
	then
		insert($i.primaryCustomerMapping($h))
		drools.setFocus("USIndicia")
                         
drools.getWorkingMemory().clearAgendaGroup("customer");

end


rule "Secondary Customer"
salience 0
agenda-group "customer"
no-loop
dialect "mvel" 
	when
		$i : Individual()
		$h : HashMap()
	then
		insert($i.secondaryCustomerMapping(map))
		drools.setFocus("USIndicia")
                        
drools.getWorkingMemory().clearAgendaGroup("customer");

end

rule "Tertiary Customer"
salience -1
agenda-group "customer"
no-loop
dialect "mvel" 
	when
		$i : Individual()
		$h : HashMap()
	then
		insert($i.tertiaryCustomerMapping($h))
		drools.setFocus("USIndicia")
		drools.getWorkingMemory().clearAgendaGroup("customer");
end

rule "US Indicia Rule"
salience 1
agenda-group "USIndicia"
no-loop
dialect "mvel"
    when
    	$c : CustomerStatusVO()
             $h : HashMap(this["Primary_Citizenship"] == "USA")
    then
    	$c.setCustIndicia("US Individual")
             drools.setFocus("USIndiciaDocumentsRequired");
  	drools.getWorkingMemory().clearAgendaGroup("USIndicia");
        		        
end


rule "US Indicia Documents Required"
salience 1
agenda-group "USIndiciaDocumentsRequired"
no-loop
 
	when
		$i : Individual()
		$c : CustomerStatusVO()
		$h : HashMap(this["Primary_Citizenship"] == "USA")
	then
		modify( $c )
		{
			setDocumentsRequired("W-9 Form, Waiver Document");
		};
		retract($h)
end




>From here you can see that the map in "Not threshold rule" contains the
details about primary, secondary and tertiary customers...

i gotta divide the customers and then fire rule "US indicia" and hence "US
Indicia Documents Required" on them..

once Primary customer work is done..i need to go back and apply both the
rules for "secondary"

and again for tertiary...

if i use : 

rule "Primary Customer"
salience 1
agenda-group "customer"
no-loop
dialect "mvel" 
	when
		$i : Individual()
		$h : HashMap()
		
	then
		insert($i.primaryCustomerMapping($h))
		drools.setFocus("USIndicia")
                         * retract($h)*
                        
drools.getWorkingMemory().clearAgendaGroup("customer");

end


but i need the main map for secondary and tertiary...

can sme1 find a work around...

i need to do evrything in drool rules only...cant use the java class to
insert or retract nething !!


Thanks,
Abhinay

--
View this message in context: http://drools.46999.n3.nabble.com/Rule-refiring-issue-tp4018618p4018635.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list