Search in sources :

Example 16 with JSIDMNDiagram

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram in project kie-wb-common by kiegroup.

the class DRGDiagramUtils method newJSIDRGInstance.

public static JSIDMNDiagram newJSIDRGInstance() {
    final JSIDMNDiagram diagram = new JSIDMNDiagram();
    diagram.setId(new Id().getValue());
    diagram.setName(DRG);
    return diagram;
}
Also used : JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 17 with JSIDMNDiagram

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram in project kie-wb-common by kiegroup.

the class DMNUnmarshaller method findComponentsWidthsExtensions.

private List<JSITComponentsWidthsExtension> findComponentsWidthsExtensions(final List<JSIDMNDiagram> dmnDDDiagrams) {
    final List<JSITComponentsWidthsExtension> componentsWidthsExtensions = new ArrayList<>();
    for (int index = 0, dmnDiagram1Size = dmnDDDiagrams.size(); index < dmnDiagram1Size; index++) {
        final JSIDMNDiagram jsiDiagram = Js.uncheckedCast(dmnDDDiagrams.get(index));
        final JSIDiagramElement.JSIExtension dmnDDExtensions = Js.uncheckedCast(jsiDiagram.getExtension());
        if (Objects.isNull(dmnDDExtensions)) {
            break;
        }
        if (Objects.isNull(dmnDDExtensions.getAny())) {
            break;
        }
        final List<Object> extensions = dmnDDExtensions.getAny();
        if (!Objects.isNull(extensions)) {
            for (int i = 0; i < extensions.size(); i++) {
                final Object wrapped = extensions.get(i);
                final Object extension = JsUtils.getUnwrappedElement(wrapped);
                if (JSITComponentsWidthsExtension.instanceOf(extension)) {
                    final JSITComponentsWidthsExtension jsiExtension = Js.uncheckedCast(extension);
                    componentsWidthsExtensions.add(jsiExtension);
                }
            }
        }
    }
    return componentsWidthsExtensions;
}
Also used : JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) JSITComponentsWidthsExtension(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentsWidthsExtension) JSIDiagramElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement) ArrayList(java.util.ArrayList)

Example 18 with JSIDMNDiagram

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram in project kie-wb-common by kiegroup.

the class IdUtilsTest method testGetShapeIdWhenDiagramNameIsNull.

@Test
public void testGetShapeIdWhenDiagramNameIsNull() {
    final JSIDMNDiagram diagram = mock(JSIDMNDiagram.class);
    assertEquals("dmnshape-_1111-2222", getShapeId(diagram, list(), "_1111-2222"));
}
Also used : JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) Test(org.junit.Test)

Example 19 with JSIDMNDiagram

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram in project kie-wb-common by kiegroup.

the class NodeEntriesFactory method getShapesByDiagramId.

private Map<JSIDMNShape, String> getShapesByDiagramId(final JSITDefinitions definitions) {
    final Map<JSIDMNShape, String> dmnShapesByDiagramId = new HashMap<>();
    final List<JSIDMNDiagram> diagrams = definitions.getDMNDI().getDMNDiagram();
    forEach(diagrams, diagram -> {
        final String diagramId = diagram.getId();
        final List<JSIDiagramElement> diagramElements = diagram.getDMNDiagramElement();
        forEach(diagramElements, diagramElement -> {
            if (JSIDMNShape.instanceOf(diagramElement)) {
                final JSIDMNShape shape = Js.uncheckedCast(diagramElement);
                dmnShapesByDiagramId.put(shape, diagramId);
            }
        });
    });
    return dmnShapesByDiagramId;
}
Also used : JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) HashMap(java.util.HashMap) JSIDiagramElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement) JSIDMNShape(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape)

Aggregations

JSIDMNDiagram (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram)14 ArrayList (java.util.ArrayList)7 JSIDMNEdge (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge)6 Test (org.junit.Test)5 JSIDiagramElement (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement)5 List (java.util.List)4 QName (javax.xml.namespace.QName)4 Edge (org.kie.workbench.common.stunner.core.graph.Edge)4 View (org.kie.workbench.common.stunner.core.graph.content.view.View)4 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)4 HashMap (java.util.HashMap)3 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)3 JSITDefinitions (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)3 JSIDMNShape (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape)3 Node (org.kie.workbench.common.stunner.core.graph.Node)3 ControlPoint (org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint)3 DiscreteConnection (org.kie.workbench.common.stunner.core.graph.content.view.DiscreteConnection)3 DMNViewDefinition (org.kie.workbench.common.dmn.api.definition.DMNViewDefinition)2 Association (org.kie.workbench.common.dmn.api.definition.model.Association)2 DMNDiagramElement (org.kie.workbench.common.dmn.api.definition.model.DMNDiagramElement)2