Search in sources :

Example 1 with DMNElementReference

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

the class DMNElementReferenceConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    DMNElementReference er = (DMNElementReference) parent;
    String href = reader.getAttribute(HREF);
    er.setHref(href);
}
Also used : DMNElementReference(org.kie.dmn.model.api.DMNElementReference) TDMNElementReference(org.kie.dmn.model.v1_1.TDMNElementReference)

Example 2 with DMNElementReference

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

the class DecisionConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Decision dec = (Decision) parent;
    if (dec.getQuestion() != null)
        writeChildrenNodeAsValue(writer, context, dec.getQuestion(), QUESTION);
    if (dec.getAllowedAnswers() != null)
        writeChildrenNodeAsValue(writer, context, dec.getAllowedAnswers(), ALLOWED_ANSWERS);
    if (dec.getVariable() != null)
        writeChildrenNode(writer, context, dec.getVariable(), VARIABLE);
    for (InformationRequirement ir : dec.getInformationRequirement()) {
        writeChildrenNode(writer, context, ir, INFORMATION_REQUIREMENT);
    }
    for (KnowledgeRequirement kr : dec.getKnowledgeRequirement()) {
        writeChildrenNode(writer, context, kr, KNOWLEDGE_REQUIREMENT);
    }
    for (AuthorityRequirement ar : dec.getAuthorityRequirement()) {
        writeChildrenNode(writer, context, ar, AUTHORITY_REQUIREMENT);
    }
    for (DMNElementReference so : dec.getSupportedObjective()) {
        writeChildrenNode(writer, context, so, SUPPORTED_OBJECTIVE);
    }
    for (DMNElementReference ipi : dec.getImpactedPerformanceIndicator()) {
        writeChildrenNode(writer, context, ipi, IMPACTED_PERFORMANCE_INDICATOR);
    }
    for (DMNElementReference dm : dec.getDecisionMaker()) {
        writeChildrenNode(writer, context, dm, DECISION_MAKER);
    }
    for (DMNElementReference downer : dec.getDecisionOwner()) {
        writeChildrenNode(writer, context, downer, DECISION_OWNER);
    }
    for (DMNElementReference up : dec.getUsingProcess()) {
        writeChildrenNode(writer, context, up, USING_PROCESS);
    }
    for (DMNElementReference ut : dec.getUsingTask()) {
        writeChildrenNode(writer, context, ut, USING_TASK);
    }
    if (dec.getExpression() != null) {
        Expression e = dec.getExpression();
        String nodeName = MarshallingUtils.defineExpressionNodeName(e);
        writeChildrenNode(writer, context, e, nodeName);
    }
}
Also used : KnowledgeRequirement(org.kie.dmn.model.api.KnowledgeRequirement) DMNElementReference(org.kie.dmn.model.api.DMNElementReference) InformationRequirement(org.kie.dmn.model.api.InformationRequirement) Expression(org.kie.dmn.model.api.Expression) AuthorityRequirement(org.kie.dmn.model.api.AuthorityRequirement) TDecision(org.kie.dmn.model.v1_1.TDecision) Decision(org.kie.dmn.model.api.Decision)

Example 3 with DMNElementReference

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

the class PerformanceIndicatorConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    PerformanceIndicator pi = (PerformanceIndicator) parent;
    for (DMNElementReference id : pi.getImpactingDecision()) {
        writeChildrenNode(writer, context, id, IMPACTING_DECISION);
    }
}
Also used : PerformanceIndicator(org.kie.dmn.model.api.PerformanceIndicator) TPerformanceIndicator(org.kie.dmn.model.v1_1.TPerformanceIndicator) DMNElementReference(org.kie.dmn.model.api.DMNElementReference)

Example 4 with DMNElementReference

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

the class DecisionConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Decision dec = (Decision) parent;
    if (dec.getQuestion() != null)
        writeChildrenNodeAsValue(writer, context, dec.getQuestion(), QUESTION);
    if (dec.getAllowedAnswers() != null)
        writeChildrenNodeAsValue(writer, context, dec.getAllowedAnswers(), ALLOWED_ANSWERS);
    if (dec.getVariable() != null)
        writeChildrenNode(writer, context, dec.getVariable(), VARIABLE);
    for (InformationRequirement ir : dec.getInformationRequirement()) {
        writeChildrenNode(writer, context, ir, INFORMATION_REQUIREMENT);
    }
    for (KnowledgeRequirement kr : dec.getKnowledgeRequirement()) {
        writeChildrenNode(writer, context, kr, KNOWLEDGE_REQUIREMENT);
    }
    for (AuthorityRequirement ar : dec.getAuthorityRequirement()) {
        writeChildrenNode(writer, context, ar, AUTHORITY_REQUIREMENT);
    }
    for (DMNElementReference so : dec.getSupportedObjective()) {
        writeChildrenNode(writer, context, so, SUPPORTED_OBJECTIVE);
    }
    for (DMNElementReference ipi : dec.getImpactedPerformanceIndicator()) {
        writeChildrenNode(writer, context, ipi, IMPACTED_PERFORMANCE_INDICATOR);
    }
    for (DMNElementReference dm : dec.getDecisionMaker()) {
        writeChildrenNode(writer, context, dm, DECISION_MAKER);
    }
    for (DMNElementReference downer : dec.getDecisionOwner()) {
        writeChildrenNode(writer, context, downer, DECISION_OWNER);
    }
    for (DMNElementReference up : dec.getUsingProcess()) {
        writeChildrenNode(writer, context, up, USING_PROCESS);
    }
    for (DMNElementReference ut : dec.getUsingTask()) {
        writeChildrenNode(writer, context, ut, USING_TASK);
    }
    if (dec.getExpression() != null) {
        Expression e = dec.getExpression();
        String nodeName = MarshallingUtils.defineExpressionNodeName(e);
        writeChildrenNode(writer, context, e, nodeName);
    }
}
Also used : KnowledgeRequirement(org.kie.dmn.model.api.KnowledgeRequirement) DMNElementReference(org.kie.dmn.model.api.DMNElementReference) InformationRequirement(org.kie.dmn.model.api.InformationRequirement) Expression(org.kie.dmn.model.api.Expression) AuthorityRequirement(org.kie.dmn.model.api.AuthorityRequirement) TDecision(org.kie.dmn.model.v1_2.TDecision) Decision(org.kie.dmn.model.api.Decision)

Example 5 with DMNElementReference

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

the class DecisionServiceConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DecisionService decisionService = (DecisionService) parent;
    for (DMNElementReference ref : decisionService.getOutputDecision()) {
        writeChildrenNode(writer, context, ref, OUTPUT_DECISION);
    }
    for (DMNElementReference ref : decisionService.getEncapsulatedDecision()) {
        writeChildrenNode(writer, context, ref, ENCAPSULATED_DECISION);
    }
    for (DMNElementReference ref : decisionService.getInputDecision()) {
        writeChildrenNode(writer, context, ref, INPUT_DECISION);
    }
    for (DMNElementReference ref : decisionService.getInputData()) {
        writeChildrenNode(writer, context, ref, INPUT_DATA);
    }
}
Also used : DMNElementReference(org.kie.dmn.model.api.DMNElementReference) TDMNElementReference(org.kie.dmn.model.v1_2.TDMNElementReference) TDecisionService(org.kie.dmn.model.v1_2.TDecisionService) DecisionService(org.kie.dmn.model.api.DecisionService)

Aggregations

DMNElementReference (org.kie.dmn.model.api.DMNElementReference)36 Decision (org.kie.dmn.model.api.Decision)5 InformationRequirement (org.kie.dmn.model.api.InformationRequirement)5 TDMNElementReference (org.kie.dmn.model.v1_2.TDMNElementReference)5 AuthorityRequirement (org.kie.dmn.model.api.AuthorityRequirement)4 DMNModelInstrumentedBase (org.kie.dmn.model.api.DMNModelInstrumentedBase)4 DecisionService (org.kie.dmn.model.api.DecisionService)4 ElementCollection (org.kie.dmn.model.api.ElementCollection)4 Expression (org.kie.dmn.model.api.Expression)4 KnowledgeRequirement (org.kie.dmn.model.api.KnowledgeRequirement)4 OrganizationUnit (org.kie.dmn.model.api.OrganizationUnit)4 PerformanceIndicator (org.kie.dmn.model.api.PerformanceIndicator)4 TDMNElementReference (org.kie.dmn.model.v1_1.TDMNElementReference)4 TDMNElementReference (org.kie.dmn.model.v1_3.TDMNElementReference)4 TDMNElementReference (org.kie.dmn.model.v1_4.TDMNElementReference)4 IOException (java.io.IOException)2 Reader (java.io.Reader)2 Arrays (java.util.Arrays)2 List (java.util.List)2 CoreMatchers.is (org.hamcrest.CoreMatchers.is)2