target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test public void testCalculateVerticesPositions() { final DefaultVertexPositioning tested = mock(DefaultVertexPositioning.class); final LayeredGraph graph = mock(LayeredGraph.class); final List<OrientedEdge> edges = mock(List.class); final LayerArrangement arrangement = LayerArrangement.BottomUp; final Set<Vertex> vertices = mock(Set.class); when(tested.getVertices(graph)).thenReturn(vertices); final List<GraphLayer> layers = mock(List.class); when(graph.getLayers()).thenReturn(layers); when(graph.getEdges()).thenReturn(edges); doCallRealMethod().when(tested).calculateVerticesPositions(graph, arrangement); tested.calculateVerticesPositions(graph, arrangement); final InOrder inOrder = inOrder(tested); inOrder.verify(tested).deReverseEdges(graph); inOrder.verify(tested).getVertices(graph); inOrder.verify(tested).removeVirtualVertices(edges, vertices); inOrder.verify(tested).removeVirtualVerticesFromLayers(layers, vertices); inOrder.verify(tested).arrangeVertices(layers, arrangement, graph); }
|
@Override public void calculateVerticesPositions(final ReorderedGraph graph, final LayerArrangement arrangement) { final LayeredGraph layered = (LayeredGraph) graph; deReverseEdges(graph); final Set<Vertex> vertices = getVertices(layered); removeVirtualVertices(graph.getEdges(), vertices); removeVirtualVerticesFromLayers(layered.getLayers(), vertices); arrangeVertices(layered.getLayers(), arrangement, graph); }
|
DefaultVertexPositioning implements VertexPositioning { @Override public void calculateVerticesPositions(final ReorderedGraph graph, final LayerArrangement arrangement) { final LayeredGraph layered = (LayeredGraph) graph; deReverseEdges(graph); final Set<Vertex> vertices = getVertices(layered); removeVirtualVertices(graph.getEdges(), vertices); removeVirtualVerticesFromLayers(layered.getLayers(), vertices); arrangeVertices(layered.getLayers(), arrangement, graph); } }
|
DefaultVertexPositioning implements VertexPositioning { @Override public void calculateVerticesPositions(final ReorderedGraph graph, final LayerArrangement arrangement) { final LayeredGraph layered = (LayeredGraph) graph; deReverseEdges(graph); final Set<Vertex> vertices = getVertices(layered); removeVirtualVertices(graph.getEdges(), vertices); removeVirtualVerticesFromLayers(layered.getLayers(), vertices); arrangeVertices(layered.getLayers(), arrangement, graph); } }
|
DefaultVertexPositioning implements VertexPositioning { @Override public void calculateVerticesPositions(final ReorderedGraph graph, final LayerArrangement arrangement) { final LayeredGraph layered = (LayeredGraph) graph; deReverseEdges(graph); final Set<Vertex> vertices = getVertices(layered); removeVirtualVertices(graph.getEdges(), vertices); removeVirtualVerticesFromLayers(layered.getLayers(), vertices); arrangeVertices(layered.getLayers(), arrangement, graph); } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
DefaultVertexPositioning implements VertexPositioning { @Override public void calculateVerticesPositions(final ReorderedGraph graph, final LayerArrangement arrangement) { final LayeredGraph layered = (LayeredGraph) graph; deReverseEdges(graph); final Set<Vertex> vertices = getVertices(layered); removeVirtualVertices(graph.getEdges(), vertices); removeVirtualVerticesFromLayers(layered.getLayers(), vertices); arrangeVertices(layered.getLayers(), arrangement, graph); } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
@Test public void testGetVertices() { final LayeredGraph graph = new LayeredGraph(); final GraphLayer layer1 = mock(GraphLayer.class); final GraphLayer layer2 = mock(GraphLayer.class); final List<Vertex> vertices1 = new ArrayList<>(); final List<Vertex> vertices2 = new ArrayList<>(); final Vertex v1 = mock(Vertex.class); final Vertex v2 = mock(Vertex.class); final Vertex v3 = mock(Vertex.class); vertices1.add(v1); vertices1.add(v2); vertices1.add(v3); when(layer1.getVertices()).thenReturn(vertices1); when(layer2.getVertices()).thenReturn(vertices2); graph.getLayers().add(layer1); graph.getLayers().add(layer2); final Set<Vertex> actual = tested.getVertices(graph); assertTrue(actual.contains(v1)); assertTrue(actual.contains(v2)); assertTrue(actual.contains(v3)); assertEquals(3, actual.size()); }
|
Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); }
|
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); } }
|
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); } }
|
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
@Test public void testDeReverseEdges() { final LayeredGraph graph = new LayeredGraph(); final OrientedEdgeImpl e1 = new OrientedEdgeImpl("1", "2", true); final OrientedEdgeImpl e2 = new OrientedEdgeImpl("2", "3", false); final OrientedEdgeImpl e3 = new OrientedEdgeImpl("2", "4", true); graph.addEdge(e1); graph.addEdge(e2); graph.addEdge(e3); tested.deReverseEdges(graph); assertFalse(e1.isReversed()); assertFalse(e2.isReversed()); assertFalse(e3.isReversed()); }
|
void deReverseEdges(final ReorderedGraph graph) { for (final OrientedEdge edge : graph.getEdges()) { if (edge.isReversed()) { edge.reverse(); } } }
|
DefaultVertexPositioning implements VertexPositioning { void deReverseEdges(final ReorderedGraph graph) { for (final OrientedEdge edge : graph.getEdges()) { if (edge.isReversed()) { edge.reverse(); } } } }
|
DefaultVertexPositioning implements VertexPositioning { void deReverseEdges(final ReorderedGraph graph) { for (final OrientedEdge edge : graph.getEdges()) { if (edge.isReversed()) { edge.reverse(); } } } }
|
DefaultVertexPositioning implements VertexPositioning { void deReverseEdges(final ReorderedGraph graph) { for (final OrientedEdge edge : graph.getEdges()) { if (edge.isReversed()) { edge.reverse(); } } } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
DefaultVertexPositioning implements VertexPositioning { void deReverseEdges(final ReorderedGraph graph) { for (final OrientedEdge edge : graph.getEdges()) { if (edge.isReversed()) { edge.reverse(); } } } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
@Test public void testGetLayersStartX() { final int largestWidth = 600; final int layersCount = 3; final HashMap<Integer, Integer> layersWidth = new HashMap<>(); layersWidth.put(0, 200); layersWidth.put(1, 600); layersWidth.put(2, 300); final HashMap<Integer, Integer> startX = tested.getLayersStartX(layersCount, layersWidth, largestWidth); assertEquals(200 + DEFAULT_LAYER_HORIZONTAL_PADDING, (int) startX.get(0)); assertEquals(0 + DEFAULT_LAYER_HORIZONTAL_PADDING, (int) startX.get(1)); assertEquals(150 + DEFAULT_LAYER_HORIZONTAL_PADDING, (int) startX.get(2)); }
|
HashMap<Integer, Integer> getLayersStartX(final int layersCount, final HashMap<Integer, Integer> layersWidth, final int largestWidth) { final HashMap<Integer, Integer> layersStartX = new HashMap<>(); for (int i = 0; i < layersCount; i++) { final int middle = largestWidth / 2; final int layerWidth = layersWidth.get(i); final int firstHalf = layerWidth / 2; int startPoint = middle - firstHalf; startPoint += DEFAULT_LAYER_HORIZONTAL_PADDING; layersStartX.put(i, startPoint); } return layersStartX; }
|
DefaultVertexPositioning implements VertexPositioning { HashMap<Integer, Integer> getLayersStartX(final int layersCount, final HashMap<Integer, Integer> layersWidth, final int largestWidth) { final HashMap<Integer, Integer> layersStartX = new HashMap<>(); for (int i = 0; i < layersCount; i++) { final int middle = largestWidth / 2; final int layerWidth = layersWidth.get(i); final int firstHalf = layerWidth / 2; int startPoint = middle - firstHalf; startPoint += DEFAULT_LAYER_HORIZONTAL_PADDING; layersStartX.put(i, startPoint); } return layersStartX; } }
|
DefaultVertexPositioning implements VertexPositioning { HashMap<Integer, Integer> getLayersStartX(final int layersCount, final HashMap<Integer, Integer> layersWidth, final int largestWidth) { final HashMap<Integer, Integer> layersStartX = new HashMap<>(); for (int i = 0; i < layersCount; i++) { final int middle = largestWidth / 2; final int layerWidth = layersWidth.get(i); final int firstHalf = layerWidth / 2; int startPoint = middle - firstHalf; startPoint += DEFAULT_LAYER_HORIZONTAL_PADDING; layersStartX.put(i, startPoint); } return layersStartX; } }
|
DefaultVertexPositioning implements VertexPositioning { HashMap<Integer, Integer> getLayersStartX(final int layersCount, final HashMap<Integer, Integer> layersWidth, final int largestWidth) { final HashMap<Integer, Integer> layersStartX = new HashMap<>(); for (int i = 0; i < layersCount; i++) { final int middle = largestWidth / 2; final int layerWidth = layersWidth.get(i); final int firstHalf = layerWidth / 2; int startPoint = middle - firstHalf; startPoint += DEFAULT_LAYER_HORIZONTAL_PADDING; layersStartX.put(i, startPoint); } return layersStartX; } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
DefaultVertexPositioning implements VertexPositioning { HashMap<Integer, Integer> getLayersStartX(final int layersCount, final HashMap<Integer, Integer> layersWidth, final int largestWidth) { final HashMap<Integer, Integer> layersStartX = new HashMap<>(); for (int i = 0; i < layersCount; i++) { final int middle = largestWidth / 2; final int layerWidth = layersWidth.get(i); final int firstHalf = layerWidth / 2; int startPoint = middle - firstHalf; startPoint += DEFAULT_LAYER_HORIZONTAL_PADDING; layersStartX.put(i, startPoint); } return layersStartX; } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
@Test public void testGetLargestWidth() { final GraphLayer layer1 = createGraphLayer(2); final int expectedSize1 = getExpectSize(2); final GraphLayer layer2 = createGraphLayer(4); final int expectedSize2 = getExpectSize(4); final GraphLayer layer3 = createGraphLayer(1); final int expectedSize3 = getExpectSize(1); final List<GraphLayer> layers = Arrays.asList(layer1, layer2, layer3); final HashMap<Integer, Integer> layersWidth = new HashMap<>(); final int largest = tested.calculateLayersWidth(layers, layersWidth); assertEquals(expectedSize2, largest); assertEquals((int) layersWidth.get(0), expectedSize1); assertEquals((int) layersWidth.get(1), expectedSize2); assertEquals((int) layersWidth.get(2), expectedSize3); }
|
int calculateLayersWidth(final List<GraphLayer> layers, final HashMap<Integer, Integer> layersWidth) { int largestWidth = 0; for (int i = 0; i < layers.size(); i++) { final GraphLayer layer = layers.get(i); int currentWidth = layer.getVertices().size() * DEFAULT_VERTEX_WIDTH; currentWidth += (layer.getVertices().size() - 1) * DEFAULT_VERTEX_SPACE; layersWidth.put(i, currentWidth); largestWidth = Math.max(largestWidth, currentWidth); } return largestWidth; }
|
DefaultVertexPositioning implements VertexPositioning { int calculateLayersWidth(final List<GraphLayer> layers, final HashMap<Integer, Integer> layersWidth) { int largestWidth = 0; for (int i = 0; i < layers.size(); i++) { final GraphLayer layer = layers.get(i); int currentWidth = layer.getVertices().size() * DEFAULT_VERTEX_WIDTH; currentWidth += (layer.getVertices().size() - 1) * DEFAULT_VERTEX_SPACE; layersWidth.put(i, currentWidth); largestWidth = Math.max(largestWidth, currentWidth); } return largestWidth; } }
|
DefaultVertexPositioning implements VertexPositioning { int calculateLayersWidth(final List<GraphLayer> layers, final HashMap<Integer, Integer> layersWidth) { int largestWidth = 0; for (int i = 0; i < layers.size(); i++) { final GraphLayer layer = layers.get(i); int currentWidth = layer.getVertices().size() * DEFAULT_VERTEX_WIDTH; currentWidth += (layer.getVertices().size() - 1) * DEFAULT_VERTEX_SPACE; layersWidth.put(i, currentWidth); largestWidth = Math.max(largestWidth, currentWidth); } return largestWidth; } }
|
DefaultVertexPositioning implements VertexPositioning { int calculateLayersWidth(final List<GraphLayer> layers, final HashMap<Integer, Integer> layersWidth) { int largestWidth = 0; for (int i = 0; i < layers.size(); i++) { final GraphLayer layer = layers.get(i); int currentWidth = layer.getVertices().size() * DEFAULT_VERTEX_WIDTH; currentWidth += (layer.getVertices().size() - 1) * DEFAULT_VERTEX_SPACE; layersWidth.put(i, currentWidth); largestWidth = Math.max(largestWidth, currentWidth); } return largestWidth; } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
DefaultVertexPositioning implements VertexPositioning { int calculateLayersWidth(final List<GraphLayer> layers, final HashMap<Integer, Integer> layersWidth) { int largestWidth = 0; for (int i = 0; i < layers.size(); i++) { final GraphLayer layer = layers.get(i); int currentWidth = layer.getVertices().size() * DEFAULT_VERTEX_WIDTH; currentWidth += (layer.getVertices().size() - 1) * DEFAULT_VERTEX_SPACE; layersWidth.put(i, currentWidth); largestWidth = Math.max(largestWidth, currentWidth); } return largestWidth; } @Override void calculateVerticesPositions(final ReorderedGraph graph,
final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
final List<OrientedEdge> edges,
final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
final Set<Vertex> vertices); }
|
@Test public void testGetVertexHeight() { final int width = 10; final int height = 20; final String id = "1"; int actual = tested.getVertexHeight(id); assertEquals(DEFAULT_VERTEX_HEIGHT, actual); tested.setVertexSize(id, width, height); actual = tested.getVertexHeight(id); assertEquals(height, actual); }
|
@Override public int getVertexHeight(final String vertexId) { final int height = verticesHeight.getOrDefault(vertexId, DEFAULT_VERTEX_HEIGHT); return height; }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexHeight(final String vertexId) { final int height = verticesHeight.getOrDefault(vertexId, DEFAULT_VERTEX_HEIGHT); return height; } }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexHeight(final String vertexId) { final int height = verticesHeight.getOrDefault(vertexId, DEFAULT_VERTEX_HEIGHT); return height; } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexHeight(final String vertexId) { final int height = verticesHeight.getOrDefault(vertexId, DEFAULT_VERTEX_HEIGHT); return height; } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); void addEdge(final String from,
final String to); void addEdge(final OrientedEdgeImpl edge); List<GraphLayer> getLayers(); List<String> getVertices(); @Override List<OrientedEdge> getEdges(); @Override int getVertexHeight(final String vertexId); @Override int getVertexWidth(final String vertexId); @Override void setVertexSize(final String vertexId, final int width, final int height); boolean isAcyclic(); String[] getVerticesFrom(final String vertex); }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexHeight(final String vertexId) { final int height = verticesHeight.getOrDefault(vertexId, DEFAULT_VERTEX_HEIGHT); return height; } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); void addEdge(final String from,
final String to); void addEdge(final OrientedEdgeImpl edge); List<GraphLayer> getLayers(); List<String> getVertices(); @Override List<OrientedEdge> getEdges(); @Override int getVertexHeight(final String vertexId); @Override int getVertexWidth(final String vertexId); @Override void setVertexSize(final String vertexId, final int width, final int height); boolean isAcyclic(); String[] getVerticesFrom(final String vertex); }
|
@Test public void testGetVertexWidth() { final int width = 10; final int height = 20; final String id = "1"; int actual = tested.getVertexWidth(id); assertEquals(DEFAULT_VERTEX_WIDTH, actual); tested.setVertexSize(id, width, height); actual = tested.getVertexWidth(id); assertEquals(width, actual); }
|
@Override public int getVertexWidth(final String vertexId) { final int width = verticesWidth.getOrDefault(vertexId, DEFAULT_VERTEX_WIDTH); return width; }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexWidth(final String vertexId) { final int width = verticesWidth.getOrDefault(vertexId, DEFAULT_VERTEX_WIDTH); return width; } }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexWidth(final String vertexId) { final int width = verticesWidth.getOrDefault(vertexId, DEFAULT_VERTEX_WIDTH); return width; } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexWidth(final String vertexId) { final int width = verticesWidth.getOrDefault(vertexId, DEFAULT_VERTEX_WIDTH); return width; } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); void addEdge(final String from,
final String to); void addEdge(final OrientedEdgeImpl edge); List<GraphLayer> getLayers(); List<String> getVertices(); @Override List<OrientedEdge> getEdges(); @Override int getVertexHeight(final String vertexId); @Override int getVertexWidth(final String vertexId); @Override void setVertexSize(final String vertexId, final int width, final int height); boolean isAcyclic(); String[] getVerticesFrom(final String vertex); }
|
LayeredGraph implements ReorderedGraph { @Override public int getVertexWidth(final String vertexId) { final int width = verticesWidth.getOrDefault(vertexId, DEFAULT_VERTEX_WIDTH); return width; } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); void addEdge(final String from,
final String to); void addEdge(final OrientedEdgeImpl edge); List<GraphLayer> getLayers(); List<String> getVertices(); @Override List<OrientedEdge> getEdges(); @Override int getVertexHeight(final String vertexId); @Override int getVertexWidth(final String vertexId); @Override void setVertexSize(final String vertexId, final int width, final int height); boolean isAcyclic(); String[] getVerticesFrom(final String vertex); }
|
@Test public void testSetVertexSize() { final int width = 15; final int height = 17; final String id = "1"; tested.setVertexSize(id, width, height); final int actualWidth = tested.getVertexWidth(id); final int actualHeight = tested.getVertexHeight(id); assertEquals(width, actualWidth); assertEquals(height, actualHeight); }
|
@Override public void setVertexSize(final String vertexId, final int width, final int height) { verticesWidth.put(vertexId, width); verticesHeight.put(vertexId, height); }
|
LayeredGraph implements ReorderedGraph { @Override public void setVertexSize(final String vertexId, final int width, final int height) { verticesWidth.put(vertexId, width); verticesHeight.put(vertexId, height); } }
|
LayeredGraph implements ReorderedGraph { @Override public void setVertexSize(final String vertexId, final int width, final int height) { verticesWidth.put(vertexId, width); verticesHeight.put(vertexId, height); } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); }
|
LayeredGraph implements ReorderedGraph { @Override public void setVertexSize(final String vertexId, final int width, final int height) { verticesWidth.put(vertexId, width); verticesHeight.put(vertexId, height); } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); void addEdge(final String from,
final String to); void addEdge(final OrientedEdgeImpl edge); List<GraphLayer> getLayers(); List<String> getVertices(); @Override List<OrientedEdge> getEdges(); @Override int getVertexHeight(final String vertexId); @Override int getVertexWidth(final String vertexId); @Override void setVertexSize(final String vertexId, final int width, final int height); boolean isAcyclic(); String[] getVerticesFrom(final String vertex); }
|
LayeredGraph implements ReorderedGraph { @Override public void setVertexSize(final String vertexId, final int width, final int height) { verticesWidth.put(vertexId, width); verticesHeight.put(vertexId, height); } LayeredGraph(); LayeredGraph(final String[][] edgesMatrix); void addEdge(final String from,
final String to); void addEdge(final OrientedEdgeImpl edge); List<GraphLayer> getLayers(); List<String> getVertices(); @Override List<OrientedEdge> getEdges(); @Override int getVertexHeight(final String vertexId); @Override int getVertexWidth(final String vertexId); @Override void setVertexSize(final String vertexId, final int width, final int height); boolean isAcyclic(); String[] getVerticesFrom(final String vertex); }
|
@Test public void testCreateLayout() { final Graph<?, ?> graph = mock(Graph.class); final Iterable nodes = mock(Iterable.class); final HashMap indexByUuid = mock(HashMap.class); final Collection values = mock(Collection.class); final LayeredGraph layeredGraph = mock(LayeredGraph.class); final List layers = mock(List.class); when(graphProcessor.getNodes(graph)).thenReturn(nodes); when(indexByUuid.values()).thenReturn(values); when(layeredGraph.getLayers()).thenReturn(layers); doReturn(indexByUuid).when(layoutService).createIndex(nodes); doReturn(layeredGraph).when(layoutService).createLayeredGraph(values); layoutService.createLayout(graph); final InOrder inOrder = inOrder(graphProcessor, cycleBreaker, vertexLayerer, vertexOrdering, vertexPositioning); inOrder.verify(graphProcessor).getNodes(graph); inOrder.verify(cycleBreaker).breakCycle(layeredGraph); inOrder.verify(vertexLayerer).createLayers(layeredGraph); inOrder.verify(vertexOrdering).orderVertices(layeredGraph); inOrder.verify(vertexPositioning).calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); verify(layoutService).buildLayout(indexByUuid, layers); }
|
@Override public Layout createLayout(final Graph<?, ?> graph) { final Iterable<? extends Node> nodes = graphProcessor.getNodes(graph); final HashMap<String, Node> indexByUuid = createIndex(nodes); final LayeredGraph layeredGraph = createLayeredGraph(indexByUuid.values()); this.cycleBreaker.breakCycle(layeredGraph); this.vertexLayerer.createLayers(layeredGraph); this.vertexOrdering.orderVertices(layeredGraph); this.vertexPositioning.calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); final List<GraphLayer> orderedLayers = layeredGraph.getLayers(); return buildLayout(indexByUuid, orderedLayers); }
|
SugiyamaLayoutService extends AbstractLayoutService { @Override public Layout createLayout(final Graph<?, ?> graph) { final Iterable<? extends Node> nodes = graphProcessor.getNodes(graph); final HashMap<String, Node> indexByUuid = createIndex(nodes); final LayeredGraph layeredGraph = createLayeredGraph(indexByUuid.values()); this.cycleBreaker.breakCycle(layeredGraph); this.vertexLayerer.createLayers(layeredGraph); this.vertexOrdering.orderVertices(layeredGraph); this.vertexPositioning.calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); final List<GraphLayer> orderedLayers = layeredGraph.getLayers(); return buildLayout(indexByUuid, orderedLayers); } }
|
SugiyamaLayoutService extends AbstractLayoutService { @Override public Layout createLayout(final Graph<?, ?> graph) { final Iterable<? extends Node> nodes = graphProcessor.getNodes(graph); final HashMap<String, Node> indexByUuid = createIndex(nodes); final LayeredGraph layeredGraph = createLayeredGraph(indexByUuid.values()); this.cycleBreaker.breakCycle(layeredGraph); this.vertexLayerer.createLayers(layeredGraph); this.vertexOrdering.orderVertices(layeredGraph); this.vertexPositioning.calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); final List<GraphLayer> orderedLayers = layeredGraph.getLayers(); return buildLayout(indexByUuid, orderedLayers); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { @Override public Layout createLayout(final Graph<?, ?> graph) { final Iterable<? extends Node> nodes = graphProcessor.getNodes(graph); final HashMap<String, Node> indexByUuid = createIndex(nodes); final LayeredGraph layeredGraph = createLayeredGraph(indexByUuid.values()); this.cycleBreaker.breakCycle(layeredGraph); this.vertexLayerer.createLayers(layeredGraph); this.vertexOrdering.orderVertices(layeredGraph); this.vertexPositioning.calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); final List<GraphLayer> orderedLayers = layeredGraph.getLayers(); return buildLayout(indexByUuid, orderedLayers); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { @Override public Layout createLayout(final Graph<?, ?> graph) { final Iterable<? extends Node> nodes = graphProcessor.getNodes(graph); final HashMap<String, Node> indexByUuid = createIndex(nodes); final LayeredGraph layeredGraph = createLayeredGraph(indexByUuid.values()); this.cycleBreaker.breakCycle(layeredGraph); this.vertexLayerer.createLayers(layeredGraph); this.vertexOrdering.orderVertices(layeredGraph); this.vertexPositioning.calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); final List<GraphLayer> orderedLayers = layeredGraph.getLayers(); return buildLayout(indexByUuid, orderedLayers); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testDelegateSetRowDraggingEnabled() { uiModel.setRowDraggingEnabled(true); verify(delegate).setRowDraggingEnabled(eq(true)); }
|
@Override public void setRowDraggingEnabled(final boolean enabled) { delegate.setRowDraggingEnabled(enabled); }
|
DelegatingGridData implements GridData { @Override public void setRowDraggingEnabled(final boolean enabled) { delegate.setRowDraggingEnabled(enabled); } }
|
DelegatingGridData implements GridData { @Override public void setRowDraggingEnabled(final boolean enabled) { delegate.setRowDraggingEnabled(enabled); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public void setRowDraggingEnabled(final boolean enabled) { delegate.setRowDraggingEnabled(enabled); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public void setRowDraggingEnabled(final boolean enabled) { delegate.setRowDraggingEnabled(enabled); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test public void testCreateIndex() { final Node nodeWithoutBounds = mock(Node.class); final String noBoundsId = "not"; final String id1 = "id1"; final String id2 = "id2"; final Object notHasBoundsInstance = mock(Object.class); final Node n1 = createNode(id1); final Node n2 = createNode(id2); final List<Node> nodes = Arrays.asList(n1, n2, nodeWithoutBounds); when(nodeWithoutBounds.getUUID()).thenReturn(noBoundsId); when(nodeWithoutBounds.getContent()).thenReturn(notHasBoundsInstance); final HashMap<String, Node> index = layoutService.createIndex(nodes); assertTrue(index.containsKey(id1)); assertTrue(index.containsKey(id2)); assertFalse(index.containsKey(noBoundsId)); assertEquals(n1, index.get(id1)); assertEquals(n2, index.get(id2)); }
|
HashMap<String, Node> createIndex(final Iterable<? extends Node> nodes) { final HashMap<String, Node> indexByUuid = new HashMap<>(); for (final Node n : nodes) { if (!(n.getContent() instanceof HasBounds)) { continue; } indexByUuid.put(n.getUUID(), n); } return indexByUuid; }
|
SugiyamaLayoutService extends AbstractLayoutService { HashMap<String, Node> createIndex(final Iterable<? extends Node> nodes) { final HashMap<String, Node> indexByUuid = new HashMap<>(); for (final Node n : nodes) { if (!(n.getContent() instanceof HasBounds)) { continue; } indexByUuid.put(n.getUUID(), n); } return indexByUuid; } }
|
SugiyamaLayoutService extends AbstractLayoutService { HashMap<String, Node> createIndex(final Iterable<? extends Node> nodes) { final HashMap<String, Node> indexByUuid = new HashMap<>(); for (final Node n : nodes) { if (!(n.getContent() instanceof HasBounds)) { continue; } indexByUuid.put(n.getUUID(), n); } return indexByUuid; } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { HashMap<String, Node> createIndex(final Iterable<? extends Node> nodes) { final HashMap<String, Node> indexByUuid = new HashMap<>(); for (final Node n : nodes) { if (!(n.getContent() instanceof HasBounds)) { continue; } indexByUuid.put(n.getUUID(), n); } return indexByUuid; } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { HashMap<String, Node> createIndex(final Iterable<? extends Node> nodes) { final HashMap<String, Node> indexByUuid = new HashMap<>(); for (final Node n : nodes) { if (!(n.getContent() instanceof HasBounds)) { continue; } indexByUuid.put(n.getUUID(), n); } return indexByUuid; } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testCreateLayeredGraph() { final Node n1 = createNode("id1"); final Node n2 = createNode("id2"); final List<Node> nodes = Arrays.asList(n1, n2); final LayeredGraph layeredGraph = mock(LayeredGraph.class); doReturn(layeredGraph).when(layoutService).getLayeredGraph(); doNothing().when(layoutService).addInEdges(layeredGraph, n1); doNothing().when(layoutService).addOutEdges(layeredGraph, n1); doNothing().when(layoutService).addInEdges(layeredGraph, n2); doNothing().when(layoutService).addOutEdges(layeredGraph, n2); layoutService.createLayeredGraph(nodes); verify(layoutService).addInEdges(layeredGraph, n1); verify(layoutService).addInEdges(layeredGraph, n2); verify(layoutService).addOutEdges(layeredGraph, n1); verify(layoutService).addOutEdges(layeredGraph, n2); }
|
LayeredGraph createLayeredGraph(final Iterable<? extends Node> nodes) { final LayeredGraph layeredGraph = getLayeredGraph(); for (final Node n : nodes) { addInEdges(layeredGraph, n); addOutEdges(layeredGraph, n); } return layeredGraph; }
|
SugiyamaLayoutService extends AbstractLayoutService { LayeredGraph createLayeredGraph(final Iterable<? extends Node> nodes) { final LayeredGraph layeredGraph = getLayeredGraph(); for (final Node n : nodes) { addInEdges(layeredGraph, n); addOutEdges(layeredGraph, n); } return layeredGraph; } }
|
SugiyamaLayoutService extends AbstractLayoutService { LayeredGraph createLayeredGraph(final Iterable<? extends Node> nodes) { final LayeredGraph layeredGraph = getLayeredGraph(); for (final Node n : nodes) { addInEdges(layeredGraph, n); addOutEdges(layeredGraph, n); } return layeredGraph; } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { LayeredGraph createLayeredGraph(final Iterable<? extends Node> nodes) { final LayeredGraph layeredGraph = getLayeredGraph(); for (final Node n : nodes) { addInEdges(layeredGraph, n); addOutEdges(layeredGraph, n); } return layeredGraph; } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { LayeredGraph createLayeredGraph(final Iterable<? extends Node> nodes) { final LayeredGraph layeredGraph = getLayeredGraph(); for (final Node n : nodes) { addInEdges(layeredGraph, n); addOutEdges(layeredGraph, n); } return layeredGraph; } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testAddInEdges() { final LayeredGraph layeredGraph = mock(LayeredGraph.class); final Node node = mock(Node.class); final Edge edge = mock(Edge.class); final Node sourceNode = mock(Node.class); final List inEdges = Arrays.asList(edge); final String fromId = "from"; final String toId = "to"; final int width = 10; final int height = 20; when(node.getInEdges()).thenReturn(inEdges); when(edge.getSourceNode()).thenReturn(sourceNode); doReturn(fromId).when(layoutService).getId(sourceNode); doReturn(toId).when(layoutService).getId(node); doReturn(width).when(layoutService).getWidth(node); doReturn(height).when(layoutService).getHeight(node); layoutService.addInEdges(layeredGraph, node); verify(layeredGraph).addEdge(fromId, toId); verify(layeredGraph).setVertexSize(toId, width, height); }
|
void addInEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getInEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String from = getId(edge.getSourceNode()); final String to = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } }
|
SugiyamaLayoutService extends AbstractLayoutService { void addInEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getInEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String from = getId(edge.getSourceNode()); final String to = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } }
|
SugiyamaLayoutService extends AbstractLayoutService { void addInEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getInEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String from = getId(edge.getSourceNode()); final String to = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { void addInEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getInEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String from = getId(edge.getSourceNode()); final String to = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { void addInEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getInEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String from = getId(edge.getSourceNode()); final String to = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testAddOutEdges() { final LayeredGraph layeredGraph = mock(LayeredGraph.class); final Node node = mock(Node.class); final Edge edge = mock(Edge.class); final Node targetNode = mock(Node.class); final List outEdges = Arrays.asList(edge); final String fromId = "from"; final String toId = "to"; final int width = 10; final int height = 20; when(node.getOutEdges()).thenReturn(outEdges); when(edge.getTargetNode()).thenReturn(targetNode); doReturn(fromId).when(layoutService).getId(node); doReturn(toId).when(layoutService).getId(targetNode); doReturn(width).when(layoutService).getWidth(node); doReturn(height).when(layoutService).getHeight(node); layoutService.addOutEdges(layeredGraph, node); verify(layeredGraph).addEdge(fromId, toId); verify(layeredGraph).setVertexSize(fromId, width, height); }
|
void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } }
|
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } }
|
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testGetHeight() { final Node n = mock(Node.class); final HasBounds hasBounds = mock(HasBounds.class); final Bounds bounds = mock(Bounds.class); final double height = 15; final int expected = (int) height; when(bounds.getHeight()).thenReturn(height); when(hasBounds.getBounds()).thenReturn(bounds); when(n.getContent()).thenReturn(hasBounds); int actual = layoutService.getHeight(n); assertEquals(expected, actual); }
|
int getHeight(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getHeight(); }
|
SugiyamaLayoutService extends AbstractLayoutService { int getHeight(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getHeight(); } }
|
SugiyamaLayoutService extends AbstractLayoutService { int getHeight(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getHeight(); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { int getHeight(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getHeight(); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { int getHeight(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getHeight(); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testGetWidth() { final Node n = mock(Node.class); final HasBounds hasBounds = mock(HasBounds.class); final Bounds bounds = mock(Bounds.class); final double width = 17; final int expected = (int) width; when(bounds.getWidth()).thenReturn(width); when(hasBounds.getBounds()).thenReturn(bounds); when(n.getContent()).thenReturn(hasBounds); int actual = layoutService.getWidth(n); assertEquals(expected, actual); }
|
int getWidth(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getWidth(); }
|
SugiyamaLayoutService extends AbstractLayoutService { int getWidth(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getWidth(); } }
|
SugiyamaLayoutService extends AbstractLayoutService { int getWidth(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getWidth(); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); }
|
SugiyamaLayoutService extends AbstractLayoutService { int getWidth(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getWidth(); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
SugiyamaLayoutService extends AbstractLayoutService { int getWidth(final Node n) { return (int) ((HasBounds) n.getContent()).getBounds().getWidth(); } @Inject SugiyamaLayoutService(final CycleBreaker cycleBreaker,
final VertexLayerer vertexLayerer,
final VertexOrdering vertexOrdering,
final VertexPositioning vertexPositioning,
final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
|
@Test public void testAcyclicGraphs() { final LayeredGraph graph = new LayeredGraph(Graphs.SIMPLE_ACYCLIC); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
|
@Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
@Test public void testSimpleCyclicGraph() { final LayeredGraph graph = new LayeredGraph(Graphs.SIMPLE_CYCLIC); graph.addEdge("A", "B"); graph.addEdge("B", "C"); graph.addEdge("C", "D"); graph.addEdge("D", "A"); assertFalse(graph.isAcyclic()); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
|
@Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
@Test public void testCyclicGraph1() { final LayeredGraph graph = new LayeredGraph(Graphs.CYCLIC_GRAPH_1); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
|
@Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
@Test public void testCyclicGraphFull() { final LayeredGraph graph = new LayeredGraph(Graphs.Full); assertFalse(graph.isAcyclic()); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
|
@Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph); }
|
@Test public void testDelegateIsRowDraggingEnabled() { uiModel.isRowDraggingEnabled(); verify(delegate).isRowDraggingEnabled(); }
|
@Override public boolean isRowDraggingEnabled() { return delegate.isRowDraggingEnabled(); }
|
DelegatingGridData implements GridData { @Override public boolean isRowDraggingEnabled() { return delegate.isRowDraggingEnabled(); } }
|
DelegatingGridData implements GridData { @Override public boolean isRowDraggingEnabled() { return delegate.isRowDraggingEnabled(); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public boolean isRowDraggingEnabled() { return delegate.isRowDraggingEnabled(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public boolean isRowDraggingEnabled() { return delegate.isRowDraggingEnabled(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test public void getLayoutInformationThreshold() { when(n1.getUUID()).thenReturn(UUID.uuid()); when(n2.getUUID()).thenReturn(UUID.uuid()); final GraphNodeStoreImpl store = new GraphNodeStoreImpl(); store.add(n1); doCallRealMethod().when(layoutService).getLayoutInformationThreshold(graph); when(graph.nodes()).thenReturn(store); double threshold = layoutService.getLayoutInformationThreshold(graph); assertEquals(0.25, threshold, 0.01); store.add(n2); threshold = layoutService.getLayoutInformationThreshold(graph); assertEquals(0.50, threshold, 0.01); }
|
protected double getLayoutInformationThreshold(final Graph<?, ?> graph) { final List<Node> list = new ArrayList<>(); graph.nodes().iterator().forEachRemaining(list::add); return list.size() / 4.0D; }
|
AbstractLayoutService implements LayoutService { protected double getLayoutInformationThreshold(final Graph<?, ?> graph) { final List<Node> list = new ArrayList<>(); graph.nodes().iterator().forEachRemaining(list::add); return list.size() / 4.0D; } }
|
AbstractLayoutService implements LayoutService { protected double getLayoutInformationThreshold(final Graph<?, ?> graph) { final List<Node> list = new ArrayList<>(); graph.nodes().iterator().forEachRemaining(list::add); return list.size() / 4.0D; } }
|
AbstractLayoutService implements LayoutService { protected double getLayoutInformationThreshold(final Graph<?, ?> graph) { final List<Node> list = new ArrayList<>(); graph.nodes().iterator().forEachRemaining(list::add); return list.size() / 4.0D; } @Override boolean hasLayoutInformation(final Graph<?, ?> graph); @Override abstract Layout createLayout(Graph<?, ?> graph); }
|
AbstractLayoutService implements LayoutService { protected double getLayoutInformationThreshold(final Graph<?, ?> graph) { final List<Node> list = new ArrayList<>(); graph.nodes().iterator().forEachRemaining(list::add); return list.size() / 4.0D; } @Override boolean hasLayoutInformation(final Graph<?, ?> graph); @Override abstract Layout createLayout(Graph<?, ?> graph); }
|
@Test public void hasLayoutInformation() { when(n1.getUUID()).thenReturn(UUID.uuid()); when(n2.getUUID()).thenReturn(UUID.uuid()); final GraphNodeStoreImpl store = new GraphNodeStoreImpl(); store.add(n2); store.add(n1); doCallRealMethod().when(layoutService).hasLayoutInformation(graph); doCallRealMethod().when(layoutService).getLayoutInformationThreshold(graph); when(graph.nodes()).thenReturn(store); assertFalse(layoutService.hasLayoutInformation(graph)); final Bounds bounds = Bounds.create(10, 10, 10, 10); final Bounds noBounds = Bounds.create(0, 0, 0, 0); when(n1.getContent()).thenReturn(hasBounds1); when(hasBounds1.getBounds()).thenReturn(noBounds); when(n2.getContent()).thenReturn(hasBounds2); when(hasBounds2.getBounds()).thenReturn(bounds); assertTrue(layoutService.hasLayoutInformation(graph)); }
|
@Override public boolean hasLayoutInformation(final Graph<?, ?> graph) { final double threshold = getLayoutInformationThreshold(graph); int nodesWithLayout = 0; for (final Node n : graph.nodes()) { final Object content = n.getContent(); if (content instanceof HasBounds) { if (!isNullOrCloseToZero(((HasBounds) content).getBounds())) { nodesWithLayout++; } } if (nodesWithLayout >= threshold) { return true; } } return false; }
|
AbstractLayoutService implements LayoutService { @Override public boolean hasLayoutInformation(final Graph<?, ?> graph) { final double threshold = getLayoutInformationThreshold(graph); int nodesWithLayout = 0; for (final Node n : graph.nodes()) { final Object content = n.getContent(); if (content instanceof HasBounds) { if (!isNullOrCloseToZero(((HasBounds) content).getBounds())) { nodesWithLayout++; } } if (nodesWithLayout >= threshold) { return true; } } return false; } }
|
AbstractLayoutService implements LayoutService { @Override public boolean hasLayoutInformation(final Graph<?, ?> graph) { final double threshold = getLayoutInformationThreshold(graph); int nodesWithLayout = 0; for (final Node n : graph.nodes()) { final Object content = n.getContent(); if (content instanceof HasBounds) { if (!isNullOrCloseToZero(((HasBounds) content).getBounds())) { nodesWithLayout++; } } if (nodesWithLayout >= threshold) { return true; } } return false; } }
|
AbstractLayoutService implements LayoutService { @Override public boolean hasLayoutInformation(final Graph<?, ?> graph) { final double threshold = getLayoutInformationThreshold(graph); int nodesWithLayout = 0; for (final Node n : graph.nodes()) { final Object content = n.getContent(); if (content instanceof HasBounds) { if (!isNullOrCloseToZero(((HasBounds) content).getBounds())) { nodesWithLayout++; } } if (nodesWithLayout >= threshold) { return true; } } return false; } @Override boolean hasLayoutInformation(final Graph<?, ?> graph); @Override abstract Layout createLayout(Graph<?, ?> graph); }
|
AbstractLayoutService implements LayoutService { @Override public boolean hasLayoutInformation(final Graph<?, ?> graph) { final double threshold = getLayoutInformationThreshold(graph); int nodesWithLayout = 0; for (final Node n : graph.nodes()) { final Object content = n.getContent(); if (content instanceof HasBounds) { if (!isNullOrCloseToZero(((HasBounds) content).getBounds())) { nodesWithLayout++; } } if (nodesWithLayout >= threshold) { return true; } } return false; } @Override boolean hasLayoutInformation(final Graph<?, ?> graph); @Override abstract Layout createLayout(Graph<?, ?> graph); }
|
@Test @SuppressWarnings("unchecked") public void testEvaluate() { StatefulGraphEvaluationState.StatefulContainmentState containmentState = new StatefulGraphEvaluationState.StatefulContainmentState(); when(state.getContainmentState()).thenReturn(containmentState); Element parent = new NodeImpl<>("parent"); Node child = new NodeImpl<>("child"); final NodeContainmentContext[] containmentContext = new NodeContainmentContext[1]; tested.evaluate(builder -> containmentContext[0] = builder.containment(parent, child)); verify(ruleManager, times(1)).evaluate(eq(ruleSet), eq(containmentContext[0])); assertEquals(parent, containmentState.getParent(child)); }
|
@Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); void clear(); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { ((AbstractGraphEvaluationContext) context).setState(this::getState); return StatefulGraphEvaluationContexts.evaluate(context, c -> ruleManager.evaluate(ruleSet, c)); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); void clear(); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
|
@Test public void testClear() { tested.clear(); verify(state, times(1)).clear(); }
|
public void clear() { getState().clear(); }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { public void clear() { getState().clear(); } }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { public void clear() { getState().clear(); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { public void clear() { getState().clear(); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); void clear(); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
|
ContextualGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { public void clear() { getState().clear(); } ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); ContextualGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleManager ruleManager,
final RuleEvaluationContextBuilder.StatefulGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex,
final RuleSet ruleSet); void clear(); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
|
@Test @SuppressWarnings("unchecked") public void testEvaluate() { when(contextBuilder.containment(any(Element.class), any(Node.class))).thenReturn(mock(NodeContainmentContext.class)); RuleViolations result = tested.evaluate(builder -> builder.containment(mock(Element.class), mock(Node.class))); assertEquals(EmptyRuleViolations.INSTANCE, result); }
|
@Override public RuleViolations evaluate(final GraphEvaluationContext context) { return EmptyRuleViolations.INSTANCE; }
|
DirectGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { return EmptyRuleViolations.INSTANCE; } }
|
DirectGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { return EmptyRuleViolations.INSTANCE; } DirectGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final Index<?, ?> graphIndex); DirectGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleEvaluationContextBuilder.StatelessGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex); }
|
DirectGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { return EmptyRuleViolations.INSTANCE; } DirectGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final Index<?, ?> graphIndex); DirectGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleEvaluationContextBuilder.StatelessGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
|
DirectGraphCommandExecutionContext extends AbstractGraphCommandExecutionContext { @Override public RuleViolations evaluate(final GraphEvaluationContext context) { return EmptyRuleViolations.INSTANCE; } DirectGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final Index<?, ?> graphIndex); DirectGraphCommandExecutionContext(final DefinitionManager definitionManager,
final FactoryManager factoryManager,
final RuleEvaluationContextBuilder.StatelessGraphContextBuilder contextBuilder,
final Index<?, ?> graphIndex); @Override RuleViolations evaluate(final GraphEvaluationContext context); @Override RuleSet getRuleSet(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertTrue(parentOutEdges.isEmpty()); assertTrue(candidateInEdges.isEmpty()); verify(graphIndex, times(1)).removeEdge(eq(edge)); verify(graphIndex, times(0)).removeNode(any(Node.class)); verify(graph, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); parent.getOutEdges().stream() .filter(e -> e.getContent() instanceof Dock) .filter(e -> e.getTargetNode().equals(candidate)) .findFirst() .ifPresent(e -> removeDockEdge(context, parent, candidate, e)); } return results; }
|
UnDockNodeCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); parent.getOutEdges().stream() .filter(e -> e.getContent() instanceof Dock) .filter(e -> e.getTargetNode().equals(candidate)) .findFirst() .ifPresent(e -> removeDockEdge(context, parent, candidate, e)); } return results; } }
|
UnDockNodeCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); parent.getOutEdges().stream() .filter(e -> e.getContent() instanceof Dock) .filter(e -> e.getTargetNode().equals(candidate)) .findFirst() .ifPresent(e -> removeDockEdge(context, parent, candidate, e)); } return results; } UnDockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); UnDockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); }
|
UnDockNodeCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); parent.getOutEdges().stream() .filter(e -> e.getContent() instanceof Dock) .filter(e -> e.getTargetNode().equals(candidate)) .findFirst() .ifPresent(e -> removeDockEdge(context, parent, candidate, e)); } return results; } UnDockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); UnDockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node<?, Edge> getCandidate(); @Override String toString(); }
|
UnDockNodeCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); parent.getOutEdges().stream() .filter(e -> e.getContent() instanceof Dock) .filter(e -> e.getTargetNode().equals(candidate)) .findFirst() .ifPresent(e -> removeDockEdge(context, parent, candidate, e)); } return results; } UnDockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); UnDockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node<?, Edge> getCandidate(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { final List sourceOutEdges = spy(new ArrayList()); final List targetInEdges = spy(new ArrayList()); when(source.getOutEdges()).thenReturn(sourceOutEdges); when(target.getInEdges()).thenReturn(targetInEdges); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(sourceOutEdges, times(1)).remove(eq(edge)); verify(targetInEdges, times(1)).remove(eq(edge)); verify(graphIndex, times(1)).removeEdge(eq(edge)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID); DeleteConnectorCommand(final Edge<? extends View, Node> edge); }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID); DeleteConnectorCommand(final Edge<? extends View, Node> edge); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(); @Override String toString(); }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID); DeleteConnectorCommand(final Edge<? extends View, Node> edge); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecuteCheckFailed() { final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations() .addViolation(new ContainmentRuleViolation(graph.getUUID(), UUID)); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS); final List sourceOutEdges = spy(new ArrayList()); final List targetInEdges = spy(new ArrayList()); when(source.getOutEdges()).thenReturn(sourceOutEdges); when(target.getInEdges()).thenReturn(targetInEdges); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); verify(sourceOutEdges, times(0)).remove(any(Edge.class)); verify(targetInEdges, times(0)).remove(any(Edge.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); verify(graphIndex, times(0)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID); DeleteConnectorCommand(final Edge<? extends View, Node> edge); }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID); DeleteConnectorCommand(final Edge<? extends View, Node> edge); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(); @Override String toString(); }
|
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID); DeleteConnectorCommand(final Edge<? extends View, Node> edge); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testInitializeCommands() { this.tested = spy(tested); tested.initialize(graphCommandExecutionContext); ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class); verify(tested, times(2)).addCommand(commandArgumentCaptor.capture()); List<Command> commands = commandArgumentCaptor.getAllValues(); assertNotNull(commands); assertTrue(commands.size() == 2); assertTrue(commands.get(0) instanceof RegisterNodeCommand); assertTrue(commands.get(1) instanceof DockNodeCommand); }
|
protected AddDockedNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.addCommand(new RegisterNodeCommand(candidate)) .addCommand(new DockNodeCommand(getParent(context), candidate)); return this; }
|
AddDockedNodeCommand extends AbstractGraphCompositeCommand { protected AddDockedNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.addCommand(new RegisterNodeCommand(candidate)) .addCommand(new DockNodeCommand(getParent(context), candidate)); return this; } }
|
AddDockedNodeCommand extends AbstractGraphCompositeCommand { protected AddDockedNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.addCommand(new RegisterNodeCommand(candidate)) .addCommand(new DockNodeCommand(getParent(context), candidate)); return this; } AddDockedNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate); AddDockedNodeCommand(final Node parent,
final Node candidate); }
|
AddDockedNodeCommand extends AbstractGraphCompositeCommand { protected AddDockedNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.addCommand(new RegisterNodeCommand(candidate)) .addCommand(new DockNodeCommand(getParent(context), candidate)); return this; } AddDockedNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate); AddDockedNodeCommand(final Node parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node getCandidate(); @Override String toString(); }
|
AddDockedNodeCommand extends AbstractGraphCompositeCommand { protected AddDockedNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.addCommand(new RegisterNodeCommand(candidate)) .addCommand(new DockNodeCommand(getParent(context), candidate)); return this; } AddDockedNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate); AddDockedNodeCommand(final Node parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node getCandidate(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testUndo() { CommandResult<RuleViolation> result = tested.undo(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(graph, times(1)).removeNode(eq(UUID)); verify(graphIndex, times(1)).removeNode(eq(node)); verify(graphIndex, times(0)).removeEdge(any(Edge.class)); verify(graph, times(0)).addNode(eq(node)); verify(graphIndex, times(0)).addNode(eq(node)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final SafeDeleteNodeCommand undoCommand = new SafeDeleteNodeCommand(getCandidate()); return undoCommand.execute(context); }
|
AddNodeCommand extends RegisterNodeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final SafeDeleteNodeCommand undoCommand = new SafeDeleteNodeCommand(getCandidate()); return undoCommand.execute(context); } }
|
AddNodeCommand extends RegisterNodeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final SafeDeleteNodeCommand undoCommand = new SafeDeleteNodeCommand(getCandidate()); return undoCommand.execute(context); } AddNodeCommand(final @MapsTo("candidate") Node candidate); }
|
AddNodeCommand extends RegisterNodeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final SafeDeleteNodeCommand undoCommand = new SafeDeleteNodeCommand(getCandidate()); return undoCommand.execute(context); } AddNodeCommand(final @MapsTo("candidate") Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
AddNodeCommand extends RegisterNodeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final SafeDeleteNodeCommand undoCommand = new SafeDeleteNodeCommand(getCandidate()); return undoCommand.execute(context); } AddNodeCommand(final @MapsTo("candidate") Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test public void testDelegateSetMerged() { uiModel.setMerged(true); verify(delegate).setMerged(eq(true)); }
|
@Override public void setMerged(final boolean isMerged) { delegate.setMerged(isMerged); }
|
DelegatingGridData implements GridData { @Override public void setMerged(final boolean isMerged) { delegate.setMerged(isMerged); } }
|
DelegatingGridData implements GridData { @Override public void setMerged(final boolean isMerged) { delegate.setMerged(isMerged); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public void setMerged(final boolean isMerged) { delegate.setMerged(isMerged); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public void setMerged(final boolean isMerged) { delegate.setMerged(isMerged); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test @SuppressWarnings("unchecked") public void testCompositeTheRightCommands() { tested.initialize(graphCommandExecutionContext); final List<Command<GraphCommandExecutionContext, RuleViolation>> commands = tested.getCommands(); assertEquals(3, commands.size()); DeleteConnectorCommand deleteConnectorCommand = (DeleteConnectorCommand) commands.get(0); assertEquals(edge, deleteConnectorCommand.getEdge()); SafeDeleteNodeCommand deleteSourceNodeCommand = (SafeDeleteNodeCommand) commands.get(1); assertEquals(source, deleteSourceNodeCommand.getNode()); SafeDeleteNodeCommand deleteTargetNodeCommand = (SafeDeleteNodeCommand) commands.get(2); assertEquals(target, deleteTargetNodeCommand.getNode()); assertTrue(deleteSourceNodeCommand.getOptions().getExclusions().contains(EDGE_UUID)); assertTrue(deleteTargetNodeCommand.getOptions().getExclusions().contains(EDGE_UUID)); }
|
@Override @SuppressWarnings("unchecked") protected DeleteElementsCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); if (null == elements) { elements = uuids.stream() .map(uuid -> context.getGraphIndex().get(uuid)) .collect(Collectors.toList()); } if (elements.isEmpty()) { throw new IllegalArgumentException("No elements to delete."); } if (1 == elements.size()) { final Element<?> element = elements.iterator().next(); if (null != element.asNode()) { final Node<?, Edge> node = element.asNode(); final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.defaults(); commands.add(createSafeDeleteNodeCommand(node, options, callback)); } else { final Edge<? extends View, Node> edge = (Edge<? extends View, Node>) element.asEdge(); commands.add(new DeleteConnectorCommand(edge)); callback.onDeleteEdge(edge); } } else { final List<Element> edges = elements.stream() .filter(e -> null != e.asEdge()) .collect(Collectors.toList()); final Set<String> edgeIds = edges.stream() .map(Element::getUUID) .collect(Collectors.toSet()); edges.forEach(edge -> { commands.add(new DeleteConnectorCommand((Edge<? extends View, Node>) edge)); callback.onDeleteEdge((Edge<? extends View, Node>) edge); }); elements.stream() .filter(e -> null != e.asNode()) .collect(Collectors.toList()) .forEach(e -> { final Node<?, Edge> node = (Node<?, Edge>) e; final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.exclude(edgeIds); commands.add(createSafeDeleteNodeCommand(node, options, callback)); }); } return this; }
|
DeleteElementsCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected DeleteElementsCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); if (null == elements) { elements = uuids.stream() .map(uuid -> context.getGraphIndex().get(uuid)) .collect(Collectors.toList()); } if (elements.isEmpty()) { throw new IllegalArgumentException("No elements to delete."); } if (1 == elements.size()) { final Element<?> element = elements.iterator().next(); if (null != element.asNode()) { final Node<?, Edge> node = element.asNode(); final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.defaults(); commands.add(createSafeDeleteNodeCommand(node, options, callback)); } else { final Edge<? extends View, Node> edge = (Edge<? extends View, Node>) element.asEdge(); commands.add(new DeleteConnectorCommand(edge)); callback.onDeleteEdge(edge); } } else { final List<Element> edges = elements.stream() .filter(e -> null != e.asEdge()) .collect(Collectors.toList()); final Set<String> edgeIds = edges.stream() .map(Element::getUUID) .collect(Collectors.toSet()); edges.forEach(edge -> { commands.add(new DeleteConnectorCommand((Edge<? extends View, Node>) edge)); callback.onDeleteEdge((Edge<? extends View, Node>) edge); }); elements.stream() .filter(e -> null != e.asNode()) .collect(Collectors.toList()) .forEach(e -> { final Node<?, Edge> node = (Node<?, Edge>) e; final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.exclude(edgeIds); commands.add(createSafeDeleteNodeCommand(node, options, callback)); }); } return this; } }
|
DeleteElementsCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected DeleteElementsCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); if (null == elements) { elements = uuids.stream() .map(uuid -> context.getGraphIndex().get(uuid)) .collect(Collectors.toList()); } if (elements.isEmpty()) { throw new IllegalArgumentException("No elements to delete."); } if (1 == elements.size()) { final Element<?> element = elements.iterator().next(); if (null != element.asNode()) { final Node<?, Edge> node = element.asNode(); final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.defaults(); commands.add(createSafeDeleteNodeCommand(node, options, callback)); } else { final Edge<? extends View, Node> edge = (Edge<? extends View, Node>) element.asEdge(); commands.add(new DeleteConnectorCommand(edge)); callback.onDeleteEdge(edge); } } else { final List<Element> edges = elements.stream() .filter(e -> null != e.asEdge()) .collect(Collectors.toList()); final Set<String> edgeIds = edges.stream() .map(Element::getUUID) .collect(Collectors.toSet()); edges.forEach(edge -> { commands.add(new DeleteConnectorCommand((Edge<? extends View, Node>) edge)); callback.onDeleteEdge((Edge<? extends View, Node>) edge); }); elements.stream() .filter(e -> null != e.asNode()) .collect(Collectors.toList()) .forEach(e -> { final Node<?, Edge> node = (Node<?, Edge>) e; final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.exclude(edgeIds); commands.add(createSafeDeleteNodeCommand(node, options, callback)); }); } return this; } DeleteElementsCommand(final @MapsTo("uuids") Collection<String> uuids); DeleteElementsCommand(final Supplier<Collection<Element>> elements); DeleteElementsCommand(final Supplier<Collection<Element>> elements,
final DeleteCallback callback); }
|
DeleteElementsCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected DeleteElementsCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); if (null == elements) { elements = uuids.stream() .map(uuid -> context.getGraphIndex().get(uuid)) .collect(Collectors.toList()); } if (elements.isEmpty()) { throw new IllegalArgumentException("No elements to delete."); } if (1 == elements.size()) { final Element<?> element = elements.iterator().next(); if (null != element.asNode()) { final Node<?, Edge> node = element.asNode(); final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.defaults(); commands.add(createSafeDeleteNodeCommand(node, options, callback)); } else { final Edge<? extends View, Node> edge = (Edge<? extends View, Node>) element.asEdge(); commands.add(new DeleteConnectorCommand(edge)); callback.onDeleteEdge(edge); } } else { final List<Element> edges = elements.stream() .filter(e -> null != e.asEdge()) .collect(Collectors.toList()); final Set<String> edgeIds = edges.stream() .map(Element::getUUID) .collect(Collectors.toSet()); edges.forEach(edge -> { commands.add(new DeleteConnectorCommand((Edge<? extends View, Node>) edge)); callback.onDeleteEdge((Edge<? extends View, Node>) edge); }); elements.stream() .filter(e -> null != e.asNode()) .collect(Collectors.toList()) .forEach(e -> { final Node<?, Edge> node = (Node<?, Edge>) e; final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.exclude(edgeIds); commands.add(createSafeDeleteNodeCommand(node, options, callback)); }); } return this; } DeleteElementsCommand(final @MapsTo("uuids") Collection<String> uuids); DeleteElementsCommand(final Supplier<Collection<Element>> elements); DeleteElementsCommand(final Supplier<Collection<Element>> elements,
final DeleteCallback callback); Collection<String> getUUIDs(); @Override String toString(); }
|
DeleteElementsCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected DeleteElementsCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); if (null == elements) { elements = uuids.stream() .map(uuid -> context.getGraphIndex().get(uuid)) .collect(Collectors.toList()); } if (elements.isEmpty()) { throw new IllegalArgumentException("No elements to delete."); } if (1 == elements.size()) { final Element<?> element = elements.iterator().next(); if (null != element.asNode()) { final Node<?, Edge> node = element.asNode(); final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.defaults(); commands.add(createSafeDeleteNodeCommand(node, options, callback)); } else { final Edge<? extends View, Node> edge = (Edge<? extends View, Node>) element.asEdge(); commands.add(new DeleteConnectorCommand(edge)); callback.onDeleteEdge(edge); } } else { final List<Element> edges = elements.stream() .filter(e -> null != e.asEdge()) .collect(Collectors.toList()); final Set<String> edgeIds = edges.stream() .map(Element::getUUID) .collect(Collectors.toSet()); edges.forEach(edge -> { commands.add(new DeleteConnectorCommand((Edge<? extends View, Node>) edge)); callback.onDeleteEdge((Edge<? extends View, Node>) edge); }); elements.stream() .filter(e -> null != e.asNode()) .collect(Collectors.toList()) .forEach(e -> { final Node<?, Edge> node = (Node<?, Edge>) e; final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.exclude(edgeIds); commands.add(createSafeDeleteNodeCommand(node, options, callback)); }); } return this; } DeleteElementsCommand(final @MapsTo("uuids") Collection<String> uuids); DeleteElementsCommand(final Supplier<Collection<Element>> elements); DeleteElementsCommand(final Supplier<Collection<Element>> elements,
final DeleteCallback callback); Collection<String> getUUIDs(); @Override String toString(); }
|
@Test public void testCheck() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 0); CommandResult<RuleViolation> result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 1); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 2); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 3); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidIndex() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, -1); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidIndexDuringExecute() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, -1); tested.execute(graphCommandExecutionContext); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidCPIndex() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 4); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidCPIndexDuringExecute() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 4); tested.execute(graphCommandExecutionContext); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidCP() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 2); newControlPoint.setLocation(null); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkAddControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoint, index); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidCPDuringExecute() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 2); newControlPoint.setLocation(null); tested.execute(graphCommandExecutionContext); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testAddControlPointAt0() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 0); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(4, controlPoints.length); assertEquals(newControlPoint, controlPoints[0]); assertEquals(controlPoint1, controlPoints[1]); assertEquals(controlPoint2, controlPoints[2]); assertEquals(controlPoint3, controlPoints[3]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testAddControlPointAt1() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 1); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(4, controlPoints.length); assertEquals(controlPoint1, controlPoints[0]); assertEquals(newControlPoint, controlPoints[1]); assertEquals(controlPoint2, controlPoints[2]); assertEquals(controlPoint3, controlPoints[3]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testDelegateIsMerged() { uiModel.isMerged(); verify(delegate).isMerged(); }
|
@Override public boolean isMerged() { return delegate.isMerged(); }
|
DelegatingGridData implements GridData { @Override public boolean isMerged() { return delegate.isMerged(); } }
|
DelegatingGridData implements GridData { @Override public boolean isMerged() { return delegate.isMerged(); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public boolean isMerged() { return delegate.isMerged(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public boolean isMerged() { return delegate.isMerged(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test public void testGetItemDefinitionsWithNamespace() { final Definitions definitions = mock(Definitions.class); final Import anImport = mock(Import.class); final ItemDefinition itemDefinition1 = new TItemDefinition(); final ItemDefinition itemDefinition2 = new TItemDefinition(); final ItemDefinition itemDefinition3 = new TItemDefinition(); final ItemDefinition itemDefinition4 = new TItemDefinition(); final ItemDefinition itemDefinition5 = new TItemDefinition(); final List<ItemDefinition> itemDefinitions = asList(itemDefinition1, itemDefinition2, itemDefinition3, itemDefinition4, itemDefinition5); itemDefinition1.setName("tUUID"); itemDefinition2.setName("tPerson"); itemDefinition3.setName("id"); itemDefinition4.setName("name"); itemDefinition5.setName("age"); itemDefinition1.setTypeRef(new QName("string")); itemDefinition2.setTypeRef(null); itemDefinition3.setTypeRef(new QName("tUUID")); itemDefinition4.setTypeRef(new QName("string")); itemDefinition5.setTypeRef(new QName("number")); when(anImport.getName()).thenReturn("model"); when(definitions.getItemDefinition()).thenReturn(itemDefinitions); final List<ItemDefinition> actualItemDefinitions = helper.getItemDefinitionsWithNamespace(definitions, anImport); assertEquals(5, actualItemDefinitions.size()); final ItemDefinition actualItemDefinition1 = actualItemDefinitions.get(0); assertEquals("model.tUUID", actualItemDefinition1.getName()); assertEquals("string", actualItemDefinition1.getTypeRef().getLocalPart()); final ItemDefinition actualItemDefinition2 = actualItemDefinitions.get(1); assertEquals("model.tPerson", actualItemDefinition2.getName()); assertNull(actualItemDefinition2.getTypeRef()); final ItemDefinition actualItemDefinition3 = actualItemDefinitions.get(2); assertEquals("model.id", actualItemDefinition3.getName()); assertEquals("model.tUUID", actualItemDefinition3.getTypeRef().getLocalPart()); final ItemDefinition actualItemDefinition4 = actualItemDefinitions.get(3); assertEquals("model.name", actualItemDefinition4.getName()); assertEquals("string", actualItemDefinition4.getTypeRef().getLocalPart()); final ItemDefinition actualItemDefinition5 = actualItemDefinitions.get(4); assertEquals("model.age", actualItemDefinition5.getName()); assertEquals("number", actualItemDefinition5.getTypeRef().getLocalPart()); }
|
List<ItemDefinition> getItemDefinitionsWithNamespace(final Definitions definitions, final Import anImport) { final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); final String prefix = anImport.getName(); return itemDefinitions .stream() .map(itemDefinition -> withNamespace(itemDefinition, prefix)) .collect(Collectors.toList()); }
|
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { List<ItemDefinition> getItemDefinitionsWithNamespace(final Definitions definitions, final Import anImport) { final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); final String prefix = anImport.getName(); return itemDefinitions .stream() .map(itemDefinition -> withNamespace(itemDefinition, prefix)) .collect(Collectors.toList()); } }
|
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { List<ItemDefinition> getItemDefinitionsWithNamespace(final Definitions definitions, final Import anImport) { final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); final String prefix = anImport.getName(); return itemDefinitions .stream() .map(itemDefinition -> withNamespace(itemDefinition, prefix)) .collect(Collectors.toList()); } DMNMarshallerImportsHelperStandaloneImpl(); @Inject DMNMarshallerImportsHelperStandaloneImpl(final DMNPathsHelper pathsHelper,
final WorkspaceProjectService projectService,
final DMNMarshaller marshaller,
final DMNIOHelper dmnIOHelper,
final PMMLIncludedDocumentFactory pmmlDocumentFactory,
final @Named("ioStrategy") IOService ioService); }
|
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { List<ItemDefinition> getItemDefinitionsWithNamespace(final Definitions definitions, final Import anImport) { final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); final String prefix = anImport.getName(); return itemDefinitions .stream() .map(itemDefinition -> withNamespace(itemDefinition, prefix)) .collect(Collectors.toList()); } DMNMarshallerImportsHelperStandaloneImpl(); @Inject DMNMarshallerImportsHelperStandaloneImpl(final DMNPathsHelper pathsHelper,
final WorkspaceProjectService projectService,
final DMNMarshaller marshaller,
final DMNIOHelper dmnIOHelper,
final PMMLIncludedDocumentFactory pmmlDocumentFactory,
final @Named("ioStrategy") IOService ioService); @Override Map<Import, Definitions> getImportDefinitions(final Metadata metadata,
final List<Import> imports); @Override Map<Import, PMMLDocumentMetadata> getPMMLDocuments(final Metadata metadata,
final List<Import> imports); @Override Map<Import, String> getImportXML(final Metadata metadata,
final List<Import> imports); @Override Path getDMNModelPath(final Metadata metadata,
final String modelNamespace,
final String modelName); @Override List<DRGElement> getImportedDRGElements(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
final String modelName,
final String namespace); @Override Optional<InputStream> loadPath(final Path path); }
|
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { List<ItemDefinition> getItemDefinitionsWithNamespace(final Definitions definitions, final Import anImport) { final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); final String prefix = anImport.getName(); return itemDefinitions .stream() .map(itemDefinition -> withNamespace(itemDefinition, prefix)) .collect(Collectors.toList()); } DMNMarshallerImportsHelperStandaloneImpl(); @Inject DMNMarshallerImportsHelperStandaloneImpl(final DMNPathsHelper pathsHelper,
final WorkspaceProjectService projectService,
final DMNMarshaller marshaller,
final DMNIOHelper dmnIOHelper,
final PMMLIncludedDocumentFactory pmmlDocumentFactory,
final @Named("ioStrategy") IOService ioService); @Override Map<Import, Definitions> getImportDefinitions(final Metadata metadata,
final List<Import> imports); @Override Map<Import, PMMLDocumentMetadata> getPMMLDocuments(final Metadata metadata,
final List<Import> imports); @Override Map<Import, String> getImportXML(final Metadata metadata,
final List<Import> imports); @Override Path getDMNModelPath(final Metadata metadata,
final String modelNamespace,
final String modelName); @Override List<DRGElement> getImportedDRGElements(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
final String modelName,
final String namespace); @Override Optional<InputStream> loadPath(final Path path); static final QName NAMESPACE; }
|
@Test public void testAddControlPointAt2() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 2); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(4, controlPoints.length); assertEquals(controlPoint1, controlPoints[0]); assertEquals(controlPoint2, controlPoints[1]); assertEquals(newControlPoint, controlPoints[2]); assertEquals(controlPoint3, controlPoints[3]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testAddControlPointAt3() { tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 3); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(4, controlPoints.length); assertEquals(controlPoint1, controlPoints[0]); assertEquals(controlPoint2, controlPoints[1]); assertEquals(controlPoint3, controlPoints[2]); assertEquals(newControlPoint, controlPoints[3]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testAddControlPointFirstTime() { when(viewConnector.getControlPoints()).thenReturn(null); tested = new AddControlPointCommand(EDGE_UUID, newControlPoint, 0); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(1, controlPoints.length); assertEquals(newControlPoint, controlPoints[0]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
AddControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = Objects.isNull(edgeControlPoints.getControlPoints()) ? 0 : edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size + 1]; for (int i = 0; i < size + 1; i++) { if (i < index) { cps[i] = edgeControlPoints.getControlPoints()[i]; } else if (i == index) { cps[i] = controlPoint; } else { cps[i] = edgeControlPoints.getControlPoints()[i - 1]; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } AddControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoint") ControlPoint controlPoint,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertFalse(parent.getOutEdges().isEmpty()); assertFalse(candidate.getInEdges().isEmpty()); Edge edge = (Edge) parent.getOutEdges().get(0); assertTrue(edge.getContent() instanceof Dock); assertEquals(parent, edge.getSourceNode()); assertEquals(candidate, edge.getTargetNode()); verify(graphIndex, times(1)).addEdge(eq(edge)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } DockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") String candidateUUID); DockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } DockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") String candidateUUID); DockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getCandidate(); Node<?, Edge> getParent(); @Override String toString(); }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } DockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") String candidateUUID); DockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getCandidate(); Node<?, Edge> getParent(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecuteCheckFailed() { final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations() .addViolation(new ContainmentRuleViolation(graph.getUUID(), PARENT_UUID)); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); assertTrue(parent.getOutEdges().isEmpty()); assertTrue(candidate.getInEdges().isEmpty()); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } DockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") String candidateUUID); DockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } DockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") String candidateUUID); DockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getCandidate(); Node<?, Edge> getParent(); @Override String toString(); }
|
DockNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Dock, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Dock()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } DockNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") String candidateUUID); DockNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getCandidate(); Node<?, Edge> getParent(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testInitializeCommands() { this.tested = spy(tested); tested.initialize(graphCommandExecutionContext); ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class); verify(tested, times(3)).addCommand(commandArgumentCaptor.capture()); List<Command> commands = commandArgumentCaptor.getAllValues(); assertNotNull(commands); assertTrue(commands.size() == 3); assertTrue(commands.get(0) instanceof RegisterNodeCommand); assertTrue(commands.get(1) instanceof SetChildrenCommand); assertTrue(commands.get(2) instanceof UpdateElementPositionCommand); }
|
@SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testInitializeWithNoPositionCommands() { this.tested = spy(new AddChildNodeCommand(PARENT_UUID, candidate, null)); tested.initialize(graphCommandExecutionContext); ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class); verify(tested, times(2)).addCommand(commandArgumentCaptor.capture()); List<Command> commands = commandArgumentCaptor.getAllValues(); assertNotNull(commands); assertTrue(commands.size() == 2); assertTrue(commands.get(0) instanceof RegisterNodeCommand); assertTrue(commands.get(1) instanceof SetChildrenCommand); }
|
@SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @SuppressWarnings("unchecked") protected AddChildNodeCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); final Node<?, Edge> parent = getParent(context); this.addCommand(getRegisterNodeCommand(candidate)); this.addCommand(getSetChildNodeCommand(parent, candidate)); if (null != location) { this.addCommand(getUpdateElementPositionCommand(candidate, location)); } return this; } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testAllow() { CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); List<Command<GraphCommandExecutionContext, RuleViolation>> commands = tested.getCommands(); assertNotNull(commands); assertEquals(3, commands.size()); final ArgumentCaptor<RuleEvaluationContext> contextCaptor = ArgumentCaptor.forClass(RuleEvaluationContext.class); verify(ruleManager, times(2)).evaluate(eq(ruleSet), contextCaptor.capture()); final List<RuleEvaluationContext> contexts = contextCaptor.getAllValues(); assertEquals(2, contexts.size()); verifyCardinality((ElementCardinalityContext) contexts.get(1), graph, candidate, CardinalityContext.Operation.ADD); verifyContainment((NodeContainmentContext) contexts.get(0), parent, candidate); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testAllowNoRules() { useAllowedExecutionContext(); CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(ruleManager, times(0)).evaluate(eq(ruleSet), any(RuleEvaluationContext.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testNotAllowed() { final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations() .addViolation(new ContainmentRuleViolation(graph.getUUID(), PARENT_UUID)); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS); CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
AddChildNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { ensureInitialized(context); final Element<? extends Definition<?>> parent = (Element<? extends Definition<?>>) getParent(context); final Collection<RuleViolation> containmentRuleViolations = evaluate(context, contextBuilder -> contextBuilder.containment(parent, candidate)); final Collection<RuleViolation> cardinalityRuleViolations = evaluate(context, contextBuilder -> contextBuilder.cardinality(Collections.singleton(candidate), CardinalityContext.Operation.ADD)); final Collection<RuleViolation> violations = new LinkedList<RuleViolation>(); violations.addAll(containmentRuleViolations); violations.addAll(cardinalityRuleViolations); return new GraphCommandResultBuilder(violations).build(); } AddChildNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidate") Node candidate,
final @MapsTo("location") Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate,
final Point2D location); AddChildNodeCommand(final Node<?, Edge> parent,
final Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Node getCandidate(); Point2D getLocation(); @Override String toString(); }
|
@Test public void testDelegateUpdateColumn() { uiModel.updateColumn(0, gridColumn); verify(delegate).updateColumn(eq(0), eq(gridColumn)); }
|
@Override public void updateColumn(final int index, final GridColumn<?> column) { delegate.updateColumn(index, column); }
|
DelegatingGridData implements GridData { @Override public void updateColumn(final int index, final GridColumn<?> column) { delegate.updateColumn(index, column); } }
|
DelegatingGridData implements GridData { @Override public void updateColumn(final int index, final GridColumn<?> column) { delegate.updateColumn(index, column); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public void updateColumn(final int index, final GridColumn<?> column) { delegate.updateColumn(index, column); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public void updateColumn(final int index, final GridColumn<?> column) { delegate.updateColumn(index, column); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { assertEquals(CommandResult.Type.INFO, command.execute(graphCommandExecutionContext).getType()); verify(propertyAdapter).getValue(eq(domainObject.getNameProperty())); verify(propertyAdapter).setValue(eq(domainObject.getNameProperty()), eq(PROPERTY_VALUE)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final DefinitionManager definitionManager = context.getDefinitionManager(); final Object p = definitionManager.adapters().forDefinition().getProperty(domainObject, field).get(); final AdapterManager adapterManager = definitionManager.adapters(); final AdapterRegistry adapterRegistry = adapterManager.registry(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) adapterRegistry.getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final DefinitionManager definitionManager = context.getDefinitionManager(); final Object p = definitionManager.adapters().forDefinition().getProperty(domainObject, field).get(); final AdapterManager adapterManager = definitionManager.adapters(); final AdapterRegistry adapterRegistry = adapterManager.registry(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) adapterRegistry.getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final DefinitionManager definitionManager = context.getDefinitionManager(); final Object p = definitionManager.adapters().forDefinition().getProperty(domainObject, field).get(); final AdapterManager adapterManager = definitionManager.adapters(); final AdapterRegistry adapterRegistry = adapterManager.registry(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) adapterRegistry.getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final DefinitionManager definitionManager = context.getDefinitionManager(); final Object p = definitionManager.adapters().forDefinition().getProperty(domainObject, field).get(); final AdapterManager adapterManager = definitionManager.adapters(); final AdapterRegistry adapterRegistry = adapterManager.registry(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) adapterRegistry.getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final DefinitionManager definitionManager = context.getDefinitionManager(); final Object p = definitionManager.adapters().forDefinition().getProperty(domainObject, field).get(); final AdapterManager adapterManager = definitionManager.adapters(); final AdapterRegistry adapterRegistry = adapterManager.registry(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) adapterRegistry.getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testUndo() { command.execute(graphCommandExecutionContext); verify(propertyAdapter).getValue(eq(domainObject.getNameProperty())); verify(propertyAdapter).setValue(eq(domainObject.getNameProperty()), eq(PROPERTY_VALUE)); assertEquals(CommandResult.Type.INFO, command.undo(graphCommandExecutionContext).getType()); verify(propertyAdapter, times(2)).getValue(eq(domainObject.getNameProperty())); verify(propertyAdapter).setValue(eq(domainObject.getNameProperty()), eq(PROPERTY_OLD_VALUE)); }
|
@Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testDeleteStartNode() { this.tested = new SafeDeleteNodeCommand(graphHolder.startNode); final CommandResult<RuleViolation> result = tested.allow(graphTestHandler.graphCommandExecutionContext); final List<Command<GraphCommandExecutionContext, RuleViolation>> commands = tested.getCommands(); assertNotNull(commands); assertTrue(3 == commands.size()); final DeleteConnectorCommand delete1 = (DeleteConnectorCommand) commands.get(0); assertNotNull(delete1); assertEquals(graphHolder.edge1, delete1.getEdge()); final RemoveChildrenCommand removeChild = (RemoveChildrenCommand) commands.get(1); assertNotNull(removeChild); assertEquals(graphHolder.parentNode, removeChild.getParent()); assertEquals(graphHolder.startNode, removeChild.getCandidates().iterator().next()); final DeregisterNodeCommand deleteNode = (DeregisterNodeCommand) commands.get(2); assertNotNull(deleteNode); assertEquals(graphHolder.startNode, deleteNode.getNode()); assertEquals(CommandResult.Type.INFO, result.getType()); }
|
public Node<?, Edge> getNode() { return node; }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testDeleteEndNode() { this.tested = new SafeDeleteNodeCommand(graphHolder.endNode); final CommandResult<RuleViolation> result = tested.allow(graphTestHandler.graphCommandExecutionContext); final List<Command<GraphCommandExecutionContext, RuleViolation>> commands = tested.getCommands(); assertNotNull(commands); assertTrue(3 == commands.size()); final DeleteConnectorCommand delete2 = (DeleteConnectorCommand) commands.get(0); assertNotNull(delete2); assertEquals(graphHolder.edge2, delete2.getEdge()); final RemoveChildrenCommand removeChild = (RemoveChildrenCommand) commands.get(1); assertNotNull(removeChild); assertEquals(graphHolder.parentNode, removeChild.getParent()); assertEquals(graphHolder.endNode, removeChild.getCandidates().iterator().next()); final DeregisterNodeCommand deleteNode = (DeregisterNodeCommand) commands.get(2); assertNotNull(deleteNode); assertEquals(graphHolder.endNode, deleteNode.getNode()); assertEquals(CommandResult.Type.INFO, result.getType()); }
|
public Node<?, Edge> getNode() { return node; }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testDeleteIntermediateNode() { this.tested = new SafeDeleteNodeCommand(graphHolder.intermNode); final CommandResult<RuleViolation> result = tested.allow(graphTestHandler.graphCommandExecutionContext); final List<Command<GraphCommandExecutionContext, RuleViolation>> commands = tested.getCommands(); assertNotNull(commands); assertTrue(4 == commands.size()); final DeleteConnectorCommand delete2 = (DeleteConnectorCommand) commands.get(0); assertNotNull(delete2); assertEquals(graphHolder.edge2, delete2.getEdge()); final SetConnectionTargetNodeCommand setConnectionNewTarget = (SetConnectionTargetNodeCommand) commands.get(1); assertNotNull(setConnectionNewTarget); assertEquals(graphHolder.edge1, setConnectionNewTarget.getEdge()); assertEquals(graphHolder.startNode, setConnectionNewTarget.getSourceNode()); assertEquals(graphHolder.endNode, setConnectionNewTarget.getTargetNode()); final RemoveChildrenCommand removeChild = (RemoveChildrenCommand) commands.get(2); assertNotNull(removeChild); assertEquals(graphHolder.parentNode, removeChild.getParent()); assertEquals(graphHolder.intermNode, removeChild.getCandidates().iterator().next()); final DeregisterNodeCommand deleteNode = (DeregisterNodeCommand) commands.get(3); assertNotNull(deleteNode); assertEquals(graphHolder.intermNode, deleteNode.getNode()); assertEquals(CommandResult.Type.INFO, result.getType()); }
|
public Node<?, Edge> getNode() { return node; }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Node<?, Edge> getNode() { return node; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
@Test public void testGetSafeDeleteCallback() { final Node node = mock(Node.class); when(node.getUUID()).thenReturn("uuid"); final SafeDeleteNodeCommand.SafeDeleteNodeCommandCallback callback = mock(SafeDeleteNodeCommand.SafeDeleteNodeCommandCallback.class); final SafeDeleteNodeCommand command = new SafeDeleteNodeCommand(node, callback, SafeDeleteNodeCommand.Options.defaults()); final Optional<SafeDeleteNodeCommand.SafeDeleteNodeCommandCallback> actual = command.getSafeDeleteCallback(); assertTrue(actual.isPresent()); assertEquals(callback, actual.get()); }
|
public Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback() { return safeDeleteCallback; }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback() { return safeDeleteCallback; } }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback() { return safeDeleteCallback; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback() { return safeDeleteCallback; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { public Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback() { return safeDeleteCallback; } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
@Test public void testCreateChangeParentCommands() { final Node node = mock(Node.class); final SafeDeleteNodeCommand.SafeDeleteNodeCommandCallback callback = mock(SafeDeleteNodeCommand.SafeDeleteNodeCommandCallback.class); final Element<?> canvas = mock(Element.class); final Node canvasNode = mock(Node.class); final Node<?, Edge> candidate = mock(Node.class); final List<Edge> outEdges = new ArrayList<>(); final Edge e1 = mock(Edge.class); final Child child = mock(Child.class); final Node targetNode = mock(Node.class); when(node.getUUID()).thenReturn("uuid"); when(canvas.asNode()).thenReturn(canvasNode); when(e1.getContent()).thenReturn(child); when(e1.getTargetNode()).thenReturn(targetNode); when(candidate.getOutEdges()).thenReturn(outEdges); outEdges.add(e1); final SafeDeleteNodeCommand command = new SafeDeleteNodeCommand(node, callback, SafeDeleteNodeCommand.Options.defaults()); command.createChangeParentCommands(canvas, candidate); verify(callback).moveChildToCanvasRoot(canvasNode, targetNode); }
|
void createChangeParentCommands(final Element<?> canvas, final Node<?, Edge> candidate) { final List<Node> childNodes = GraphUtils.getChildNodes(candidate); for (final Node n : childNodes) { safeDeleteCallback.ifPresent(c -> c.moveChildToCanvasRoot(canvas.asNode(), n)); } }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { void createChangeParentCommands(final Element<?> canvas, final Node<?, Edge> candidate) { final List<Node> childNodes = GraphUtils.getChildNodes(candidate); for (final Node n : childNodes) { safeDeleteCallback.ifPresent(c -> c.moveChildToCanvasRoot(canvas.asNode(), n)); } } }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { void createChangeParentCommands(final Element<?> canvas, final Node<?, Edge> candidate) { final List<Node> childNodes = GraphUtils.getChildNodes(candidate); for (final Node n : childNodes) { safeDeleteCallback.ifPresent(c -> c.moveChildToCanvasRoot(canvas.asNode(), n)); } } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { void createChangeParentCommands(final Element<?> canvas, final Node<?, Edge> candidate) { final List<Node> childNodes = GraphUtils.getChildNodes(candidate); for (final Node n : childNodes) { safeDeleteCallback.ifPresent(c -> c.moveChildToCanvasRoot(canvas.asNode(), n)); } } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
SafeDeleteNodeCommand extends AbstractGraphCompositeCommand { void createChangeParentCommands(final Element<?> canvas, final Node<?, Edge> candidate) { final List<Node> childNodes = GraphUtils.getChildNodes(candidate); for (final Node n : childNodes) { safeDeleteCallback.ifPresent(c -> c.moveChildToCanvasRoot(canvas.asNode(), n)); } } SafeDeleteNodeCommand(final @MapsTo("candidateUUID") String candidateUUID,
final @MapsTo("options") Options options); SafeDeleteNodeCommand(final Node<?, Edge> node); SafeDeleteNodeCommand(final Node<?, Edge> node,
final Options options); SafeDeleteNodeCommand(final Node<?, Edge> node,
final SafeDeleteNodeCommandCallback safeDeleteCallback,
final Options options); Optional<SafeDeleteNodeCommandCallback> getSafeDeleteCallback(); boolean shouldKeepChildren(final Node<Definition<?>, Edge> candidate); GraphsProvider getGraphsProvider(); Node<?, Edge> getNode(); Options getOptions(); @Override String toString(); }
|
@Test public void testChecks() { tested = new DeleteControlPointCommand(EDGE_UUID, 0); CommandResult<RuleViolation> result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new DeleteControlPointCommand(EDGE_UUID, 1); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new DeleteControlPointCommand(EDGE_UUID, 2); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidIndex() { tested = new DeleteControlPointCommand(EDGE_UUID, -1); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testIndexForbidden() { tested = new DeleteControlPointCommand(EDGE_UUID, 3); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testDelegateClearSelections() { uiModel.clearSelections(); verify(delegate).clearSelections(); }
|
@Override public void clearSelections() { delegate.clearSelections(); }
|
DelegatingGridData implements GridData { @Override public void clearSelections() { delegate.clearSelections(); } }
|
DelegatingGridData implements GridData { @Override public void clearSelections() { delegate.clearSelections(); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public void clearSelections() { delegate.clearSelections(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public void clearSelections() { delegate.clearSelections(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidIndexDuringExecute() { tested = new DeleteControlPointCommand(EDGE_UUID, -1); tested.execute(graphCommandExecutionContext); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testIndexForbiddenDuringExecute() { tested = new DeleteControlPointCommand(EDGE_UUID, 3); tested.execute(graphCommandExecutionContext); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testDeleteControlPointAt0() { tested = new DeleteControlPointCommand(EDGE_UUID, 0); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(2, controlPoints.length); assertEquals(controlPoint2, controlPoints[0]); assertEquals(controlPoint3, controlPoints[1]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testDeleteControlPointAt1() { tested = new DeleteControlPointCommand(EDGE_UUID, 1); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(2, controlPoints.length); assertEquals(controlPoint1, controlPoints[0]); assertEquals(controlPoint3, controlPoints[1]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testDeleteControlPointAt2() { tested = new DeleteControlPointCommand(EDGE_UUID, 2); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); assertFalse(CommandUtils.isError(result)); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(2, controlPoints.length); assertEquals(controlPoint1, controlPoints[0]); assertEquals(controlPoint2, controlPoints[1]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
DeleteControlPointCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { check(context); final HasControlPoints edgeControlPoints = getEdgeControlPoints(context); final int size = edgeControlPoints.getControlPoints().length; final ControlPoint[] cps = new ControlPoint[size - 1]; for (int i = 0, j = 0; i < size; i++, j++) { ControlPoint controlPoint = edgeControlPoints.getControlPoints()[i]; if (i == index) { j--; deletedControlPoint = controlPoint; } else { cps[j] = controlPoint; } } edgeControlPoints.setControlPoints(cps); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertTrue(parentOutEdges.isEmpty()); assertTrue(candidateInEdges.isEmpty()); verify(graphIndex, times(1)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); verify(graph, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; }
|
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } }
|
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } RemoveChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); RemoveChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); RemoveChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); }
|
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } RemoveChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); RemoveChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); RemoveChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
|
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } RemoveChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); RemoveChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); RemoveChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertFalse(parent.getOutEdges().isEmpty()); assertFalse(candidate.getInEdges().isEmpty()); Edge edge = (Edge) parent.getOutEdges().get(0); assertTrue(edge.getContent() instanceof Parent); assertEquals(parent, edge.getSourceNode()); assertEquals(candidate, edge.getTargetNode()); verify(graphIndex, times(1)).addEdge(eq(edge)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } SetParentNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); SetParentNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } SetParentNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); SetParentNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } SetParentNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); SetParentNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecuteCheckFailed() { final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations() .addViolation(new ContainmentRuleViolation(graph.getUUID(), PARENT_UUID)); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); assertTrue(parent.getOutEdges().isEmpty()); assertTrue(candidate.getInEdges().isEmpty()); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } SetParentNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); SetParentNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } SetParentNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); SetParentNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
SetParentNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final String uuid = UUID.uuid(); final Edge<Parent, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Parent()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; } SetParentNodeCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); SetParentNodeCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testAllow() { CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); final ArgumentCaptor<RuleEvaluationContext> contextCaptor = ArgumentCaptor.forClass(RuleEvaluationContext.class); verify(ruleManager, times(2)).evaluate(eq(ruleSet), contextCaptor.capture()); final List<RuleEvaluationContext> contexts = contextCaptor.getAllValues(); assertEquals(2, contexts.size()); verifyConnection((GraphConnectionContext) contexts.get(0), edge, node, null); verifyConnectorCardinality((ConnectorCardinalityContext) contexts.get(1), graph, node, edge, EdgeCardinalityContext.Direction.OUTGOING, Optional.of(CardinalityContext.Operation.ADD)); }
|
@Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testAllowNoRules() { useAllowedExecutionContext(); CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(ruleManager, times(0)).evaluate(any(RuleSet.class), any(RuleEvaluationContext.class)); }
|
@Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
|
@Test public void testDelegateGetSelectedCells() { uiModel.getSelectedCells(); verify(delegate).getSelectedCells(); }
|
@Override public List<SelectedCell> getSelectedCells() { return delegate.getSelectedCells(); }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedCells() { return delegate.getSelectedCells(); } }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedCells() { return delegate.getSelectedCells(); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedCells() { return delegate.getSelectedCells(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedCells() { return delegate.getSelectedCells(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertTrue(node.getOutEdges().size() == 1); assertEquals(edge, node.getOutEdges().get(0)); verify(graphIndex, times(1)).addEdge(eq(edge)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.execute(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.execute(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.execute(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.execute(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
|
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.execute(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
final @MapsTo("edge") Edge edge,
final @MapsTo("magnet") Connection connection); AddConnectorCommand(final Node<?, Edge> sourceNode,
final Edge edge,
final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testUndo() { tested.removed = node; CommandResult<RuleViolation> result = tested.undo(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(graph, times(2)).addNode(any(Node.class)); verify(graphIndex, times(1)).addNode(any(Node.class)); verify(graph, times(0)).removeNode(eq(UUID)); verify(graphIndex, times(0)).removeNode(eq(node)); verify(graphIndex, times(0)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }
|
@Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final AddNodeCommand undoCommand = new AddNodeCommand(getRemoved()); return undoCommand.execute(context); }
|
DeleteNodeCommand extends DeregisterNodeCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final AddNodeCommand undoCommand = new AddNodeCommand(getRemoved()); return undoCommand.execute(context); } }
|
DeleteNodeCommand extends DeregisterNodeCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final AddNodeCommand undoCommand = new AddNodeCommand(getRemoved()); return undoCommand.execute(context); } DeleteNodeCommand(final @MapsTo("uuid") String uuid); DeleteNodeCommand(final Node<?, Edge> node); }
|
DeleteNodeCommand extends DeregisterNodeCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final AddNodeCommand undoCommand = new AddNodeCommand(getRemoved()); return undoCommand.execute(context); } DeleteNodeCommand(final @MapsTo("uuid") String uuid); DeleteNodeCommand(final Node<?, Edge> node); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
DeleteNodeCommand extends DeregisterNodeCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final AddNodeCommand undoCommand = new AddNodeCommand(getRemoved()); return undoCommand.execute(context); } DeleteNodeCommand(final @MapsTo("uuid") String uuid); DeleteNodeCommand(final Node<?, Edge> node); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test public void initialize() throws Exception { cloneConnectorCommand.initialize(graphCommandExecutionContext); AddConnectorCommand addConnectorCommand = getExecutedCommand(command -> command instanceof AddConnectorCommand); assertEquals(addConnectorCommand.getEdge(), cloneEdge); assertEquals(addConnectorCommand.getSourceNode().getUUID(), sourceNodeUUID); assertEquals(addConnectorCommand.getConnection(), sourceConnection); SetConnectionTargetNodeCommand setConnectionTargetNodeCommand = getExecutedCommand(command -> command instanceof SetConnectionTargetNodeCommand); assertEquals(setConnectionTargetNodeCommand.getTargetNode().getUUID(), targetNodeUUID); assertEquals(setConnectionTargetNodeCommand.getEdge(), cloneEdge); assertEquals(setConnectionTargetNodeCommand.getConnection(), targetConnection); verify(graphIndex, times(1)).addEdge(cloneEdge); }
|
@Override @SuppressWarnings("unchecked") protected CloneConnectorCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); this.targetNode = (Node<? extends View<?>, Edge>) getNode(context, targetNodeUUID); if (!(candidate.getContent() instanceof ViewConnector)) { throw new IllegalArgumentException("Candidate: " + candidate.getTargetNode() + " content should be a ViewConnector"); } ViewConnector edgeContent = (ViewConnector) candidate.getContent(); final Object bean = edgeContent.getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asEdge(); Object clonedDefinition = context.getDefinitionManager().cloneManager().clone(edgeContent.getDefinition(), ClonePolicy.ALL); ViewConnector clonedContent = (ViewConnector) clone.getContent(); clonedContent.setDefinition(clonedDefinition); ViewConnector connectionContent = (ViewConnector) candidate.getContent(); this.sourceConnection = (Connection) connectionContent.getSourceConnection().orElse(null); this.targetConnection = (Connection) connectionContent.getTargetConnection().orElse(null); commands.add(new AddConnectorCommand(sourceNode, clone, sourceConnection)); commands.add(new SetConnectionTargetNodeCommand(targetNode, clone, targetConnection)); getMutableIndex(context).addEdge(clone); return this; }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected CloneConnectorCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); this.targetNode = (Node<? extends View<?>, Edge>) getNode(context, targetNodeUUID); if (!(candidate.getContent() instanceof ViewConnector)) { throw new IllegalArgumentException("Candidate: " + candidate.getTargetNode() + " content should be a ViewConnector"); } ViewConnector edgeContent = (ViewConnector) candidate.getContent(); final Object bean = edgeContent.getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asEdge(); Object clonedDefinition = context.getDefinitionManager().cloneManager().clone(edgeContent.getDefinition(), ClonePolicy.ALL); ViewConnector clonedContent = (ViewConnector) clone.getContent(); clonedContent.setDefinition(clonedDefinition); ViewConnector connectionContent = (ViewConnector) candidate.getContent(); this.sourceConnection = (Connection) connectionContent.getSourceConnection().orElse(null); this.targetConnection = (Connection) connectionContent.getTargetConnection().orElse(null); commands.add(new AddConnectorCommand(sourceNode, clone, sourceConnection)); commands.add(new SetConnectionTargetNodeCommand(targetNode, clone, targetConnection)); getMutableIndex(context).addEdge(clone); return this; } }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected CloneConnectorCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); this.targetNode = (Node<? extends View<?>, Edge>) getNode(context, targetNodeUUID); if (!(candidate.getContent() instanceof ViewConnector)) { throw new IllegalArgumentException("Candidate: " + candidate.getTargetNode() + " content should be a ViewConnector"); } ViewConnector edgeContent = (ViewConnector) candidate.getContent(); final Object bean = edgeContent.getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asEdge(); Object clonedDefinition = context.getDefinitionManager().cloneManager().clone(edgeContent.getDefinition(), ClonePolicy.ALL); ViewConnector clonedContent = (ViewConnector) clone.getContent(); clonedContent.setDefinition(clonedDefinition); ViewConnector connectionContent = (ViewConnector) candidate.getContent(); this.sourceConnection = (Connection) connectionContent.getSourceConnection().orElse(null); this.targetConnection = (Connection) connectionContent.getTargetConnection().orElse(null); commands.add(new AddConnectorCommand(sourceNode, clone, sourceConnection)); commands.add(new SetConnectionTargetNodeCommand(targetNode, clone, targetConnection)); getMutableIndex(context).addEdge(clone); return this; } CloneConnectorCommand(); CloneConnectorCommand(final @MapsTo("candidate") Edge candidate, final @MapsTo("sourceNodeUUID") String sourceNodeUUID, final @MapsTo("targetNodeUUID") String targetNodeUUID); CloneConnectorCommand(Edge candidate, String sourceNodeUUID, String targetNodeUUID, Consumer<Edge> callback); }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected CloneConnectorCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); this.targetNode = (Node<? extends View<?>, Edge>) getNode(context, targetNodeUUID); if (!(candidate.getContent() instanceof ViewConnector)) { throw new IllegalArgumentException("Candidate: " + candidate.getTargetNode() + " content should be a ViewConnector"); } ViewConnector edgeContent = (ViewConnector) candidate.getContent(); final Object bean = edgeContent.getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asEdge(); Object clonedDefinition = context.getDefinitionManager().cloneManager().clone(edgeContent.getDefinition(), ClonePolicy.ALL); ViewConnector clonedContent = (ViewConnector) clone.getContent(); clonedContent.setDefinition(clonedDefinition); ViewConnector connectionContent = (ViewConnector) candidate.getContent(); this.sourceConnection = (Connection) connectionContent.getSourceConnection().orElse(null); this.targetConnection = (Connection) connectionContent.getTargetConnection().orElse(null); commands.add(new AddConnectorCommand(sourceNode, clone, sourceConnection)); commands.add(new SetConnectionTargetNodeCommand(targetNode, clone, targetConnection)); getMutableIndex(context).addEdge(clone); return this; } CloneConnectorCommand(); CloneConnectorCommand(final @MapsTo("candidate") Edge candidate, final @MapsTo("sourceNodeUUID") String sourceNodeUUID, final @MapsTo("targetNodeUUID") String targetNodeUUID); CloneConnectorCommand(Edge candidate, String sourceNodeUUID, String targetNodeUUID, Consumer<Edge> callback); @Override CommandResult<RuleViolation> execute(GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected CloneConnectorCommand initialize(final GraphCommandExecutionContext context) { super.initialize(context); this.sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); this.targetNode = (Node<? extends View<?>, Edge>) getNode(context, targetNodeUUID); if (!(candidate.getContent() instanceof ViewConnector)) { throw new IllegalArgumentException("Candidate: " + candidate.getTargetNode() + " content should be a ViewConnector"); } ViewConnector edgeContent = (ViewConnector) candidate.getContent(); final Object bean = edgeContent.getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asEdge(); Object clonedDefinition = context.getDefinitionManager().cloneManager().clone(edgeContent.getDefinition(), ClonePolicy.ALL); ViewConnector clonedContent = (ViewConnector) clone.getContent(); clonedContent.setDefinition(clonedDefinition); ViewConnector connectionContent = (ViewConnector) candidate.getContent(); this.sourceConnection = (Connection) connectionContent.getSourceConnection().orElse(null); this.targetConnection = (Connection) connectionContent.getTargetConnection().orElse(null); commands.add(new AddConnectorCommand(sourceNode, clone, sourceConnection)); commands.add(new SetConnectionTargetNodeCommand(targetNode, clone, targetConnection)); getMutableIndex(context).addEdge(clone); return this; } CloneConnectorCommand(); CloneConnectorCommand(final @MapsTo("candidate") Edge candidate, final @MapsTo("sourceNodeUUID") String sourceNodeUUID, final @MapsTo("targetNodeUUID") String targetNodeUUID); CloneConnectorCommand(Edge candidate, String sourceNodeUUID, String targetNodeUUID, Consumer<Edge> callback); @Override CommandResult<RuleViolation> execute(GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void undo() throws Exception { cloneConnectorCommand.execute(graphCommandExecutionContext); cloneConnectorCommand.undo(graphCommandExecutionContext); verify(graphIndex, times(1)).removeEdge(cloneEdge); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { return new DeleteConnectorCommand(clone).execute(context); }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { return new DeleteConnectorCommand(clone).execute(context); } }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { return new DeleteConnectorCommand(clone).execute(context); } CloneConnectorCommand(); CloneConnectorCommand(final @MapsTo("candidate") Edge candidate, final @MapsTo("sourceNodeUUID") String sourceNodeUUID, final @MapsTo("targetNodeUUID") String targetNodeUUID); CloneConnectorCommand(Edge candidate, String sourceNodeUUID, String targetNodeUUID, Consumer<Edge> callback); }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { return new DeleteConnectorCommand(clone).execute(context); } CloneConnectorCommand(); CloneConnectorCommand(final @MapsTo("candidate") Edge candidate, final @MapsTo("sourceNodeUUID") String sourceNodeUUID, final @MapsTo("targetNodeUUID") String targetNodeUUID); CloneConnectorCommand(Edge candidate, String sourceNodeUUID, String targetNodeUUID, Consumer<Edge> callback); @Override CommandResult<RuleViolation> execute(GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
CloneConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { return new DeleteConnectorCommand(clone).execute(context); } CloneConnectorCommand(); CloneConnectorCommand(final @MapsTo("candidate") Edge candidate, final @MapsTo("sourceNodeUUID") String sourceNodeUUID, final @MapsTo("targetNodeUUID") String targetNodeUUID); CloneConnectorCommand(Edge candidate, String sourceNodeUUID, String targetNodeUUID, Consumer<Edge> callback); @Override CommandResult<RuleViolation> execute(GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = BadCommandArgumentsException.class) public void testAllowNodeNotFound() { this.tested = new UpdateElementPositionCommand(UUID, LOCATION, PREVIOUS_LOCATION); when(graphIndex.getNode(eq(UUID))).thenReturn(null); tested.allow(graphCommandExecutionContext); }
|
public Node<?, Edge> getNode() { return node; }
|
UpdateElementPositionCommand extends AbstractGraphCommand { public Node<?, Edge> getNode() { return node; } }
|
UpdateElementPositionCommand extends AbstractGraphCommand { public Node<?, Edge> getNode() { return node; } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { public Node<?, Edge> getNode() { return node; } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
final Point2D location); @Override String toString(); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { public Node<?, Edge> getNode() { return node; } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
final Point2D location); @Override String toString(); }
|
@Test public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<Bounds> bounds = ArgumentCaptor.forClass(Bounds.class); verify(content, times(1)).setBounds(bounds.capture()); assertEquals(CommandResult.Type.INFO, result.getType()); Bounds b = bounds.getValue(); assertEquals(UUID, tested.getUuid()); assertEquals(LOCATION, tested.getLocation()); assertEquals(PREVIOUS_LOCATION, tested.getPreviousLocation()); assertEquals(PREVIOUS_LOCATION.getY(), tested.getPreviousLocation().getY() , 0d); assertEquals(Double.valueOf(LOCATION.getX() + W), b.getLowerRight().getX()); assertEquals(Double.valueOf(LOCATION.getY() + H), b.getLowerRight().getY()); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
final Point2D location); @Override String toString(); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
final Point2D location); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecuteDockedNode() { ArgumentCaptor<Bounds> boundsArgumentCaptor = ArgumentCaptor.forClass(Bounds.class); this.tested = new UpdateElementPositionCommand(dockedNode, new Point2D(600d, 600d)); final CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); verify((View) dockedNode.getContent(), times(1)).setBounds(boundsArgumentCaptor.capture()); assertEquals(CommandResult.Type.INFO, result.getType()); Bounds bounds = boundsArgumentCaptor.getValue(); assertEquals(bounds.getUpperLeft(), Bound.create(600d, 600d)); assertEquals(bounds.getLowerRight(), Bound.create(650d, 650d)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
final Point2D location); @Override String toString(); }
|
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
final @MapsTo("location") Point2D location,
final @MapsTo("previousLocation") Point2D previousLocation); UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
final Point2D location); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertTrue(parentInEdges.isEmpty()); assertTrue(candidateOutEdges.isEmpty()); verify(graphIndex, times(1)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); verify(graph, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final Edge<Parent, Node> edge = getEdgeForTarget(parent, candidate); if (null != edge) { edge.setSourceNode(null); edge.setTargetNode(null); parent.getInEdges().remove(edge); candidate.getOutEdges().remove(edge); getMutableIndex(context).removeEdge(edge); } } return results; }
|
RemoveParentCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final Edge<Parent, Node> edge = getEdgeForTarget(parent, candidate); if (null != edge) { edge.setSourceNode(null); edge.setTargetNode(null); parent.getInEdges().remove(edge); candidate.getOutEdges().remove(edge); getMutableIndex(context).removeEdge(edge); } } return results; } }
|
RemoveParentCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final Edge<Parent, Node> edge = getEdgeForTarget(parent, candidate); if (null != edge) { edge.setSourceNode(null); edge.setTargetNode(null); parent.getInEdges().remove(edge); candidate.getOutEdges().remove(edge); getMutableIndex(context).removeEdge(edge); } } return results; } RemoveParentCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); RemoveParentCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); }
|
RemoveParentCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final Edge<Parent, Node> edge = getEdgeForTarget(parent, candidate); if (null != edge) { edge.setSourceNode(null); edge.setTargetNode(null); parent.getInEdges().remove(edge); candidate.getOutEdges().remove(edge); getMutableIndex(context).removeEdge(edge); } } return results; } RemoveParentCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); RemoveParentCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
RemoveParentCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); final Node<?, Edge> candidate = getCandidate(context); final Edge<Parent, Node> edge = getEdgeForTarget(parent, candidate); if (null != edge) { edge.setSourceNode(null); edge.setTargetNode(null); parent.getInEdges().remove(edge); candidate.getOutEdges().remove(edge); getMutableIndex(context).removeEdge(edge); } } return results; } RemoveParentCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUID") String candidateUUID); RemoveParentCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertFalse(parent.getOutEdges().isEmpty()); assertFalse(candidate.getInEdges().isEmpty()); Edge edge = (Edge) parent.getOutEdges().get(0); assertTrue(edge.getContent() instanceof Child); assertEquals(parent, edge.getSourceNode()); assertEquals(candidate, edge.getTargetNode()); verify(graphIndex, times(1)).addEdge(eq(edge)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); SetChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); SetChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); SetChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); SetChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); SetChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); SetChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecuteCheckFailed() { final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations() .addViolation(new ContainmentRuleViolation(graph.getUUID(), PARENT_UUID)); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); assertTrue(parent.getOutEdges().isEmpty()); assertTrue(candidate.getInEdges().isEmpty()); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); SetChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); SetChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); SetChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); SetChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
|
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
final @MapsTo("candidateUUIDs") String[] candidateUUIDs); SetChildrenCommand(final Node<?, Edge> parent,
final Node<?, Edge> candidate); SetChildrenCommand(final Node<?, Edge> parent,
final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
|
@Test public void testDelegateGetSelectedCellsOrigin() { uiModel.getSelectedCellsOrigin(); verify(delegate).getSelectedCellsOrigin(); }
|
@Override public SelectedCell getSelectedCellsOrigin() { return delegate.getSelectedCellsOrigin(); }
|
DelegatingGridData implements GridData { @Override public SelectedCell getSelectedCellsOrigin() { return delegate.getSelectedCellsOrigin(); } }
|
DelegatingGridData implements GridData { @Override public SelectedCell getSelectedCellsOrigin() { return delegate.getSelectedCellsOrigin(); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public SelectedCell getSelectedCellsOrigin() { return delegate.getSelectedCellsOrigin(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public SelectedCell getSelectedCellsOrigin() { return delegate.getSelectedCellsOrigin(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<Bounds> bounds = ArgumentCaptor.forClass(Bounds.class); assertEquals(CommandResult.Type.INFO, result.getType()); assertEquals(PROPERTY_OLD_VALUE, tested.getOldValue()); verify(propertyAdapter, times(1)).getValue(eq(property)); verify(propertyAdapter, times(1)).setValue(eq(property), eq(PROPERTY_VALUE)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); UpdateElementPropertyValueCommand(final Element<?> element,
final String propertyId,
final Object value); }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); UpdateElementPropertyValueCommand(final Element<?> element,
final String propertyId,
final Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Object getOldValue(); String getField(); Object getValue(); Element<?> getElement(); @Override String toString(); }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); UpdateElementPropertyValueCommand(final Element<?> element,
final String propertyId,
final Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Object getOldValue(); String getField(); Object getValue(); Element<?> getElement(); @Override String toString(); }
|
@Test(expected = BadCommandArgumentsException.class) public void testExecuteNodeNotFound() { when(graphIndex.get(eq(UUID))).thenReturn(null); tested.execute(graphCommandExecutionContext); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); UpdateElementPropertyValueCommand(final Element<?> element,
final String propertyId,
final Object value); }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); UpdateElementPropertyValueCommand(final Element<?> element,
final String propertyId,
final Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Object getOldValue(); String getField(); Object getValue(); Element<?> getElement(); @Override String toString(); }
|
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
final @MapsTo("field") String field,
final @MapsTo("value") Object value); UpdateElementPropertyValueCommand(final Element<?> element,
final String propertyId,
final Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Object getOldValue(); String getField(); Object getValue(); Element<?> getElement(); @Override String toString(); }
|
@Test public void testCheck() { tested = new UpdateControlPointPositionCommand(EDGE_UUID, newControlPoints); CommandResult<RuleViolation> result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testCannotUpdateCPs() { newControlPoints = new ControlPoint[]{newControlPoint1, newControlPoint2}; tested = new UpdateControlPointPositionCommand(EDGE_UUID, newControlPoints); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test(expected = IllegalArgumentException.class) public void testCannotUpdateCPs2() { when(viewConnector.getControlPoints()).thenReturn(new ControlPoint[]{controlPoint1, controlPoint2}); tested = new UpdateControlPointPositionCommand(EDGE_UUID, newControlPoints); tested.check(graphCommandExecutionContext); }
|
@Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkUpdateControlPoint(getEdgeControlPoints(context).getControlPoints(), controlPoints); return GraphCommandResultBuilder.SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testUpdateControlPoints() { tested = new UpdateControlPointPositionCommand(EDGE_UUID, newControlPoints); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); ArgumentCaptor<ControlPoint[]> pointsCaptor = ArgumentCaptor.forClass(ControlPoint[].class); verify(viewConnector, times(1)).setControlPoints(pointsCaptor.capture()); ControlPoint[] controlPoints = pointsCaptor.getValue(); assertNotNull(controlPoints); assertEquals(3, controlPoints.length); assertEquals(newControlPoint1, controlPoints[0]); assertEquals(newControlPoint2, controlPoints[1]); assertEquals(newControlPoint3, controlPoints[2]); }
|
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final HasControlPoints hasControlPoints = getEdgeControlPoints(context); oldControlPoints = hasControlPoints.getControlPoints(); hasControlPoints.setControlPoints(controlPoints); return SUCCESS; }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final HasControlPoints hasControlPoints = getEdgeControlPoints(context); oldControlPoints = hasControlPoints.getControlPoints(); hasControlPoints.setControlPoints(controlPoints); return SUCCESS; } }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final HasControlPoints hasControlPoints = getEdgeControlPoints(context); oldControlPoints = hasControlPoints.getControlPoints(); hasControlPoints.setControlPoints(controlPoints); return SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final HasControlPoints hasControlPoints = getEdgeControlPoints(context); oldControlPoints = hasControlPoints.getControlPoints(); hasControlPoints.setControlPoints(controlPoints); return SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
UpdateControlPointPositionCommand extends AbstractControlPointCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final HasControlPoints hasControlPoints = getEdgeControlPoints(context); oldControlPoints = hasControlPoints.getControlPoints(); hasControlPoints.setControlPoints(controlPoints); return SUCCESS; } UpdateControlPointPositionCommand(final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("controlPoints") ControlPoint[] controlPoints); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); }
|
@Test public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(graph, times(1)).clear(); verify(graphIndex, times(1)).clear(); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Graph<?, Node> graph = getGraph(context); if (hasRootUUID()) { Iterator<Node> nodes = graph.nodes().iterator(); if (null != nodes) { nodes.forEachRemaining(node -> { if (!node.getUUID().equals(rootUUID)) { getMutableIndex(context).removeNode(node); nodes.remove(); } else { node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge)); node.getOutEdges().clear(); } }); } } else { graph.clear(); getMutableIndex(context).clear(); } } return results; }
|
ClearGraphCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Graph<?, Node> graph = getGraph(context); if (hasRootUUID()) { Iterator<Node> nodes = graph.nodes().iterator(); if (null != nodes) { nodes.forEachRemaining(node -> { if (!node.getUUID().equals(rootUUID)) { getMutableIndex(context).removeNode(node); nodes.remove(); } else { node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge)); node.getOutEdges().clear(); } }); } } else { graph.clear(); getMutableIndex(context).clear(); } } return results; } }
|
ClearGraphCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Graph<?, Node> graph = getGraph(context); if (hasRootUUID()) { Iterator<Node> nodes = graph.nodes().iterator(); if (null != nodes) { nodes.forEachRemaining(node -> { if (!node.getUUID().equals(rootUUID)) { getMutableIndex(context).removeNode(node); nodes.remove(); } else { node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge)); node.getOutEdges().clear(); } }); } } else { graph.clear(); getMutableIndex(context).clear(); } } return results; } ClearGraphCommand(final @MapsTo("rootUUID") String rootUUID); }
|
ClearGraphCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Graph<?, Node> graph = getGraph(context); if (hasRootUUID()) { Iterator<Node> nodes = graph.nodes().iterator(); if (null != nodes) { nodes.forEachRemaining(node -> { if (!node.getUUID().equals(rootUUID)) { getMutableIndex(context).removeNode(node); nodes.remove(); } else { node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge)); node.getOutEdges().clear(); } }); } } else { graph.clear(); getMutableIndex(context).clear(); } } return results; } ClearGraphCommand(final @MapsTo("rootUUID") String rootUUID); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); String getRootUUID(); @Override String toString(); }
|
ClearGraphCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Graph<?, Node> graph = getGraph(context); if (hasRootUUID()) { Iterator<Node> nodes = graph.nodes().iterator(); if (null != nodes) { nodes.forEachRemaining(node -> { if (!node.getUUID().equals(rootUUID)) { getMutableIndex(context).removeNode(node); nodes.remove(); } else { node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge)); node.getOutEdges().clear(); } }); } } else { graph.clear(); getMutableIndex(context).clear(); } } return results; } ClearGraphCommand(final @MapsTo("rootUUID") String rootUUID); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); String getRootUUID(); @Override String toString(); }
|
@Test(expected = UnsupportedOperationException.class) public void testUndo() { tested.undo(graphCommandExecutionContext); }
|
@Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { throw new UnsupportedOperationException("Undo operation for Clear Graph Command is still not supported. "); }
|
ClearGraphCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { throw new UnsupportedOperationException("Undo operation for Clear Graph Command is still not supported. "); } }
|
ClearGraphCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { throw new UnsupportedOperationException("Undo operation for Clear Graph Command is still not supported. "); } ClearGraphCommand(final @MapsTo("rootUUID") String rootUUID); }
|
ClearGraphCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { throw new UnsupportedOperationException("Undo operation for Clear Graph Command is still not supported. "); } ClearGraphCommand(final @MapsTo("rootUUID") String rootUUID); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); String getRootUUID(); @Override String toString(); }
|
ClearGraphCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { throw new UnsupportedOperationException("Undo operation for Clear Graph Command is still not supported. "); } ClearGraphCommand(final @MapsTo("rootUUID") String rootUUID); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); String getRootUUID(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testSkipRulesForSameSourceNodeAsBefore() { when(edge.getSourceNode()).thenReturn(node); CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(ruleManager, times(0)).evaluate(eq(ruleSet), any(RuleEvaluationContext.class)); }
|
@SuppressWarnings("unchecked") public Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context) { if (null == sourceNode) { sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); } return sourceNode; }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @SuppressWarnings("unchecked") public Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context) { if (null == sourceNode) { sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); } return sourceNode; } }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @SuppressWarnings("unchecked") public Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context) { if (null == sourceNode) { sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); } return sourceNode; } @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final @MapsTo("sourceNodeUUID") String sourceNodeUUID,
final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("magnet") Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge); }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @SuppressWarnings("unchecked") public Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context) { if (null == sourceNode) { sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); } return sourceNode; } @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final @MapsTo("sourceNodeUUID") String sourceNodeUUID,
final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("magnet") Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getTargetNode(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(final GraphCommandExecutionContext context); Node<? extends View<?>, Edge> getSourceNode(); Edge<? extends View, Node> getEdge(); Node<? extends View<?>, Edge> getTargetNode(); Connection getConnection(); @Override String toString(); }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @SuppressWarnings("unchecked") public Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context) { if (null == sourceNode) { sourceNode = (Node<? extends View<?>, Edge>) getNode(context, sourceNodeUUID); } return sourceNode; } @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final @MapsTo("sourceNodeUUID") String sourceNodeUUID,
final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("magnet") Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getTargetNode(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(final GraphCommandExecutionContext context); Node<? extends View<?>, Edge> getSourceNode(); Edge<? extends View, Node> getEdge(); Node<? extends View<?>, Edge> getTargetNode(); Connection getConnection(); @Override String toString(); }
|
@Test @SuppressWarnings("unchecked") public void testExecute() { final List lastSourceOutEdges = spy(new ArrayList()); final List sourceOutEdges = spy(new ArrayList()); final List targetInEdges = spy(new ArrayList()); when(node.getOutEdges()).thenReturn(sourceOutEdges); when(lastSourceNode.getOutEdges()).thenReturn(lastSourceOutEdges); when(target.getInEdges()).thenReturn(targetInEdges); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); final ArgumentCaptor<RuleEvaluationContext> contextCaptor = ArgumentCaptor.forClass(RuleEvaluationContext.class); verify(ruleManager, times(3)).evaluate(eq(ruleSet), contextCaptor.capture()); final List<RuleEvaluationContext> contexts = contextCaptor.getAllValues(); assertEquals(3, contexts.size()); verifyConnection((GraphConnectionContext) contexts.get(0), edge, node, target); verifyConnectorCardinality((ConnectorCardinalityContext) contexts.get(1), graph, lastSourceNode, edge, EdgeCardinalityContext.Direction.OUTGOING, Optional.of(CardinalityContext.Operation.DELETE)); verifyConnectorCardinality((ConnectorCardinalityContext) contexts.get(2), graph, node, edge, EdgeCardinalityContext.Direction.OUTGOING, Optional.of(CardinalityContext.Operation.ADD)); assertEquals(CommandResult.Type.INFO, result.getType()); verify(lastSourceOutEdges, times(1)).remove(eq(edge)); verify(sourceOutEdges, times(1)).add(eq(edge)); verify(edgeContent, times(1)).setSourceConnection(any(Connection.class)); verify(edge, times(1)).setSourceNode(eq(node)); verify(targetInEdges, times(0)).remove(any(Edge.class)); verify(targetInEdges, times(0)).add(any(Edge.class)); verify(graphIndex, times(0)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); }
|
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Edge<? extends View, Node> edge = getEdge(context); final Node<?, Edge> sourceNode = getSourceNode(context); final Node<? extends View<?>, Edge> lastSourceNode = edge.getSourceNode(); if (null != lastSourceNode) { this.lastSourceNodeUUID = lastSourceNode.getUUID(); lastSourceNode.getOutEdges().remove(edge); } if (null != sourceNode) { sourceNode.getOutEdges().add(edge); } edge.setSourceNode(sourceNode); ViewConnector connectionContent = (ViewConnector) edge.getContent(); lastConnection = (Connection) connectionContent.getSourceConnection().orElse(null); connectionContent.setSourceConnection(connection); } return results; }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Edge<? extends View, Node> edge = getEdge(context); final Node<?, Edge> sourceNode = getSourceNode(context); final Node<? extends View<?>, Edge> lastSourceNode = edge.getSourceNode(); if (null != lastSourceNode) { this.lastSourceNodeUUID = lastSourceNode.getUUID(); lastSourceNode.getOutEdges().remove(edge); } if (null != sourceNode) { sourceNode.getOutEdges().add(edge); } edge.setSourceNode(sourceNode); ViewConnector connectionContent = (ViewConnector) edge.getContent(); lastConnection = (Connection) connectionContent.getSourceConnection().orElse(null); connectionContent.setSourceConnection(connection); } return results; } }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Edge<? extends View, Node> edge = getEdge(context); final Node<?, Edge> sourceNode = getSourceNode(context); final Node<? extends View<?>, Edge> lastSourceNode = edge.getSourceNode(); if (null != lastSourceNode) { this.lastSourceNodeUUID = lastSourceNode.getUUID(); lastSourceNode.getOutEdges().remove(edge); } if (null != sourceNode) { sourceNode.getOutEdges().add(edge); } edge.setSourceNode(sourceNode); ViewConnector connectionContent = (ViewConnector) edge.getContent(); lastConnection = (Connection) connectionContent.getSourceConnection().orElse(null); connectionContent.setSourceConnection(connection); } return results; } @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final @MapsTo("sourceNodeUUID") String sourceNodeUUID,
final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("magnet") Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge); }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Edge<? extends View, Node> edge = getEdge(context); final Node<?, Edge> sourceNode = getSourceNode(context); final Node<? extends View<?>, Edge> lastSourceNode = edge.getSourceNode(); if (null != lastSourceNode) { this.lastSourceNodeUUID = lastSourceNode.getUUID(); lastSourceNode.getOutEdges().remove(edge); } if (null != sourceNode) { sourceNode.getOutEdges().add(edge); } edge.setSourceNode(sourceNode); ViewConnector connectionContent = (ViewConnector) edge.getContent(); lastConnection = (Connection) connectionContent.getSourceConnection().orElse(null); connectionContent.setSourceConnection(connection); } return results; } @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final @MapsTo("sourceNodeUUID") String sourceNodeUUID,
final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("magnet") Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getTargetNode(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(final GraphCommandExecutionContext context); Node<? extends View<?>, Edge> getSourceNode(); Edge<? extends View, Node> getEdge(); Node<? extends View<?>, Edge> getTargetNode(); Connection getConnection(); @Override String toString(); }
|
SetConnectionSourceNodeCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Edge<? extends View, Node> edge = getEdge(context); final Node<?, Edge> sourceNode = getSourceNode(context); final Node<? extends View<?>, Edge> lastSourceNode = edge.getSourceNode(); if (null != lastSourceNode) { this.lastSourceNodeUUID = lastSourceNode.getUUID(); lastSourceNode.getOutEdges().remove(edge); } if (null != sourceNode) { sourceNode.getOutEdges().add(edge); } edge.setSourceNode(sourceNode); ViewConnector connectionContent = (ViewConnector) edge.getContent(); lastConnection = (Connection) connectionContent.getSourceConnection().orElse(null); connectionContent.setSourceConnection(connection); } return results; } @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final @MapsTo("sourceNodeUUID") String sourceNodeUUID,
final @MapsTo("edgeUUID") String edgeUUID,
final @MapsTo("magnet") Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection); @SuppressWarnings("unchecked") SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getTargetNode(final GraphCommandExecutionContext context); @SuppressWarnings("unchecked") Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(final GraphCommandExecutionContext context); Node<? extends View<?>, Edge> getSourceNode(); Edge<? extends View, Node> getEdge(); Node<? extends View<?>, Edge> getTargetNode(); Connection getConnection(); @Override String toString(); }
|
@Test public void testDelegateGetSelectedHeaderCells() { uiModel.getSelectedHeaderCells(); verify(delegate).getSelectedHeaderCells(); }
|
@Override public List<SelectedCell> getSelectedHeaderCells() { return delegate.getSelectedHeaderCells(); }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedHeaderCells() { return delegate.getSelectedHeaderCells(); } }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedHeaderCells() { return delegate.getSelectedHeaderCells(); } DelegatingGridData(final DMNGridData delegate); }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedHeaderCells() { return delegate.getSelectedHeaderCells(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
DelegatingGridData implements GridData { @Override public List<SelectedCell> getSelectedHeaderCells() { return delegate.getSelectedHeaderCells(); } DelegatingGridData(final DMNGridData delegate); @Override void moveRowTo(final int index,
final GridRow row); @Override void moveRowsTo(final int index,
final List<GridRow> rows); @Override void moveColumnTo(final int index,
final GridColumn<?> column); @Override void moveColumnsTo(final int index,
final List<GridColumn<?>> columns); @Override Range selectCell(final int rowIndex,
final int columnIndex); @Override Range selectCells(final int rowIndex,
final int columnIndex,
final int width,
final int height); @Override Range selectHeaderCell(final int headerRowIndex,
final int headerColumnIndex); @Override List<SelectedCell> getSelectedHeaderCells(); @Override Range setCell(final int rowIndex,
final int columnIndex,
final Supplier<GridCell<?>> cellSupplier); @Override Range setCellValue(final int rowIndex,
final int columnIndex,
final GridCellValue<?> value); @Override Range deleteCell(final int rowIndex,
final int columnIndex); @Override List<GridColumn<?>> getColumns(); @Override int getColumnCount(); @Override void appendColumn(final GridColumn<?> column); @Override void insertColumn(final int index,
final GridColumn<?> column); @Override void deleteColumn(final GridColumn<?> column); @Override List<GridRow> getRows(); @Override void expandCell(final int rowIndex,
final int columnIndex); @Override void collapseCell(final int rowIndex,
final int columnIndex); @Override void setColumnDraggingEnabled(final boolean enabled); @Override boolean isColumnDraggingEnabled(); @Override void setRowDraggingEnabled(final boolean enabled); @Override boolean isRowDraggingEnabled(); @Override void setMerged(final boolean isMerged); @Override boolean isMerged(); @Override void updateColumn(final int index,
final GridColumn<?> column); @Override void clearSelections(); @Override List<SelectedCell> getSelectedCells(); @Override SelectedCell getSelectedCellsOrigin(); @Override GridCell<?> getCell(final int rowIndex,
final int columnIndex); @Override void setHeaderRowCount(final int headerRowCount); @Override int getHeaderRowCount(); @Override int getRowCount(); @Override Range deleteRow(final int rowIndex); @Override void insertRow(final int rowIndex,
final GridRow row); @Override void appendRow(final GridRow row); @Override GridRow getRow(final int rowIndex); @Override boolean refreshWidth(); @Override boolean refreshWidth(final double currentWidth); @Override boolean setVisibleSizeAndRefresh(final int width, final int height); @Override int getVisibleWidth(); @Override int getVisibleHeight(); }
|
@Test public void testInitialize() throws Exception { cloneNodeCommand.initialize(graphCommandExecutionContext); Node<View, Edge> clone = cloneNodeCommand.getClone(); assertEquals(clone, this.clone); RegisterNodeCommand registerNodeCommand = (RegisterNodeCommand) cloneNodeCommand.getCommands().stream().filter(command -> command instanceof RegisterNodeCommand).findFirst().get(); assertNotNull(registerNodeCommand); assertEquals(registerNodeCommand.getCandidate(), clone); AddChildNodeCommand addChildCommand = (AddChildNodeCommand) cloneNodeCommand.getCommands().stream().filter(command -> command instanceof AddChildNodeCommand).findFirst().get(); assertNotNull(addChildCommand); assertEquals(addChildCommand.getCandidate(), clone); assertEquals(addChildCommand.getParent(graphCommandExecutionContext), graphInstance.parentNode); if (addChildCommand.getLocation() != null) { assertEquals(addChildCommand.getLocation().getX(), position.getX(), 0); assertEquals(addChildCommand.getLocation().getY(), position.getY(), 0); } }
|
@Override @SuppressWarnings("unchecked") protected AbstractCompositeCommand<GraphCommandExecutionContext, RuleViolation> initialize(GraphCommandExecutionContext context) { Optional<String> parentUUID = getParentUUID(); if (!parentUUID.isPresent()) { throw new IllegalStateException("Parent not found for node " + candidate); } final Object bean = candidate.getContent().getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = (Node<View, Edge>) context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asNode(); cloneNodeContentWithProperties(context); createNodeCommands(clone, parentUUID.get(), position); return this; }
|
CloneNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected AbstractCompositeCommand<GraphCommandExecutionContext, RuleViolation> initialize(GraphCommandExecutionContext context) { Optional<String> parentUUID = getParentUUID(); if (!parentUUID.isPresent()) { throw new IllegalStateException("Parent not found for node " + candidate); } final Object bean = candidate.getContent().getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = (Node<View, Edge>) context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asNode(); cloneNodeContentWithProperties(context); createNodeCommands(clone, parentUUID.get(), position); return this; } }
|
CloneNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected AbstractCompositeCommand<GraphCommandExecutionContext, RuleViolation> initialize(GraphCommandExecutionContext context) { Optional<String> parentUUID = getParentUUID(); if (!parentUUID.isPresent()) { throw new IllegalStateException("Parent not found for node " + candidate); } final Object bean = candidate.getContent().getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = (Node<View, Edge>) context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asNode(); cloneNodeContentWithProperties(context); createNodeCommands(clone, parentUUID.get(), position); return this; } protected CloneNodeCommand(); CloneNodeCommand(final @MapsTo("candidate") Node candidate, final @MapsTo("parentUuid") String parentUuid); CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback); }
|
CloneNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected AbstractCompositeCommand<GraphCommandExecutionContext, RuleViolation> initialize(GraphCommandExecutionContext context) { Optional<String> parentUUID = getParentUUID(); if (!parentUUID.isPresent()) { throw new IllegalStateException("Parent not found for node " + candidate); } final Object bean = candidate.getContent().getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = (Node<View, Edge>) context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asNode(); cloneNodeContentWithProperties(context); createNodeCommands(clone, parentUUID.get(), position); return this; } protected CloneNodeCommand(); CloneNodeCommand(final @MapsTo("candidate") Node candidate, final @MapsTo("parentUuid") String parentUuid); CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); List<CommandResult<RuleViolation>> processChildrenNodes(GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); Node<View, Edge> getClone(); Node<Definition, Edge> getCandidate(); List<Command<GraphCommandExecutionContext, RuleViolation>> getChildrenCommands(); }
|
CloneNodeCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") protected AbstractCompositeCommand<GraphCommandExecutionContext, RuleViolation> initialize(GraphCommandExecutionContext context) { Optional<String> parentUUID = getParentUUID(); if (!parentUUID.isPresent()) { throw new IllegalStateException("Parent not found for node " + candidate); } final Object bean = candidate.getContent().getDefinition(); final DefinitionId definitionId = context.getDefinitionManager().adapters().forDefinition().getId(bean); clone = (Node<View, Edge>) context.getFactoryManager().newElement(UUID.uuid(), definitionId.value()).asNode(); cloneNodeContentWithProperties(context); createNodeCommands(clone, parentUUID.get(), position); return this; } protected CloneNodeCommand(); CloneNodeCommand(final @MapsTo("candidate") Node candidate, final @MapsTo("parentUuid") String parentUuid); CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); List<CommandResult<RuleViolation>> processChildrenNodes(GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); Node<View, Edge> getClone(); Node<Definition, Edge> getCandidate(); List<Command<GraphCommandExecutionContext, RuleViolation>> getChildrenCommands(); }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.