use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule in project kie-wb-common by kiegroup.
the class DecisionRulePropertyConverter method dmnFromWB.
public static org.kie.dmn.model.v1_1.DecisionRule dmnFromWB(final DecisionRule wb) {
org.kie.dmn.model.v1_1.DecisionRule result = new org.kie.dmn.model.v1_1.DecisionRule();
result.setId(wb.getId().getValue());
result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
for (UnaryTests ie : wb.getInputEntry()) {
result.getInputEntry().add(UnaryTestsPropertyConverter.dmnFromWB(ie));
}
for (LiteralExpression oe : wb.getOutputEntry()) {
result.getOutputEntry().add(LiteralExpressionPropertyConverter.dmnFromWB(oe));
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule in project kie-wb-common by kiegroup.
the class DecisionTablePropertyConverter method dmnFromWB.
public static org.kie.dmn.model.v1_1.DecisionTable dmnFromWB(final DecisionTable wb) {
org.kie.dmn.model.v1_1.DecisionTable result = new org.kie.dmn.model.v1_1.DecisionTable();
result.setId(wb.getId().getValue());
result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
for (InputClause input : wb.getInput()) {
result.getInput().add(InputClausePropertyConverter.dmnFromWB(input));
}
for (OutputClause input : wb.getOutput()) {
result.getOutput().add(OutputClausePropertyConverter.dmnFromWB(input));
}
for (DecisionRule dr : wb.getRule()) {
result.getRule().add(DecisionRulePropertyConverter.dmnFromWB(dr));
}
if (wb.getHitPolicy() != null) {
result.setHitPolicy(org.kie.dmn.model.v1_1.HitPolicy.fromValue(wb.getHitPolicy().value()));
}
if (wb.getAggregation() != null) {
result.setAggregation(org.kie.dmn.model.v1_1.BuiltinAggregator.fromValue(wb.getAggregation().value()));
}
if (wb.getPreferredOrientation() != null) {
result.setPreferredOrientation(org.kie.dmn.model.v1_1.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value()));
}
result.setOutputLabel(wb.getOutputLabel());
return result;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule in project drools by kiegroup.
the class DecisionRuleConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
DecisionRule dr = (DecisionRule) parent;
for (UnaryTests ie : dr.getInputEntry()) {
writeChildrenNode(writer, context, ie, INPUT_ENTRY);
}
for (LiteralExpression oe : dr.getOutputEntry()) {
writeChildrenNode(writer, context, oe, OUTPUT_ENTRY);
}
}
Aggregations