I am trying to pass a map in DRT template of the of the drools like this
TEMPLATE
template "another map"
rule "test map_2"
no-loop true
dialect "java"
when
namedmap:Map(map:"${namedTags}")
review:FactNew(
(compareNamedTags(namedmap,namedTags))
)
then
System.out.println("Value is present in the list: "+ namedmap.get("objective"));
modify(review){setComment("accepted")}
end
end template
DRL GENERATED
rule "test map_2"
no-loop true
dialect "java"
when
namedmap:Map(map:"{key1=value1, key2=value2}")
review:FactNew(
(compareNamedTags(namedmap,namedTags))
)
then
System.out.println("Value is present in the list: "+ namedmap.get("key2"));
modify(review){setComment("accepted")}
end
FUNCTION TO CHECK THE MAP
function Boolean compareNamedTags(Map namedTagsMap, Map namedTags){
System.out.println("Comparing the named Tags map");
System.out.println("namedTag -->"+namedTagsMap );
System.out.println("namedTagsMap -->"+namedTags );
System.out.println("equality -->"+namedTagsMap.keySet().equals(namedTags.keySet()) );
boolean flag = false;
flag = namedTagsMap.equals(namedTags);
return true;
}
While firing the rule there is no error but no output is printed. Also there is no call to the function why? Is this the right to pass the map in DRT and use it in the when condition of the rule.
Please provide some guidance on how one can pass a map in the DRT template and use it.