@Test public void testRemoveDrgElementsWithoutShapeWhenAllElementsHaveShape() { final String id1 = "id1"; final String id2 = "id2"; final String id3 = "id3"; final DRGElement e1 = createDRGElement(id1); final DRGElement e2 = createDRGElement(id2); final DRGElement e3 = createDRGElement(id3); final List<org.kie.dmn.model.api.DRGElement> drgElements = new ArrayList<>(Arrays.asList(e1, e2, e3)); final DMNShape s1 = createDMNShape(id1); final DMNShape s2 = createDMNShape(id2); final DMNShape s3 = createDMNShape(id3); final List<DMNShape> dmnShapes = new ArrayList<>(Arrays.asList(s1, s2, s3)); getDMNMarshaller().removeDrgElementsWithoutShape(drgElements, dmnShapes); assertEquals(3, drgElements.size()); assertEquals(e1, drgElements.get(0)); assertEquals(e2, drgElements.get(1)); assertEquals(e3, drgElements.get(2)); }
void removeDrgElementsWithoutShape(final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.isEmpty()) { return; } drgElements.removeIf(element -> dmnShapes.stream().noneMatch(s -> s.getDmnElementRef().getLocalPart().endsWith(element.getId()))); }
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { void removeDrgElementsWithoutShape(final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.isEmpty()) { return; } drgElements.removeIf(element -> dmnShapes.stream().noneMatch(s -> s.getDmnElementRef().getLocalPart().endsWith(element.getId()))); } }
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { void removeDrgElementsWithoutShape(final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.isEmpty()) { return; } drgElements.removeIf(element -> dmnShapes.stream().noneMatch(s -> s.getDmnElementRef().getLocalPart().endsWith(element.getId()))); } protected  DMNMarshallerStandalone(); @Inject  DMNMarshallerStandalone(final XMLEncoderDiagramMetadataMarshaller diagramMetadataMarshaller,
                                   final FactoryManager factoryManager,
                                   final DMNMarshallerImportsHelperStandalone dmnMarshallerImportsHelper,
                                   final DMNMarshaller marshaller); }
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { void removeDrgElementsWithoutShape(final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.isEmpty()) { return; } drgElements.removeIf(element -> dmnShapes.stream().noneMatch(s -> s.getDmnElementRef().getLocalPart().endsWith(element.getId()))); } protected  DMNMarshallerStandalone(); @Inject  DMNMarshallerStandalone(final XMLEncoderDiagramMetadataMarshaller diagramMetadataMarshaller,
                                   final FactoryManager factoryManager,
                                   final DMNMarshallerImportsHelperStandalone dmnMarshallerImportsHelper,
                                   final DMNMarshaller marshaller); @Override @SuppressWarnings("unchecked") Graph unmarshall(final Metadata metadata,
                            final InputStream input); static Node<?, ?> findDMNDiagramRoot(final Graph<?, Node<View, ?>> graph); @SuppressWarnings({"rawtypes", "unchecked"}) static void connectRootWithChild(final Node dmnDiagramRoot,
                                            final Node child); @SuppressWarnings({"rawtypes", "unchecked"}) static void connectEdge(final Edge edge,
                                   final Node source,
                                   final Node target); @Override @SuppressWarnings("unchecked") String marshall(final Diagram<Graph, Metadata> diagram); @Override DiagramMetadataMarshaller<Metadata> getMetadataMarshaller(); }
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { void removeDrgElementsWithoutShape(final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.isEmpty()) { return; } drgElements.removeIf(element -> dmnShapes.stream().noneMatch(s -> s.getDmnElementRef().getLocalPart().endsWith(element.getId()))); } protected  DMNMarshallerStandalone(); @Inject  DMNMarshallerStandalone(final XMLEncoderDiagramMetadataMarshaller diagramMetadataMarshaller,
                                   final FactoryManager factoryManager,
                                   final DMNMarshallerImportsHelperStandalone dmnMarshallerImportsHelper,
                                   final DMNMarshaller marshaller); @Override @SuppressWarnings("unchecked") Graph unmarshall(final Metadata metadata,
                            final InputStream input); static Node<?, ?> findDMNDiagramRoot(final Graph<?, Node<View, ?>> graph); @SuppressWarnings({"rawtypes", "unchecked"}) static void connectRootWithChild(final Node dmnDiagramRoot,
                                            final Node child); @SuppressWarnings({"rawtypes", "unchecked"}) static void connectEdge(final Edge edge,
                                   final Node source,
                                   final Node target); @Override @SuppressWarnings("unchecked") String marshall(final Diagram<Graph, Metadata> diagram); @Override DiagramMetadataMarshaller<Metadata> getMetadataMarshaller(); static final String INFO_REQ_ID; static final String KNOWLEDGE_REQ_ID; static final String AUTH_REQ_ID; static final String ASSOCIATION_ID; }