Unless you assert the contents of the map into working memory, you are gonna have to use either an eval statement or from. For example using eval<br><br>when <br> Cheese($type : type)<br> Cheese(eval(map.get("foo").containsKey($type))<br>
then <br><br><br><div class="gmail_quote">2009/4/21 Meny Kobel <span dir="ltr"><<a href="mailto:meny.kobel@gmail.com">meny.kobel@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Hi,<br>One of the class member of the fact is map<String,List>.<br>In the DRL file I need to get list from the map(I know the map key) and set it to variable name $theList.<br>Then I need to check if some variable is memberof $theList<br>
Can you please advice how to get the list from the map and set the $theList variable?<br><br>For example :<br><br>public class Cheese <br>{<br> private String type;<br> private Map<String,List<Integer>> map;<br>
<br><br> public Cheese(String type) {<br> this.type = type;<br> }<br><br> public String getType() {<br> return type;<br> }<br><br> public void setType(String type) {<br> this.type = type;<br>
}<br><br> public Map<String, List<Integer>> getMap()<br> {<br> return map;<br> }<br><br> public void setMap(Map<String, List<Integer>> map)<br> {<br> this.map = map;<br>
}<br> <br> <br> public List<Integer> getListFromMap(String name)<br> {<br> return map.get(name);<br> }<br>}<br><br>DRL file - <br><br>rule "Cheese_fans_18"<br> when<br> Cheese($theList :<b> don't know how to get the list from the map</b>)<br>
Cheese(type memberof $theList)<br> <br> then<br> System.out.println("Cool");<br>end<br><br><br><br>Thanks,<br>Meny<br><br></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>