use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DMNSetConnectionSourceNodeCommandTest method createNode.
private Node createNode(final String diagramId) {
final Node node = mock(Node.class);
final Definition definition = mock(Definition.class);
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
when(node.getContent()).thenReturn(definition);
when(hasContentDefinitionId.getDiagramId()).thenReturn(diagramId);
when(definition.getDefinition()).thenReturn(hasContentDefinitionId);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DMNSetConnectionTargetNodeCommandTest method createNode.
private Node createNode(final String diagramId) {
final Node node = mock(Node.class);
final Definition definition = mock(Definition.class);
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
when(node.getContent()).thenReturn(definition);
when(hasContentDefinitionId.getDiagramId()).thenReturn(diagramId);
when(definition.getDefinition()).thenReturn(hasContentDefinitionId);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class NodeDefinitionHelperTest method createNode.
private Node createNode(final String contentDefinitionId, final String diagramId) {
final Node node = mock(Node.class);
final Definition content = mock(Definition.class);
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
when(hasContentDefinitionId.getContentDefinitionId()).thenReturn(contentDefinitionId);
when(hasContentDefinitionId.getDiagramId()).thenReturn(diagramId);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(hasContentDefinitionId);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DMNCanvasHandlerTest method testUpdateDiagramIdWhenDiagramIdIsEmpty.
@Test
public void testUpdateDiagramIdWhenDiagramIdIsEmpty() {
final String diagramId = "diagram id";
final String currentDiagramId = "";
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
final Element element = getElementForTestUpdateDiagramId(diagramId, currentDiagramId, hasContentDefinitionId);
canvasHandler.updateDiagramId(element);
verify(hasContentDefinitionId).setDiagramId(diagramId);
}
use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DeleteNodeConfirmationImpl method isReferredInAnotherGraph.
boolean isReferredInAnotherGraph(final Element element) {
if (element.getContent() instanceof Definition) {
final Definition def = (Definition) element.getContent();
if (def.getDefinition() instanceof HasContentDefinitionId) {
final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) def.getDefinition();
final String contentId = hasContentDefinitionId.getContentDefinitionId();
final List<Graph> graphs = getGraphsProvider().getNonGlobalGraphs();
return graphs.stream().anyMatch(graph -> containsNodeWithContentId(graph, contentId));
}
}
return false;
}
Aggregations