@Test public void testWbFromDMNWithAnnotationRules() { final org.kie.dmn.model.api.DecisionRule dmn = new TDecisionRule(); final String annotation1 = "some annotation"; final String annotation2 = "some other annotation"; final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation1 = createRuleAnnotation(annotation1); final org.kie.dmn.model.api.RuleAnnotation ruleAnnotation2 = createRuleAnnotation(annotation2); dmn.getAnnotationEntry().add(ruleAnnotation1); dmn.getAnnotationEntry().add(ruleAnnotation2); dmn.setId(ID); final org.kie.workbench.common.dmn.api.definition.model.DecisionRule wb = DecisionRulePropertyConverter.wbFromDMN(dmn); assertEquals(ID, wb.getId().getValue()); assertEquals(2, wb.getAnnotationEntry().size()); assertEquals(annotation1, wb.getAnnotationEntry().get(0).getText().getValue()); assertEquals(annotation2, wb.getAnnotationEntry().get(1).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);  }