@SuppressWarnings("unchecked") private void createChild(String uuid, Node parent, Node child, int parentIndex) { final Edge<Child, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Child()); edge.setSourceNode(parent); edge.setTargetNode(child); if (parentIndex >= 0) { parent.getOutEdges().add(parentIndex, edge); } else { parent.getOutEdges().add(edge); } child.getInEdges().add(edge); }
@SuppressWarnings("unchecked") private void addRelationship(final Node parent, final Node child, final OptionalInt index, final GraphCommandExecutionContext context) { final String uuid = UUID.uuid(); final Edge<Child, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Child()); edge.setSourceNode(parent); edge.setTargetNode(child); parent.getOutEdges().add(index.orElseGet(() -> parent.getOutEdges().size()), edge); child.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); }
@Before @SuppressWarnings("unchecked") public void setup() throws Exception { super.init(); this.parent = mockNode(PARENT_UUID); this.candidate = mockNode(CANDIDATE_UUID); this.edge = new EdgeImpl<>(EDGE_UUID); this.edge.setContent(new Dock()); this.edge.setSourceNode(parent); this.edge.setTargetNode(candidate); when(graphIndex.getNode(eq(PARENT_UUID))).thenReturn(parent); when(graphIndex.getNode(eq(CANDIDATE_UUID))).thenReturn(candidate); when(graphIndex.getEdge(eq(EDGE_UUID))).thenReturn(edge); when(parent.getOutEdges()).thenReturn(parentOutEdges); when(candidate.getInEdges()).thenReturn(candidateInEdges); parentOutEdges.add(edge); candidateInEdges.add(edge); this.tested = new UnDockNodeCommand(PARENT_UUID, CANDIDATE_UUID); }
@Before @SuppressWarnings("unchecked") public void setUp() { controlPoint = ControlPoint.build(1, 4, 0); when(commandExecutionContext.getRuleManager()).thenReturn(ruleManager); content = new ViewConnectorImpl<>(mock(Object.class), Bounds.create(0, 0, 10, 10)); edge = new EdgeImpl<>("edge1"); edge.setContent(content); content.setControlPoints(Collections.singletonList(controlPoint)); tested = new UpdateControlPointPositionCommand(edge, controlPoint, TARGET_LOCATION); }
@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<Child, Node> edge = new EdgeImpl<>(uuid); edge.setContent(new Child()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); getMutableIndex(context).addEdge(edge); } return results; }
@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; }
@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); // TODO: Create a ParentEdgeFactory iface extending EdgeFactory using as content generics type Relationship 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; }
targetConnection = MagnetConnection.Builder.forElement(graphInstance.intermNode); connectorContent.setTargetConnection(targetConnection); graphInstance.edge1.setContent(connectorContent); graphInstance.edge2.setContent(connectorContent);
final Edge existingConnector = new EdgeImpl<>("edge1"); final ViewConnector existingConnectorView = mock(ViewConnector.class); existingConnector.setContent(existingConnectorView); when(existingConnectorView.getDefinition()).thenReturn(new Definition());
childEdge3.setTargetNode(child3); parentEdge1.setContent(new Child()); parentEdge2.setContent(new Child()); parentEdge3.setContent(new Child()); childEdge1.setContent(new Child()); childEdge2.setContent(new Child()); childEdge3.setContent(new Child());
@Before public void setup() { super.setup(); this.parent = CommandTestUtils.makeNode("uuid1", "parent", 10.0, 20.0, 50.0, 50.0); this.candidate = CommandTestUtils.makeNode("uuid2", "candidate", 10.0, 20.0, 50.0, 50.0); this.command = new CaseManagementRemoveChildCommand(parent, candidate); final Edge<Child, Node> edge = new EdgeImpl<>("edge1"); edge.setContent(new Child()); edge.setSourceNode(parent); edge.setTargetNode(candidate); parent.getOutEdges().add(edge); candidate.getInEdges().add(edge); }
stage1InEdge.setSourceNode(rootNode); stage1InEdge.setTargetNode(stage1Node); stage1InEdge.setContent(new Child()); rootNode.getOutEdges().add(stage1InEdge); stage1Node.getInEdges().add(stage1InEdge); task1InEdge.setSourceNode(stage1Node); task1InEdge.setTargetNode(task1Node); task1InEdge.setContent(new Child()); stage1Node.getOutEdges().add(task1InEdge); task1Node.getInEdges().add(task1InEdge); case1InEdge.setSourceNode(stage1Node); case1InEdge.setTargetNode(case1Node); case1InEdge.setContent(new Child()); stage1Node.getOutEdges().add(case1InEdge); case1Node.getInEdges().add(case1InEdge); stage2InEdge.setSourceNode(rootNode); stage2InEdge.setTargetNode(stage2Node); stage2InEdge.setContent(new Child()); rootNode.getOutEdges().add(stage2InEdge); stage2Node.getInEdges().add(stage2InEdge); case2InEdge.setSourceNode(stage2Node); case2InEdge.setTargetNode(case2Node); case2InEdge.setContent(new Child()); stage2Node.getOutEdges().add(case2InEdge); case2Node.getInEdges().add(case2InEdge);
stageInEdge.setSourceNode(rootNode); stageInEdge.setTargetNode(stageNode); stageInEdge.setContent(new Child()); rootNode.getOutEdges().add(stageInEdge); stageNode.getInEdges().add(stageInEdge); subcaseInEdge.setSourceNode(stageNode); subcaseInEdge.setTargetNode(subcaseNode); subcaseInEdge.setContent(new Child()); stageNode.getOutEdges().add(subcaseInEdge); subcaseNode.getInEdges().add(subcaseInEdge);
stageInEdge.setSourceNode(rootNode); stageInEdge.setTargetNode(stageNode); stageInEdge.setContent(new Child()); rootNode.getOutEdges().add(stageInEdge); stageNode.getInEdges().add(stageInEdge); subprocessInEdge.setSourceNode(stageNode); subprocessInEdge.setTargetNode(subprocessNode); subprocessInEdge.setContent(new Child()); stageNode.getOutEdges().add(subprocessInEdge); subprocessNode.getInEdges().add(subprocessInEdge);
stageInEdge.setSourceNode(rootNode); stageInEdge.setTargetNode(stageNode); stageInEdge.setContent(new Child()); rootNode.getOutEdges().add(stageInEdge); stageNode.getInEdges().add(stageInEdge); taskInEdge.setSourceNode(stageNode); taskInEdge.setTargetNode(taskNode); taskInEdge.setContent(new Child()); stageNode.getOutEdges().add(taskInEdge); taskNode.getInEdges().add(taskInEdge);
stageInEdge.setSourceNode(rootNode); stageInEdge.setTargetNode(stageNode); stageInEdge.setContent(new Child()); rootNode.getOutEdges().add(stageInEdge); stageNode.getInEdges().add(stageInEdge);