Search in sources :

Example 1 with DMNDiagram

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

the class DMNDiagramConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNDiagram style = (DMNDiagram) parent;
    if (style.getSize() != null) {
        writeChildrenNode(writer, context, style.getSize(), SIZE);
    }
    for (DiagramElement de : style.getDMNDiagramElement()) {
        writeChildrenNode(writer, context, de, de.getClass().getSimpleName());
    }
}
Also used : DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement) DMNDiagram(org.kie.dmn.model.api.dmndi.DMNDiagram)

Example 2 with DMNDiagram

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

the class DMNDI method normalize.

@Override
public void normalize() {
    if (dmnStyle == null || dmnDiagram == null) {
        return;
    }
    Map<String, DMNStyle> styleById = dmnStyle.stream().collect(Collectors.toMap(DMNStyle::getId, Function.identity()));
    for (DMNDiagram diagram : dmnDiagram) {
        for (DiagramElement element : diagram.getDMNDiagramElement()) {
            replaceSharedStyleIfStubbed(element, styleById);
            if (element instanceof DMNShape) {
                DMNShape dmnShape = (DMNShape) element;
                replaceSharedStyleIfStubbed(dmnShape.getDMNLabel(), styleById);
            }
        }
    }
}
Also used : DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement) DMNDiagram(org.kie.dmn.model.api.dmndi.DMNDiagram) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 3 with DMNDiagram

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

the class DMNDI method normalize.

@Override
public void normalize() {
    if (dmnStyle == null || dmnDiagram == null) {
        return;
    }
    Map<String, DMNStyle> styleById = dmnStyle.stream().collect(Collectors.toMap(DMNStyle::getId, Function.identity()));
    for (DMNDiagram diagram : dmnDiagram) {
        for (DiagramElement element : diagram.getDMNDiagramElement()) {
            replaceSharedStyleIfStubbed(element, styleById);
            if (element instanceof DMNShape) {
                DMNShape dmnShape = (DMNShape) element;
                replaceSharedStyleIfStubbed(dmnShape.getDMNLabel(), styleById);
            }
        }
    }
}
Also used : DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement) DMNDiagram(org.kie.dmn.model.api.dmndi.DMNDiagram) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 4 with DMNDiagram

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

the class DMNDIConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNDI list = (DMNDI) parent;
    for (DMNDiagram e : list.getDMNDiagram()) {
        writeChildrenNode(writer, context, e, DMN_DIAGRAM);
    }
    for (DMNStyle e : list.getDMNStyle()) {
        writeChildrenNode(writer, context, e, DMN_STYLE);
    }
}
Also used : DMNDiagram(org.kie.dmn.model.api.dmndi.DMNDiagram) DMNDI(org.kie.dmn.model.api.dmndi.DMNDI) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 5 with DMNDiagram

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

the class DMNDIConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNDI list = (DMNDI) parent;
    for (DMNDiagram e : list.getDMNDiagram()) {
        writeChildrenNode(writer, context, e, DMN_DIAGRAM);
    }
    for (DMNStyle e : list.getDMNStyle()) {
        writeChildrenNode(writer, context, e, DMN_STYLE);
    }
}
Also used : DMNDiagram(org.kie.dmn.model.api.dmndi.DMNDiagram) DMNDI(org.kie.dmn.model.api.dmndi.DMNDI) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Aggregations

DMNDiagram (org.kie.dmn.model.api.dmndi.DMNDiagram)6 DMNStyle (org.kie.dmn.model.api.dmndi.DMNStyle)4 DiagramElement (org.kie.dmn.model.api.dmndi.DiagramElement)4 DMNDI (org.kie.dmn.model.api.dmndi.DMNDI)2