Last active
August 18, 2017 06:42
-
-
Save dmarrazzo/45d087d3a68cf05172ba9ace0b1af1e9 to your computer and use it in GitHub Desktop.
drools dmn execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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