@Test @SuppressWarnings("unchecked") public void testWBFromDMN() { final Node<View<InputData>, ?> factoryNode = new NodeImpl<>(UUID.uuid()); final View<InputData> view = new ViewImpl<>(new InputData(), Bounds.create()); factoryNode.setContent(view); when(factoryManager.newElement(anyString(), eq(getDefinitionId(InputData.class)))).thenReturn(element); when(element.asNode()).thenReturn(factoryNode); final org.kie.dmn.model.api.InputData dmn = new TInputData(); final org.kie.dmn.model.api.InformationItem informationItem = new TInformationItem(); dmn.setId(INPUT_DATA_UUID); dmn.setName(INPUT_DATA_NAME); dmn.setDescription(INPUT_DATA_DESCRIPTION); dmn.setVariable(informationItem); final Node<View<InputData>, ?> node = converter.nodeFromDMN(dmn, hasComponentWidthsConsumer); final InputData wb = (InputData) DefinitionUtils.getElementDefinition(node); assertThat(wb).isNotNull(); assertThat(wb.getId()).isNotNull(); assertThat(wb.getId().getValue()).isEqualTo(INPUT_DATA_UUID); assertThat(wb.getName()).isNotNull(); assertThat(wb.getName().getValue()).isEqualTo(INPUT_DATA_NAME); assertThat(wb.getDescription()).isNotNull(); assertThat(wb.getDescription().getValue()).isEqualTo(INPUT_DATA_DESCRIPTION); assertThat(wb.getVariable()).isNotNull(); assertThat(wb.getVariable().getName().getValue()).isEqualTo(INPUT_DATA_NAME); verifyNoMoreInteractions(hasComponentWidthsConsumer); }
@Override public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(InputData.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 InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new GeneralRectangleDimensionsSet()); node.getContent().setDefinition(inputData); if (informationItem != null) { informationItem.setParent(inputData); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData); return node; }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(InputData.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 InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new GeneralRectangleDimensionsSet()); node.getContent().setDefinition(inputData); if (informationItem != null) { informationItem.setParent(inputData); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData); return node; } }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(InputData.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 InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new GeneralRectangleDimensionsSet()); node.getContent().setDefinition(inputData); if (informationItem != null) { informationItem.setParent(inputData); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData); return node; } InputDataConverter(final FactoryManager factoryManager); }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(InputData.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 InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new GeneralRectangleDimensionsSet()); node.getContent().setDefinition(inputData); if (informationItem != null) { informationItem.setParent(inputData); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData); return node; } InputDataConverter(final FactoryManager factoryManager); @Override Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn,
                                                final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); @Override org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node,
                                                       final Consumer<ComponentWidths> componentWidthsConsumer); }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(InputData.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 InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new GeneralRectangleDimensionsSet()); node.getContent().setDefinition(inputData); if (informationItem != null) { informationItem.setParent(inputData); } DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData); return node; } InputDataConverter(final FactoryManager factoryManager); @Override Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.api.InputData dmn,
                                                final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); @Override org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node,
                                                       final Consumer<ComponentWidths> componentWidthsConsumer);  }