0

我有简单的 DRL 规则

package drl;

//generated from Decision Table
import com.Location;
import com.LocationApproval;

// rule values at C12, header at C7
rule "Basic_12"
    salience 65535
    when
        location: Location(city == "A")
    then
        insert(new LocationApproval(true,"20"));
end

// rule values at C13, header at C7
rule "Basic_13"
    salience 65534
    when
        location: Location(city == "B")
    then
        insert(new LocationApproval(true,"10"));
end

这是执行规则的代码 KIE Server Execution

    Location location = new Location();
    location.setCity("A");
    LocationApproval locationApproval = new LocationApproval();
    KieCommands commandsFactory = KieServices.Factory.get().getCommands();
    List<Command> commandList = new ArrayList<Command>();
    Command<?> insert = commandsFactory.newInsert(location, "LocationApproval");
    Command<?> fireAllRules = commandsFactory.newFireAllRules();
    Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays.asList(insert, fireAllRules));
    ServiceResponse<ExecutionResults> results = ruleServicesClient.executeCommandsWithResults("containerOD",
            commandsFactory.newBatchExecution(Arrays.asList(insert, fireAllRules), "session"));

这不会返回 LocationApproval 对象

输出响应 ::

{
  "type" : "SUCCESS",
  "msg" : "Container container successfully called.",
  "result" : {
    "execution-results" : {
      "results" : [ {
        "value" : [{"com.Location":{
  "city" : "A"
}}],
        "key" : "LocationApproval"
      } ],
      "facts" : [ ]
    }
  }
}

请帮助

4

0 回答 0