Skip to content

Instantly share code, notes, and snippets.

@dmarrazzo dmarrazzo/dmn.java
Last active Aug 18, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.