Search in sources :

Example 1 with JSITDefinitions

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

the class DMNMarshallerTest method testAddNodeToDefinitionsIfNotPresentWhenNodeIsNotPresent.

@Test
public void testAddNodeToDefinitionsIfNotPresentWhenNodeIsNotPresent() {
    final DMNMarshaller dmnMarshaller = spy(new DMNMarshaller());
    final Optional<JSITDRGElement> existingNode = Optional.empty();
    final JSITDefinitions definitions = mock(JSITDefinitions.class);
    final JSITDRGElement node = mock(JSITDRGElement.class);
    doReturn(existingNode).when(dmnMarshaller).getExistingNode(definitions, node);
    doNothing().when(dmnMarshaller).addNodeToDefinitions(node, definitions);
    dmnMarshaller.addNodeToDefinitionsIfNotPresent(node, definitions);
    verify(dmnMarshaller).addNodeToDefinitions(node, definitions);
}
Also used : JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) Test(org.junit.Test)

Example 2 with JSITDefinitions

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

the class DMNMarshaller method marshall.

public JSITDefinitions marshall() {
    final Map<String, JSITDRGElement> nodes = new HashMap<>();
    final Map<String, JSITTextAnnotation> textAnnotations = new HashMap<>();
    final Node<View<DMNDiagram>, ?> dmnDiagramRoot = (Node<View<DMNDiagram>, ?>) DMNGraphUtils.findDMNDiagramRoot(dmnDiagramsSession.getDRGDiagram().getGraph());
    final Definitions definitionsStunnerPojo = ((DMNDiagram) getElementDefinition(dmnDiagramRoot)).getDefinitions();
    final List<String> dmnDiagramElementIds = new ArrayList<>();
    final JSITDefinitions definitions = DefinitionsConverter.dmnFromWB(definitionsStunnerPojo, true);
    if (Objects.isNull(definitions.getExtensionElements())) {
        JSITDMNElement.JSIExtensionElements jsiExtensionElements = new JSITDMNElement.JSIExtensionElements();
        definitions.setExtensionElements(jsiExtensionElements);
    }
    final JsArrayLike<JSIDMNDiagram> dmnDiagrams = definitions.getDMNDI().getNativeDMNDiagram();
    for (int i = 0; i < dmnDiagrams.getLength(); i++) {
        JSIDMNDiagram diagram = Js.uncheckedCast(dmnDiagrams.getAt(i));
        final String elementDiagramId = diagram.getId();
        final List<JSIDMNEdge> dmnEdges = new ArrayList<>();
        final List<Node> diagramNodes = getNodeStream(dmnDiagramsSession.getDiagram(elementDiagramId));
        // Setup callback for marshalling ComponentWidths
        if (Objects.isNull(diagram.getExtension())) {
            diagram.setExtension(new JSIDiagramElement.JSIExtension());
        }
        final JSITComponentsWidthsExtension componentsWidthsExtension = new JSITComponentsWidthsExtension();
        final JSIDiagramElement.JSIExtension extension = diagram.getExtension();
        JSITComponentsWidthsExtension wrappedComponentsWidthsExtension = WrapperUtils.getWrappedJSITComponentsWidthsExtension(componentsWidthsExtension);
        extension.addAny(wrappedComponentsWidthsExtension);
        final Consumer<JSITComponentWidths> componentWidthsConsumer = (cw) -> componentsWidthsExtension.addComponentWidths(cw);
        // Convert relative positioning to absolute
        for (final Node<?, ?> node : diagramNodes) {
            PointUtils.convertToAbsoluteBounds(node);
        }
        // Iterate Graph processing nodes..
        for (final Node<?, ?> node : diagramNodes) {
            if (!(node.getContent() instanceof View<?>)) {
                continue;
            }
            final View<?> view = (View<?>) node.getContent();
            final Object viewDefinition = view.getDefinition();
            if (!(viewDefinition instanceof HasContentDefinitionId)) {
                continue;
            }
            final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) viewDefinition;
            final String nodeDiagramId = hasContentDefinitionId.getDiagramId();
            if (!Objects.equals(nodeDiagramId, elementDiagramId)) {
                continue;
            }
            if (viewDefinition instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) viewDefinition;
                if (!drgElement.isAllowOnlyVisualChange()) {
                    if (nodes.containsKey(drgElement.getId().getValue())) {
                        final JSITDRGElement currentValue = nodes.get(drgElement.getId().getValue());
                        mergeNodeRequirements(stunnerToDMN(withIncludedModels(node, definitionsStunnerPojo), componentWidthsConsumer), currentValue);
                    } else {
                        nodes.put(drgElement.getId().getValue(), stunnerToDMN(withIncludedModels(node, definitionsStunnerPojo), componentWidthsConsumer));
                    }
                }
                final String namespaceURI = definitionsStunnerPojo.getDefaultNamespace();
                diagram.addDMNDiagramElement(WrapperUtils.getWrappedJSIDMNShape(diagram, dmnDiagramElementIds, definitionsStunnerPojo, (View<? extends DMNElement>) view, namespaceURI));
            }
            if (viewDefinition instanceof TextAnnotation) {
                final TextAnnotation textAnnotation = (TextAnnotation) viewDefinition;
                if (!textAnnotation.isAllowOnlyVisualChange()) {
                    textAnnotations.put(textAnnotation.getId().getValue(), textAnnotationConverter.dmnFromNode((Node<View<TextAnnotation>, ?>) node, componentWidthsConsumer));
                }
                final String namespaceURI = definitionsStunnerPojo.getDefaultNamespace();
                diagram.addDMNDiagramElement(WrapperUtils.getWrappedJSIDMNShape(diagram, dmnDiagramElementIds, definitionsStunnerPojo, (View<? extends DMNElement>) view, namespaceURI));
                final List<JSITAssociation> associations = AssociationConverter.dmnFromWB((Node<View<TextAnnotation>, ?>) node);
                forEach(associations, association -> {
                    final JSITAssociation wrappedJSITAssociation = WrapperUtils.getWrappedJSITAssociation(Js.uncheckedCast(association));
                    definitions.addArtifact(wrappedJSITAssociation);
                });
            }
            connect(diagram, dmnDiagramElementIds, definitionsStunnerPojo, dmnEdges, node, view);
        }
        nodes.values().forEach(node -> {
            addNodeToDefinitionsIfNotPresent(node, definitions);
        });
        textAnnotations.values().forEach(text -> {
            final boolean exists = anyMatch(definitions.getArtifact(), artifact -> Objects.equals(artifact.getId(), text.getId()));
            if (!exists) {
                definitions.addArtifact(WrapperUtils.getWrappedJSITTextAnnotation(text));
            }
        });
        forEach(dmnEdges, dmnEdge -> {
            final boolean exists = anyMatch(diagram.getDMNDiagramElement(), diagramElement -> {
                if (JSIDMNEdge.instanceOf(diagramElement)) {
                    final JSIDMNEdge jsidmnEdge = Js.uncheckedCast(diagramElement);
                    return Objects.equals(jsidmnEdge.getDmnElementRef(), dmnEdge.getDmnElementRef());
                }
                return false;
            });
            if (!exists) {
                diagram.addDMNDiagramElement(WrapperUtils.getWrappedJSIDMNEdge(Js.uncheckedCast(dmnEdge)));
            }
        });
        // Convert absolute positioning to relative
        for (final Node<?, ?> node : diagramNodes) {
            PointUtils.convertToRelativeBounds(node);
        }
    }
    ;
    return definitions;
}
Also used : TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) KnowledgeSourceConverter(org.kie.workbench.common.dmn.client.marshaller.converters.KnowledgeSourceConverter) JsInteropUtils.anyMatch(org.kie.workbench.common.dmn.client.marshaller.common.JsInteropUtils.anyMatch) JSITDMNElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElement) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) Edge(org.kie.workbench.common.stunner.core.graph.Edge) PointUtils.upperLeftBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.upperLeftBound) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) JSIDMNEdge(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge) Import(org.kie.workbench.common.dmn.api.definition.model.Import) DMNElement(org.kie.workbench.common.dmn.api.definition.model.DMNElement) Map(java.util.Map) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) IdUtils.getEdgeId(org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getEdgeId) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) DecisionServiceConverter(org.kie.workbench.common.dmn.client.marshaller.converters.DecisionServiceConverter) PointUtils.yOfBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.yOfBound) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Collectors(java.util.stream.Collectors) JSITComponentWidths(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths) Objects(java.util.Objects) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) TextAnnotationConverter(org.kie.workbench.common.dmn.client.marshaller.converters.TextAnnotationConverter) List(java.util.List) Stream(java.util.stream.Stream) DMNDiagramsSession(org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSession) BusinessKnowledgeModelConverter(org.kie.workbench.common.dmn.client.marshaller.converters.BusinessKnowledgeModelConverter) DMNGraphUtils(org.kie.workbench.common.dmn.client.marshaller.common.DMNGraphUtils) PostConstruct(javax.annotation.PostConstruct) DefinitionUtils.getElementDefinition(org.kie.workbench.common.stunner.core.util.DefinitionUtils.getElementDefinition) Optional(java.util.Optional) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) ApplicationScoped(javax.enterprise.context.ApplicationScoped) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) QName(javax.xml.namespace.QName) Node(org.kie.workbench.common.stunner.core.graph.Node) JSIDiagramElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) AssociationConverter(org.kie.workbench.common.dmn.client.marshaller.converters.AssociationConverter) InputDataConverter(org.kie.workbench.common.dmn.client.marshaller.converters.InputDataConverter) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) HashMap(java.util.HashMap) HasContentDefinitionId(org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ArrayList(java.util.ArrayList) WrapperUtils(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils) Inject(javax.inject.Inject) Js(jsinterop.base.Js) JsArrayLike(jsinterop.base.JsArrayLike) IdUtils.getRawId(org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getRawId) StreamSupport(java.util.stream.StreamSupport) JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement) DMNViewDefinition(org.kie.workbench.common.dmn.api.definition.DMNViewDefinition) XMLConstants(javax.xml.XMLConstants) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) MainJs(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.MainJs) JSITAssociation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITAssociation) DefinitionsConverter(org.kie.workbench.common.dmn.client.marshaller.converters.DefinitionsConverter) PointUtils.xOfBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.xOfBound) PointUtils(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) DecisionConverter(org.kie.workbench.common.dmn.client.marshaller.converters.DecisionConverter) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) Association(org.kie.workbench.common.dmn.api.definition.model.Association) Consumer(java.util.function.Consumer) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) Graph(org.kie.workbench.common.stunner.core.graph.Graph) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) JSITComponentsWidthsExtension(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentsWidthsExtension) JsInteropUtils.forEach(org.kie.workbench.common.dmn.client.marshaller.common.JsInteropUtils.forEach) DiscreteConnection(org.kie.workbench.common.stunner.core.graph.content.view.DiscreteConnection) HasContentDefinitionId(org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId) JSITComponentsWidthsExtension(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentsWidthsExtension) JSITAssociation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITAssociation) HashMap(java.util.HashMap) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) Node(org.kie.workbench.common.stunner.core.graph.Node) ArrayList(java.util.ArrayList) JSITDMNElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElement) JSITDMNElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElement) DMNElement(org.kie.workbench.common.dmn.api.definition.model.DMNElement) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) JSITComponentWidths(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths) JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) JSIDiagramElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement) JSIDMNEdge(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement)

Example 3 with JSITDefinitions

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

the class DMNMarshallerImportsClientHelper method getImportDefinitionsAsync.

public Promise<Map<JSITImport, JSITDefinitions>> getImportDefinitionsAsync(final Metadata metadata, final List<JSITImport> imports) {
    if (!imports.isEmpty()) {
        return loadDMNDefinitions().then(otherDefinitions -> {
            final Map<JSITImport, JSITDefinitions> importDefinitions = new HashMap<>();
            for (final Map.Entry<String, JSITDefinitions> entry : otherDefinitions.entrySet()) {
                final JSITDefinitions def = Js.uncheckedCast(entry.getValue());
                findImportByDefinitions(def, imports).ifPresent(anImport -> {
                    final JSITImport foundImported = Js.uncheckedCast(anImport);
                    importDefinitions.put(foundImported, def);
                });
            }
            return promises.resolve(importDefinitions);
        });
    }
    return promises.resolve(Collections.emptyMap());
}
Also used : HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JSITImport(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)

Example 4 with JSITDefinitions

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

the class DMNMarshallerImportsClientHelper method getImportedItemDefinitionsByNamespaceAsync.

public void getImportedItemDefinitionsByNamespaceAsync(final String modelName, final String namespace, final ServiceCallback<List<ItemDefinition>> callback) {
    loadDMNDefinitions().then(definitions -> {
        final List<ItemDefinition> result = new ArrayList<>();
        for (final Map.Entry<String, JSITDefinitions> entry : definitions.entrySet()) {
            final JSITDefinitions definition = Js.uncheckedCast(entry.getValue());
            if (Objects.equals(definition.getNamespace(), namespace)) {
                final List<JSITItemDefinition> items = definition.getItemDefinition();
                for (int j = 0; j < items.size(); j++) {
                    final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(items.get(j));
                    final ItemDefinition converted = ImportedItemDefinitionPropertyConverter.wbFromDMN(jsitItemDefinition, modelName);
                    result.add(converted);
                }
            }
        }
        result.sort(Comparator.comparing(o -> o.getName().getValue()));
        callback.onSuccess(result);
        return promises.resolve(result);
    });
}
Also used : JSITInvocable(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocable) Arrays(java.util.Arrays) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) PMMLDocumentMetadata(org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata) JSITDMNElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElement) Promises(org.uberfire.client.promise.Promises) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) BuiltInTypeUtils.isBuiltInType(org.kie.workbench.common.dmn.api.editors.types.BuiltInTypeUtils.isBuiltInType) HashMap(java.util.HashMap) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) Promise(elemental2.promise.Promise) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Inject(javax.inject.Inject) Js(jsinterop.base.Js) Map(java.util.Map) JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) ServiceCallback(org.kie.workbench.common.stunner.core.client.service.ServiceCallback) DMNMarshallerImportsHelper(org.kie.workbench.common.dmn.api.marshalling.DMNMarshallerImportsHelper) JSITItemDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition) StringUtils.isEmpty(org.kie.workbench.common.stunner.core.util.StringUtils.isEmpty) DMNIncludedNode(org.kie.workbench.common.dmn.api.editors.included.DMNIncludedNode) PMMLIncludedModel(org.kie.workbench.common.dmn.api.editors.included.PMMLIncludedModel) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) ItemDefinition(org.kie.workbench.common.dmn.api.definition.model.ItemDefinition) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Objects(java.util.Objects) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) FileUtils(org.kie.workbench.common.stunner.core.util.FileUtils) List(java.util.List) ImportedItemDefinitionPropertyConverter(org.kie.workbench.common.dmn.client.marshaller.converters.ImportedItemDefinitionPropertyConverter) JSITImport(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport) DMNImportTypes(org.kie.workbench.common.dmn.api.editors.included.DMNImportTypes) ImportedItemDefinitionPropertyConverter.withNamespace(org.kie.workbench.common.dmn.client.marshaller.converters.ImportedItemDefinitionPropertyConverter.withNamespace) Optional(java.util.Optional) DMNIncludedModel(org.kie.workbench.common.dmn.api.editors.included.DMNIncludedModel) IncludedModel(org.kie.workbench.common.dmn.api.editors.included.IncludedModel) QName(javax.xml.namespace.QName) Comparator(java.util.Comparator) Collections(java.util.Collections) JSITItemDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition) ItemDefinition(org.kie.workbench.common.dmn.api.definition.model.ItemDefinition) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JSITItemDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)

Example 5 with JSITDefinitions

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

the class DMNMarshallerImportsClientHelper method getDrgElementsWithNamespace.

private List<JSITDRGElement> getDrgElementsWithNamespace(final JSITDefinitions definitions, final JSITImport anImport) {
    final List<JSITDRGElement> result = new ArrayList<>();
    final List<JSITDRGElement> drgElements = definitions.getDrgElement();
    for (int i = 0; i < drgElements.size(); i++) {
        final JSITDRGElement drgElement = Js.uncheckedCast(drgElements.get(i));
        final JSITDRGElement element = Js.uncheckedCast(drgElementWithNamespace(drgElement, anImport));
        result.add(element);
    }
    return result;
}
Also used : JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement) ArrayList(java.util.ArrayList)

Aggregations

JSITDefinitions (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)18 HashMap (java.util.HashMap)14 Map (java.util.Map)13 ArrayList (java.util.ArrayList)12 JSITImport (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport)12 JSITDRGElement (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement)10 Inject (javax.inject.Inject)8 Js (jsinterop.base.Js)8 JSITItemDefinition (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition)8 Objects (java.util.Objects)7 Optional (java.util.Optional)7 QName (javax.xml.namespace.QName)7 Definitions (org.kie.workbench.common.dmn.api.definition.model.Definitions)7 PMMLDocumentMetadata (org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata)7 ClientRuntimeError (org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError)7 ServiceCallback (org.kie.workbench.common.stunner.core.client.service.ServiceCallback)7 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 ItemDefinition (org.kie.workbench.common.dmn.api.definition.model.ItemDefinition)6 MainJs (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.MainJs)6