@Test @SuppressWarnings("unchecked") public void testWBFromDMN() { final Node<View<DecisionService>, ?> factoryNode = new NodeImpl<>(UUID.uuid()); final View<DecisionService> view = new ViewImpl<>(new DecisionService(), Bounds.create()); factoryNode.setContent(view); when(factoryManager.newElement(anyString(), eq(getDefinitionId(DecisionService.class)))).thenReturn(element); when(element.asNode()).thenReturn(factoryNode); final org.kie.dmn.model.api.DecisionService dmn = new TDecisionService(); final org.kie.dmn.model.api.InformationItem informationItem = new TInformationItem(); dmn.setId(DECISION_SERVICE_UUID); dmn.setName(DECISION_SERVICE_NAME); dmn.setDescription(DECISION_SERVICE_DESCRIPTION); dmn.setVariable(informationItem); final Node<View<DecisionService>, ?> node = converter.nodeFromDMN(dmn, hasComponentWidthsConsumer); final DecisionService wb = (DecisionService) DefinitionUtils.getElementDefinition(node); assertThat(wb).isNotNull(); assertThat(wb.getId()).isNotNull(); assertThat(wb.getId().getValue()).isEqualTo(DECISION_SERVICE_UUID); assertThat(wb.getName()).isNotNull(); assertThat(wb.getName().getValue()).isEqualTo(DECISION_SERVICE_NAME); assertThat(wb.getDescription()).isNotNull(); assertThat(wb.getDescription().getValue()).isEqualTo(DECISION_SERVICE_DESCRIPTION); assertThat(wb.getVariable()).isNotNull(); assertThat(wb.getVariable().getName().getValue()).isEqualTo(DECISION_SERVICE_NAME); verifyNoMoreInteractions(hasComponentWidthsConsumer); }
@Override public Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(DecisionService.class)).asNode(); final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final Name name = new Name(dmn.getName()); final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn); final List<DMNElementReference> outputDecision = dmn.getOutputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> encapsulatedDecision = dmn.getEncapsulatedDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputDecision = dmn.getInputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputData = dmn.getInputData().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new BackgroundSet(), new FontSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY()); node.getContent().setDefinition(decisionService); if (informationItem != null) { informationItem.setParent(decisionService); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService); return node; }
DecisionServiceConverter implements NodeConverter<org.kie.dmn.model.api.DecisionService, org.kie.workbench.common.dmn.api.definition.model.DecisionService> { @Override public Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(DecisionService.class)).asNode(); final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final Name name = new Name(dmn.getName()); final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn); final List<DMNElementReference> outputDecision = dmn.getOutputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> encapsulatedDecision = dmn.getEncapsulatedDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputDecision = dmn.getInputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputData = dmn.getInputData().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new BackgroundSet(), new FontSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY()); node.getContent().setDefinition(decisionService); if (informationItem != null) { informationItem.setParent(decisionService); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService); return node; } }
DecisionServiceConverter implements NodeConverter<org.kie.dmn.model.api.DecisionService, org.kie.workbench.common.dmn.api.definition.model.DecisionService> { @Override public Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(DecisionService.class)).asNode(); final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final Name name = new Name(dmn.getName()); final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn); final List<DMNElementReference> outputDecision = dmn.getOutputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> encapsulatedDecision = dmn.getEncapsulatedDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputDecision = dmn.getInputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputData = dmn.getInputData().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new BackgroundSet(), new FontSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY()); node.getContent().setDefinition(decisionService); if (informationItem != null) { informationItem.setParent(decisionService); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService); return node; } DecisionServiceConverter(final FactoryManager factoryManager); }
DecisionServiceConverter implements NodeConverter<org.kie.dmn.model.api.DecisionService, org.kie.workbench.common.dmn.api.definition.model.DecisionService> { @Override public Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(DecisionService.class)).asNode(); final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final Name name = new Name(dmn.getName()); final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn); final List<DMNElementReference> outputDecision = dmn.getOutputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> encapsulatedDecision = dmn.getEncapsulatedDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputDecision = dmn.getInputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputData = dmn.getInputData().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new BackgroundSet(), new FontSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY()); node.getContent().setDefinition(decisionService); if (informationItem != null) { informationItem.setParent(decisionService); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService); return node; } DecisionServiceConverter(final FactoryManager factoryManager); @Override Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn,
                                                      final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); @Override @SuppressWarnings("unchecked") org.kie.dmn.model.api.DecisionService dmnFromNode(final Node<View<DecisionService>, ?> node,
                                                             final Consumer<ComponentWidths> componentWidthsConsumer); }
DecisionServiceConverter implements NodeConverter<org.kie.dmn.model.api.DecisionService, org.kie.workbench.common.dmn.api.definition.model.DecisionService> { @Override public Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(DecisionService.class)).asNode(); final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final Name name = new Name(dmn.getName()); final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn); final List<DMNElementReference> outputDecision = dmn.getOutputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> encapsulatedDecision = dmn.getEncapsulatedDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputDecision = dmn.getInputDecision().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final List<DMNElementReference> inputData = dmn.getInputData().stream().map(DMNElementReferenceConverter::wbFromDMN).collect(Collectors.toList()); final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new BackgroundSet(), new FontSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY()); node.getContent().setDefinition(decisionService); if (informationItem != null) { informationItem.setParent(decisionService); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService); return node; } DecisionServiceConverter(final FactoryManager factoryManager); @Override Node<View<DecisionService>, ?> nodeFromDMN(final org.kie.dmn.model.api.DecisionService dmn,
                                                      final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); @Override @SuppressWarnings("unchecked") org.kie.dmn.model.api.DecisionService dmnFromNode(final Node<View<DecisionService>, ?> node,
                                                             final Consumer<ComponentWidths> componentWidthsConsumer);  }