<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=269365508-03102007><FONT face=Arial 
color=#0000ff size=2>Taken from the documentation:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=269365508-03102007>
<DIV class=titlepage>
<DIV>
<DIV>
<H4 class=title><A name=d0e805></A>1.6.5.2.&nbsp;Agenda 
Groups</H4></DIV></DIV></DIV>
<P>Agenda groups are a way to partition rules (activations, actually) on the 
agenda. At any one time, only one group has "focus" which means that the 
activations for rules in that group will only take effect - you can also have 
rules "auto focus" which means the focus for its agenda group is taken when that 
rules conditions are true.</P>
<P>They are sometimes known as "modules" in CLIPS terminology. Agenda groups are 
a handy way to create a "flow" between grouped rules. You can switch the group 
which has focus either from within the rule engine, or from the API. If you 
rules have a clear need for multiple "phases" or "sequences" of processing, 
consider using agenda-groups for this purpose.</P>
<P>Each time setFocus(...) is called it pushes that Agenda Group onto a stack, 
when the focus group is empty it is popped off and the next one of the stack 
evaluates. An Agenda Group can appear in multiple locations on the stack. The 
default Agenda Group is "MAIN", all rules which do not specify an Agenda Group 
are placed there, it is also always the first group on the Stack and given focus 
as default.</P></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>I<SPAN class=269365508-03102007> 
would therefore assume that after all activations in the "Check" Agenda Group 
executed, the MAIN Agenda Group received focus and remaining activations 
processed.</SPAN><BR></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
  [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of 
  </B>prateek.katiyar@wipro.com<BR><B>Sent:</B> 03 October 2007 
  09:42<BR><B>To:</B> rules-users@lists.jboss.org<BR><B>Subject:</B> 
  [rules-users] Help me<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV id=idOWAReplyText40129 dir=ltr>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>
  <DIV id=idOWAReplyText34721 dir=ltr>
  <DIV dir=ltr><FONT face=Arial size=2>Hi </FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>I hava a rule file as:</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT size=2>
  <P align=left><STRONG>&lt;?xml version="1.0" 
encoding="UTF-8"?&gt;</STRONG></P>
  <P align=left><STRONG>&lt;package name="rules"</STRONG></P>
  <P align=left><STRONG>xmlns="http://drools.org/drools-4.0"</STRONG></P>
  <P 
  align=left><STRONG>xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"</STRONG></P>
  <P align=left><STRONG>xs:schemaLocation="http://drools.org/drools-4.0 
  drools-4.0.xsd"&gt;</STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG>&lt;import 
  name="com.wipro.rfq.report.bean.Validator.RFQBean" /&gt;</STRONG></P>
  <P align=left><STRONG>&lt;global identifier="rfq" 
  type="com.wipro.rfq.report.bean.Validator.RFQBean" /&gt;</STRONG></P>
  <P align=left><STRONG>&lt;import 
  name="com.wipro.loan.validation.bean.Final.LoanApplicationBean" 
  /&gt;</STRONG></P>
  <P align=left><STRONG>&lt;global identifier="loanApplication" 
  type="com.wipro.loan.validation.bean.Final.LoanApplicationBean" 
  /&gt;</STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG>&lt;rule name="Check_NotNullof_rfqId"&gt; </STRONG></P>
  <P align=left><STRONG>&lt;rule-attribute name="agenda-group" 
  value="Check"/&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rule-attribute name="auto-focus" 
  value="true"/&gt;</STRONG></P>
  <P align=left><STRONG>&lt;lhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;eval&gt;(rfq.getM_rfqId() ==null) || 
  (rfq.getM_rfqId().trim().equals(""))&lt;/eval&gt;</STRONG></P>
  <P align=left><STRONG>&lt;/lhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rhs&gt;</STRONG></P>
  <P align=left><STRONG>System.out.println("The value of m_rfqId is 
  null.");</STRONG></P>
  <P align=left><STRONG>&lt;/rhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;/rule&gt; </STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG>&lt;rule name="Check_NotNullof_partId"&gt; </STRONG></P>
  <P align=left><STRONG>&lt;rule-attribute name="agenda-group" 
  value="Check"/&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rule-attribute name="auto-focus" 
  value="true"/&gt;</STRONG></P>
  <P align=left><STRONG>&lt;lhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;eval&gt;(rfq.getM_partId() =="null") || 
  (rfq.getM_partId().trim().equals(""))&lt;/eval&gt;</STRONG></P>
  <P align=left><STRONG>&lt;/lhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rhs&gt;</STRONG></P>
  <P align=left><STRONG>System.out.println("The value of m_partId is 
  null.");</STRONG></P>
  <P align=left><STRONG>&lt;/rhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;/rule&gt; </STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG>&lt;rule name="validate_FullName"&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rule-attribute name="agenda-group" 
  value="validate-bean"/&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rule-attribute name="auto-focus" 
  value="true"/&gt;</STRONG></P>
  <P align=left><STRONG>&lt;lhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;eval&gt;true&lt;/eval&gt;</STRONG></P>
  <P align=left><STRONG>&lt;/lhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;rhs&gt;</STRONG></P>
  <P align=left><STRONG>System.out.println("full name is null from 
  xml");</STRONG></P>
  <P align=left><STRONG>&lt;/rhs&gt;</STRONG></P>
  <P align=left><STRONG>&lt;/rule&gt;</STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P align=left><STRONG></STRONG></P>
  <P><STRONG>&lt;/package&gt;</STRONG></P>
  <P>As for the first two rules i declared the agenda group as "Check".</P>
  <P>Now i want to know that how&nbsp;will i write the code in my java program 
  to&nbsp;activate this agenda group instead of "MAIN".</P>
  <P>I have already tried with the following option:</P><FONT size=2>
  <P><STRONG>Agenda agenda=workingMemory.getAgenda();</STRONG></P><FONT size=2>
  <P><STRONG>AgendaGroup 
  Check=agenda.getAgendaGroup(</STRONG></FONT><STRONG><FONT color=#2a00ff 
  size=2>"Check"</FONT><FONT size=2>);</FONT></STRONG></P><FONT size=2><FONT 
  size=2>
  <P><STRONG>workingMemory.setFocus(Check);</STRONG></P><FONT size=2>
  <P><STRONG>workingMemory.fireAllRules();</STRONG></P>
  <P>But after this when i wrote <STRONG><FONT size=2>System.</FONT><I><FONT 
  color=#0000c0 size=2>out</I></STRONG></FONT><STRONG><FONT 
  size=2>.println(</FONT><FONT color=#2a00ff size=2>"The focussed agenda group 
  is "</FONT><FONT size=2>+workingMemory.getFocus());</FONT></STRONG></P>
  <P><FONT size=2>Then the output was <FONT size=2><STRONG>The focussed agenda 
  group is AgendaGroup 'MAIN'</STRONG></FONT></FONT></P>
  <P><FONT size=2><FONT size=2>So now could you please help 
  me.</P></FONT></FONT></FONT></FONT></FONT></FONT></FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV></DIV>
  <DIV id=idSignature69254 dir=ltr>
  <DIV><FONT face=Arial><EM><STRONG>With Regards</STRONG></EM></FONT></DIV>
  <DIV><FONT face=Arial><EM><STRONG>Prateek </STRONG></EM></FONT></DIV>
  <DIV><FONT 
  face=Arial><EM><STRONG></STRONG></EM></FONT>&nbsp;</DIV></DIV></FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV></DIV>
  <DIV id=idSignature28775 dir=ltr>&nbsp;</DIV>
  <TABLE>
    <TBODY>
    <TR>
      <TD bgColor=#ffffff><FONT color=#000000><BR>The information contained in 
        this electronic message and any attachments to this message are intended 
        for the exclusive use of the addressee(s) and may contain proprietary, 
        confidential or privileged information. If you are not the intended 
        recipient, you should not disseminate, distribute or copy this e-mail. 
        Please notify the sender immediately and destroy all copies of this 
        message and any attachments. <BR><BR>WARNING: Computer viruses can be 
        transmitted via email. The recipient should check this email and any 
        attachments for the presence of viruses. The company accepts no 
        liability for any damage caused by any virus transmitted by this 
        email.<BR><BR>www.wipro.com<BR></FONT></TD></TR></TBODY></TABLE></BLOCKQUOTE></BODY></HTML>