I have the below two requirement for Drools implementation.
1. To use a java method(with single argument) of my application class in the
'LHS' of the rule .
2. To pass the object set in 'RHS' of the rule back to my application.
Is it possible to implement point 1 and point 2 as below ?
Example :
Application class is defined as :
//Class for getting various types from my application
package application.custom;
public class Project
{
public string getStringValue(String name) {
<Logic of the application>
return ;
}
}
//Class 2 for setting the rule result
package application.customresults;
public class ProjectResults
{
public void setResult(String name) {
<Logic of the application>
}}
===========================================================================
Drl file like :
package application.rules
#I shall set the object 'projRes' in my appl using setGlobal
global application.customresults.ProjectResults projRes ;
import application.custom.Project;
rule "project-1.option1"
when
$proj : application.custom.Project();
eval ($proj.getStringValue("Drools") .equals ("ABC")) # Logic specific
to my
application
then
#Requirement is to set and make use of the object 'projRes' in my
application
modify (projRes) {projRes.setResult("Drools project"); }
end
rule "project-1.option2"
when
$proj : application.custom.Project();
$projRes : application.customresults.ProjectResults();
eval ($proj.getStringValue("Java") .equals ("DEF")) # Logic specific
to my
application
then
#Requirement is to set and make use of the object 'projRes' in my
application
modify (projRes) {projRes.setResult("Java project");
}
end
Please let me know if the above way of writing the drl would suffice both
the requirements (or) is there a better way to implement it.
Thanks
Dibya
--
View this message in context:
http://drools.46999.n3.nabble.com/Drools-Queries-with-relation-to-the-LHS...
Sent from the Drools: User forum mailing list archive at
Nabble.com.