Search in sources :

Example 1 with BusinessKnowledgeModel

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

the class BusinessKnowledgeModelConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    BusinessKnowledgeModel bkm = (BusinessKnowledgeModel) parent;
    if (bkm.getEncapsulatedLogic() != null)
        writeChildrenNode(writer, context, bkm.getEncapsulatedLogic(), ENCAPSULATED_LOGIC);
    // Now as Invocable: if (bkm.getVariable() != null) writeChildrenNode(writer, context, bkm.getVariable(), VARIABLE);
    for (KnowledgeRequirement i : bkm.getKnowledgeRequirement()) {
        writeChildrenNode(writer, context, i, KNOWLEDGE_REQUIREMENT);
    }
    for (AuthorityRequirement a : bkm.getAuthorityRequirement()) {
        writeChildrenNode(writer, context, a, AUTHORITY_REQUIREMENT);
    }
}
Also used : KnowledgeRequirement(org.kie.dmn.model.api.KnowledgeRequirement) BusinessKnowledgeModel(org.kie.dmn.model.api.BusinessKnowledgeModel) TBusinessKnowledgeModel(org.kie.dmn.model.v1_2.TBusinessKnowledgeModel) AuthorityRequirement(org.kie.dmn.model.api.AuthorityRequirement)

Example 2 with BusinessKnowledgeModel

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

the class BusinessKnowledgeModelConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    BusinessKnowledgeModel bkm = (BusinessKnowledgeModel) parent;
    if (bkm.getEncapsulatedLogic() != null)
        writeChildrenNode(writer, context, bkm.getEncapsulatedLogic(), ENCAPSULATED_LOGIC);
    // Now as Invocable: if (bkm.getVariable() != null) writeChildrenNode(writer, context, bkm.getVariable(), VARIABLE);
    for (KnowledgeRequirement i : bkm.getKnowledgeRequirement()) {
        writeChildrenNode(writer, context, i, KNOWLEDGE_REQUIREMENT);
    }
    for (AuthorityRequirement a : bkm.getAuthorityRequirement()) {
        writeChildrenNode(writer, context, a, AUTHORITY_REQUIREMENT);
    }
}
Also used : KnowledgeRequirement(org.kie.dmn.model.api.KnowledgeRequirement) BusinessKnowledgeModel(org.kie.dmn.model.api.BusinessKnowledgeModel) TBusinessKnowledgeModel(org.kie.dmn.model.v1_3.TBusinessKnowledgeModel) AuthorityRequirement(org.kie.dmn.model.api.AuthorityRequirement)

Example 3 with BusinessKnowledgeModel

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

the class DefinitionsConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Definitions def = (Definitions) parent;
    for (Import i : def.getImport()) {
        writeChildrenNode(writer, context, i, IMPORT);
    }
    for (ItemDefinition id : def.getItemDefinition()) {
        writeChildrenNode(writer, context, id, ITEM_DEFINITION);
    }
    for (DRGElement e : def.getDrgElement()) {
        String nodeName = DRG_ELEMENT;
        if (e instanceof BusinessKnowledgeModel) {
            nodeName = "businessKnowledgeModel";
        } else if (e instanceof Decision) {
            nodeName = "decision";
        } else if (e instanceof InputData) {
            nodeName = "inputData";
        } else if (e instanceof KnowledgeSource) {
            nodeName = "knowledgeSource";
        } else if (e instanceof DecisionService) {
            nodeName = "decisionService";
        }
        writeChildrenNode(writer, context, e, nodeName);
    }
    for (Artifact a : def.getArtifact()) {
        String nodeName = ARTIFACT;
        if (a instanceof Association) {
            nodeName = "association";
        } else if (a instanceof TextAnnotation) {
            nodeName = "textAnnotation";
        } else if (a instanceof Group) {
            nodeName = "group";
        }
        writeChildrenNode(writer, context, a, nodeName);
    }
    for (ElementCollection ec : def.getElementCollection()) {
        writeChildrenNode(writer, context, ec, ELEMENT_COLLECTION);
    }
    for (BusinessContextElement bce : def.getBusinessContextElement()) {
        String nodeName = BUSINESS_CONTEXT_ELEMENT;
        if (bce instanceof OrganizationUnit) {
            nodeName = "organizationUnit";
        } else if (bce instanceof PerformanceIndicator) {
            nodeName = "performanceIndicator";
        }
        writeChildrenNode(writer, context, bce, nodeName);
    }
    if (def.getDMNDI() != null) {
        writeChildrenNode(writer, context, def.getDMNDI(), "DMNDI");
    }
}
Also used : Group(org.kie.dmn.model.api.Group) Import(org.kie.dmn.model.api.Import) PerformanceIndicator(org.kie.dmn.model.api.PerformanceIndicator) Definitions(org.kie.dmn.model.api.Definitions) TDefinitions(org.kie.dmn.model.v1_3.TDefinitions) ItemDefinition(org.kie.dmn.model.api.ItemDefinition) BusinessContextElement(org.kie.dmn.model.api.BusinessContextElement) Decision(org.kie.dmn.model.api.Decision) Artifact(org.kie.dmn.model.api.Artifact) DecisionService(org.kie.dmn.model.api.DecisionService) Association(org.kie.dmn.model.api.Association) KnowledgeSource(org.kie.dmn.model.api.KnowledgeSource) OrganizationUnit(org.kie.dmn.model.api.OrganizationUnit) BusinessKnowledgeModel(org.kie.dmn.model.api.BusinessKnowledgeModel) ElementCollection(org.kie.dmn.model.api.ElementCollection) InputData(org.kie.dmn.model.api.InputData) TextAnnotation(org.kie.dmn.model.api.TextAnnotation) DRGElement(org.kie.dmn.model.api.DRGElement)

Example 4 with BusinessKnowledgeModel

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

the class BusinessKnowledgeModelConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    BusinessKnowledgeModel bkm = (BusinessKnowledgeModel) parent;
    if (bkm.getEncapsulatedLogic() != null)
        writeChildrenNode(writer, context, bkm.getEncapsulatedLogic(), ENCAPSULATED_LOGIC);
    // Now as Invocable: if (bkm.getVariable() != null) writeChildrenNode(writer, context, bkm.getVariable(), VARIABLE);
    for (KnowledgeRequirement i : bkm.getKnowledgeRequirement()) {
        writeChildrenNode(writer, context, i, KNOWLEDGE_REQUIREMENT);
    }
    for (AuthorityRequirement a : bkm.getAuthorityRequirement()) {
        writeChildrenNode(writer, context, a, AUTHORITY_REQUIREMENT);
    }
}
Also used : KnowledgeRequirement(org.kie.dmn.model.api.KnowledgeRequirement) TBusinessKnowledgeModel(org.kie.dmn.model.v1_4.TBusinessKnowledgeModel) BusinessKnowledgeModel(org.kie.dmn.model.api.BusinessKnowledgeModel) AuthorityRequirement(org.kie.dmn.model.api.AuthorityRequirement)

Example 5 with BusinessKnowledgeModel

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

the class DMNEvaluatorCompiler method inferTypeRef.

public static BaseDMNTypeImpl inferTypeRef(DMNModelImpl model, DecisionTable dt, OutputClause oc) {
    BaseDMNTypeImpl typeRef = (BaseDMNTypeImpl) model.getTypeRegistry().unknown();
    if (oc.getTypeRef() != null) {
        QName outputExpressionTypeRef = oc.getTypeRef();
        QName resolvedOutputExpressionTypeRef = DMNCompilerImpl.getNamespaceAndName(oc, model.getImportAliasesForNS(), outputExpressionTypeRef, model.getNamespace());
        typeRef = (BaseDMNTypeImpl) model.getTypeRegistry().resolveType(resolvedOutputExpressionTypeRef.getNamespaceURI(), resolvedOutputExpressionTypeRef.getLocalPart());
        if (typeRef == null) {
            typeRef = (BaseDMNTypeImpl) model.getTypeRegistry().unknown();
        }
    } else if (dt.getOutput().size() == 1 && (dt.getParent() instanceof Decision || dt.getParent() instanceof BusinessKnowledgeModel || dt.getParent() instanceof ContextEntry)) {
        QName inferredTypeRef = recurseUpToInferTypeRef(model, oc, dt);
        // if inferredTypeRef is null, a std err will have been reported
        if (inferredTypeRef != null) {
            QName resolvedInferredTypeRef = DMNCompilerImpl.getNamespaceAndName(oc, model.getImportAliasesForNS(), inferredTypeRef, model.getNamespace());
            typeRef = (BaseDMNTypeImpl) model.getTypeRegistry().resolveType(resolvedInferredTypeRef.getNamespaceURI(), resolvedInferredTypeRef.getLocalPart());
        }
    }
    return typeRef;
}
Also used : QName(javax.xml.namespace.QName) BusinessKnowledgeModel(org.kie.dmn.model.api.BusinessKnowledgeModel) BaseDMNTypeImpl(org.kie.dmn.core.impl.BaseDMNTypeImpl) Decision(org.kie.dmn.model.api.Decision) ContextEntry(org.kie.dmn.model.api.ContextEntry)

Aggregations

BusinessKnowledgeModel (org.kie.dmn.model.api.BusinessKnowledgeModel)10 Decision (org.kie.dmn.model.api.Decision)5 Artifact (org.kie.dmn.model.api.Artifact)4 Association (org.kie.dmn.model.api.Association)4 AuthorityRequirement (org.kie.dmn.model.api.AuthorityRequirement)4 BusinessContextElement (org.kie.dmn.model.api.BusinessContextElement)4 DRGElement (org.kie.dmn.model.api.DRGElement)4 Definitions (org.kie.dmn.model.api.Definitions)4 ElementCollection (org.kie.dmn.model.api.ElementCollection)4 Import (org.kie.dmn.model.api.Import)4 InputData (org.kie.dmn.model.api.InputData)4 ItemDefinition (org.kie.dmn.model.api.ItemDefinition)4 KnowledgeRequirement (org.kie.dmn.model.api.KnowledgeRequirement)4 KnowledgeSource (org.kie.dmn.model.api.KnowledgeSource)4 OrganizationUnit (org.kie.dmn.model.api.OrganizationUnit)4 PerformanceIndicator (org.kie.dmn.model.api.PerformanceIndicator)4 TextAnnotation (org.kie.dmn.model.api.TextAnnotation)4 DecisionService (org.kie.dmn.model.api.DecisionService)3 Group (org.kie.dmn.model.api.Group)2 QName (javax.xml.namespace.QName)1