<?xml version="1.0" encoding="UTF-8"?>
<package name="rules"
xmlns="http://drools.org/drools-4.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
<import name="com.wipro.rfq.report.bean.Validator.RFQBean" />
<global identifier="rfq" type="com.wipro.rfq.report.bean.Validator.RFQBean" />
<import name="com.wipro.loan.validation.bean.Final.LoanApplicationBean" />
<global identifier="loanApplication" type="com.wipro.loan.validation.bean.Final.LoanApplicationBean" />
<rule name="Check_NotNullof_rfqId">
<rule-attribute name="agenda-group" value="Check"/>
<rule-attribute name="auto-focus" value="true"/>
<lhs>
<eval>(rfq.getM_rfqId() ==null) || (rfq.getM_rfqId().trim().equals(""))</eval>
</lhs>
<rhs>
System.out.println("The value of m_rfqId is null.");
</rhs>
</rule>
<rule name="Check_NotNullof_partId">
<rule-attribute name="agenda-group" value="Check"/>
<rule-attribute name="auto-focus" value="true"/>
<lhs>
<eval>(rfq.getM_partId() =="null") || (rfq.getM_partId().trim().equals(""))</eval>
</lhs>
<rhs>
System.out.println("The value of m_partId is null.");
</rhs>
</rule>
<rule name="validate_FullName">
<rule-attribute name="agenda-group" value="validate-bean"/>
<rule-attribute name="auto-focus" value="true"/>
<lhs>
<eval>true</eval>
</lhs>
<rhs>
System.out.println("full name is null from xml");
</rhs>
</rule>
</package>
As for the first two rules i declared the agenda group as "Check".
Now i want to know that how will i write the code in my java program to activate this agenda group instead of "MAIN".
I have already tried with the following option:
Agenda agenda=workingMemory.getAgenda();
AgendaGroup Check=agenda.getAgendaGroup(
"Check");workingMemory.setFocus(Check);
workingMemory.fireAllRules();
But after this when i wrote System.out
.println("The focussed agenda group is "+workingMemory.getFocus());Then the output was The focussed agenda group is AgendaGroup 'MAIN'
So now could you please help me.