@Test public void testDMNFromWBWithNoDefault() { final Context wb = setupDMNFromWB(Optional.empty()); final org.kie.dmn.model.api.Context dmn = ContextPropertyConverter.dmnFromWB(wb, componentWidthsConsumer); assertThat(dmn).isNotNull(); assertThat(dmn.getContextEntry()).isNotNull(); assertThat(dmn.getContextEntry().size()).isEqualTo(1); assertThat(dmn.getContextEntry().get(0)).isNotNull(); assertThat(dmn.getContextEntry().get(0).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.Context dmnFromWB(final Context wb, final Consumer<ComponentWidths> componentWidthsConsumer) { final org.kie.dmn.model.api.Context result = new org.kie.dmn.model.v1_2.TContext(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (ContextEntry ce : wb.getContextEntry()) { final org.kie.dmn.model.api.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce, componentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount > 0) { if (Objects.isNull(wb.getContextEntry().get(contextEntriesCount - 1).getExpression())) { result.getContextEntry().remove(contextEntriesCount - 1); } } return result; }
ContextPropertyConverter { public static org.kie.dmn.model.api.Context dmnFromWB(final Context wb, final Consumer<ComponentWidths> componentWidthsConsumer) { final org.kie.dmn.model.api.Context result = new org.kie.dmn.model.v1_2.TContext(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (ContextEntry ce : wb.getContextEntry()) { final org.kie.dmn.model.api.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce, componentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount > 0) { if (Objects.isNull(wb.getContextEntry().get(contextEntriesCount - 1).getExpression())) { result.getContextEntry().remove(contextEntriesCount - 1); } } return result; } }
ContextPropertyConverter { public static org.kie.dmn.model.api.Context dmnFromWB(final Context wb, final Consumer<ComponentWidths> componentWidthsConsumer) { final org.kie.dmn.model.api.Context result = new org.kie.dmn.model.v1_2.TContext(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (ContextEntry ce : wb.getContextEntry()) { final org.kie.dmn.model.api.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce, componentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount > 0) { if (Objects.isNull(wb.getContextEntry().get(contextEntriesCount - 1).getExpression())) { result.getContextEntry().remove(contextEntriesCount - 1); } } return result; }  }
ContextPropertyConverter { public static org.kie.dmn.model.api.Context dmnFromWB(final Context wb, final Consumer<ComponentWidths> componentWidthsConsumer) { final org.kie.dmn.model.api.Context result = new org.kie.dmn.model.v1_2.TContext(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (ContextEntry ce : wb.getContextEntry()) { final org.kie.dmn.model.api.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce, componentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount > 0) { if (Objects.isNull(wb.getContextEntry().get(contextEntriesCount - 1).getExpression())) { result.getContextEntry().remove(contextEntriesCount - 1); } } return result; }  static Context wbFromDMN(final org.kie.dmn.model.api.Context dmn,
                                    final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.Context dmnFromWB(final Context wb,
                                                          final Consumer<ComponentWidths> componentWidthsConsumer); }
ContextPropertyConverter { public static org.kie.dmn.model.api.Context dmnFromWB(final Context wb, final Consumer<ComponentWidths> componentWidthsConsumer) { final org.kie.dmn.model.api.Context result = new org.kie.dmn.model.v1_2.TContext(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (ContextEntry ce : wb.getContextEntry()) { final org.kie.dmn.model.api.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce, componentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount > 0) { if (Objects.isNull(wb.getContextEntry().get(contextEntriesCount - 1).getExpression())) { result.getContextEntry().remove(contextEntriesCount - 1); } } return result; }  static Context wbFromDMN(final org.kie.dmn.model.api.Context dmn,
                                    final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.Context dmnFromWB(final Context wb,
                                                          final Consumer<ComponentWidths> componentWidthsConsumer);  }