Read the manual. Look for "from" CE.

    []s
    Edson

2009/7/9 Ashok Deivasigamani <ashokdeiva@gmail.com>
I have a Message Object which has a Attribute Object which has a ArrayList of AttributeParams Objects. How can I iterate through the ArrayList to get to a perticular AttributeParans Object in the drl file.

The java representation of these Objects are as Follows

Class Message {
    private Attributes attributes;
}

Class Attributes {
    private ArrayList<AttributeParams> attributeParams;
}

Class AttributeParsms {
   private String name;
}
 
This is my drl file,
when
        m : Message( myAttributes : attributes)
then
        System.out.println(myAttributes);
        System.out.println(myAttributes.getAttributeParams());
        System.out.println( myMessage );

when I fire my rule, this is the output I am getting.

com.sample.Attributes@39c639c6
[com.sample.AttributeParams@39a639a6, com.sample.AttributeParams@39ac39ac]

From the result we can see that we have two Attribute objects in the ArrayList.
How can I iterate through the ArrayList to get a perticular AttributeParams object
This is my drl file,
when
        m : Message( myAttributes : attributes)
then
        System.out.println(myAttributes);
        System.out.println(myAttributes.getAttributeParams());
        System.out.println( myMessage );

when I fire my rule, this is the output I am getting.

com.sample.Attributes@39c639c6
[com.sample.AttributeParams@39a639a6, com.sample.AttributeParams@39ac39ac]

From the result we can see that we have two Attribute objects in the ArrayList.
How can I iterate through the ArrayList to get a perticular AttributeParams object


--
Ashok Deivasigamani

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com