Search in sources :

Example 1 with Import

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

the class ImportConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    Import i = (Import) parent;
    if (i.getNamespace() != null)
        writer.addAttribute(NAMESPACE, i.getNamespace());
    if (i.getLocationURI() != null)
        writer.addAttribute(LOCATION_URI, i.getLocationURI());
    if (i.getImportType() != null)
        writer.addAttribute(IMPORT_TYPE, i.getImportType());
}
Also used : TImport(org.kie.dmn.model.v1_1.TImport) Import(org.kie.dmn.model.api.Import)

Example 2 with Import

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

the class ImportConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    Import i = (Import) parent;
    String namespace = reader.getAttribute(NAMESPACE);
    String locationUri = reader.getAttribute(LOCATION_URI);
    String importType = reader.getAttribute(IMPORT_TYPE);
    i.setNamespace(namespace);
    i.setLocationURI(locationUri);
    i.setImportType(importType);
}
Also used : TImport(org.kie.dmn.model.v1_1.TImport) Import(org.kie.dmn.model.api.Import)

Example 3 with Import

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

the class ImportConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    Import i = (Import) parent;
    String namespace = reader.getAttribute(NAMESPACE);
    String locationUri = reader.getAttribute(LOCATION_URI);
    String importType = reader.getAttribute(IMPORT_TYPE);
    i.setNamespace(namespace);
    i.setLocationURI(locationUri);
    i.setImportType(importType);
}
Also used : TImport(org.kie.dmn.model.v1_2.TImport) Import(org.kie.dmn.model.api.Import)

Example 4 with Import

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

the class ImportConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    Import i = (Import) parent;
    String namespace = reader.getAttribute(NAMESPACE);
    String locationUri = reader.getAttribute(LOCATION_URI);
    String importType = reader.getAttribute(IMPORT_TYPE);
    i.setNamespace(namespace);
    i.setLocationURI(locationUri);
    i.setImportType(importType);
}
Also used : TImport(org.kie.dmn.model.v1_4.TImport) Import(org.kie.dmn.model.api.Import)

Example 5 with Import

use of org.kie.dmn.model.api.Import 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)

Aggregations

Import (org.kie.dmn.model.api.Import)42 Test (org.junit.Test)22 QName (javax.xml.namespace.QName)19 TImport (org.kie.dmn.model.v1_1.TImport)15 Definitions (org.kie.dmn.model.api.Definitions)13 HashMap (java.util.HashMap)7 DRGElement (org.kie.dmn.model.api.DRGElement)7 ItemDefinition (org.kie.dmn.model.api.ItemDefinition)6 ArrayList (java.util.ArrayList)5 BusinessKnowledgeModel (org.kie.dmn.model.api.BusinessKnowledgeModel)5 Decision (org.kie.dmn.model.api.Decision)5 PMMLDocumentMetadata (org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata)5 Artifact (org.kie.dmn.model.api.Artifact)4 Association (org.kie.dmn.model.api.Association)4 BusinessContextElement (org.kie.dmn.model.api.BusinessContextElement)4 ElementCollection (org.kie.dmn.model.api.ElementCollection)4 InputData (org.kie.dmn.model.api.InputData)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