Search in sources :

Example 6 with DiagramElement

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

the class DiagramElementConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    DiagramElement abs = (DiagramElement) parent;
    if (abs.getId() != null) {
        writer.addAttribute(ID, abs.getId());
    }
    if (abs.getSharedStyle() != null) {
        writer.addAttribute(SHARED_STYLE, abs.getSharedStyle().getId());
    }
}
Also used : DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement)

Example 7 with DiagramElement

use of org.kie.dmn.model.api.dmndi.DiagramElement 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 8 with DiagramElement

use of org.kie.dmn.model.api.dmndi.DiagramElement 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 9 with DiagramElement

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

the class DiagramElementConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DiagramElement abs = (DiagramElement) parent;
    if (abs.getExtension() != null) {
        writeChildrenNode(writer, context, abs.getExtension(), EXTENSION);
    }
    if (abs.getStyle() != null) {
        writeChildrenNode(writer, context, abs.getStyle(), STYLE);
    }
}
Also used : DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement)

Example 10 with DiagramElement

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

Aggregations

DiagramElement (org.kie.dmn.model.api.dmndi.DiagramElement)11 DMNDiagram (org.kie.dmn.model.api.dmndi.DMNDiagram)4 DMNStyle (org.kie.dmn.model.api.dmndi.DMNStyle)2 Style (org.kie.dmn.model.api.dmndi.Style)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 DMNShape (org.kie.dmn.model.api.dmndi.DMNShape)1