Hi All,
Is there a way to retrieve an object array from a Class getter in the when clause of a rule in a drl file ? I have tried a lot of things but they did not work out. The Problem is detailed below :-
The following class has a private parameter Column1 which is an Object type array.
public class EightColumnGenericClass {
private Object[] Column1;
/** Getters and Setters */
public Object[] getColumn1() {
return Column1;
}
public void setColumn1(Object[] column1) {
Column1 = column1;
}
}
Following is the method where I am creating the knowledgebase and utilizing it. I am reading a file record and splitting the columns. The columns[] array gets saved into the attribute of the class defined above.
public static void fnReadFromFile(String FilePath, String FileName){
/* Declarations and other code */
while ((str = brReadFromFile.readLine())!=null){
Columns = str.split(",");
ecgcPLC = new EightColumnGenericClass();
ecgcPLC.setColumn1(Columns);
ksession.insert(ecgcPLC);
}
ksession.fireAllRules();
}
I have to try and retrieve each cell of the Columns[] array in the entire collection and apply rules on individual cell. My drl file is given below.
rule "SourceSystemId = value"
when
c: EightColumnGenericClass()
Object[] columns: c.getColumn1();
for (Object o : columns)
{
System.out.println(o.toString());
# The condition I want here is - if (o.toString()==”1794”)
}
then
#RHS Code
end
Is there a way to achieve this? Or is there something missing with my DRL file? Please assist.
Thanks in Advance,
Amal