@Test public void testWbFromDMN() { final UnaryTests inputEntry = new TUnaryTests(); final LiteralExpression outputEntry = new TLiteralExpression(); final org.kie.dmn.model.api.DecisionRule dmn = new TDecisionRule(); dmn.setId(ID); dmn.setDescription(DESCRIPTION); dmn.getInputEntry().add(inputEntry); dmn.getOutputEntry().add(outputEntry); final org.kie.workbench.common.dmn.api.definition.model.DecisionRule wb = DecisionRulePropertyConverter.wbFromDMN(dmn); assertEquals(ID, wb.getId().getValue()); assertEquals("", wb.getDescription().getValue()); assertEquals(wb, wb.getInputEntry().get(0).getParent()); assertEquals(wb, wb.getOutputEntry().get(0).getParent()); assertEquals(1, wb.getAnnotationEntry().size()); assertEquals(DESCRIPTION, wb.getAnnotationEntry().get(0).getText().getValue()); }
public static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final DecisionRule result = new DecisionRule(); result.setId(id); if (!(dmn instanceof org.kie.dmn.model.v1_1.TDecisionRule)) { for (final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation : dmn.getAnnotationEntry()) { final RuleAnnotationClauseText annotationEntryConverted = RuleAnnotationClauseTextConverter.wbFromDMN(ruleAnnotation); if (annotationEntryConverted != null) { annotationEntryConverted.setParent(result); } result.getAnnotationEntry().add(annotationEntryConverted); } } if (result.getAnnotationEntry().isEmpty()) { final RuleAnnotationClauseText annotationEntryText = new RuleAnnotationClauseText(); annotationEntryText.getText().setValue(description.getValue()); annotationEntryText.setParent(result); result.getAnnotationEntry().add(annotationEntryText); } for (final org.kie.dmn.model.api.UnaryTests ie : dmn.getInputEntry()) { final UnaryTests inputEntryConverted = UnaryTestsPropertyConverter.wbFromDMN(ie); if (inputEntryConverted != null) { inputEntryConverted.setParent(result); } result.getInputEntry().add(inputEntryConverted); } for (final org.kie.dmn.model.api.LiteralExpression oe : dmn.getOutputEntry()) { final LiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.wbFromDMN(oe); if (outputEntryConverted != null) { outputEntryConverted.setParent(result); } result.getOutputEntry().add(outputEntryConverted); } return result; }
DecisionRulePropertyConverter { public static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final DecisionRule result = new DecisionRule(); result.setId(id); if (!(dmn instanceof org.kie.dmn.model.v1_1.TDecisionRule)) { for (final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation : dmn.getAnnotationEntry()) { final RuleAnnotationClauseText annotationEntryConverted = RuleAnnotationClauseTextConverter.wbFromDMN(ruleAnnotation); if (annotationEntryConverted != null) { annotationEntryConverted.setParent(result); } result.getAnnotationEntry().add(annotationEntryConverted); } } if (result.getAnnotationEntry().isEmpty()) { final RuleAnnotationClauseText annotationEntryText = new RuleAnnotationClauseText(); annotationEntryText.getText().setValue(description.getValue()); annotationEntryText.setParent(result); result.getAnnotationEntry().add(annotationEntryText); } for (final org.kie.dmn.model.api.UnaryTests ie : dmn.getInputEntry()) { final UnaryTests inputEntryConverted = UnaryTestsPropertyConverter.wbFromDMN(ie); if (inputEntryConverted != null) { inputEntryConverted.setParent(result); } result.getInputEntry().add(inputEntryConverted); } for (final org.kie.dmn.model.api.LiteralExpression oe : dmn.getOutputEntry()) { final LiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.wbFromDMN(oe); if (outputEntryConverted != null) { outputEntryConverted.setParent(result); } result.getOutputEntry().add(outputEntryConverted); } return result; } }
DecisionRulePropertyConverter { public static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final DecisionRule result = new DecisionRule(); result.setId(id); if (!(dmn instanceof org.kie.dmn.model.v1_1.TDecisionRule)) { for (final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation : dmn.getAnnotationEntry()) { final RuleAnnotationClauseText annotationEntryConverted = RuleAnnotationClauseTextConverter.wbFromDMN(ruleAnnotation); if (annotationEntryConverted != null) { annotationEntryConverted.setParent(result); } result.getAnnotationEntry().add(annotationEntryConverted); } } if (result.getAnnotationEntry().isEmpty()) { final RuleAnnotationClauseText annotationEntryText = new RuleAnnotationClauseText(); annotationEntryText.getText().setValue(description.getValue()); annotationEntryText.setParent(result); result.getAnnotationEntry().add(annotationEntryText); } for (final org.kie.dmn.model.api.UnaryTests ie : dmn.getInputEntry()) { final UnaryTests inputEntryConverted = UnaryTestsPropertyConverter.wbFromDMN(ie); if (inputEntryConverted != null) { inputEntryConverted.setParent(result); } result.getInputEntry().add(inputEntryConverted); } for (final org.kie.dmn.model.api.LiteralExpression oe : dmn.getOutputEntry()) { final LiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.wbFromDMN(oe); if (outputEntryConverted != null) { outputEntryConverted.setParent(result); } result.getOutputEntry().add(outputEntryConverted); } return result; }  }
DecisionRulePropertyConverter { public static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final DecisionRule result = new DecisionRule(); result.setId(id); if (!(dmn instanceof org.kie.dmn.model.v1_1.TDecisionRule)) { for (final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation : dmn.getAnnotationEntry()) { final RuleAnnotationClauseText annotationEntryConverted = RuleAnnotationClauseTextConverter.wbFromDMN(ruleAnnotation); if (annotationEntryConverted != null) { annotationEntryConverted.setParent(result); } result.getAnnotationEntry().add(annotationEntryConverted); } } if (result.getAnnotationEntry().isEmpty()) { final RuleAnnotationClauseText annotationEntryText = new RuleAnnotationClauseText(); annotationEntryText.getText().setValue(description.getValue()); annotationEntryText.setParent(result); result.getAnnotationEntry().add(annotationEntryText); } for (final org.kie.dmn.model.api.UnaryTests ie : dmn.getInputEntry()) { final UnaryTests inputEntryConverted = UnaryTestsPropertyConverter.wbFromDMN(ie); if (inputEntryConverted != null) { inputEntryConverted.setParent(result); } result.getInputEntry().add(inputEntryConverted); } for (final org.kie.dmn.model.api.LiteralExpression oe : dmn.getOutputEntry()) { final LiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.wbFromDMN(oe); if (outputEntryConverted != null) { outputEntryConverted.setParent(result); } result.getOutputEntry().add(outputEntryConverted); } return result; }  static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn); static org.kie.dmn.model.api.DecisionRule dmnFromWB(final DecisionRule wb); }
DecisionRulePropertyConverter { public static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn) { final Id id = new Id(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final DecisionRule result = new DecisionRule(); result.setId(id); if (!(dmn instanceof org.kie.dmn.model.v1_1.TDecisionRule)) { for (final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation : dmn.getAnnotationEntry()) { final RuleAnnotationClauseText annotationEntryConverted = RuleAnnotationClauseTextConverter.wbFromDMN(ruleAnnotation); if (annotationEntryConverted != null) { annotationEntryConverted.setParent(result); } result.getAnnotationEntry().add(annotationEntryConverted); } } if (result.getAnnotationEntry().isEmpty()) { final RuleAnnotationClauseText annotationEntryText = new RuleAnnotationClauseText(); annotationEntryText.getText().setValue(description.getValue()); annotationEntryText.setParent(result); result.getAnnotationEntry().add(annotationEntryText); } for (final org.kie.dmn.model.api.UnaryTests ie : dmn.getInputEntry()) { final UnaryTests inputEntryConverted = UnaryTestsPropertyConverter.wbFromDMN(ie); if (inputEntryConverted != null) { inputEntryConverted.setParent(result); } result.getInputEntry().add(inputEntryConverted); } for (final org.kie.dmn.model.api.LiteralExpression oe : dmn.getOutputEntry()) { final LiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.wbFromDMN(oe); if (outputEntryConverted != null) { outputEntryConverted.setParent(result); } result.getOutputEntry().add(outputEntryConverted); } return result; }  static DecisionRule wbFromDMN(final org.kie.dmn.model.api.DecisionRule dmn); static org.kie.dmn.model.api.DecisionRule dmnFromWB(final DecisionRule wb);  }