Friday, May 11, 2007

rules implementation

9 May 2007
While calling the unmarshall method in jaxb it takes FileInputStream, File, etc.
If we give anything other than File then internally a field called system identifier remains null. And when this is null it throws a warning saying [WARNING]: URI was not reported to parser for entity [document]. To avoid this warning use File while unmarshlling.
9 May 2007
The Drool or JBOSS rules is a rule engine. We have used it in our application to get the dispositions that are performed on the task. I pass the task details to the rule engine, and the rule file to be executed, the rule engine in response returns the exact disposition by executing the rule that is specified in the rule file.
e.g.


package com.application.swa.rules;
import com.application.swa.bean.InboxDetailsBean;
rule "AutoLoan_Submit_SM"
no-loop true
when
m : InboxDetailsBean(taskStepId == 1)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Submit_SM");
end
#step 1 end
rule "AutoLoan_Prequal_False"
no-loop true
when
m : InboxDetailsBean(taskStepId == 2)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Prequal_False");
end
rule "AutoLoan_Prequal_True_RuleMet_True"
no-loop true
when
m : InboxDetailsBean(taskStepId == 2)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Prequal_True_RuleMet_True");
end
rule "AutoLoan_Prequal_True_RuleMet_False"
no-loop true
when
m : InboxDetailsBean(taskStepId == 2)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Prequal_True_RuleMet_False");
end
#step 2 end
rule "AutoLoan_Approval_False_LO"
no-loop true
when
m : InboxDetailsBean(taskStepId == 3)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_False_LO");
end
rule "AutoLoan_Approval_True_LO"
no-loop true
when
m : InboxDetailsBean(taskStepId == 3)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_True_LO");
end
#step 3 end
rule "AutoLoan_Approval_False_App"
no-loop true
when
m : InboxDetailsBean(taskStepId == 4)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_False_App");
end
rule "AutoLoan_Approval_True_App"
no-loop true
when
m : InboxDetailsBean(taskStepId == 4)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_True_App");
end
#step 4 end
rule "AutoLoan_End_LO"
no-loop true
when
m : InboxDetailsBean(taskStepId == 5)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_End_LO");
end
#step 5 end
rule "AutoLoan_End_App"
no-loop true
when
m : InboxDetailsBean(taskStepId == 6)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_End_App");
end
#step 6 end
rule "AutoLoan_End_SM"
no-loop true
when
m : InboxDetailsBean(taskStepId == 7)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_End_SM");
end
#step 7 end


The jboss rule uses rete algorithm to execute rules.

I am writing the rule file GUI editor.

Another implementation of rules can be in the Skill based allocation.