Search in sources :

Example 1 with JSITComponentWidths

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

the class BusinessKnowledgeModelConverter method dmnFromNode.

@Override
@SuppressWarnings("unchecked")
public JSITBusinessKnowledgeModel dmnFromNode(final Node<View<BusinessKnowledgeModel>, ?> node, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final BusinessKnowledgeModel source = (BusinessKnowledgeModel) DefinitionUtils.getElementDefinition(node);
    final JSITBusinessKnowledgeModel result = new JSITBusinessKnowledgeModel();
    result.setId(source.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    description.ifPresent(result::setDescription);
    result.setName(source.getName().getValue());
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(result.getKnowledgeRequirement())) {
        result.setKnowledgeRequirement(new ArrayList<>());
    }
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(result.getAuthorityRequirement())) {
        result.setAuthorityRequirement(new ArrayList<>());
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result);
    final JSITInformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source);
    result.setVariable(variable);
    final JSITFunctionDefinition functionDefinition = FunctionDefinitionPropertyConverter.dmnFromWB(source.getEncapsulatedLogic(), componentWidthsConsumer);
    final FunctionDefinition wbFunctionDefinition = source.getEncapsulatedLogic();
    if (Objects.nonNull(wbFunctionDefinition)) {
        final String uuid = wbFunctionDefinition.getId().getValue();
        if (Objects.nonNull(uuid)) {
            final JSITComponentWidths componentWidths = new JSITComponentWidths();
            componentWidths.setDmnElementRef(uuid);
            source.getEncapsulatedLogic().getComponentWidths().stream().filter(Objects::nonNull).forEach(w -> componentWidths.addWidth(new Float(w)));
            componentWidthsConsumer.accept(componentWidths);
        }
    }
    result.setEncapsulatedLogic(functionDefinition);
    // DMN spec table 2: Requirements connection rules
    final List<Edge<?, ?>> inEdges = (List<Edge<?, ?>>) node.getInEdges();
    for (Edge<?, ?> e : inEdges) {
        final Node<?, ?> sourceNode = e.getSourceNode();
        if (sourceNode.getContent() instanceof View<?>) {
            final View<?> view = (View<?>) sourceNode.getContent();
            if (view.getDefinition() instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) view.getDefinition();
                if (drgElement instanceof BusinessKnowledgeModel) {
                    final JSITKnowledgeRequirement iReq = new JSITKnowledgeRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredKnowledge(ri);
                    result.addKnowledgeRequirement(iReq);
                } else if (drgElement instanceof KnowledgeSource) {
                    final JSITAuthorityRequirement iReq = new JSITAuthorityRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredAuthority(ri);
                    result.addAuthorityRequirement(iReq);
                } else if (drgElement instanceof DecisionService) {
                    if (e.getContent() instanceof View && ((View) e.getContent()).getDefinition() instanceof KnowledgeRequirement) {
                        final JSITKnowledgeRequirement iReq = new JSITKnowledgeRequirement();
                        iReq.setId(getRawId(e.getUUID()));
                        final JSITDMNElementReference ri = new JSITDMNElementReference();
                        ri.setHref(getHref(drgElement));
                        iReq.setRequiredKnowledge(ri);
                        result.addKnowledgeRequirement(iReq);
                    } else {
                        throw new UnsupportedOperationException("wrong model definition.");
                    }
                } else {
                    throw new UnsupportedOperationException("wrong model definition.");
                }
            }
        }
    }
    return result;
}
Also used : JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) JSITAuthorityRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITAuthorityRequirement) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) ArrayList(java.util.ArrayList) List(java.util.List) JSITComponentWidths(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) View(org.kie.workbench.common.stunner.core.graph.content.view.View) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) JSITKnowledgeRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeRequirement) JSITKnowledgeRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeRequirement) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement)

Example 2 with JSITComponentWidths

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

the class DecisionServiceConverter method dmnFromNode.

@Override
@SuppressWarnings("unchecked")
public JSITDecisionService dmnFromNode(final Node<View<DecisionService>, ?> node, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final DecisionService source = (DecisionService) DefinitionUtils.getElementDefinition(node);
    final JSITDecisionService ds = new JSITDecisionService();
    ds.setId(source.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    description.ifPresent(ds::setDescription);
    ds.setName(source.getName().getValue());
    final JSITInformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source);
    ds.setVariable(variable);
    final List<JSITDMNElementReference> existing_outputDecision = source.getOutputDecision().stream().map(DMNElementReferenceConverter::dmnFromWB).collect(Collectors.toList());
    final List<JSITDMNElementReference> existing_encapsulatedDecision = source.getEncapsulatedDecision().stream().map(DMNElementReferenceConverter::dmnFromWB).collect(Collectors.toList());
    final List<JSITDMNElementReference> existing_inputDecision = source.getInputDecision().stream().map(DMNElementReferenceConverter::dmnFromWB).collect(Collectors.toList());
    final List<JSITDMNElementReference> existing_inputData = source.getInputData().stream().map(DMNElementReferenceConverter::dmnFromWB).collect(Collectors.toList());
    final List<JSITDMNElementReference> candidate_outputDecision = new ArrayList<>();
    final List<JSITDMNElementReference> candidate_encapsulatedDecision = new ArrayList<>();
    final List<JSITDMNElementReference> candidate_inputDecision = new ArrayList<>();
    final List<JSITDMNElementReference> candidate_inputData = new ArrayList<>();
    final HashSet<InputData> reqInputs = new HashSet();
    final HashSet<Decision> reqDecisions = new HashSet();
    // DMN spec table 2: Requirements connection rules
    final List<Edge<?, ?>> outEdges = (List<Edge<?, ?>>) node.getOutEdges();
    for (Edge<?, ?> e : outEdges) {
        if (e.getContent() instanceof Child) {
            @SuppressWarnings("unchecked") final Node<View<?>, ?> targetNode = e.getTargetNode();
            final View<?> targetNodeView = targetNode.getContent();
            if (targetNodeView.getDefinition() instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) targetNodeView.getDefinition();
                if (drgElement instanceof Decision) {
                    final Decision decision = (Decision) drgElement;
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref("#" + decision.getId().getValue());
                    if (isOutputDecision(targetNode.getContent(), node.getContent())) {
                        candidate_outputDecision.add(ri);
                    } else {
                        candidate_encapsulatedDecision.add(ri);
                        final List<Node> all = diagramsSession.getNodesFromAllDiagramsWithContentId(drgElement.getContentDefinitionId());
                        for (final Node other : all) {
                            if (!Objects.equals(other, targetNode)) {
                                inspectDecisionForDSReqs(other, reqInputs, reqDecisions);
                            }
                        }
                    }
                    inspectDecisionForDSReqs(targetNode, reqInputs, reqDecisions);
                } else {
                    throw new UnsupportedOperationException("wrong model definition: a DecisionService is expected to encapsulate only Decision");
                }
            }
        } else if (e.getContent() instanceof View && ((View) e.getContent()).getDefinition() instanceof KnowledgeRequirement) {
        // this was taken care by the receiving Decision or BKM.
        } else {
            throw new UnsupportedOperationException("wrong model definition.");
        }
    }
    reqInputs.stream().sorted(Comparator.comparing(x -> x.getName().getValue())).map(x -> {
        final JSITDMNElementReference ri = new JSITDMNElementReference();
        ri.setHref("#" + x.getId().getValue());
        return ri;
    }).forEach(ri -> candidate_inputData.add(Js.uncheckedCast(ri)));
    reqDecisions.stream().sorted(Comparator.comparing(x -> x.getName().getValue())).map(x -> {
        final JSITDMNElementReference ri = new JSITDMNElementReference();
        ri.setHref("#" + x.getId().getValue());
        return ri;
    }).forEach(rs -> candidate_inputDecision.add(Js.uncheckedCast(rs)));
    for (int i = 0; i < candidate_outputDecision.size(); i++) {
        final JSITDMNElementReference er = Js.uncheckedCast(candidate_outputDecision.get(i));
        candidate_inputDecision.removeIf(x -> x.getHref().equals(er.getHref()));
    }
    for (int i = 0; i < candidate_encapsulatedDecision.size(); i++) {
        final JSITDMNElementReference er = Js.uncheckedCast(candidate_encapsulatedDecision.get(i));
        candidate_inputDecision.removeIf(x -> x.getHref().equals(er.getHref()));
    }
    ds.setInputData(reconcileExistingAndCandidate(existing_inputData, candidate_inputData));
    ds.setInputDecision(reconcileExistingAndCandidate(existing_inputDecision, candidate_inputDecision));
    ds.setEncapsulatedDecision(reconcileExistingAndCandidate(existing_encapsulatedDecision, candidate_encapsulatedDecision));
    ds.setOutputDecision(reconcileExistingAndCandidate(existing_outputDecision, candidate_outputDecision));
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, ds);
    return ds;
}
Also used : DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) Edge(org.kie.workbench.common.stunner.core.graph.Edge) InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Js(jsinterop.base.Js) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) NodeEntry(org.kie.workbench.common.dmn.client.marshaller.unmarshall.nodes.NodeEntry) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) DecisionServiceDividerLineY(org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) DecisionServiceRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.DecisionServiceRectangleDimensionsSet) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) Collectors(java.util.stream.Collectors) JSITComponentWidths(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths) Objects(java.util.Objects) Consumer(java.util.function.Consumer) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) List(java.util.List) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) DMNDiagramsSession(org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSession) Optional(java.util.Optional) DMNElementReference(org.kie.workbench.common.dmn.api.definition.model.DMNElementReference) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Comparator(java.util.Comparator) Node(org.kie.workbench.common.stunner.core.graph.Node) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) Node(org.kie.workbench.common.stunner.core.graph.Node) ArrayList(java.util.ArrayList) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) ArrayList(java.util.ArrayList) List(java.util.List) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) HashSet(java.util.HashSet) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement)

Example 3 with JSITComponentWidths

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

the class ExpressionPropertyConverter method dmnFromWB.

public static JSITExpression dmnFromWB(final Expression wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    if (Objects.isNull(wb)) {
        return null;
    }
    final String uuid = wb.getId().getValue();
    if (Objects.nonNull(uuid)) {
        final JSITComponentWidths componentWidths = new JSITComponentWidths();
        componentWidths.setDmnElementRef(uuid);
        wb.getComponentWidths().stream().filter(Objects::nonNull).forEach(w -> componentWidths.addWidth(new Float(w)));
        componentWidthsConsumer.accept(componentWidths);
    }
    if (wb instanceof IsLiteralExpression) {
        final JSITLiteralExpression unwrappedJSITLiteralExpression = LiteralExpressionPropertyConverter.dmnFromWB((IsLiteralExpression) wb);
        final JSITLiteralExpression wrappedJSITLiteralExpression = getWrappedJSITLiteralExpression(unwrappedJSITLiteralExpression, "dmn", "literalExpression");
        return wrappedJSITLiteralExpression;
    } else if (wb instanceof Context) {
        final JSITContext unwrappedJSITContext = ContextPropertyConverter.dmnFromWB((Context) wb, componentWidthsConsumer);
        final JSITContext wrappedJSITContext = getWrappedJSITContext(unwrappedJSITContext, "dmn", "context");
        return wrappedJSITContext;
    } else if (wb instanceof Relation) {
        final JSITRelation unwrappedJSITRelation = RelationPropertyConverter.dmnFromWB((Relation) wb, componentWidthsConsumer);
        final JSITRelation wrappedJSITRelation = getWrappedJSITRelation(unwrappedJSITRelation, "dmn", "relation");
        return wrappedJSITRelation;
    } else if (wb instanceof List) {
        final JSITList unwrappedJSITList = ListPropertyConverter.dmnFromWB((List) wb, componentWidthsConsumer);
        final JSITList wrappedJSITList = getWrappedJSITList(unwrappedJSITList, "dmn", "list");
        return wrappedJSITList;
    } else if (wb instanceof Invocation) {
        final JSITInvocation unwrappedJSITInvocation = InvocationPropertyConverter.dmnFromWB((Invocation) wb, componentWidthsConsumer);
        final JSITInvocation wrappedJSITInvocation = getWrappedJSITInvocation(unwrappedJSITInvocation, "dmn", "invocation");
        return wrappedJSITInvocation;
    } else if (wb instanceof FunctionDefinition) {
        final JSITFunctionDefinition unwrappedJSITFunctionDefinition = FunctionDefinitionPropertyConverter.dmnFromWB((FunctionDefinition) wb, componentWidthsConsumer);
        final JSITFunctionDefinition wrappedJSITFunctionDefinition = getWrappedJSITFunctionDefinition(unwrappedJSITFunctionDefinition, "dmn", "functionDefinition");
        return wrappedJSITFunctionDefinition;
    } else if (wb instanceof DecisionTable) {
        final JSITDecisionTable unwrappedJSITDecisionTable = DecisionTablePropertyConverter.dmnFromWB((DecisionTable) wb);
        final JSITDecisionTable wrappedJSITDecisionTable = getWrappedJSITDecisionTable(unwrappedJSITDecisionTable, "dmn", "decisionTable");
        return wrappedJSITDecisionTable;
    }
    return null;
}
Also used : JSITContext(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITContext) WrapperUtils.getWrappedJSITContext(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITContext) Context(org.kie.workbench.common.dmn.api.definition.model.Context) WrapperUtils.getWrappedJSITFunctionDefinition(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITFunctionDefinition) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) IsLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression) JSITRelation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation) WrapperUtils.getWrappedJSITRelation(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITRelation) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) WrapperUtils.getWrappedJSITList(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITList) WrapperUtils.getWrappedJSITInvocation(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITInvocation) Invocation(org.kie.workbench.common.dmn.api.definition.model.Invocation) JSITInvocation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocation) WrapperUtils.getWrappedJSITLiteralExpression(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITLiteralExpression) JSITLiteralExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression) JSITDecisionTable(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionTable) WrapperUtils.getWrappedJSITDecisionTable(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITDecisionTable) DecisionTable(org.kie.workbench.common.dmn.api.definition.model.DecisionTable) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) JSITRelation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation) WrapperUtils.getWrappedJSITRelation(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITRelation) JSITContext(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITContext) WrapperUtils.getWrappedJSITContext(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITContext) List(org.kie.workbench.common.dmn.api.definition.model.List) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) WrapperUtils.getWrappedJSITList(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITList) WrapperUtils.getWrappedJSITInvocation(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITInvocation) JSITInvocation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocation) WrapperUtils.getWrappedJSITFunctionDefinition(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITFunctionDefinition) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) JSITComponentWidths(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths) JSITDecisionTable(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionTable) WrapperUtils.getWrappedJSITDecisionTable(org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITDecisionTable)

Example 4 with JSITComponentWidths

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths 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 5 with JSITComponentWidths

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

the class DMNUnmarshaller method unmarshall.

private Promise<Graph> unmarshall(final Metadata metadata, final JSITDefinitions dmnDefinitions, final Map<JSITImport, JSITDefinitions> importDefinitions, final Map<JSITImport, PMMLDocumentMetadata> pmmlDocuments) {
    final Map<String, HasComponentWidths> hasComponentWidthsMap = new HashMap<>();
    final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer = (uuid, hcw) -> {
        if (Objects.nonNull(uuid)) {
            hasComponentWidthsMap.put(uuid, hcw);
        }
    };
    // Check before the DRG creation ('ensureDRGElementExists').
    final boolean isDMNDIPresent = Optional.ofNullable(dmnDefinitions.getDMNDI()).isPresent();
    ensureDRGElementExists(dmnDefinitions);
    final Definitions wbDefinitions = DefinitionsConverter.wbFromDMN(dmnDefinitions, importDefinitions, pmmlDocuments);
    final List<NodeEntry> nodeEntries = modelToStunnerConverter.makeNodes(dmnDefinitions, importDefinitions, isDMNDIPresent, hasComponentWidthsConsumer);
    final List<JSITDecisionService> dmnDecisionServices = getDecisionServices(nodeEntries);
    // Ensure all locations are updated to relative for Stunner
    nodeEntries.forEach(e -> PointUtils.convertToRelativeBounds(e.getNode()));
    final Map<String, Diagram> stunnerDiagramsById = new HashMap<>();
    final Map<String, DMNDiagramElement> dmnDiagramsById = new HashMap<>();
    for (final DMNDiagramElement dmnDiagramElement : wbDefinitions.getDiagramElements()) {
        final String dmnDiagramId = dmnDiagramElement.getId().getValue();
        final Diagram value = factoryManager.newDiagram(dmnDiagramId, BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class), metadata);
        stunnerDiagramsById.put(dmnDiagramId, value);
        dmnDiagramsById.put(dmnDiagramId, dmnDiagramElement);
    }
    final DMNDiagramsSessionState state = dmnDiagramsSession.setState(metadata, stunnerDiagramsById, dmnDiagramsById);
    nodeEntries.forEach(nodeEntry -> {
        final String diagramId = nodeEntry.getDiagramId();
        final Graph graph = stunnerDiagramsById.get(diagramId).getGraph();
        graph.addNode(nodeEntry.getNode());
    });
    final Graph drgGraph = state.getDRGDiagram().getGraph();
    loadImportedItemDefinitions(wbDefinitions, importDefinitions);
    for (final Diagram value : stunnerDiagramsById.values()) {
        final Node<?, ?> dmnDiagramRoot = DMNGraphUtils.findDMNDiagramRoot(value.getGraph());
        ((View<DMNDiagram>) dmnDiagramRoot.getContent()).getDefinition().setDefinitions(wbDefinitions);
        nodeEntries.forEach(nodeEntry -> {
            if (Objects.equals(stunnerDiagramsById.get(nodeEntry.getDiagramId()), value)) {
                connectRootWithChild(dmnDiagramRoot, nodeEntry.getNode());
            }
        });
    }
    // Only connect Nodes to the Diagram that are not referenced by DecisionServices
    final List<String> references = new ArrayList<>();
    final List<JSITDecisionService> lstDecisionServices = new ArrayList<>(dmnDecisionServices);
    for (int iDS = 0; iDS < lstDecisionServices.size(); iDS++) {
        final JSITDecisionService jsiDecisionService = Js.uncheckedCast(lstDecisionServices.get(iDS));
        final List<JSITDMNElementReference> jsiEncapsulatedDecisions = jsiDecisionService.getEncapsulatedDecision();
        if (Objects.nonNull(jsiEncapsulatedDecisions)) {
            for (int i = 0; i < jsiEncapsulatedDecisions.size(); i++) {
                final JSITDMNElementReference jsiEncapsulatedDecision = Js.uncheckedCast(jsiEncapsulatedDecisions.get(i));
                references.add(jsiEncapsulatedDecision.getHref());
            }
        }
        final List<JSITDMNElementReference> jsiOutputDecisions = jsiDecisionService.getOutputDecision();
        if (Objects.nonNull(jsiOutputDecisions)) {
            for (int i = 0; i < jsiOutputDecisions.size(); i++) {
                final JSITDMNElementReference jsiOutputDecision = Js.uncheckedCast(jsiOutputDecisions.get(i));
                references.add(jsiOutputDecision.getHref());
            }
        }
    }
    // Copy ComponentWidths information
    final List<JSITComponentsWidthsExtension> extensions = findComponentsWidthsExtensions(dmnDefinitions.getDMNDI().getDMNDiagram());
    extensions.forEach(componentsWidthsExtension -> {
        // can be imported from another diagram but the extension is not imported or present in this diagram.
        if (Objects.nonNull(componentsWidthsExtension.getComponentWidths())) {
            hasComponentWidthsMap.entrySet().forEach(es -> {
                final List<JSITComponentWidths> jsiComponentWidths = componentsWidthsExtension.getComponentWidths();
                for (int i = 0; i < jsiComponentWidths.size(); i++) {
                    final JSITComponentWidths jsiWidths = Js.uncheckedCast(jsiComponentWidths.get(i));
                    if (Objects.equals(jsiWidths.getDmnElementRef(), es.getKey())) {
                        final List<Double> widths = es.getValue().getComponentWidths();
                        if (Objects.nonNull(jsiWidths.getWidth())) {
                            widths.clear();
                            for (int w = 0; w < jsiWidths.getWidth().size(); w++) {
                                final double width = jsiWidths.getWidth().get(w).doubleValue();
                                widths.add(width);
                            }
                        }
                    }
                }
            });
        }
    });
    return promises.resolve(drgGraph);
}
Also used : JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) Edge(org.kie.workbench.common.stunner.core.graph.Edge) UUID(org.kie.workbench.common.stunner.core.util.UUID) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) Map(java.util.Map) DMNDiagramElementsUtils(org.kie.workbench.common.dmn.client.marshaller.common.DMNDiagramElementsUtils) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) ItemDefinition(org.kie.workbench.common.dmn.api.definition.model.ItemDefinition) 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) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Objects(java.util.Objects) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) List(java.util.List) DMNDiagramsSession(org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSession) DMNGraphUtils(org.kie.workbench.common.dmn.client.marshaller.common.DMNGraphUtils) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ApplicationScoped(javax.enterprise.context.ApplicationScoped) DMNDiagramElement(org.kie.workbench.common.dmn.api.definition.model.DMNDiagramElement) Node(org.kie.workbench.common.stunner.core.graph.Node) PMMLDocumentMetadata(org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata) JSIDiagramElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement) DMNDefinitionSet(org.kie.workbench.common.dmn.api.DMNDefinitionSet) Promises(org.uberfire.client.promise.Promises) HashMap(java.util.HashMap) Promise(elemental2.promise.Promise) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Js(jsinterop.base.Js) NodeEntry(org.kie.workbench.common.dmn.client.marshaller.unmarshall.nodes.NodeEntry) DMNMarshallerImportsClientHelper(org.kie.workbench.common.dmn.client.marshaller.included.DMNMarshallerImportsClientHelper) BiConsumer(java.util.function.BiConsumer) NodeEntriesFactory(org.kie.workbench.common.dmn.client.marshaller.unmarshall.nodes.NodeEntriesFactory) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) BindableAdapterUtils(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils) MainJs(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.MainJs) DMNDiagramsSessionState(org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSessionState) JSITItemDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition) DefinitionsConverter(org.kie.workbench.common.dmn.client.marshaller.converters.DefinitionsConverter) PointUtils(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) Graph(org.kie.workbench.common.stunner.core.graph.Graph) JsUtils(org.kie.workbench.common.dmn.webapp.kogito.marshaller.mapper.JsUtils) ItemDefinitionPropertyConverter(org.kie.workbench.common.dmn.client.marshaller.converters.ItemDefinitionPropertyConverter) JSITImport(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport) JSITComponentsWidthsExtension(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentsWidthsExtension) JSITComponentsWidthsExtension(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentsWidthsExtension) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) DMNDiagramElement(org.kie.workbench.common.dmn.api.definition.model.DMNDiagramElement) DMNDiagramsSessionState(org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSessionState) 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) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) DMNDefinitionSet(org.kie.workbench.common.dmn.api.DMNDefinitionSet) JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Graph(org.kie.workbench.common.stunner.core.graph.Graph) NodeEntry(org.kie.workbench.common.dmn.client.marshaller.unmarshall.nodes.NodeEntry)

Aggregations

JSITComponentWidths (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 Js (jsinterop.base.Js)3 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)3 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)3 DMNDiagramsSession (org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSession)3 JSITDMNElementReference (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference)3 JSITDecisionService (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService)3 Edge (org.kie.workbench.common.stunner.core.graph.Edge)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Consumer (java.util.function.Consumer)2 PostConstruct (javax.annotation.PostConstruct)2 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Inject (javax.inject.Inject)2