@Test public void testWBFromDMN() { final org.kie.dmn.model.api.List dmn = new TList(); final org.kie.dmn.model.api.LiteralExpression literalExpression = new TLiteralExpression(); literalExpression.setId(EXPRESSION_UUID); dmn.setId(LIST_UUID); dmn.setDescription(LIST_DESCRIPTION); dmn.setTypeRef(new QName(LIST_QNAME_LOCALPART)); dmn.getExpression().add(literalExpression); final List wb = ListPropertyConverter.wbFromDMN(dmn, hasComponentWidthsConsumer); assertThat(wb).isNotNull(); assertThat(wb.getId()).isNotNull(); assertThat(wb.getId().getValue()).isEqualTo(LIST_UUID); assertThat(wb.getDescription()).isNotNull(); assertThat(wb.getDescription().getValue()).isEqualTo(LIST_DESCRIPTION); assertThat(wb.getTypeRef()).isNotNull(); assertThat(wb.getTypeRef().getLocalPart()).isEqualTo(LIST_QNAME_LOCALPART); assertThat(wb.getExpression()).isNotNull(); assertThat(wb.getExpression().size()).isEqualTo(1); assertThat(wb.getExpression().get(0).getExpression().getId().getValue()).isEqualTo(EXPRESSION_UUID); verify(hasComponentWidthsConsumer).accept(eq(EXPRESSION_UUID), hasComponentWidthsCaptor.capture()); final HasComponentWidths hasComponentWidths = hasComponentWidthsCaptor.getValue(); assertThat(hasComponentWidths).isNotNull(); assertThat(hasComponentWidths).isEqualTo(wb.getExpression().get(0).getExpression()); }
public static List wbFromDMN(final org.kie.dmn.model.api.List dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final java.util.List<HasExpression> expression = new ArrayList<>(); final List result = new List(id, description, typeRef, expression); for (org.kie.dmn.model.api.Expression e : dmn.getExpression()) { final Expression eConverted = ExpressionPropertyConverter.wbFromDMN(e, hasComponentWidthsConsumer); final HasExpression hasExpression = HasExpression.wrap(result, eConverted); expression.add(hasExpression); } for (HasExpression hasExpression : expression) { final Expression e = hasExpression.getExpression(); if (Objects.nonNull(e)) { e.setParent(result); } } return result; }
ListPropertyConverter { public static List wbFromDMN(final org.kie.dmn.model.api.List dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final java.util.List<HasExpression> expression = new ArrayList<>(); final List result = new List(id, description, typeRef, expression); for (org.kie.dmn.model.api.Expression e : dmn.getExpression()) { final Expression eConverted = ExpressionPropertyConverter.wbFromDMN(e, hasComponentWidthsConsumer); final HasExpression hasExpression = HasExpression.wrap(result, eConverted); expression.add(hasExpression); } for (HasExpression hasExpression : expression) { final Expression e = hasExpression.getExpression(); if (Objects.nonNull(e)) { e.setParent(result); } } return result; } }
ListPropertyConverter { public static List wbFromDMN(final org.kie.dmn.model.api.List dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final java.util.List<HasExpression> expression = new ArrayList<>(); final List result = new List(id, description, typeRef, expression); for (org.kie.dmn.model.api.Expression e : dmn.getExpression()) { final Expression eConverted = ExpressionPropertyConverter.wbFromDMN(e, hasComponentWidthsConsumer); final HasExpression hasExpression = HasExpression.wrap(result, eConverted); expression.add(hasExpression); } for (HasExpression hasExpression : expression) { final Expression e = hasExpression.getExpression(); if (Objects.nonNull(e)) { e.setParent(result); } } return result; }  }
ListPropertyConverter { public static List wbFromDMN(final org.kie.dmn.model.api.List dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final java.util.List<HasExpression> expression = new ArrayList<>(); final List result = new List(id, description, typeRef, expression); for (org.kie.dmn.model.api.Expression e : dmn.getExpression()) { final Expression eConverted = ExpressionPropertyConverter.wbFromDMN(e, hasComponentWidthsConsumer); final HasExpression hasExpression = HasExpression.wrap(result, eConverted); expression.add(hasExpression); } for (HasExpression hasExpression : expression) { final Expression e = hasExpression.getExpression(); if (Objects.nonNull(e)) { e.setParent(result); } } return result; }  static List wbFromDMN(final org.kie.dmn.model.api.List dmn,
                                 final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.List dmnFromWB(final List wb,
                                                       final Consumer<ComponentWidths> componentWidthsConsumer); }
ListPropertyConverter { public static List wbFromDMN(final org.kie.dmn.model.api.List dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final java.util.List<HasExpression> expression = new ArrayList<>(); final List result = new List(id, description, typeRef, expression); for (org.kie.dmn.model.api.Expression e : dmn.getExpression()) { final Expression eConverted = ExpressionPropertyConverter.wbFromDMN(e, hasComponentWidthsConsumer); final HasExpression hasExpression = HasExpression.wrap(result, eConverted); expression.add(hasExpression); } for (HasExpression hasExpression : expression) { final Expression e = hasExpression.getExpression(); if (Objects.nonNull(e)) { e.setParent(result); } } return result; }  static List wbFromDMN(final org.kie.dmn.model.api.List dmn,
                                 final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.List dmnFromWB(final List wb,
                                                       final Consumer<ComponentWidths> componentWidthsConsumer);  }