Skip to content

Instantly share code, notes, and snippets.

@dmarrazzo
Last active August 18, 2017 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmarrazzo/45d087d3a68cf05172ba9ace0b1af1e9 to your computer and use it in GitHub Desktop.
Save dmarrazzo/45d087d3a68cf05172ba9ace0b1af1e9 to your computer and use it in GitHub Desktop.
drools dmn execution
KieServices kieServices = KieServices.Factory.get();
KieContainer kieContainer = kieServices.getKieClasspathContainer();
DMNRuntime dmnRuntime = kieContainer.newKieSession().getKieRuntime( DMNRuntime.class );
DMNModel dmnModel = dmnRuntime.getModel("http://www.trisotech.com/definitions/_90a17b17-c884-4fa9-ba59-7a47899d89b2", "driving-eligibility");
DMNContext dmnContext = dmnRuntime.newContext();
Map<String, Object> person = new HashMap<>();
person.put("name", "Donato");
person.put("age", 17);
person.put("country", "italy");
dmnContext.set("Person", person);
DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, dmnContext);
for (DMNDecisionResult dr : dmnResult.getDecisionResults()) {
System.out.println("Decision '" + dr.getDecisionName() + "' : " + dr.getResult());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment