2
votes

I am using drools for implementing certain condtion.I don't know how to set the arraylist of the bean in action from drools decision table.For example following is my class.

public class Dog implements Serializable{

 private String id;
 private List<String> names;

}

My decision table should set the list of names based on the id paseed.How to implement this?

Conditon    Action
d:Dog
id          ???(what needs to be done here)
1           "tom","jack","pearl"
2

2 Answers

4
votes

This can be done in the usual way.

Condition    Action
d:Dog        d.getNames()
id           addAll(Arrays.asList($param))
Match id!    Add some names!   
1            "tom","jack","pearl"

You'll have to import Arrays or use the full class name.

2
votes

If you used Spreadsheet File (.xlsx or .xls) then you can try this:

pojo calss:

public class CategoryEntity {

       private String type;
       private String allAction;
       private List<String> actionList; // list

       // Getters and Setters 

}

And Spreadsheet File like this:

enter image description here