@Test public void testDMNFromWB() { final InputData wb = new InputData(); final InformationItemPrimary informationItem = new InformationItemPrimary(); wb.getId().setValue(INPUT_DATA_UUID); wb.getName().setValue(INPUT_DATA_NAME); wb.getDescription().setValue(INPUT_DATA_DESCRIPTION); wb.setVariable(informationItem); final Node<View<InputData>, ?> node = new NodeImpl<>(UUID.uuid()); final View<InputData> view = new ViewImpl<>(wb, Bounds.create()); node.setContent(view); final org.kie.dmn.model.api.InputData dmn = converter.dmnFromNode(node, componentWidthsConsumer); assertThat(dmn).isNotNull(); assertThat(dmn.getId()).isNotNull(); assertThat(dmn.getId()).isEqualTo(INPUT_DATA_UUID); assertThat(dmn.getName()).isNotNull(); assertThat(dmn.getName()).isEqualTo(INPUT_DATA_NAME); assertThat(dmn.getDescription()).isNotNull(); assertThat(dmn.getDescription()).isEqualTo(INPUT_DATA_DESCRIPTION); assertThat(dmn.getVariable()).isNotNull(); assertThat(dmn.getVariable().getName()).isEqualTo(INPUT_DATA_NAME); verifyNoMoreInteractions(componentWidthsConsumer); }
@Override public org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) { final InputData source = (InputData) DefinitionUtils.getElementDefinition(node); final org.kie.dmn.model.api.InputData result = new org.kie.dmn.model.v1_2.TInputData(); result.setId(source.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription())); result.setName(source.getName().getValue()); final org.kie.dmn.model.api.InformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source); if (variable != null) { variable.setParent(result); } result.setVariable(variable); DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result); return result; }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) { final InputData source = (InputData) DefinitionUtils.getElementDefinition(node); final org.kie.dmn.model.api.InputData result = new org.kie.dmn.model.v1_2.TInputData(); result.setId(source.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription())); result.setName(source.getName().getValue()); final org.kie.dmn.model.api.InformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source); if (variable != null) { variable.setParent(result); } result.setVariable(variable); DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result); return result; } }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) { final InputData source = (InputData) DefinitionUtils.getElementDefinition(node); final org.kie.dmn.model.api.InputData result = new org.kie.dmn.model.v1_2.TInputData(); result.setId(source.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription())); result.setName(source.getName().getValue()); final org.kie.dmn.model.api.InformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source); if (variable != null) { variable.setParent(result); } result.setVariable(variable); DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result); return result; } InputDataConverter(final FactoryManager factoryManager); }
InputDataConverter implements NodeConverter<org.kie.dmn.model.api.InputData, org.kie.workbench.common.dmn.api.definition.model.InputData> { @Override public org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) { final InputData source = (InputData) DefinitionUtils.getElementDefinition(node); final org.kie.dmn.model.api.InputData result = new org.kie.dmn.model.v1_2.TInputData(); result.setId(source.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription())); result.setName(source.getName().getValue()); final org.kie.dmn.model.api.InformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source); if (variable != null) { variable.setParent(result); } result.setVariable(variable); DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result); return result; } 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 org.kie.dmn.model.api.InputData dmnFromNode(final Node<View<InputData>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) { final InputData source = (InputData) DefinitionUtils.getElementDefinition(node); final org.kie.dmn.model.api.InputData result = new org.kie.dmn.model.v1_2.TInputData(); result.setId(source.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription())); result.setName(source.getName().getValue()); final org.kie.dmn.model.api.InformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source); if (variable != null) { variable.setParent(result); } result.setVariable(variable); DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result); return result; } 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);  }