Search in sources :

Example 11 with BusinessContextElement

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

the class BusinessContextElementConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    BusinessContextElement bce = (BusinessContextElement) parent;
    String uri = reader.getAttribute(URI);
    bce.setURI(uri);
}
Also used : BusinessContextElement(org.kie.dmn.model.api.BusinessContextElement)

Example 12 with BusinessContextElement

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

the class BusinessContextElementConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    BusinessContextElement bce = (BusinessContextElement) parent;
    String uri = reader.getAttribute(URI);
    bce.setURI(uri);
}
Also used : BusinessContextElement(org.kie.dmn.model.api.BusinessContextElement)

Example 13 with BusinessContextElement

use of org.kie.dmn.model.api.BusinessContextElement 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) TDefinitions(org.kie.dmn.model.v1_4.TDefinitions) Definitions(org.kie.dmn.model.api.Definitions) 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 14 with BusinessContextElement

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

the class BusinessContextElementConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    BusinessContextElement bce = (BusinessContextElement) parent;
    if (bce.getURI() != null)
        writer.addAttribute(URI, bce.getURI());
}
Also used : BusinessContextElement(org.kie.dmn.model.api.BusinessContextElement)

Example 15 with BusinessContextElement

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

the class DefinitionsConverter method assignChildElement.

@Override
protected void assignChildElement(Object parent, String nodeName, Object child) {
    Definitions def = (Definitions) parent;
    if (IMPORT.equals(nodeName)) {
        def.getImport().add((Import) child);
    } else if (ITEM_DEFINITION.equals(nodeName)) {
        def.getItemDefinition().add((ItemDefinition) child);
    } else if (child instanceof DRGElement) {
        def.getDrgElement().add((DRGElement) child);
    } else if (child instanceof Artifact) {
        def.getArtifact().add((Artifact) child);
    } else if (ELEMENT_COLLECTION.equals(nodeName)) {
        def.getElementCollection().add((ElementCollection) child);
    } else if (child instanceof BusinessContextElement) {
        def.getBusinessContextElement().add((BusinessContextElement) child);
    } else if (child instanceof DMNDI) {
        DMNDI dmndi = (DMNDI) child;
        dmndi.normalize();
        def.setDMNDI(dmndi);
    } else {
        super.assignChildElement(def, nodeName, child);
    }
}
Also used : Definitions(org.kie.dmn.model.api.Definitions) TDefinitions(org.kie.dmn.model.v1_3.TDefinitions) ItemDefinition(org.kie.dmn.model.api.ItemDefinition) DMNDI(org.kie.dmn.model.api.dmndi.DMNDI) BusinessContextElement(org.kie.dmn.model.api.BusinessContextElement) Artifact(org.kie.dmn.model.api.Artifact) DRGElement(org.kie.dmn.model.api.DRGElement)

Aggregations

BusinessContextElement (org.kie.dmn.model.api.BusinessContextElement)15 Artifact (org.kie.dmn.model.api.Artifact)7 DRGElement (org.kie.dmn.model.api.DRGElement)7 Definitions (org.kie.dmn.model.api.Definitions)7 ItemDefinition (org.kie.dmn.model.api.ItemDefinition)7 Association (org.kie.dmn.model.api.Association)4 BusinessKnowledgeModel (org.kie.dmn.model.api.BusinessKnowledgeModel)4 Decision (org.kie.dmn.model.api.Decision)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 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 DMNDI (org.kie.dmn.model.api.dmndi.DMNDI)3 Group (org.kie.dmn.model.api.Group)2 TDefinitions (org.kie.dmn.model.v1_2.TDefinitions)2 TDefinitions (org.kie.dmn.model.v1_3.TDefinitions)2