@Test public void testWBFromDMNWithFEELFunctionDefinitionAsParent() { when(functionDefinition.getKind()).thenReturn(FunctionKind.FEEL); final org.kie.dmn.model.api.Context dmn = setupWBFromDMN(functionDefinition); final Context wb = ContextPropertyConverter.wbFromDMN(dmn, hasComponentWidthsConsumer); assertDefaultContextEntry(wb); }
public static Context wbFromDMN(final org.kie.dmn.model.api.Context 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 Context result = new Context(id, description, typeRef); for (org.kie.dmn.model.api.ContextEntry ce : dmn.getContextEntry()) { final ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce, hasComponentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } if (dmn.getParent() instanceof FunctionDefinition) { final FunctionDefinition functionDefinition = (FunctionDefinition) dmn.getParent(); if (!functionDefinition.getKind().equals(FunctionKind.FEEL)) { return result; } } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount == 0) { result.getContextEntry().add(new ContextEntry()); } else if (!Objects.isNull(result.getContextEntry().get(contextEntriesCount - 1).getVariable())) { result.getContextEntry().add(new ContextEntry()); } return result; }
ContextPropertyConverter { public static Context wbFromDMN(final org.kie.dmn.model.api.Context 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 Context result = new Context(id, description, typeRef); for (org.kie.dmn.model.api.ContextEntry ce : dmn.getContextEntry()) { final ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce, hasComponentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } if (dmn.getParent() instanceof FunctionDefinition) { final FunctionDefinition functionDefinition = (FunctionDefinition) dmn.getParent(); if (!functionDefinition.getKind().equals(FunctionKind.FEEL)) { return result; } } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount == 0) { result.getContextEntry().add(new ContextEntry()); } else if (!Objects.isNull(result.getContextEntry().get(contextEntriesCount - 1).getVariable())) { result.getContextEntry().add(new ContextEntry()); } return result; } }
ContextPropertyConverter { public static Context wbFromDMN(final org.kie.dmn.model.api.Context 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 Context result = new Context(id, description, typeRef); for (org.kie.dmn.model.api.ContextEntry ce : dmn.getContextEntry()) { final ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce, hasComponentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } if (dmn.getParent() instanceof FunctionDefinition) { final FunctionDefinition functionDefinition = (FunctionDefinition) dmn.getParent(); if (!functionDefinition.getKind().equals(FunctionKind.FEEL)) { return result; } } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount == 0) { result.getContextEntry().add(new ContextEntry()); } else if (!Objects.isNull(result.getContextEntry().get(contextEntriesCount - 1).getVariable())) { result.getContextEntry().add(new ContextEntry()); } return result; }  }
ContextPropertyConverter { public static Context wbFromDMN(final org.kie.dmn.model.api.Context 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 Context result = new Context(id, description, typeRef); for (org.kie.dmn.model.api.ContextEntry ce : dmn.getContextEntry()) { final ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce, hasComponentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } if (dmn.getParent() instanceof FunctionDefinition) { final FunctionDefinition functionDefinition = (FunctionDefinition) dmn.getParent(); if (!functionDefinition.getKind().equals(FunctionKind.FEEL)) { return result; } } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount == 0) { result.getContextEntry().add(new ContextEntry()); } else if (!Objects.isNull(result.getContextEntry().get(contextEntriesCount - 1).getVariable())) { result.getContextEntry().add(new ContextEntry()); } 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 Context wbFromDMN(final org.kie.dmn.model.api.Context 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 Context result = new Context(id, description, typeRef); for (org.kie.dmn.model.api.ContextEntry ce : dmn.getContextEntry()) { final ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce, hasComponentWidthsConsumer); if (ceConverted != null) { ceConverted.setParent(result); } result.getContextEntry().add(ceConverted); } if (dmn.getParent() instanceof FunctionDefinition) { final FunctionDefinition functionDefinition = (FunctionDefinition) dmn.getParent(); if (!functionDefinition.getKind().equals(FunctionKind.FEEL)) { return result; } } final int contextEntriesCount = result.getContextEntry().size(); if (contextEntriesCount == 0) { result.getContextEntry().add(new ContextEntry()); } else if (!Objects.isNull(result.getContextEntry().get(contextEntriesCount - 1).getVariable())) { result.getContextEntry().add(new ContextEntry()); } 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);  }