DMNTypeServiceImpl extends AbstractKieContainerService implements DMNTypeService { @Override public FactModelTuple retrieveFactModelTuple(Path path, String dmnPath) { DMNModel dmnModel = getDMNModel(path, dmnPath); SortedMap<String, FactModelTree> visibleFacts = new TreeMap<>(); SortedMap<String, FactModelTree> hiddenFacts = new TreeMap<>(); ErrorHolder errorHolder = new ErrorHolder(); for (InputDataNode input : dmnModel.getInputs()) { DMNType type = input.getType(); checkTypeSupport(type, errorHolder, input.getName()); try { visibleFacts.put(input.getName(), createTopLevelFactModelTree(input.getName(), type, hiddenFacts, FactModelTree.Type.INPUT)); } catch (WrongDMNTypeException e) { throw ExceptionUtilities.handleException(e); } } for (DecisionNode decision : dmnModel.getDecisions()) { DMNType type = decision.getResultType(); checkTypeSupport(type, errorHolder, decision.getName()); try { visibleFacts.put(decision.getName(), createTopLevelFactModelTree(decision.getName(), type, hiddenFacts, FactModelTree.Type.DECISION)); } catch (WrongDMNTypeException e) { throw ExceptionUtilities.handleException(e); } } FactModelTuple factModelTuple = new FactModelTuple(visibleFacts, hiddenFacts); errorHolder.getMultipleNestedCollection().forEach(factModelTuple::addMultipleNestedCollectionError); errorHolder.getMultipleNestedObject().forEach(factModelTuple::addMultipleNestedObjectError); return factModelTuple; }  @Override FactModelTuple retrieveFactModelTuple(Path path, String dmnPath); @Override void initializeNameAndNamespace(Settings settings, Path path, String dmnPath); DMNModel getDMNModel(Path path, String dmnPath); DMNRuntime getDMNRuntime(Path path);  }
@Test public void retrieveFactModelTupleDmnList() throws WrongDMNTypeException { setDmnModelLocal("dmn-list.dmn", "https: FactModelTuple factModelTuple = dmnTypeServiceImpl.retrieveFactModelTuple(mock(Path.class), null); int expectedVisibleFacts = dmnModelLocal.getInputs().size() + dmnModelLocal.getDecisions().size(); assertEquals(expectedVisibleFacts, factModelTuple.getVisibleFacts().size()); dmnModelLocal.getInputs().forEach(inputDataNode -> verifyFactModelTree(factModelTuple, inputDataNode, factModelTuple.getHiddenFacts())); dmnModelLocal.getDecisions().forEach(decisionNode -> verifyFactModelTree(factModelTuple, decisionNode, factModelTuple.getHiddenFacts())); }
@Test public void retrieveFactModelTupleDmnListComposite() throws WrongDMNTypeException { setDmnModelLocal("dmn-list-composite.dmn", "https: FactModelTuple factModelTuple = dmnTypeServiceImpl.retrieveFactModelTuple(mock(Path.class), null); int expectedVisibleFacts = dmnModelLocal.getInputs().size() + dmnModelLocal.getDecisions().size(); assertEquals(expectedVisibleFacts, factModelTuple.getVisibleFacts().size()); dmnModelLocal.getInputs().forEach(inputDataNode -> verifyFactModelTree(factModelTuple, inputDataNode, factModelTuple.getHiddenFacts())); dmnModelLocal.getDecisions().forEach(decisionNode -> verifyFactModelTree(factModelTuple, decisionNode, factModelTuple.getHiddenFacts())); }