@Test public void testWBFromDMN() { final org.kie.dmn.model.api.Relation dmn = new TRelation(); final org.kie.dmn.model.api.InformationItem informationItem = new TInformationItem(); final org.kie.dmn.model.api.List list = new TList(); final org.kie.dmn.model.api.LiteralExpression literalExpression = new TLiteralExpression(); literalExpression.setId(EXPRESSION_UUID); list.getExpression().add(literalExpression); dmn.setId(RELATION_UUID); dmn.setDescription(RELATION_DESCRIPTION); dmn.setTypeRef(new QName(RELATION_QNAME_LOCALPART)); dmn.getColumn().add(informationItem); dmn.getRow().add(list); final Relation wb = RelationPropertyConverter.wbFromDMN(dmn, hasComponentWidthsConsumer); assertThat(wb).isNotNull(); assertThat(wb.getId()).isNotNull(); assertThat(wb.getId().getValue()).isEqualTo(RELATION_UUID); assertThat(wb.getDescription()).isNotNull(); assertThat(wb.getDescription().getValue()).isEqualTo(RELATION_DESCRIPTION); assertThat(wb.getTypeRef()).isNotNull(); assertThat(wb.getTypeRef().getLocalPart()).isEqualTo(RELATION_QNAME_LOCALPART); assertThat(wb.getColumn()).isNotNull(); assertThat(wb.getColumn().size()).isEqualTo(1); assertThat(wb.getColumn().get(0)).isNotNull(); assertThat(wb.getRow()).isNotNull(); assertThat(wb.getRow().size()).isEqualTo(1); assertThat(wb.getRow().get(0)).isNotNull(); assertThat(wb.getRow().get(0).getExpression()).isNotNull(); assertThat(wb.getRow().get(0).getExpression().size()).isEqualTo(1); assertThat(wb.getRow().get(0).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.getRow().get(0).getExpression().get(0).getExpression()); }
public static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final List<org.kie.dmn.model.api.InformationItem> column = dmn.getColumn(); final List<org.kie.dmn.model.api.List> row = dmn.getRow(); final List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList()); final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRow = row.stream().map(r -> ListPropertyConverter.wbFromDMN(r, hasComponentWidthsConsumer)).collect(Collectors.toList()); final Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow); for (InformationItem c : convertedColumn) { if (c != null) { c.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRow) { if (r != null) { r.setParent(result); } } return result; }
RelationPropertyConverter { public static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final List<org.kie.dmn.model.api.InformationItem> column = dmn.getColumn(); final List<org.kie.dmn.model.api.List> row = dmn.getRow(); final List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList()); final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRow = row.stream().map(r -> ListPropertyConverter.wbFromDMN(r, hasComponentWidthsConsumer)).collect(Collectors.toList()); final Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow); for (InformationItem c : convertedColumn) { if (c != null) { c.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRow) { if (r != null) { r.setParent(result); } } return result; } }
RelationPropertyConverter { public static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final List<org.kie.dmn.model.api.InformationItem> column = dmn.getColumn(); final List<org.kie.dmn.model.api.List> row = dmn.getRow(); final List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList()); final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRow = row.stream().map(r -> ListPropertyConverter.wbFromDMN(r, hasComponentWidthsConsumer)).collect(Collectors.toList()); final Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow); for (InformationItem c : convertedColumn) { if (c != null) { c.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRow) { if (r != null) { r.setParent(result); } } return result; }  }
RelationPropertyConverter { public static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final List<org.kie.dmn.model.api.InformationItem> column = dmn.getColumn(); final List<org.kie.dmn.model.api.List> row = dmn.getRow(); final List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList()); final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRow = row.stream().map(r -> ListPropertyConverter.wbFromDMN(r, hasComponentWidthsConsumer)).collect(Collectors.toList()); final Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow); for (InformationItem c : convertedColumn) { if (c != null) { c.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRow) { if (r != null) { r.setParent(result); } } return result; }  static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn,
                                     final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.Relation dmnFromWB(final Relation wb,
                                                           final Consumer<ComponentWidths> componentWidthsConsumer); }
RelationPropertyConverter { public static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn); final List<org.kie.dmn.model.api.InformationItem> column = dmn.getColumn(); final List<org.kie.dmn.model.api.List> row = dmn.getRow(); final List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList()); final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRow = row.stream().map(r -> ListPropertyConverter.wbFromDMN(r, hasComponentWidthsConsumer)).collect(Collectors.toList()); final Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow); for (InformationItem c : convertedColumn) { if (c != null) { c.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRow) { if (r != null) { r.setParent(result); } } return result; }  static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn,
                                     final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.Relation dmnFromWB(final Relation wb,
                                                           final Consumer<ComponentWidths> componentWidthsConsumer);  }