@Test public void testLoadExternalLinksFromExtensionElements() { final org.kie.dmn.model.api.DRGElement source = mock(org.kie.dmn.model.api.DRGElement.class); final org.kie.workbench.common.dmn.api.definition.model.DRGElement target = mock(org.kie.workbench.common.dmn.api.definition.model.DRGElement.class); final DMNElement.ExtensionElements extensionElements = mock(DMNElement.ExtensionElements.class); final List<Object> externalLinks = new ArrayList<>(); final String linkDescription1 = "l1"; final String url1 = "url1"; final ExternalLink external1 = createExternalLinkMock(linkDescription1, url1); externalLinks.add(external1); final String linkDescription2 = "l2"; final String url2 = "url2"; final ExternalLink external2 = createExternalLinkMock(linkDescription2, url2); externalLinks.add(external2); when(extensionElements.getAny()).thenReturn(externalLinks); when(source.getExtensionElements()).thenReturn(extensionElements); final DocumentationLinksHolder linksHolder = mock(DocumentationLinksHolder.class); final DocumentationLinks links = new DocumentationLinks(); when(linksHolder.getValue()).thenReturn(links); when(target.getLinksHolder()).thenReturn(linksHolder); loadExternalLinksFromExtensionElements(source, target); assertEquals(2, links.getLinks().size()); compare(links.getLinks().get(0), linkDescription1, url1); compare(links.getLinks().get(1), linkDescription2, url2); }
static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.model.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final Object obj : source.getExtensionElements().getAny()) { if (obj instanceof ExternalLink) { final ExternalLink el = (ExternalLink) obj; final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getName()); external.setUrl(el.getUrl()); target.getLinksHolder().getValue().addLink(external); } } } }
DMNExternalLinksToExtensionElements { static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.model.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final Object obj : source.getExtensionElements().getAny()) { if (obj instanceof ExternalLink) { final ExternalLink el = (ExternalLink) obj; final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getName()); external.setUrl(el.getUrl()); target.getLinksHolder().getValue().addLink(external); } } } } }
DMNExternalLinksToExtensionElements { static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.model.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final Object obj : source.getExtensionElements().getAny()) { if (obj instanceof ExternalLink) { final ExternalLink el = (ExternalLink) obj; final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getName()); external.setUrl(el.getUrl()); target.getLinksHolder().getValue().addLink(external); } } } }  }
DMNExternalLinksToExtensionElements { static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.model.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final Object obj : source.getExtensionElements().getAny()) { if (obj instanceof ExternalLink) { final ExternalLink el = (ExternalLink) obj; final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getName()); external.setUrl(el.getUrl()); target.getLinksHolder().getValue().addLink(external); } } } }   }
DMNExternalLinksToExtensionElements { static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.model.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final Object obj : source.getExtensionElements().getAny()) { if (obj instanceof ExternalLink) { final ExternalLink el = (ExternalLink) obj; final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getName()); external.setUrl(el.getUrl()); target.getLinksHolder().getValue().addLink(external); } } } }    }