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
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are not
to copy, disclose, or distribute this e-mail or its contents to any other person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
every reasonable precaution to minimize this risk, but is not liable for any damage
you may sustain as a result of any virus in this e-mail. You should carry out your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***