@Test public void testDMNFromWB() { final Invocation wb = new Invocation(); final LiteralExpression literalExpression = new LiteralExpression(); literalExpression.getComponentWidths().set(0, 200.0); literalExpression.getId().setValue(EXPRESSION_UUID); wb.getId().setValue(INVOCATION_UUID); wb.getDescription().setValue(INVOCATION_DESCRIPTION); wb.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(org.kie.workbench.common.dmn.api.property.dmn.QName.NULL_NS_URI, INVOCATION_QNAME_LOCALPART)); wb.setExpression(literalExpression); final org.kie.dmn.model.api.Invocation dmn = InvocationPropertyConverter.dmnFromWB(wb, componentWidthsConsumer); assertThat(dmn).isNotNull(); assertThat(dmn.getId()).isNotNull(); assertThat(dmn.getId()).isEqualTo(INVOCATION_UUID); assertThat(dmn.getDescription()).isNotNull(); assertThat(dmn.getDescription()).isEqualTo(INVOCATION_DESCRIPTION); assertThat(dmn.getTypeRef()).isNotNull(); assertThat(dmn.getTypeRef().getLocalPart()).isEqualTo(INVOCATION_QNAME_LOCALPART); assertThat(dmn.getExpression()).isNotNull(); assertThat(dmn.getExpression().getId()).isEqualTo(EXPRESSION_UUID); verify(componentWidthsConsumer).accept(componentWidthsCaptor.capture()); final ComponentWidths componentWidths = componentWidthsCaptor.getValue(); assertThat(componentWidths).isNotNull(); assertThat(componentWidths.getDmnElementRef().getLocalPart()).isEqualTo(EXPRESSION_UUID); assertThat(componentWidths.getWidths().size()).isEqualTo(literalExpression.getRequiredComponentWidthCount()); assertThat(componentWidths.getWidths().get(0)).isEqualTo(200.0); }
public static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb, final Consumer<ComponentWidths> componentWidthsConsumer) { if (wb == null) { return null; } final org.kie.dmn.model.api.Invocation result = new org.kie.dmn.model.v1_2.TInvocation(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); final org.kie.dmn.model.api.Expression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer); if (convertedExpression != null) { convertedExpression.setParent(result); } result.setExpression(convertedExpression); for (Binding b : wb.getBinding()) { final org.kie.dmn.model.api.Binding bConverted = BindingPropertyConverter.dmnFromWB(b, componentWidthsConsumer); if (bConverted != null) { bConverted.setParent(result); } result.getBinding().add(bConverted); } return result; }
InvocationPropertyConverter { public static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb, final Consumer<ComponentWidths> componentWidthsConsumer) { if (wb == null) { return null; } final org.kie.dmn.model.api.Invocation result = new org.kie.dmn.model.v1_2.TInvocation(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); final org.kie.dmn.model.api.Expression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer); if (convertedExpression != null) { convertedExpression.setParent(result); } result.setExpression(convertedExpression); for (Binding b : wb.getBinding()) { final org.kie.dmn.model.api.Binding bConverted = BindingPropertyConverter.dmnFromWB(b, componentWidthsConsumer); if (bConverted != null) { bConverted.setParent(result); } result.getBinding().add(bConverted); } return result; } }
InvocationPropertyConverter { public static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb, final Consumer<ComponentWidths> componentWidthsConsumer) { if (wb == null) { return null; } final org.kie.dmn.model.api.Invocation result = new org.kie.dmn.model.v1_2.TInvocation(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); final org.kie.dmn.model.api.Expression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer); if (convertedExpression != null) { convertedExpression.setParent(result); } result.setExpression(convertedExpression); for (Binding b : wb.getBinding()) { final org.kie.dmn.model.api.Binding bConverted = BindingPropertyConverter.dmnFromWB(b, componentWidthsConsumer); if (bConverted != null) { bConverted.setParent(result); } result.getBinding().add(bConverted); } return result; }  }
InvocationPropertyConverter { public static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb, final Consumer<ComponentWidths> componentWidthsConsumer) { if (wb == null) { return null; } final org.kie.dmn.model.api.Invocation result = new org.kie.dmn.model.v1_2.TInvocation(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); final org.kie.dmn.model.api.Expression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer); if (convertedExpression != null) { convertedExpression.setParent(result); } result.setExpression(convertedExpression); for (Binding b : wb.getBinding()) { final org.kie.dmn.model.api.Binding bConverted = BindingPropertyConverter.dmnFromWB(b, componentWidthsConsumer); if (bConverted != null) { bConverted.setParent(result); } result.getBinding().add(bConverted); } return result; }  static Invocation wbFromDMN(final org.kie.dmn.model.api.Invocation dmn,
                                       final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb,
                                                             final Consumer<ComponentWidths> componentWidthsConsumer); }
InvocationPropertyConverter { public static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb, final Consumer<ComponentWidths> componentWidthsConsumer) { if (wb == null) { return null; } final org.kie.dmn.model.api.Invocation result = new org.kie.dmn.model.v1_2.TInvocation(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); final org.kie.dmn.model.api.Expression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer); if (convertedExpression != null) { convertedExpression.setParent(result); } result.setExpression(convertedExpression); for (Binding b : wb.getBinding()) { final org.kie.dmn.model.api.Binding bConverted = BindingPropertyConverter.dmnFromWB(b, componentWidthsConsumer); if (bConverted != null) { bConverted.setParent(result); } result.getBinding().add(bConverted); } return result; }  static Invocation wbFromDMN(final org.kie.dmn.model.api.Invocation dmn,
                                       final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.Invocation dmnFromWB(final Invocation wb,
                                                             final Consumer<ComponentWidths> componentWidthsConsumer);  }