Guys:
Maybe I am not seeing the error in my ways. I have four rules. I am
chaining them together. Each rule acts upon the object in a different way. I
have set up the no-loop attribute so no rule is fired more than once. I have
also assigned a priority for each of the rules so they will execute in
sequence. I have four Conflict resolvers loaded (Salience, Recency, Simplicity,
Load). After I have performed a said operation within a rule, I call the
function drools.modifyObject(taskVO) for updating the fact. However, I am
not seeing the final results with all the information getting into the object
after all the four rules have fired:
Here are my rules:
<!-- priority and no recursive rule -->
<rule name="AssignTask" salience="-4" no-loop="true">
<!-- What is being passed into the rule -->
<parameter identifier="taskVO">
<class>TaskVO</class>
</parameter>
<!-- What conditions must be true before rule is asserted -->
<java:condition>taskVO.getIdentifiersList() != null ||
taskVO.isIdentifiersListEmpty() == false</java:condition>
<java:condition>taskVO.containsIdentifier("CONTRACT", "S#1234567890") ==
true</java:condition>
<!-- What does the rule does for us -->
<java:consequence>
taskVO.setDepartment("DPT1");
taskVO.setDptCode(lookupDeptCode("DPT1"));
taskVO.setWorkBasket("rray");
taskVO.setTaskType("ADFPAYCHK");
taskVO.setTskCode(lookupTaskTypeCode("ADFPAYCHK"));
taskVO.setActionStep("INDEX");
taskVO.setActCode(lookupActStepCode("INDEX"));
taskVO.setStatus("OPEN");
//printTaskVO(taskVO);
<!-- Firing any other rules based on changes -->
drools.modifyObject(taskVO);
</java:consequence>
</rule>
<!-- priority and no recursive rule -->
<rule name="AuditTask" salience="-3" no-loop="true">
<!-- What is being passed into the rule -->
<parameter identifier="taskVO">
<class>TaskVO</class>
</parameter>
<!-- What conditions must be true before rule is asserted -->
<java:condition>taskVO.getTaskType().equalsIgnoreCase("ADFPAYCHK") ==
true</java:condition>
<java:condition>taskVO.containsIdentifier("CONTRACT", "S#1234567890") ==
true</java:condition>
<java:condition>taskVO.getStatus().equalsIgnoreCase("OPEN") ==
true</java:condition>
<!-- What does the rule does for us -->
<java:consequence>
ident = new IdentifierVO();
ident.setTaskId("t1234567890");
ident.addField("COMPANY20060313-0000001");
ident.addFieldName("AUDIT NBR");
ident.addFieldSize(45);
ident.setIdDesc("AUDIT NBR");
taskVO.addIdentifier(ident);
taskVO.setActionStep("PROCESS");
//printTaskVO(taskVO);
<!-- Firing any other rules based on changes -->
drools.modifyObject(taskVO);
</java:consequence>
</rule>
<!-- priority and no recursive rule -->
<rule name="RouteTask" salience="-2" no-loop="true">
<!-- What is being passed into the rule -->
<parameter identifier="taskVO">
<class>TaskVO</class>
</parameter>
<!-- What conditions must be true before rule is asserted -->
<java:condition>taskVO.getTaskType().equalsIgnoreCase("ADFPAYCHK") ==
true</java:condition>
<java:condition>taskVO.containsIdentifier("AUDIT NBR",
"COMPANY20060313-0000001") == true</java:condition>
<java:condition>!taskVO.getStatus().equalsIgnoreCase("Review") == true
</java:condition>
<!-- What does the rule does for us -->
<java:consequence>
taskVO.setWorkBasket("mightymouse");
taskVO.setStatus("Review");
//printTaskVO(taskVO);
<!-- Firing any other rules based on changes -->
drools.modifyObject(taskVO);
</java:consequence>
</rule>
<!-- priority and no recursive rule -->
<rule name="SuspendTask" salience="-1" no-loop="true">
<!-- What is being passed into the rule -->
<parameter identifier="taskVO">
<class>TaskVO</class>
</parameter>
<!-- What conditions must be true before rule is asserted -->
<java:condition>taskVO.getTaskType().equals("ADFPAYCHK") ==
true</java:condition>
<java:condition>taskVO.getStatus().equalsIgnoreCase("Review") ==
true</java:condition>
<java:condition>taskVO.getCaseDesc().equalsIgnoreCase("missing
signature") == true</java:condition>
<!-- What does the rule does for us -->
<java:consequence>
taskVO.setStatus("Suspend");
taskVO.setSuspOper("MightyMouse");
taskVO.setCaseDesc("missing signature");
taskVO.setCaseId("C1234567890");
DroolsMail mail = new DroolsMail();
try{
mail.postMail(loadMailReceipients(),
"Drools Dispatch Mail",
"This is a Drools Test",
"[EMAIL PROTECTED]");
}catch (MessagingException me){
me.printStackTrace();
}
//printTaskVO(taskVO);
<!-- Firing any other rules based on changes -->
drools.modifyObject(taskVO);
</java:consequence>
</rule>
Any help/clarification would be GREATLY appreciated.
Russ