@Test public void testGetDefinitionsWithConnectedNodes() { final Decision definition1 = new Decision(); final DMNDiagram definition2 = new DMNDiagram(); final Node<View, Edge> node1 = newNode(definition1); final Node<View, Edge> node2 = newNode(definition2); final Edge<View, Node> edge = new EdgeImpl<>(UUID.uuid()); node1.getInEdges().add(edge); node2.getOutEdges().add(edge); edge.setSourceNode(node2); edge.setTargetNode(node1); graph.addNode(node1); graph.addNode(node2); final Definitions definitions = utils.getDefinitions(diagram); assertNotNull(definitions); assertEquals(definition2.getDefinitions(), definitions); }
public Definitions getDefinitions(final Diagram diagram) { return getDefinitionStream(diagram) .filter(d -> d instanceof DMNDiagram) .map(d -> (DMNDiagram) d) .findFirst() .map(DMNDiagram::getDefinitions) .orElse(NONE); }
DMNDiagramUtils { public Definitions getDefinitions(final Diagram diagram) { return getDefinitionStream(diagram) .filter(d -> d instanceof DMNDiagram) .map(d -> (DMNDiagram) d) .findFirst() .map(DMNDiagram::getDefinitions) .orElse(NONE); } }
DMNDiagramUtils { public Definitions getDefinitions(final Diagram diagram) { return getDefinitionStream(diagram) .filter(d -> d instanceof DMNDiagram) .map(d -> (DMNDiagram) d) .findFirst() .map(DMNDiagram::getDefinitions) .orElse(NONE); } DMNDiagramUtils(); }
DMNDiagramUtils { public Definitions getDefinitions(final Diagram diagram) { return getDefinitionStream(diagram) .filter(d -> d instanceof DMNDiagram) .map(d -> (DMNDiagram) d) .findFirst() .map(DMNDiagram::getDefinitions) .orElse(NONE); } DMNDiagramUtils(); List<DRGElement> getDRGElements(final Diagram diagram); String getNamespace(final Diagram diagram); Definitions getDefinitions(final Diagram diagram); Stream<Object> getDefinitionStream(final Diagram diagram); @SuppressWarnings("unchecked") Stream<Node> getNodeStream(final Diagram diagram); }
DMNDiagramUtils { public Definitions getDefinitions(final Diagram diagram) { return getDefinitionStream(diagram) .filter(d -> d instanceof DMNDiagram) .map(d -> (DMNDiagram) d) .findFirst() .map(DMNDiagram::getDefinitions) .orElse(NONE); } DMNDiagramUtils(); List<DRGElement> getDRGElements(final Diagram diagram); String getNamespace(final Diagram diagram); Definitions getDefinitions(final Diagram diagram); Stream<Object> getDefinitionStream(final Diagram diagram); @SuppressWarnings("unchecked") Stream<Node> getNodeStream(final Diagram diagram);  }