@Override public Vertex createElement(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); return new UniVertex(properties, this, graph); } }
@Override public Object id() { return (long) (this.key.hashCode() + this.value.hashCode() + this.vertex.id().hashCode()); }
@Override protected Property addPropertyLocal(String key, Object value) { ElementHelper.validateProperty(key, value); UniVertexProperty property = (UniVertexProperty) createProperty(key, value); List<VertexProperty> props = this.properties.containsKey(key) ? this.properties.get(key) : new ArrayList<VertexProperty>(); props.add(property); if (props.size() == 1) properties.put(key, props); return property; }
@Override public Iterator<Vertex> vertices(Direction direction, String... edgeLabels) { Iterator<Edge> edges = this.edges(direction, edgeLabels); return ConversionUtils.asStream(edges).map(edge -> vertexToVertex(this, edge, direction)).iterator(); }
@Override public Vertex addVertex(AddVertexQuery uniQuery) { UniVertex vertex = new UniVertex(uniQuery.getProperties(), null, this.graph); try { if (this.insert(this.vertexSchemas, vertex)) { return vertex; } } catch (DataAccessException ex) { throw Graph.Exceptions.vertexWithIdAlreadyExists(vertex.id()); } return vertex; }
@Override public Set<String> keys() { validateProperties(); return super.keys(); }
@Override public void remove() { edges(Direction.BOTH).forEachRemaining(Element::remove); super.remove(); }
@Override public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys) { validateProperties(); return super.properties(propertyKeys); }
@Override public <V> VertexProperty<V> property(String key, V value) { UniVertexProperty vertexProperty = (UniVertexProperty) addPropertyLocal(key, value); PropertyQuery<UniVertex> propertyQuery = new PropertyQuery<UniVertex>(this, vertexProperty, PropertyQuery.Action.Add, null); graph.getControllerManager().getControllers(PropertyQuery.PropertyController.class).forEach(controller -> controller.property(propertyQuery)); return vertexProperty; }
@Override public Vertex createElement(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); if (properties == null) return null; return new UniVertex(properties, this, graph); }
@Override public Vertex createElement(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); if(properties == null) return null; return new UniVertex(properties, this, graph); } @Override
@Override public Vertex createElement(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); if (properties == null) return null; return new UniVertex(properties, this, graph); }
@Override public Vertex createElement(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); if(properties == null) return null; return new UniVertex(properties, this, graph); }
@Override public Vertex addVertex(AddVertexQuery uniQuery) { return new UniVertex(uniQuery.getProperties(), null, graph); }
@Override public Vertex addVertex(AddVertexQuery uniQuery) { UniVertex vertex = new UniVertex(uniQuery.getProperties(), null, graph); // try { if (index(this.vertexSchemas, vertex, true)) return vertex; // } catch (DocumentAlreadyExistsException ex) { // logger.warn("Document already exists in elastic", ex); // throw Graph.Exceptions.vertexWithIdAlreadyExists(vertex.id()); // } return null; }
@Override public Vertex addVertex(AddVertexQuery uniQuery) { UniVertex vertex = new UniVertex(uniQuery.getProperties(), null, graph); for (RestVertexSchema vertexSchema : vertexSchemas) { try { BaseRequest baseRequest = vertexSchema.addElement(vertex); if (baseRequest == null) return vertex; baseRequest.asJson(); } catch (UnirestException e) { e.printStackTrace(); } catch (NoSuchElementException e) { continue; } } return vertex; }