@Override public void startGraphTraversal(final Graph graph) { if (graph.getContent() instanceof DefinitionSet) { callback.startGraphTraversal(graph); } }
@SuppressWarnings("unchecked") protected void doStartGraphTraversal(final Graph graph, final K callback) { if (graph.getContent() instanceof View) { callback.startGraphTraversal(graph); } }
@Override public void startGraphTraversal(final Graph<DefinitionSet, Node<View, Edge>> graph) { if (graph == null) { error("Graph is null!"); } else { final DefinitionSet view = graph.getContent(); log(indent + "Graph UUID: " + graph.getUUID()); log(indent + " Graph Starting nodes"); log(indent + " ===================="); } }
protected Overview open() { final ProjectMetadata metadata = mock(ProjectMetadata.class); final Overview overview = mock(Overview.class); when(diagram.getMetadata()).thenReturn(metadata); when(metadata.getTitle()).thenReturn(TITLE); when(metadata.getOverview()).thenReturn(overview); final Graph graph = mock(Graph.class); final DefinitionSet definitionSet = mock(DefinitionSet.class); when(diagram.getGraph()).thenReturn(graph); when(graph.getContent()).thenReturn(definitionSet); presenter.open(diagram); return overview; }
@SuppressWarnings("unchecked") public <M extends Metadata, D extends Diagram> D newDiagram(final String name, final String id, final M metadata) { final Graph<DefinitionSet, ?> graph = (Graph<DefinitionSet, ?>) newElement(UUID.uuid(), id, metadata); return (D) checkDiagramFactoryNotNull(graph.getContent().getDefinition(), metadata).build(name, metadata, graph); }
@SuppressWarnings("unchecked") public static List<String> getParentIds(final DefinitionManager definitionManager, final Graph<? extends DefinitionSet, ? extends Node> graph, final Element<?> element) { final List<String> result = new ArrayList<>(5); Element<?> p = element; while (p instanceof Node && p.getContent() instanceof Definition) { p = getParent((Node<? extends Definition<?>, ? extends Edge>) p); if (null != p) { final Object definition = ((Definition) p.getContent()).getDefinition(); final String id = definitionManager.adapters().forDefinition().getId(definition).value(); result.add(id); } } final String graphId = graph.getContent().getDefinition(); result.add(graphId); return result; }
private RuleSet getRuleSet(final Graph<? extends DefinitionSet, ?> graph) { final String defSetId = graph.getContent().getDefinition(); final Object definitionSet = definitionManager.definitionSets().getDefinitionSetById(defSetId); return definitionManager.adapters().forRules().getRuleSet(definitionSet); }
@SuppressWarnings("unchecked") public void init() { MockitoAnnotations.initMocks(this); when(graph.getUUID()).thenReturn(GRAPH_UUID); when(graph.getContent()).thenReturn(graphContent); when(graph.nodes()).thenReturn(graphNodes); when(definitionManager.adapters()).thenReturn(adapterManager); when(adapterManager.registry()).thenReturn(adapterRegistry); when(adapterManager.forDefinition()).thenReturn(definitionAdapter); when(adapterManager.forProperty()).thenReturn(propertyAdapter); when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter); when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter); when(graphCommandExecutionContext.getDefinitionManager()).thenReturn(definitionManager); when(graphCommandExecutionContext.getFactoryManager()).thenReturn(factoryManager); when(graphCommandExecutionContext.getRuleManager()).thenReturn(ruleManager); when(graphCommandExecutionContext.getGraphIndex()).thenReturn(graphIndex); when(graphCommandExecutionContext.getRuleSet()).thenReturn(ruleSet); when(graphIndex.getGraph()).thenReturn(graph); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(EMPTY_VIOLATIONS); }
when(diagram.getMetadata()).thenReturn(metadata); when(diagram.getGraph()).thenReturn(graph); when(graph.getContent()).thenReturn(graphContent);
when(placeRequest.getIdentifier()).thenReturn(ProjectDiagramEditorStub.EDITOR_ID); when(diagram.getGraph()).thenReturn(graph); when(graph.getContent()).thenReturn(definitionSetContent); when(stunnerPreferencesRegistr.get(StunnerPreferences.class)).thenReturn(preferences); when(preferences.getDiagramEditorPreferences()).thenReturn(diagramEditorPreferences);
is); DiagramFactory<M, ?> factory = factoryManager.registry().getDiagramFactory(graph.getContent().getDefinition(), getMetadataType()); return (D) factory.build(name,
when(graph.getContent()).thenReturn(graphContent); when(graphContent.getDefinition()).thenReturn(DEFINITION_SET);