Question

I have following Drools rule to which I send map filled with element , but when it gets executed I have element . Why do I get null when it should be "Y" for the value? When I put breakpoint in ACDebug.debug() method and inspect map after $map.put() was executed it looks good, it has "Y" for the value, but after my rules get executed I have null? Has anyone have similar problem?

import java.util.Map;
import java.util.HashMap;
import edu.abc.ACDebug;

rule "POSTPROCESSOR 8"
    ruleflow-group "supress-processor"
    when
        $map:Map(keySet contains "STANDARD_ADDRESS:STREET_NAME")
    then
        ACDebug.debug($map, "Map before PUT: ");
        $map.put("/locationList/sourceAddress/fullStreet",new String("Y"));
        ACDebug.debug($map, "Map after PUT: ");
        $map.remove("STANDARD_ADDRESS:STREET_NAME");
end
Was it helpful?

Solution

After you have done the changes to the map, you need to do an update. This lets the working memory know that you modified the map.

Add the following line:

update( $map );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top