@Test(expected = IllegalArgumentException.class) public void testAddInvalidVertex() { Person marko = createElement(); marko.name(null); vertexGraph.addVertex(marko); }
public <V extends Vertex> Vertex addVertex(V vertex) { vertex.validate(); org.apache.tinkerpop.gremlin.structure.Vertex delegate; switch (should()) { case CREATE: delegate = complete(create(vertex)); break; case MERGE: delegate = complete(g.inject(1).coalesce( update(vertex), create(vertex))); break; case REPLACE: delegate = complete(g.inject(1).coalesce( clear(vertex), update(vertex), create(vertex))); break; case INSERT: delegate = insert(vertex); break; case IGNORE: default: delegate = complete(g.inject(1).coalesce(find(vertex), create(vertex))); break; } vertex.setDelegate(delegate); vertex.setUserSuppliedId(delegate.id()); delegates.put(vertex.id(), delegate); this.vertex = Parser.as(delegate, vertex.getClass()); observers.notifyAll(observer -> observer.vertexAdded(vertex, this.vertex)); return this.vertex; }
VertexGraph extends ElementGraph { public <V extends Vertex> Vertex addVertex(V vertex) { vertex.validate(); org.apache.tinkerpop.gremlin.structure.Vertex delegate; switch (should()) { case CREATE: delegate = complete(create(vertex)); break; case MERGE: delegate = complete(g.inject(1).coalesce( update(vertex), create(vertex))); break; case REPLACE: delegate = complete(g.inject(1).coalesce( clear(vertex), update(vertex), create(vertex))); break; case INSERT: delegate = insert(vertex); break; case IGNORE: default: delegate = complete(g.inject(1).coalesce(find(vertex), create(vertex))); break; } vertex.setDelegate(delegate); vertex.setUserSuppliedId(delegate.id()); delegates.put(vertex.id(), delegate); this.vertex = Parser.as(delegate, vertex.getClass()); observers.notifyAll(observer -> observer.vertexAdded(vertex, this.vertex)); return this.vertex; } }
VertexGraph extends ElementGraph { public <V extends Vertex> Vertex addVertex(V vertex) { vertex.validate(); org.apache.tinkerpop.gremlin.structure.Vertex delegate; switch (should()) { case CREATE: delegate = complete(create(vertex)); break; case MERGE: delegate = complete(g.inject(1).coalesce( update(vertex), create(vertex))); break; case REPLACE: delegate = complete(g.inject(1).coalesce( clear(vertex), update(vertex), create(vertex))); break; case INSERT: delegate = insert(vertex); break; case IGNORE: default: delegate = complete(g.inject(1).coalesce(find(vertex), create(vertex))); break; } vertex.setDelegate(delegate); vertex.setUserSuppliedId(delegate.id()); delegates.put(vertex.id(), delegate); this.vertex = Parser.as(delegate, vertex.getClass()); observers.notifyAll(observer -> observer.vertexAdded(vertex, this.vertex)); return this.vertex; } VertexGraph(Graph graph, GraphTraversalSource g); }
VertexGraph extends ElementGraph { public <V extends Vertex> Vertex addVertex(V vertex) { vertex.validate(); org.apache.tinkerpop.gremlin.structure.Vertex delegate; switch (should()) { case CREATE: delegate = complete(create(vertex)); break; case MERGE: delegate = complete(g.inject(1).coalesce( update(vertex), create(vertex))); break; case REPLACE: delegate = complete(g.inject(1).coalesce( clear(vertex), update(vertex), create(vertex))); break; case INSERT: delegate = insert(vertex); break; case IGNORE: default: delegate = complete(g.inject(1).coalesce(find(vertex), create(vertex))); break; } vertex.setDelegate(delegate); vertex.setUserSuppliedId(delegate.id()); delegates.put(vertex.id(), delegate); this.vertex = Parser.as(delegate, vertex.getClass()); observers.notifyAll(observer -> observer.vertexAdded(vertex, this.vertex)); return this.vertex; } VertexGraph(Graph graph, GraphTraversalSource g); org.apache.tinkerpop.gremlin.structure.Vertex delegate(V vertex); Vertex addVertex(V vertex); Vertex removeVertex(V vertex); void reset(); }
VertexGraph extends ElementGraph { public <V extends Vertex> Vertex addVertex(V vertex) { vertex.validate(); org.apache.tinkerpop.gremlin.structure.Vertex delegate; switch (should()) { case CREATE: delegate = complete(create(vertex)); break; case MERGE: delegate = complete(g.inject(1).coalesce( update(vertex), create(vertex))); break; case REPLACE: delegate = complete(g.inject(1).coalesce( clear(vertex), update(vertex), create(vertex))); break; case INSERT: delegate = insert(vertex); break; case IGNORE: default: delegate = complete(g.inject(1).coalesce(find(vertex), create(vertex))); break; } vertex.setDelegate(delegate); vertex.setUserSuppliedId(delegate.id()); delegates.put(vertex.id(), delegate); this.vertex = Parser.as(delegate, vertex.getClass()); observers.notifyAll(observer -> observer.vertexAdded(vertex, this.vertex)); return this.vertex; } VertexGraph(Graph graph, GraphTraversalSource g); org.apache.tinkerpop.gremlin.structure.Vertex delegate(V vertex); Vertex addVertex(V vertex); Vertex removeVertex(V vertex); void reset();  }