Search in sources :

Example 6 with DMNModelInstrumentedBase

use of org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.

the class SetChildrenCommand method execute.

@Override
protected void execute(final GraphCommandExecutionContext context, final Node<?, Edge> parent, final Node<?, Edge> candidate) {
    super.execute(context, parent, candidate);
    if (parent.getContent() instanceof View) {
        final DMNModelInstrumentedBase parentDMNModel = (DMNModelInstrumentedBase) ((View) parent.getContent()).getDefinition();
        if (candidate.getContent() instanceof View) {
            final DMNModelInstrumentedBase childDMNModel = (DMNModelInstrumentedBase) ((View) candidate.getContent()).getDefinition();
            childDMNModel.setParent(parentDMNModel);
            DefaultValueUtilities.updateNewNodeName(getGraph(context), childDMNModel);
        }
    }
}
Also used : DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) View(org.kie.workbench.common.stunner.core.graph.content.view.View)

Example 7 with DMNModelInstrumentedBase

use of org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.

the class DecisionTableEditorDefinitionEnricher method getOutputClauseName.

private Optional<String> getOutputClauseName(final HasVariable hasVariable) {
    final IsInformationItem variable = hasVariable.getVariable();
    if (variable instanceof InformationItem) {
        return Optional.ofNullable((variable).getName().getValue());
    }
    final DMNModelInstrumentedBase base = hasVariable.asDMNModelInstrumentedBase().getParent();
    final DMNModelInstrumentedBase parent = base.getParent();
    if (parent instanceof HasName) {
        return Optional.ofNullable(((HasName) parent).getName().getValue());
    }
    if (parent instanceof HasVariable) {
        return getOutputClauseName((HasVariable) parent);
    }
    return Optional.empty();
}
Also used : HasName(org.kie.workbench.common.dmn.api.definition.HasName) HasVariable(org.kie.workbench.common.dmn.api.definition.HasVariable) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) IsInformationItem(org.kie.workbench.common.dmn.api.definition.model.IsInformationItem) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) IsInformationItem(org.kie.workbench.common.dmn.api.definition.model.IsInformationItem)

Example 8 with DMNModelInstrumentedBase

use of org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.

the class DRDContextMenuService method connectRootWithChild.

private void connectRootWithChild(final Node dmnDiagramRoot, final Node child) {
    final String uuid = UUID.uuid();
    final Edge<Child, Node> edge = new EdgeImpl<>(uuid);
    edge.setContent(new Child());
    connectEdge(edge, dmnDiagramRoot, child);
    final Definitions definitions = ((DMNDiagram) ((View) dmnDiagramRoot.getContent()).getDefinition()).getDefinitions();
    final DMNModelInstrumentedBase childDRG = (DMNModelInstrumentedBase) ((View) child.getContent()).getDefinition();
    childDRG.setParent(definitions);
}
Also used : DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Node(org.kie.workbench.common.stunner.core.graph.Node) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child)

Example 9 with DMNModelInstrumentedBase

use of org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.

the class DMNMarshallerStandalone method connectRootWithChild.

@SuppressWarnings({ "rawtypes", "unchecked" })
public static void connectRootWithChild(final Node dmnDiagramRoot, final Node child) {
    final String uuid = org.kie.workbench.common.stunner.core.util.UUID.uuid();
    final Edge<Child, Node> edge = new EdgeImpl<>(uuid);
    edge.setContent(new Child());
    connectEdge(edge, dmnDiagramRoot, child);
    final Definitions definitions = ((DMNDiagram) ((View) dmnDiagramRoot.getContent()).getDefinition()).getDefinitions();
    final DMNModelInstrumentedBase childDRG = (DMNModelInstrumentedBase) ((View) child.getContent()).getDefinition();
    childDRG.setParent(definitions);
}
Also used : DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Node(org.kie.workbench.common.stunner.core.graph.Node) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child)

Example 10 with DMNModelInstrumentedBase

use of org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.

the class DMNUnmarshaller method connectRootWithChild.

@SuppressWarnings({ "rawtypes", "unchecked" })
private void connectRootWithChild(final Node dmnDiagramRoot, final Node child) {
    final String uuid = UUID.uuid();
    final Edge<Child, Node> edge = new EdgeImpl<>(uuid);
    edge.setContent(new Child());
    connectEdge(edge, dmnDiagramRoot, child);
    final Definitions definitions = ((DMNDiagram) ((View) dmnDiagramRoot.getContent()).getDefinition()).getDefinitions();
    final DMNModelInstrumentedBase childDRG = (DMNModelInstrumentedBase) ((View) child.getContent()).getDefinition();
    childDRG.setParent(definitions);
}
Also used : JSIDMNDiagram(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDiagram) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Node(org.kie.workbench.common.stunner.core.graph.Node) Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child)

Aggregations

DMNModelInstrumentedBase (org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase)11 Test (org.junit.Test)3 HasTypeRef (org.kie.workbench.common.dmn.api.definition.HasTypeRef)3 HasVariable (org.kie.workbench.common.dmn.api.definition.HasVariable)3 DMNDiagram (org.kie.workbench.common.dmn.api.definition.model.DMNDiagram)3 Definitions (org.kie.workbench.common.dmn.api.definition.model.Definitions)3 Node (org.kie.workbench.common.stunner.core.graph.Node)3 Child (org.kie.workbench.common.stunner.core.graph.content.relationship.Child)3 EdgeImpl (org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl)3 HasName (org.kie.workbench.common.dmn.api.definition.HasName)2 IsInformationItem (org.kie.workbench.common.dmn.api.definition.model.IsInformationItem)2 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)2 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)2 Point2D (com.ait.lienzo.client.core.types.Point2D)1 List (java.util.List)1 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)1 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)1 DecisionTable (org.kie.workbench.common.dmn.api.definition.model.DecisionTable)1 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)1 FunctionDefinition (org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition)1