@Test public void testDMNFromWBSingleOutputClauseTypeRef() { final DecisionTable wb = new DecisionTable(); final OutputClause outputClause1 = new OutputClause(); wb.getId().setValue(UUID); wb.getDescription().setValue(DESCRIPTION); wb.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(NULL_NS_URI, QNAME_LOCALPART)); outputClause1.setName(NAME); outputClause1.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(NULL_NS_URI, QNAME_LOCALPART + "-oc1")); wb.getOutput().add(outputClause1); final org.kie.dmn.model.api.DecisionTable dmn = DecisionTablePropertyConverter.dmnFromWB(wb); assertThat(dmn).isNotNull(); assertThat(dmn.getId()).isNotNull(); assertThat(dmn.getId()).isEqualTo(UUID); assertThat(dmn.getDescription()).isNotNull(); assertThat(dmn.getDescription()).isEqualTo(DESCRIPTION); assertThat(dmn.getTypeRef()).isNotNull(); assertThat(dmn.getTypeRef().getLocalPart()).isEqualTo(QNAME_LOCALPART); assertThat(dmn.getOutput()).hasSize(1); final org.kie.dmn.model.api.OutputClause dmnOutputClause1 = dmn.getOutput().get(0); assertThat(dmnOutputClause1.getName()).isNull(); assertThat(dmnOutputClause1.getTypeRef()).isNull(); }
public static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb) { final org.kie.dmn.model.api.DecisionTable result = new org.kie.dmn.model.v1_2.TDecisionTable(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (final RuleAnnotationClause annotation : wb.getAnnotations()) { final org.kie.dmn.model.api.RuleAnnotationClause converted = RuleAnnotationClauseConverter.dmnFromWB(annotation); if (converted != null) { converted.setParent(result); } result.getAnnotation().add(converted); } for (InputClause input : wb.getInput()) { final org.kie.dmn.model.api.InputClause c = InputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getInput().add(c); } for (OutputClause input : wb.getOutput()) { final org.kie.dmn.model.api.OutputClause c = OutputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getOutput().add(c); } if (result.getOutput().size() == 1) { final org.kie.dmn.model.api.OutputClause outputClause = result.getOutput().get(0); outputClause.setName(null); outputClause.setTypeRef(null); } for (DecisionRule dr : wb.getRule()) { final org.kie.dmn.model.api.DecisionRule c = DecisionRulePropertyConverter.dmnFromWB(dr); if (c != null) { c.setParent(result); } result.getRule().add(c); } if (wb.getHitPolicy() != null) { result.setHitPolicy(org.kie.dmn.model.api.HitPolicy.fromValue(wb.getHitPolicy().value())); } if (wb.getAggregation() != null) { result.setAggregation(org.kie.dmn.model.api.BuiltinAggregator.fromValue(wb.getAggregation().value())); } if (wb.getPreferredOrientation() != null) { result.setPreferredOrientation(org.kie.dmn.model.api.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value())); } result.setOutputLabel(wb.getOutputLabel()); return result; }
DecisionTablePropertyConverter { public static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb) { final org.kie.dmn.model.api.DecisionTable result = new org.kie.dmn.model.v1_2.TDecisionTable(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (final RuleAnnotationClause annotation : wb.getAnnotations()) { final org.kie.dmn.model.api.RuleAnnotationClause converted = RuleAnnotationClauseConverter.dmnFromWB(annotation); if (converted != null) { converted.setParent(result); } result.getAnnotation().add(converted); } for (InputClause input : wb.getInput()) { final org.kie.dmn.model.api.InputClause c = InputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getInput().add(c); } for (OutputClause input : wb.getOutput()) { final org.kie.dmn.model.api.OutputClause c = OutputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getOutput().add(c); } if (result.getOutput().size() == 1) { final org.kie.dmn.model.api.OutputClause outputClause = result.getOutput().get(0); outputClause.setName(null); outputClause.setTypeRef(null); } for (DecisionRule dr : wb.getRule()) { final org.kie.dmn.model.api.DecisionRule c = DecisionRulePropertyConverter.dmnFromWB(dr); if (c != null) { c.setParent(result); } result.getRule().add(c); } if (wb.getHitPolicy() != null) { result.setHitPolicy(org.kie.dmn.model.api.HitPolicy.fromValue(wb.getHitPolicy().value())); } if (wb.getAggregation() != null) { result.setAggregation(org.kie.dmn.model.api.BuiltinAggregator.fromValue(wb.getAggregation().value())); } if (wb.getPreferredOrientation() != null) { result.setPreferredOrientation(org.kie.dmn.model.api.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value())); } result.setOutputLabel(wb.getOutputLabel()); return result; } }
DecisionTablePropertyConverter { public static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb) { final org.kie.dmn.model.api.DecisionTable result = new org.kie.dmn.model.v1_2.TDecisionTable(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (final RuleAnnotationClause annotation : wb.getAnnotations()) { final org.kie.dmn.model.api.RuleAnnotationClause converted = RuleAnnotationClauseConverter.dmnFromWB(annotation); if (converted != null) { converted.setParent(result); } result.getAnnotation().add(converted); } for (InputClause input : wb.getInput()) { final org.kie.dmn.model.api.InputClause c = InputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getInput().add(c); } for (OutputClause input : wb.getOutput()) { final org.kie.dmn.model.api.OutputClause c = OutputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getOutput().add(c); } if (result.getOutput().size() == 1) { final org.kie.dmn.model.api.OutputClause outputClause = result.getOutput().get(0); outputClause.setName(null); outputClause.setTypeRef(null); } for (DecisionRule dr : wb.getRule()) { final org.kie.dmn.model.api.DecisionRule c = DecisionRulePropertyConverter.dmnFromWB(dr); if (c != null) { c.setParent(result); } result.getRule().add(c); } if (wb.getHitPolicy() != null) { result.setHitPolicy(org.kie.dmn.model.api.HitPolicy.fromValue(wb.getHitPolicy().value())); } if (wb.getAggregation() != null) { result.setAggregation(org.kie.dmn.model.api.BuiltinAggregator.fromValue(wb.getAggregation().value())); } if (wb.getPreferredOrientation() != null) { result.setPreferredOrientation(org.kie.dmn.model.api.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value())); } result.setOutputLabel(wb.getOutputLabel()); return result; }  }
DecisionTablePropertyConverter { public static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb) { final org.kie.dmn.model.api.DecisionTable result = new org.kie.dmn.model.v1_2.TDecisionTable(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (final RuleAnnotationClause annotation : wb.getAnnotations()) { final org.kie.dmn.model.api.RuleAnnotationClause converted = RuleAnnotationClauseConverter.dmnFromWB(annotation); if (converted != null) { converted.setParent(result); } result.getAnnotation().add(converted); } for (InputClause input : wb.getInput()) { final org.kie.dmn.model.api.InputClause c = InputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getInput().add(c); } for (OutputClause input : wb.getOutput()) { final org.kie.dmn.model.api.OutputClause c = OutputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getOutput().add(c); } if (result.getOutput().size() == 1) { final org.kie.dmn.model.api.OutputClause outputClause = result.getOutput().get(0); outputClause.setName(null); outputClause.setTypeRef(null); } for (DecisionRule dr : wb.getRule()) { final org.kie.dmn.model.api.DecisionRule c = DecisionRulePropertyConverter.dmnFromWB(dr); if (c != null) { c.setParent(result); } result.getRule().add(c); } if (wb.getHitPolicy() != null) { result.setHitPolicy(org.kie.dmn.model.api.HitPolicy.fromValue(wb.getHitPolicy().value())); } if (wb.getAggregation() != null) { result.setAggregation(org.kie.dmn.model.api.BuiltinAggregator.fromValue(wb.getAggregation().value())); } if (wb.getPreferredOrientation() != null) { result.setPreferredOrientation(org.kie.dmn.model.api.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value())); } result.setOutputLabel(wb.getOutputLabel()); return result; }  static DecisionTable wbFromDMN(final org.kie.dmn.model.api.DecisionTable dmn); static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb); }
DecisionTablePropertyConverter { public static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb) { final org.kie.dmn.model.api.DecisionTable result = new org.kie.dmn.model.v1_2.TDecisionTable(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); for (final RuleAnnotationClause annotation : wb.getAnnotations()) { final org.kie.dmn.model.api.RuleAnnotationClause converted = RuleAnnotationClauseConverter.dmnFromWB(annotation); if (converted != null) { converted.setParent(result); } result.getAnnotation().add(converted); } for (InputClause input : wb.getInput()) { final org.kie.dmn.model.api.InputClause c = InputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getInput().add(c); } for (OutputClause input : wb.getOutput()) { final org.kie.dmn.model.api.OutputClause c = OutputClausePropertyConverter.dmnFromWB(input); if (c != null) { c.setParent(result); } result.getOutput().add(c); } if (result.getOutput().size() == 1) { final org.kie.dmn.model.api.OutputClause outputClause = result.getOutput().get(0); outputClause.setName(null); outputClause.setTypeRef(null); } for (DecisionRule dr : wb.getRule()) { final org.kie.dmn.model.api.DecisionRule c = DecisionRulePropertyConverter.dmnFromWB(dr); if (c != null) { c.setParent(result); } result.getRule().add(c); } if (wb.getHitPolicy() != null) { result.setHitPolicy(org.kie.dmn.model.api.HitPolicy.fromValue(wb.getHitPolicy().value())); } if (wb.getAggregation() != null) { result.setAggregation(org.kie.dmn.model.api.BuiltinAggregator.fromValue(wb.getAggregation().value())); } if (wb.getPreferredOrientation() != null) { result.setPreferredOrientation(org.kie.dmn.model.api.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value())); } result.setOutputLabel(wb.getOutputLabel()); return result; }  static DecisionTable wbFromDMN(final org.kie.dmn.model.api.DecisionTable dmn); static org.kie.dmn.model.api.DecisionTable dmnFromWB(final DecisionTable wb);  }