Search in sources :

Example 1 with DecisionTable

use of org.kie.dmn.model.api.DecisionTable in project drools by kiegroup.

the class DecisionTableConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    DecisionTable dt = (DecisionTable) parent;
    String hitPolicyValue = reader.getAttribute(HIT_POLICY);
    String aggregationValue = reader.getAttribute(AGGREGATION);
    String preferredOrientationValue = reader.getAttribute(PREFERRED_ORIENTATION);
    String outputLabel = reader.getAttribute(OUTPUT_LABEL);
    if (hitPolicyValue != null)
        dt.setHitPolicy(HitPolicy.fromValue(hitPolicyValue));
    if (aggregationValue != null)
        dt.setAggregation(BuiltinAggregator.fromValue(aggregationValue));
    if (preferredOrientationValue != null)
        dt.setPreferredOrientation(DecisionTableOrientation.fromValue(preferredOrientationValue));
    dt.setOutputLabel(outputLabel);
}
Also used : DecisionTable(org.kie.dmn.model.api.DecisionTable) TDecisionTable(org.kie.dmn.model.v1_1.TDecisionTable)

Example 2 with DecisionTable

use of org.kie.dmn.model.api.DecisionTable in project drools by kiegroup.

the class DecisionTableConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DecisionTable dt = (DecisionTable) parent;
    for (InputClause i : dt.getInput()) {
        writeChildrenNode(writer, context, i, INPUT);
    }
    for (OutputClause o : dt.getOutput()) {
        writeChildrenNode(writer, context, o, OUTPUT);
    }
    for (DecisionRule r : dt.getRule()) {
        writeChildrenNode(writer, context, r, RULE);
    }
}
Also used : OutputClause(org.kie.dmn.model.api.OutputClause) DecisionTable(org.kie.dmn.model.api.DecisionTable) TDecisionTable(org.kie.dmn.model.v1_1.TDecisionTable) InputClause(org.kie.dmn.model.api.InputClause) DecisionRule(org.kie.dmn.model.api.DecisionRule)

Example 3 with DecisionTable

use of org.kie.dmn.model.api.DecisionTable in project drools by kiegroup.

the class DecisionTableConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    DecisionTable dt = (DecisionTable) parent;
    if (dt.getHitPolicy() != null)
        writer.addAttribute(HIT_POLICY, dt.getHitPolicy().value());
    if (dt.getAggregation() != null)
        writer.addAttribute(AGGREGATION, dt.getAggregation().value());
    if (dt.getPreferredOrientation() != null)
        writer.addAttribute(PREFERRED_ORIENTATION, dt.getPreferredOrientation().value());
    if (dt.getOutputLabel() != null)
        writer.addAttribute(OUTPUT_LABEL, dt.getOutputLabel());
}
Also used : DecisionTable(org.kie.dmn.model.api.DecisionTable) TDecisionTable(org.kie.dmn.model.v1_3.TDecisionTable)

Example 4 with DecisionTable

use of org.kie.dmn.model.api.DecisionTable in project drools by kiegroup.

the class DecisionTableConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DecisionTable dt = (DecisionTable) parent;
    for (InputClause i : dt.getInput()) {
        writeChildrenNode(writer, context, i, INPUT);
    }
    for (OutputClause o : dt.getOutput()) {
        writeChildrenNode(writer, context, o, OUTPUT);
    }
    for (RuleAnnotationClause a : dt.getAnnotation()) {
        writeChildrenNode(writer, context, a, ANNOTATION);
    }
    for (DecisionRule r : dt.getRule()) {
        writeChildrenNode(writer, context, r, RULE);
    }
}
Also used : OutputClause(org.kie.dmn.model.api.OutputClause) DecisionTable(org.kie.dmn.model.api.DecisionTable) TDecisionTable(org.kie.dmn.model.v1_2.TDecisionTable) RuleAnnotationClause(org.kie.dmn.model.api.RuleAnnotationClause) InputClause(org.kie.dmn.model.api.InputClause) DecisionRule(org.kie.dmn.model.api.DecisionRule)

Example 5 with DecisionTable

use of org.kie.dmn.model.api.DecisionTable in project drools by kiegroup.

the class DecisionTableConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    DecisionTable dt = (DecisionTable) parent;
    String hitPolicyValue = reader.getAttribute(HIT_POLICY);
    String aggregationValue = reader.getAttribute(AGGREGATION);
    String preferredOrientationValue = reader.getAttribute(PREFERRED_ORIENTATION);
    String outputLabel = reader.getAttribute(OUTPUT_LABEL);
    if (hitPolicyValue != null)
        dt.setHitPolicy(HitPolicy.fromValue(hitPolicyValue));
    if (aggregationValue != null)
        dt.setAggregation(BuiltinAggregator.fromValue(aggregationValue));
    if (preferredOrientationValue != null)
        dt.setPreferredOrientation(DecisionTableOrientation.fromValue(preferredOrientationValue));
    dt.setOutputLabel(outputLabel);
}
Also used : DecisionTable(org.kie.dmn.model.api.DecisionTable) TDecisionTable(org.kie.dmn.model.v1_2.TDecisionTable)

Aggregations

DecisionTable (org.kie.dmn.model.api.DecisionTable)24 OutputClause (org.kie.dmn.model.api.OutputClause)7 Definitions (org.kie.dmn.model.api.Definitions)6 InputClause (org.kie.dmn.model.api.InputClause)6 DecisionRule (org.kie.dmn.model.api.DecisionRule)5 TDecisionTable (org.kie.dmn.model.v1_2.TDecisionTable)5 DTAnalysis (org.kie.dmn.validation.dtanalysis.model.DTAnalysis)5 DMNMessage (org.kie.dmn.api.core.DMNMessage)4 Decision (org.kie.dmn.model.api.Decision)4 TDecisionTable (org.kie.dmn.model.v1_3.TDecisionTable)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 QName (javax.xml.namespace.QName)3 Test (org.junit.Test)3 BigDecimal (java.math.BigDecimal)2 Collectors (java.util.stream.Collectors)2 DMNContext (org.kie.dmn.api.core.DMNContext)2 DMNModel (org.kie.dmn.api.core.DMNModel)2 DMNResult (org.kie.dmn.api.core.DMNResult)2 DMNRuntime (org.kie.dmn.api.core.DMNRuntime)2